aboutsummaryrefslogtreecommitdiffstats
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
parentc0aec5d28074665a548159fbbf1282a22311c80e (diff)
Added basic font loading test
-rw-r--r--pom.xml8
-rw-r--r--src/test/java/net/java/dev/typecast/ot/OTFontTest.java38
2 files changed, 45 insertions, 1 deletions
diff --git a/pom.xml b/pom.xml
index 12460db..4396375 100644
--- a/pom.xml
+++ b/pom.xml
@@ -34,6 +34,12 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.2.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.28</version>
@@ -51,7 +57,7 @@
<name>David Schweinsberg</name>
<id>dcsch</id>
<email>[email protected]</email>
- <url>github.com/dcsch</url>
+ <url>https://github.com/dcsch</url>
<timezone>-8</timezone>
</developer>
</developers>
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());
+ }
+}