changeset 1439:d6264d31d0d6

TextWithWaterLevelTest.java: cutToTest get rid of hardcoded siezes, ad follows relative placement of testing points (used font is different on windows)
author Jiri Vanek <jvanek@redhat.com>
date Thu, 18 May 2017 16:24:36 +0200
parents 3e52d36eecdf
children 30e002f01f8e
files ChangeLog tests/netx/unit/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/TextWithWaterLevelTest.java
diffstat 2 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu May 18 16:16:05 2017 +0200
+++ b/ChangeLog	Thu May 18 16:24:36 2017 +0200
@@ -1,3 +1,10 @@
+2017-05-18  Jiri Vanek <jvanek@redhat.com>
+            Tomáš Votava <tomcacolca@gmail.com>
+
+	* 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 <jvanek@redhat.com>
             Tomáš Votava <tomcacolca@gmail.com>
 
--- a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/TextWithWaterLevelTest.java	Thu May 18 16:16:05 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: