Author: kiwiwings
Date: Sun Jul 9 23:28:41 2017
New Revision: 1801401
URL: http://svn.apache.org/viewvc?rev=1801401&view=rev
Log:
font rendering - handle a few system dependent textbox sizes
Modified:
poi/trunk/src/ooxml/testcases/org/apache/poi/sl/TestFonts.java
Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/sl/TestFonts.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/sl/TestFonts.java?rev=1801401&r1=1801400&r2=1801401&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/sl/TestFonts.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/sl/TestFonts.java Sun Jul 9
23:28:41 2017
@@ -19,6 +19,7 @@ package org.apache.poi.sl;
import static org.apache.poi.sl.SLCommonUtils.xslfOnly;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeFalse;
import java.awt.Color;
@@ -32,6 +33,7 @@ import java.awt.RenderingHints;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.IOException;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@@ -71,6 +73,9 @@ public class TestFonts {
private static final String INIT_FONTS[] = { "mona.ttf" };
+ // currently linux and mac return quite different values
+ private static final int[] expected_sizes = { 311, 312, 313, 399 };
+
@BeforeClass
public static void initGE() throws FontFormatException, IOException {
GraphicsEnvironment ge =
GraphicsEnvironment.getLocalGraphicsEnvironment();
@@ -87,7 +92,8 @@ public class TestFonts {
TextBox<?,?> tb = resizeToFitText(ppt);
Rectangle2D anc = tb.getAnchor();
// ignore font metrics differences on windows / linux (... hopefully
...)
-// assertEquals(anc.getHeight(), 312d, 5);
+ boolean found = Arrays.binarySearch(expected_sizes,
(int)anc.getHeight()) > -1;
+ assertTrue(found);
// setFont(tb, "Mona");
// FileOutputStream fos = new FileOutputStream("bla-hslf.ppt");
// ppt.write(fos);
@@ -101,7 +107,8 @@ public class TestFonts {
TextBox<?,?> tb = resizeToFitText(ppt);
Rectangle2D anc = tb.getAnchor();
// ignore font metrics differences on windows / linux (... hopefully
...)
-// assertEquals(anc.getHeight(), 312d, 5);
+ boolean found = Arrays.binarySearch(expected_sizes,
(int)anc.getHeight()) > -1;
+ assertTrue(found);
// setFont(tb, "Mona");
// FileOutputStream fos = new FileOutputStream("bla-xslf.ppt");
// ppt.write(fos);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]