/hg/icedtea-web: 3 new changesets

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

/hg/icedtea-web: 3 new changesets

jvanek
changeset 85c45a76dddd in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=85c45a76dddd
author: Jiri Vanek <[hidden email]>
date: Thu May 18 16:12:54 2017 +0200

        FormatterTest.java: regular expression of testXNewLinesPlain adapted to match both win and linux line endings


changeset 3e52d36eecdf in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=3e52d36eecdf
author: Jiri Vanek <[hidden email]>
date: Thu May 18 16:16:05 2017 +0200

        TeeOutputStreamTest.java: testPrint and testWriteByteArrayString made dual for linux and windows. Those tests are charset specific. testWriteByteArrayString2 is new test, showing strange issue when strange characters are going into and from byte array. On windows, this test fails, showing, that somewhere in the stack, there is bad encoding or bad offset/lenght used.


changeset d6264d31d0d6 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=d6264d31d0d6
author: Jiri Vanek <[hidden email]>
date: Thu May 18 16:24:36 2017 +0200

        TextWithWaterLevelTest.java: cutToTest get rid of hardcoded siezes, ad follows relative placement of testing points (used font is different on windows)


diffstat:

 ChangeLog                                                                                                   |  21 +++++
 tests/netx/unit/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/TextWithWaterLevelTest.java |  12 +-
 tests/netx/unit/net/sourceforge/jnlp/util/docprovider/formatters/formatters/FormatterTest.java              |   2 +-
 tests/netx/unit/net/sourceforge/jnlp/util/logging/TeeOutputStreamTest.java                                  |  40 ++++++++-
 4 files changed, 62 insertions(+), 13 deletions(-)

diffs (138 lines):

diff -r 47b05aef20b3 -r d6264d31d0d6 ChangeLog
--- a/ChangeLog Thu May 18 09:42:16 2017 +0200
+++ b/ChangeLog Thu May 18 16:24:36 2017 +0200
@@ -1,3 +1,24 @@
+2017-05-18  Jiri Vanek <[hidden email]>
+            Tomáš Votava <[hidden email]>
+
+ * tests/netx/unit/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/TextWithWaterLevelTest.java:
+ cutToTest get rid of hardcoded siezes, ad follows relative placement of testing points
+ (used font is different on windows)
+
+2017-05-18  Jiri Vanek <[hidden email]>
+            Tomáš Votava <[hidden email]>
+
+ * tests/netx/unit/net/sourceforge/jnlp/util/logging/TeeOutputStreamTest.java: testPrint and testWriteByteArrayString
+ made dual for linux and windows. Those tests are charset specific. testWriteByteArrayString2 is new test, showing
+ strange issue when strange characters are going into and from byte array. On windows, this test fails, showing, that somewhere
+ in the stack, there is bad encoding or bad offset/lenght used.
+
+2017-05-18  Jiri Vanek <[hidden email]>
+            Tomáš Votava <[hidden email]>
+
+ * tests/netx/unit/net/sourceforge/jnlp/util/docprovider/formatters/formatters/FormatterTest.java:
+ regular expression of testXNewLinesPlain adapted to match both win and linux line endings
+
 2017-05-15  Jiri Vanek <[hidden email]>
 
  Installer graphic made a bit more ITWized
diff -r 47b05aef20b3 -r d6264d31d0d6 tests/netx/unit/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/TextWithWaterLevelTest.java
--- a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/TextWithWaterLevelTest.java Thu May 18 09:42:16 2017 +0200
+++ b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/TextWithWaterLevelTest.java Thu May 18 16:24:36 2017 +0200
@@ -36,7 +36,6 @@
 exception statement from your version. */
 package net.sourceforge.jnlp.splashscreen.impls.defaultsplashscreen2012;
 
-import net.sourceforge.jnlp.splashscreen.impls.defaultsplashscreen2012.TextWithWaterLevel;
 import java.awt.Color;
 import java.awt.Font;
 import java.awt.Graphics2D;
@@ -106,17 +105,18 @@
 
     @Test
     public void cutToTest() {
+        double firstColumnSharedWidth  = 0.1947565543;
         TextWithWaterLevel ifc = getInstance();
         ifc.setPercentageOfWater(50);
         BufferedImage bic = ifc.getBackground();
         int w = bic.getWidth();
         int h = bic.getHeight();
-        bic = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
+        bic = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
         ifc.cutTo(bic.createGraphics(), 0, h);
-        Assert.assertEquals(Color.blue, new Color(bic.getRGB(52, 142)));
-        Assert.assertEquals(Color.blue, new Color(bic.getRGB(170, 110)));
-        Assert.assertEquals(Color.white, new Color(bic.getRGB(52, 62)));
-        Assert.assertEquals(Color.white, new Color(bic.getRGB(245, 85)));
+        Assert.assertEquals(Color.blue, new Color(bic.getRGB((int) (w * firstColumnSharedWidth), (int) (h * 0.93421052631))));
+        Assert.assertEquals(Color.blue, new Color(bic.getRGB((int) (w * 0.63670411985), (int) (h * 0.72368421052))));
+        Assert.assertEquals(Color.white, new Color(bic.getRGB((int) (w * firstColumnSharedWidth), (int) (h * 0.45))));
+        Assert.assertEquals(Color.white, new Color(bic.getRGB((int) (w * 0.91760299625), (int) (h * 0.55921052631))));
 
         //well this should be acctually rgba 0,0,0,0 but somehow this was no passig
         //you can confirm with:
diff -r 47b05aef20b3 -r d6264d31d0d6 tests/netx/unit/net/sourceforge/jnlp/util/docprovider/formatters/formatters/FormatterTest.java
--- a/tests/netx/unit/net/sourceforge/jnlp/util/docprovider/formatters/formatters/FormatterTest.java Thu May 18 09:42:16 2017 +0200
+++ b/tests/netx/unit/net/sourceforge/jnlp/util/docprovider/formatters/formatters/FormatterTest.java Thu May 18 16:24:36 2017 +0200
@@ -60,7 +60,7 @@
         PlainTextFormatter f = new PlainTextFormatter();
         final int x = 10;
         String s = f.getNewLine(x);
-        String[] a = s.replace(f.getNewLine(), "X" + f.getNewLine()).split("[" + f.getNewLine() + "]{1}");
+        String[] a = s.replace(f.getNewLine(), "X" + f.getNewLine()).split("" + f.getNewLine() + "");
         Assert.assertEquals(x, a.length);
     }
 
diff -r 47b05aef20b3 -r d6264d31d0d6 tests/netx/unit/net/sourceforge/jnlp/util/logging/TeeOutputStreamTest.java
--- a/tests/netx/unit/net/sourceforge/jnlp/util/logging/TeeOutputStreamTest.java Thu May 18 09:42:16 2017 +0200
+++ b/tests/netx/unit/net/sourceforge/jnlp/util/logging/TeeOutputStreamTest.java Thu May 18 16:24:36 2017 +0200
@@ -6,6 +6,9 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.PrintStream;
+import java.nio.charset.Charset;
+import net.sourceforge.jnlp.annotations.KnownToFail;
+import net.sourceforge.jnlp.annotations.WindowsIssue;
 
 import static org.junit.Assert.assertTrue;
 
@@ -28,18 +31,43 @@
     }
 
     @Test
+    @WindowsIssue
     public void testPrint() throws IOException {
-        String s = "नमस्तHello!\r";
-        tos.print(s);
-        assertTrue(tos.getByteArrayOutputStream().toString().equals(s));
+        if (Charset.defaultCharset().toString().toLowerCase().startsWith("windows")) {
+            String s = "ÆÆÆÆÆHello!\r";
+            tos.print(s);
+            assertTrue(tos.getByteArrayOutputStream().toString().equals(s));
+        } else {
+            String s = "नमस्तHello!\r"; //first five symbols are printed as "?" by windows' default character encoding
+            tos.print(s);
+            assertTrue(tos.getByteArrayOutputStream().toString().equals(s));
+        }
+
     }
 
     @Test
+    @WindowsIssue
     public void testWriteByteArrayString() throws IOException {
-        String s = "He\n\n\\llo chào";
-        tos.write(s.getBytes(), 0, s.getBytes().length);
-        assertTrue(tos.getByteArrayOutputStream().toString().equals(s.toString()));
+        if (Charset.defaultCharset().toString().toLowerCase().startsWith("windows")) {
+            String s = "He\n\n\\llo chào";
+            tos.write(s.getBytes(), 0, s.getBytes().length);
+            assertTrue(tos.getByteArrayOutputStream().toString().equals(s));
+        } else {
+            String s = "He\n\n\\llo chào"; //grave accent as "?" by windows' default character encoding
+            tos.write(s.getBytes(), 0, s.getBytes().length);
+            assertTrue(tos.getByteArrayOutputStream().toString().equals(s));
+        }
     }
+
+    @Test
+    @WindowsIssue
+    @KnownToFail
+    public void testWriteByteArrayString2() throws IOException { //last character missing
+        String s = "He\n\n\\llo chào"; //grave accent as "?" by windows' default character encoding
+        tos.write(s.getBytes("utf-8"), 0, s.getBytes().length);
+        assertTrue(tos.getByteArrayOutputStream().toString("utf-8").equals(s));
+    }
+    
     @Test
     public void testWriteByte() throws IOException {
         byte b = 5;