aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Schweinsberg <[email protected]>2019-09-10 22:59:49 -0700
committerDavid Schweinsberg <[email protected]>2019-09-10 22:59:49 -0700
commit193329eafc1a14214e15297b4b1b56d9bbb9ecbb (patch)
tree4f1176219b9febbd505f77c31e644cbb273ec675 /src
parentc0aec5d28074665a548159fbbf1282a22311c80e (diff)
Added basic font loading test
Diffstat (limited to 'src')
-rw-r--r--src/test/java/net/java/dev/typecast/ot/OTFontTest.java38
1 files changed, 38 insertions, 0 deletions
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());
+ }
+}