Opened 8 years ago
Closed 7 years ago
#13999 closed enhancement (fixed)
New MapCSS test that uses reference images
Reported by: | michael2402 | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 17.04 |
Component: | Unit tests | Version: | |
Keywords: | mapcss | Cc: | Klumbumbus |
Description
When debugging MapCSS is often found the need to create custom styles to track down issues.
This is quite annoying and I thought that it could be automated.
I wrote a test that uses sample OSM files and styles and renders them to small (256 x 256 px) images. Those images are then compared to a reference image. If the images differ, the rendered result is stored for the user to inspect.
This works as a good unit test for the renderer classes - we can detect changes and see the impact of changes visually. If we change the renderer in a good way we need to re-create the reference files.
If the team is fine with it, I would like to write some more tests and commit it.
While I was on it, I found the first potential bug (ws.lowerIndex < offset
in StyledMapRenderer
does not make sense)
Attachments (3)
Change History (23)
by , 8 years ago
Attachment: | mapcss-reference-test.zip added |
---|
comment:1 by , 8 years ago
Cc: | added |
---|
comment:2 by , 8 years ago
comment:4 by , 8 years ago
Milestone: | 16.12 → 17.01 |
---|
comment:6 by , 8 years ago
Keywords: | mapcss added |
---|
comment:9 by , 8 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Summary: | [Patch] New MapCSS test that uses reference images → New MapCSS test that uses reference images |
comment:10 by , 8 years ago
Milestone: | 17.01 → 17.02 |
---|
comment:11 by , 8 years ago
Milestone: | 17.02 → 17.03 |
---|
comment:12 by , 8 years ago
I traced this a bit more.
The problem is with the way OpenJDK and Sun handle the corner cases when drawing. There are differences in their implementations when handling sub-pixels.
Although you don't see that much of a visual difference, there are many small differences, especially in the anti-aliasing region.
So we are left with two options:
- Do not include any rendering tests
- Use a pure java implementation (the best one I found is PJA toolkit, last version is of 2004)
- Make the tests depend on the current JVM. We can add reference images for Sun and OpenJDK. Or we only add OpenJDK reference images, since this is used on our Jenkins server.
The main goal of those tests for me would be to quickly see if something was broken while working on the MapCSS code. So the last option would be fine with me. I'd have to test if there are many changes in the different OpenJDK versions, but I did not find any so far.
by , 8 years ago
Attachment: | test-differences.png added |
---|
by , 8 years ago
Attachment: | test-output.png added |
---|
comment:13 by , 8 years ago
ok for option 3 :) did you find the class which differs between Oracle and OpenJDK ?
comment:15 by , 8 years ago
No, I did not dig into that code. There is a lot of native code.
And there seems to be an issue with text drawing, I'll have to trace that one... (See Jenkins)
comment:17 by , 7 years ago
Milestone: | 17.03 → 17.04 |
---|
It will take some more time to get full (or at least most) coverage.
comment:19 by , 7 years ago
Feel free to add as many as you want.
If you search it: I moved it to functional tests, since it is not really a unit test.
In addition to rendering, it can be used to test MapCSS selectors and other MapCSS features.
comment:20 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
This ticket was only open because the tests were failing. Thanks for fixing them. A new ticket can be created if needed for new tests.
+1