Modify

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#19017 closed defect (fixed)

MapCSSRendererTest output differs between Java 8 and Java 11

Reported by: Don-vip Owned by: team
Priority: normal Milestone: 20.03
Component: Unit tests Version:
Keywords: java11 Cc: simon04

Description

Jenkins build fails because of a difference between Java 8 and Java 11:

https://josm.openstreetmap.de/jenkins/job/JOSM/jdk=JDK11/lastCompletedBuild/testReport/

@Simon: do you have any idea how to make this test more robust?

Attachments (0)

Change History (9)

comment:1 by Don-vip, 5 years ago

Keywords: java11 added

comment:2 by simon04, 5 years ago

The differences all seem to be at the edges of the painted shapes. After investigating the test-differences.png, my first guesses are/were transparency and anti-aliasing. The diffs are mostly related to the alpha channel.

Regarding transparency, painting on a white background without alpha channel does not make a difference (might be a stupid/useless test):

  • test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java

    diff --git a/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java b/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java
    index bd91c2c42..6a506a028 100644
    a b public void testRender() throws Exception {  
    190190        RenderingHelper.StyleData sd = new RenderingHelper.StyleData();
    191191        sd.styleUrl = testConfig.getStyleSourceUrl();
    192192        RenderingHelper rh = new RenderingHelper(dataSet, testConfig.getTestArea(), scale, Collections.singleton(sd));
    193         rh.setFillBackground(false);
     193        rh.setFillBackground(true);
     194        rh.setBackgroundColor(Color.white);
    194195        rh.setDebugStream(System.out);
    195196        System.out.println("Running " + getClass() + "[" + testConfig.testDirectory + "]");
    196197        BufferedImage image = rh.render();
    public TestConfig usesFont(String string) {  
    336337        }
    337338
    338339        public BufferedImage getReference() throws IOException {
    339             return ImageIO.read(new File(getTestDirectory() + "/reference.png"));
     340            final BufferedImage rgba = ImageIO.read(new File(getTestDirectory() + "/reference.png"));
     341            BufferedImage rgb = new BufferedImage(rgba.getWidth(), rgba.getHeight(), BufferedImage.TYPE_INT_RGB);
     342            rgb.getGraphics().setColor(Color.white);
     343            rgb.getGraphics().fillRect(0, 0, rgba.getWidth(), rgba.getHeight());
     344            rgb.getGraphics().drawImage(rgba, 0, 0, null);
     345            return rgb;
    340346        }
    341347
    342348        private String getTestDirectory() {

comment:3 by simon04, 5 years ago

In 16224/josm:

see #19017 - MapCSSRendererTest: separate color/alpha diff

comment:4 by Don-vip, 5 years ago

In 16228/josm:

see #19017 - update svn:ignores

comment:5 by Don-vip, 5 years ago

In 16235/josm:

see #19017 - more lenient test, allow major differences

comment:6 by Don-vip, 5 years ago

Resolution: fixed
Status: newclosed

comment:7 by simon04, 4 years ago

In 17000/josm:

see #19017 - MapCSSRendererTest: move reference.png to reference-java8.png (separate tests for Java 8 and Java 11+)

comment:8 by simon04, 4 years ago

In 17001/josm:

see #19017 - MapCSSRendererTest: add reference.png generated using Java 11 (separate tests for Java 8 and Java 11+)

Tested using:

  • Java version: 11.0.8+10, N/A, OpenJDK 64-Bit Server VM
  • Java version: 14.0.2+12, N/A, OpenJDK 64-Bit Server VM
  • Java version: 16-ea+13-521, Oracle Corporation, OpenJDK 64-Bit Server VM

comment:9 by simon04, 4 years ago

In 17002/josm:

see #19017 - MapCSSRendererTest: reset thresholds to 0

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.