adding swing to UI tests verifying HiDPI

This commit is contained in:
Martin Pernollet 2022-04-27 18:16:30 +02:00
parent ee4cabcd67
commit 72eba19fe0
25 changed files with 97 additions and 18 deletions

View File

@ -8,12 +8,16 @@ This is a summary of existing baseline images for tests.
<td>EmulGL_AWT HiDPI:OFF</td>
<td>Native_AWT HiDPI:ON</td>
<td>Native_AWT HiDPI:OFF</td>
<td>Native_Swing HiDPI:ON</td>
<td>Native_Swing HiDPI:OFF</td>
</tr>
<tr>
<td><img src="src/test/resources/Surface_EmulGL_AWT_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Surface_EmulGL_AWT_HiDPI=OFF.png"></td>
<td><img src="src/test/resources/Surface_Native_AWT_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Surface_Native_AWT_HiDPI=OFF.png"></td>
<td><img src="src/test/resources/Surface_Native_Swing_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Surface_Native_Swing_HiDPI=OFF.png"></td>
</tr>
</table>
@ -24,12 +28,16 @@ This is a summary of existing baseline images for tests.
<td>EmulGL_AWT HiDPI:OFF</td>
<td>Native_AWT HiDPI:ON</td>
<td>Native_AWT HiDPI:OFF</td>
<td>Native_Swing HiDPI:ON</td>
<td>Native_Swing HiDPI:OFF</td>
</tr>
<tr>
<td><img src="src/test/resources/Scatter_EmulGL_AWT_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Scatter_EmulGL_AWT_HiDPI=OFF.png"></td>
<td><img src="src/test/resources/Scatter_Native_AWT_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Scatter_Native_AWT_HiDPI=OFF.png"></td>
<td><img src="src/test/resources/Scatter_Native_Swing_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Scatter_Native_Swing_HiDPI=OFF.png"></td>
</tr>
</table>
@ -40,12 +48,16 @@ This is a summary of existing baseline images for tests.
<td>EmulGL_AWT HiDPI:OFF</td>
<td>Native_AWT HiDPI:ON</td>
<td>Native_AWT HiDPI:OFF</td>
<td>Native_Swing HiDPI:ON</td>
<td>Native_Swing HiDPI:OFF</td>
</tr>
<tr>
<td><img src="src/test/resources/Text_EmulGL_AWT_HiDPI=ON_Font=AppleChancery24.png"></td>
<td><img src="src/test/resources/Text_EmulGL_AWT_HiDPI=OFF_Font=AppleChancery24.png"></td>
<td><img src="src/test/resources/Text_Native_AWT_HiDPI=ON_Font=AppleChancery24.png"></td>
<td><img src="src/test/resources/Text_Native_AWT_HiDPI=OFF_Font=AppleChancery24.png"></td>
<td><img src="src/test/resources/Text_Native_Swing_HiDPI=ON_Font=AppleChancery24.png"></td>
<td><img src="src/test/resources/Text_Native_Swing_HiDPI=OFF_Font=AppleChancery24.png"></td>
</tr>
</table>
@ -56,12 +68,16 @@ This is a summary of existing baseline images for tests.
<td>EmulGL_AWT HiDPI:OFF</td>
<td>Native_AWT HiDPI:ON</td>
<td>Native_AWT HiDPI:OFF</td>
<td>Native_Swing HiDPI:ON</td>
<td>Native_Swing HiDPI:OFF</td>
</tr>
<tr>
<td><img src="src/test/resources/Text_whenDrawableTextRenderer_EmulGL_AWT_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Text_whenDrawableTextRenderer_EmulGL_AWT_HiDPI=OFF.png"></td>
<td><img src="src/test/resources/Text_whenDrawableTextRenderer_Native_AWT_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Text_whenDrawableTextRenderer_Native_AWT_HiDPI=OFF.png"></td>
<td><img src="src/test/resources/Text_whenDrawableTextRenderer_Native_Swing_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Text_whenDrawableTextRenderer_Native_Swing_HiDPI=OFF.png"></td>
</tr>
</table>
@ -72,12 +88,16 @@ This is a summary of existing baseline images for tests.
<td>EmulGL_AWT HiDPI:OFF</td>
<td>Native_AWT HiDPI:ON</td>
<td>Native_AWT HiDPI:OFF</td>
<td>Native_Swing HiDPI:ON</td>
<td>Native_Swing HiDPI:OFF</td>
</tr>
<tr>
<td><img src="src/test/resources/AxisLabelRotateLayout_EmulGL_AWT_HiDPI=ON.png"></td>
<td><img src="src/test/resources/AxisLabelRotateLayout_EmulGL_AWT_HiDPI=OFF.png"></td>
<td><img src="src/test/resources/AxisLabelRotateLayout_Native_AWT_HiDPI=ON.png"></td>
<td><img src="src/test/resources/AxisLabelRotateLayout_Native_AWT_HiDPI=OFF.png"></td>
<td><img src="src/test/resources/AxisLabelRotateLayout_Native_Swing_HiDPI=ON.png"></td>
<td><img src="src/test/resources/AxisLabelRotateLayout_Native_Swing_HiDPI=OFF.png"></td>
</tr>
</table>
@ -88,12 +108,16 @@ This is a summary of existing baseline images for tests.
<td>EmulGL_AWT HiDPI:OFF</td>
<td>Native_AWT HiDPI:ON</td>
<td>Native_AWT HiDPI:OFF</td>
<td>Native_Swing HiDPI:ON</td>
<td>Native_Swing HiDPI:OFF</td>
</tr>
<tr>
<td><img src="src/test/resources/Colorbar_Shrink_EmulGL_AWT_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Colorbar_Shrink_EmulGL_AWT_HiDPI=OFF.png"></td>
<td><img src="src/test/resources/Colorbar_Shrink_Native_AWT_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Colorbar_Shrink_Native_AWT_HiDPI=OFF.png"></td>
<td><img src="src/test/resources/Colorbar_Shrink_Native_Swing_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Colorbar_Shrink_Native_Swing_HiDPI=OFF.png"></td>
</tr>
</table>
@ -104,12 +128,16 @@ This is a summary of existing baseline images for tests.
<td>EmulGL_AWT HiDPI:OFF</td>
<td>Native_AWT HiDPI:ON</td>
<td>Native_AWT HiDPI:OFF</td>
<td>Native_Swing HiDPI:ON</td>
<td>Native_Swing HiDPI:OFF</td>
</tr>
<tr>
<td><img src="src/test/resources/Colorbar_ShrinkBigFont_EmulGL_AWT_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Colorbar_ShrinkBigFont_EmulGL_AWT_HiDPI=OFF.png"></td>
<td><img src="src/test/resources/Colorbar_ShrinkBigFont_Native_AWT_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Colorbar_ShrinkBigFont_Native_AWT_HiDPI=OFF.png"></td>
<td><img src="src/test/resources/Colorbar_ShrinkBigFont_Native_Swing_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Colorbar_ShrinkBigFont_Native_Swing_HiDPI=OFF.png"></td>
</tr>
</table>
@ -120,12 +148,16 @@ This is a summary of existing baseline images for tests.
<td>EmulGL_AWT HiDPI:OFF</td>
<td>Native_AWT HiDPI:ON</td>
<td>Native_AWT HiDPI:OFF</td>
<td>Native_Swing HiDPI:ON</td>
<td>Native_Swing HiDPI:OFF</td>
</tr>
<tr>
<td><img src="src/test/resources/Colorbar_IsModifiedByCustomFont_EmulGL_AWT_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Colorbar_IsModifiedByCustomFont_EmulGL_AWT_HiDPI=OFF.png"></td>
<td><img src="src/test/resources/Colorbar_IsModifiedByCustomFont_Native_AWT_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Colorbar_IsModifiedByCustomFont_Native_AWT_HiDPI=OFF.png"></td>
<td><img src="src/test/resources/Colorbar_IsModifiedByCustomFont_Native_Swing_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Colorbar_IsModifiedByCustomFont_Native_Swing_HiDPI=OFF.png"></td>
</tr>
</table>
@ -136,12 +168,16 @@ This is a summary of existing baseline images for tests.
<td>EmulGL_AWT HiDPI:OFF</td>
<td>Native_AWT HiDPI:ON</td>
<td>Native_AWT HiDPI:OFF</td>
<td>Native_Swing HiDPI:ON</td>
<td>Native_Swing HiDPI:OFF</td>
</tr>
<tr>
<td><img src="src/test/resources/Colorbar_HasMinimumWidth_EmulGL_AWT_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Colorbar_HasMinimumWidth_EmulGL_AWT_HiDPI=OFF.png"></td>
<td><img src="src/test/resources/Colorbar_HasMinimumWidth_Native_AWT_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Colorbar_HasMinimumWidth_Native_AWT_HiDPI=OFF.png"></td>
<td><img src="src/test/resources/Colorbar_HasMinimumWidth_Native_Swing_HiDPI=ON.png"></td>
<td><img src="src/test/resources/Colorbar_HasMinimumWidth_Native_Swing_HiDPI=OFF.png"></td>
</tr>
</table>

View File

@ -41,7 +41,7 @@ public class ITTest {
static boolean runOffscreen = false;
public enum WT{
EmulGL_AWT, Native_AWT
EmulGL_AWT, Native_AWT, Native_Swing
}
protected String indexFileName = "README_GENERATED.md";
@ -96,6 +96,8 @@ public class ITTest {
line(sb, "<td>"+ title(WT.EmulGL_AWT, HiDPI.OFF) +"</td>");
line(sb, "<td>"+ title(WT.Native_AWT, HiDPI.ON) +"</td>");
line(sb, "<td>"+ title(WT.Native_AWT, HiDPI.OFF) +"</td>");
line(sb, "<td>"+ title(WT.Native_Swing, HiDPI.ON) +"</td>");
line(sb, "<td>"+ title(WT.Native_Swing, HiDPI.OFF) +"</td>");
line(sb, "</tr>");
@ -104,6 +106,8 @@ public class ITTest {
line(sb, "<td>" + imgTest(name(testName, caseName, WT.EmulGL_AWT, HiDPI.OFF, info))+ "</td>");
line(sb, "<td>" + imgTest(name(testName, caseName, WT.Native_AWT, HiDPI.ON, info))+ "</td>");
line(sb, "<td>" + imgTest(name(testName, caseName, WT.Native_AWT, HiDPI.OFF, info))+ "</td>");
line(sb, "<td>" + imgTest(name(testName, caseName, WT.Native_Swing, HiDPI.ON, info))+ "</td>");
line(sb, "<td>" + imgTest(name(testName, caseName, WT.Native_Swing, HiDPI.OFF, info))+ "</td>");
line(sb, "</tr>");
if(false) {
@ -112,6 +116,8 @@ public class ITTest {
line(sb, "<td>" + imgDiff(name(testName, caseName, WT.EmulGL_AWT, HiDPI.OFF, info))+ "</td>");
line(sb, "<td>" + imgDiff(name(testName, caseName, WT.Native_AWT, HiDPI.ON, info))+ "</td>");
line(sb, "<td>" + imgDiff(name(testName, caseName, WT.Native_AWT, HiDPI.OFF, info))+ "</td>");
line(sb, "<td>" + imgDiff(name(testName, caseName, WT.Native_Swing, HiDPI.ON, info))+ "</td>");
line(sb, "<td>" + imgDiff(name(testName, caseName, WT.Native_Swing, HiDPI.OFF, info))+ "</td>");
line(sb, "</tr>");
}
@ -158,19 +164,26 @@ public class ITTest {
System.out.println(" ITTest : " + windowingToolkit + " " + hidpi);
if(WT.EmulGL_AWT.equals(windowingToolkit)) {
return chartEmulGL(hidpi, offscreenDimension);
return chart(new EmulGLChartFactory(), hidpi, offscreenDimension);
}
else if(WT.Native_AWT.equals(windowingToolkit)) {
return chartNative(hidpi, offscreenDimension);
return chart(new AWTChartFactory(), hidpi, offscreenDimension);//chartNative(hidpi, offscreenDimension);
}
else if(WT.Native_Swing.equals(windowingToolkit)) {
return chart(new AWTChartFactory(), hidpi, offscreenDimension);//chartNative(hidpi, offscreenDimension);
}
else {
throw new IllegalArgumentException("Unsupported toolkit : " + windowingToolkit);
}
}
public static Chart chartEmulGL(HiDPI hidpi, Rectangle offscreenDimension) {
/*public static Chart chartEmulGL(HiDPI hidpi, Rectangle offscreenDimension) {
ChartFactory factory = new EmulGLChartFactory();
return chart(factory, hidpi, offscreenDimension);
}*/
public static Chart chart(ChartFactory factory, HiDPI hidpi, Rectangle offscreenDimension) {
if(runOffscreen) {
factory.getPainterFactory().setOffscreen(offscreenDimension.clone());
System.err.println(" ITTest will run offscreen, which may not enable HiDPI hence produce inaccurate layout with texts");
@ -180,6 +193,19 @@ public class ITTest {
Chart chart = factory.newChart(q);
return chart;
}
/*public static Chart chartNative(HiDPI hidpi, Rectangle offscreenDimension) {
AWTChartFactory factory = new AWTChartFactory();
if(runOffscreen) {
factory.getPainterFactory().setOffscreen(offscreenDimension.clone());
System.err.println(" ITTest will run offscreen, which may not enable HiDPI hence produce inaccurate layout with texts");
}
Quality q = quality(hidpi);
Chart chart = factory.newChart(q);
return chart;
}*/
public static Quality quality(HiDPI hidpi) {
Quality q = Quality.Advanced();
@ -187,18 +213,7 @@ public class ITTest {
q.setAnimated(false);
return q;
}
public static Chart chartNative(HiDPI hidpi, Rectangle offscreenDimension) {
AWTChartFactory factory = new AWTChartFactory();
if(runOffscreen)
factory.getPainterFactory().setOffscreen(offscreenDimension.clone());
Quality q = quality(hidpi);
Chart chart = factory.newChart(q);
return chart;
}
// ---------------------------------------------------------------------------------------------- //
@SuppressWarnings("rawtypes")

View File

@ -29,6 +29,9 @@ public class ITTest_AxisLabelRotateLayout extends ITTest{
whenAxisLabelOrientationNotHorizontal(WT.Native_AWT, HiDPI.ON);
whenAxisLabelOrientationNotHorizontal(WT.Native_AWT, HiDPI.OFF);
whenAxisLabelOrientationNotHorizontal(WT.Native_Swing, HiDPI.ON);
whenAxisLabelOrientationNotHorizontal(WT.Native_Swing, HiDPI.OFF);
whenAxisLabelOrientationNotHorizontal(WT.EmulGL_AWT, HiDPI.OFF);
whenAxisLabelOrientationNotHorizontal(WT.EmulGL_AWT, HiDPI.ON);
}

View File

@ -43,6 +43,9 @@ public class ITTest_Colorbar extends ITTest{
whenColorbar_IsModifiedByCustomFont(WT.Native_AWT, HiDPI.OFF);
whenColorbar_IsModifiedByCustomFont(WT.Native_AWT, HiDPI.ON);
whenColorbar_IsModifiedByCustomFont(WT.Native_Swing, HiDPI.OFF);
whenColorbar_IsModifiedByCustomFont(WT.Native_Swing, HiDPI.ON);
whenColorbar_IsModifiedByCustomFont(WT.EmulGL_AWT, HiDPI.ON);
whenColorbar_IsModifiedByCustomFont(WT.EmulGL_AWT, HiDPI.OFF);
}
@ -79,6 +82,9 @@ public class ITTest_Colorbar extends ITTest{
whenColorbar_HasMininumWidth(WT.Native_AWT, HiDPI.OFF);
whenColorbar_HasMininumWidth(WT.Native_AWT, HiDPI.ON);
whenColorbar_HasMininumWidth(WT.Native_Swing, HiDPI.OFF);
whenColorbar_HasMininumWidth(WT.Native_Swing, HiDPI.ON);
whenColorbar_HasMininumWidth(WT.EmulGL_AWT, HiDPI.ON);
@ -121,6 +127,9 @@ public class ITTest_Colorbar extends ITTest{
whenColorbar_ShrinkBigFont(WT.Native_AWT, HiDPI.OFF);
whenColorbar_ShrinkBigFont(WT.Native_AWT, HiDPI.ON);
whenColorbar_ShrinkBigFont(WT.Native_Swing, HiDPI.OFF);
whenColorbar_ShrinkBigFont(WT.Native_Swing, HiDPI.ON);
whenColorbar_ShrinkBigFont(WT.EmulGL_AWT, HiDPI.ON);
whenColorbar_ShrinkBigFont(WT.EmulGL_AWT, HiDPI.OFF);
@ -172,7 +181,10 @@ public class ITTest_Colorbar extends ITTest{
whenColorbar_Shrink(WT.Native_AWT, HiDPI.OFF);
whenColorbar_Shrink(WT.Native_AWT, HiDPI.ON);
whenColorbar_Shrink(WT.Native_Swing, HiDPI.OFF);
whenColorbar_Shrink(WT.Native_Swing, HiDPI.ON);
whenColorbar_Shrink(WT.EmulGL_AWT, HiDPI.OFF);
whenColorbar_Shrink(WT.EmulGL_AWT, HiDPI.ON);
}

View File

@ -17,8 +17,12 @@ public class ITTest_Scatter extends ITTest{
whenScatterChart_ThenMatchBaselineImagePixelwise(WT.Native_AWT, HiDPI.OFF);
whenScatterChart_ThenMatchBaselineImagePixelwise(WT.Native_AWT, HiDPI.ON);
whenScatterChart_ThenMatchBaselineImagePixelwise(WT.Native_Swing, HiDPI.OFF);
whenScatterChart_ThenMatchBaselineImagePixelwise(WT.Native_Swing, HiDPI.ON);
whenScatterChart_ThenMatchBaselineImagePixelwise(WT.EmulGL_AWT, HiDPI.ON);
whenScatterChart_ThenMatchBaselineImagePixelwise(WT.EmulGL_AWT, HiDPI.OFF);
}
private Chart whenScatterChart_ThenMatchBaselineImagePixelwise(WT wt, HiDPI hidpi) {

View File

@ -8,7 +8,10 @@ public class ITTest_Surface extends ITTest{
@Test
public void whenSurfaceChart_ThenMatchBaselineImagePixelwise() {
System.out.println("ITTest : whenSurfaceChart_ThenMatchBaselineImagePixelwise");
whenSurfaceChart_ThenMatchBaselineImagePixelwise(WT.Native_Swing, HiDPI.ON);
whenSurfaceChart_ThenMatchBaselineImagePixelwise(WT.Native_Swing, HiDPI.OFF);
whenSurfaceChart_ThenMatchBaselineImagePixelwise(WT.Native_AWT, HiDPI.ON);
whenSurfaceChart_ThenMatchBaselineImagePixelwise(WT.Native_AWT, HiDPI.OFF);

View File

@ -42,6 +42,9 @@ public class ITTest_Text extends ITTest{
whenCustomFont(WT.Native_AWT, HiDPI.ON);
whenCustomFont(WT.Native_AWT, HiDPI.OFF);
whenCustomFont(WT.Native_Swing, HiDPI.ON);
whenCustomFont(WT.Native_Swing, HiDPI.OFF);
whenCustomFont(WT.EmulGL_AWT, HiDPI.ON);
whenCustomFont(WT.EmulGL_AWT, HiDPI.OFF);
}
@ -76,6 +79,9 @@ public class ITTest_Text extends ITTest{
whenDrawableTextRenderer(WT.Native_AWT, HiDPI.ON);
whenDrawableTextRenderer(WT.Native_AWT, HiDPI.OFF);
whenDrawableTextRenderer(WT.Native_Swing, HiDPI.ON);
whenDrawableTextRenderer(WT.Native_Swing, HiDPI.OFF);
whenDrawableTextRenderer(WT.EmulGL_AWT, HiDPI.ON);
whenDrawableTextRenderer(WT.EmulGL_AWT, HiDPI.OFF);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB