From 193329eafc1a14214e15297b4b1b56d9bbb9ecbb Mon Sep 17 00:00:00 2001 From: David Schweinsberg Date: Tue, 10 Sep 2019 22:59:49 -0700 Subject: Added basic font loading test --- .../java/net/java/dev/typecast/ot/OTFontTest.java | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/test/java/net/java/dev/typecast/ot/OTFontTest.java (limited to 'src/test') diff --git a/src/test/java/net/java/dev/typecast/ot/OTFontTest.java b/src/test/java/net/java/dev/typecast/ot/OTFontTest.java new file mode 100644 index 0000000..028bf8a --- /dev/null +++ b/src/test/java/net/java/dev/typecast/ot/OTFontTest.java @@ -0,0 +1,38 @@ +package net.java.dev.typecast.ot; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +import net.java.dev.typecast.ot.table.HeadTable; + +public class OTFontTest extends TestCase { + /** + * Create the test case + * + * @param testName name of the test case + */ + public OTFontTest(String testName) { + super(testName); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() { + return new TestSuite(OTFontTest.class); + } + + public void testLoadSingleFont() throws URISyntaxException, IOException { + URL url = ClassLoader.getSystemResource("Lato-Regular.ttf"); + File file = new File(url.toURI()); + OTFontCollection fontCollection = OTFontCollection.create(file); + OTFont font = fontCollection.getFont(0); + assertEquals(HeadTable.class, font.getHeadTable().getClass()); + } +} -- cgit v1.2.3