aboutsummaryrefslogtreecommitdiffstats
path: root/test/java/org/apache/fop/fonts
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2011-10-04 10:09:01 +0000
committerVincent Hennebert <vhennebert@apache.org>2011-10-04 10:09:01 +0000
commit91c66d97428aa57c844ec58e1deb07a8ab745574 (patch)
treed6062f718053ad636c8f587d5d5f199e9d158252 /test/java/org/apache/fop/fonts
parent7d33c81a0a079336dd1ffcac97e4ee1dfba16c36 (diff)
downloadxmlgraphics-fop-91c66d97428aa57c844ec58e1deb07a8ab745574.tar.gz
xmlgraphics-fop-91c66d97428aa57c844ec58e1deb07a8ab745574.zip
Bugzilla #51928: Upgraded all tests to JUnit 4
Patch by Mehdi Houshmand, applied with minor cosmetics and error fixes git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1178747 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/java/org/apache/fop/fonts')
-rw-r--r--test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java9
-rw-r--r--test/java/org/apache/fop/fonts/EncodingModeTest.java9
-rw-r--r--test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java13
3 files changed, 24 insertions, 7 deletions
diff --git a/test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java b/test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java
index fb0c3a795..013d04d13 100644
--- a/test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java
+++ b/test/java/org/apache/fop/fonts/DejaVuLGCSerifTest.java
@@ -19,14 +19,17 @@
package org.apache.fop.fonts;
+import static org.junit.Assert.assertEquals;
+
import java.io.File;
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
/**
*
*/
-public class DejaVuLGCSerifTest extends TestCase {
+public class DejaVuLGCSerifTest {
private FontResolver fontResolver = FontManager.createMinimalFontResolver();
private CustomFont font;
@@ -37,6 +40,7 @@ public class DejaVuLGCSerifTest extends TestCase {
* @throws Exception
* if the test fails.
*/
+ @Before
public void setUp() throws Exception {
File file = new File("test/resources/fonts/DejaVuLGCSerif.ttf");
font = FontLoader.loadFont(file, "", true, EncodingMode.AUTO,
@@ -46,6 +50,7 @@ public class DejaVuLGCSerifTest extends TestCase {
/**
* Simple test to see if font name was detected correctly.
*/
+ @Test
public void testFontName() {
assertEquals("DejaVuLGCSerif", font.getFontName());
}
diff --git a/test/java/org/apache/fop/fonts/EncodingModeTest.java b/test/java/org/apache/fop/fonts/EncodingModeTest.java
index 4e81c46d6..310916a04 100644
--- a/test/java/org/apache/fop/fonts/EncodingModeTest.java
+++ b/test/java/org/apache/fop/fonts/EncodingModeTest.java
@@ -19,15 +19,20 @@
package org.apache.fop.fonts;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
-public class EncodingModeTest extends TestCase {
+import org.junit.Test;
+
+public class EncodingModeTest {
+
+ @Test
public void testGetName() {
assertEquals("auto", EncodingMode.AUTO.getName());
assertEquals("single-byte", EncodingMode.SINGLE_BYTE.getName());
assertEquals("cid", EncodingMode.CID.getName());
}
+ @Test
public void testGetValue() {
assertEquals(EncodingMode.AUTO, EncodingMode.getEncodingMode("auto"));
assertEquals(EncodingMode.SINGLE_BYTE, EncodingMode.getEncodingMode("single-byte"));
diff --git a/test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java b/test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java
index 89527a775..a55d94e80 100644
--- a/test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java
+++ b/test/java/org/apache/fop/fonts/truetype/GlyfTableTestCase.java
@@ -19,6 +19,8 @@
package org.apache.fop.fonts.truetype;
+import static org.junit.Assert.assertTrue;
+
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -26,12 +28,13 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
-import junit.framework.TestCase;
+import org.junit.Before;
+import org.junit.Test;
/**
* Tests {@link GlyfTable}.
*/
-public class GlyfTableTestCase extends TestCase {
+public class GlyfTableTestCase {
private final static class DirData {
@@ -50,7 +53,7 @@ public class GlyfTableTestCase extends TestCase {
private FontFileReader originalFontReader;
- @Override
+ @Before
public void setUp() throws IOException {
originalFontReader = new FontFileReader("test/resources/fonts/DejaVuLGCSerif.ttf");
}
@@ -60,6 +63,7 @@ public class GlyfTableTestCase extends TestCase {
*
* @throws IOException if an I/O error occurs
*/
+ @Test
public void testPopulateGlyphsWithComposites() throws IOException {
// Glyph 408 -> U+01D8 "uni01D8" this is a composite glyph.
int[] composedIndices = setupTest(408);
@@ -77,6 +81,7 @@ public class GlyfTableTestCase extends TestCase {
*
* @throws IOException if an I/O error occurs
*/
+ @Test
public void testPopulateNoCompositeGlyphs() throws IOException {
int[] composedIndices = setupTest(36, 37, 38); // "A", "B", "C"
int[] expected = new int[composedIndices.length];
@@ -90,6 +95,7 @@ public class GlyfTableTestCase extends TestCase {
*
* @throws IOException if an I/O error occurs
*/
+ @Test
public void testGlyphsNotRemappedTwice() throws IOException {
int composedGlyph = 12;
// The order of these glyph indices, must NOT be changed! (see javadoc above)
@@ -108,6 +114,7 @@ public class GlyfTableTestCase extends TestCase {
*
* @throws IOException if an I/O error occurs
*/
+ @Test
public void testSingleRecursionStep() throws IOException {
// Glyph 2077 -> U+283F "uni283F" this is composed of a composite glyph (recursive).
int[] composedIndices = setupTest(2077);