Skip to content

Commit ff976a3

Browse files
committed
Set the auto scale method explicitly in ImagesWin32Tests
Set it to "smooth" so the test works as a proper regression test. Contributes to #1790
1 parent 920fe85 commit ff976a3

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/graphics/ImagesWin32Tests.java

+18
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,24 @@
2525
@ExtendWith(WithMonitorSpecificScalingExtension.class)
2626
class ImagesWin32Tests {
2727

28+
private static final String SWT_AUTOSCALE_METHOD = "swt.autoScale.method";
29+
private static String originalAutoScaleMethod;
30+
31+
@BeforeAll
32+
static void setUpAutoScaleMethodSmooth() {
33+
originalAutoScaleMethod = System.getProperty(SWT_AUTOSCALE_METHOD);
34+
System.setProperty(SWT_AUTOSCALE_METHOD, "smooth");
35+
}
36+
37+
@AfterAll
38+
static void restoreAutoScaleMethod() {
39+
if (originalAutoScaleMethod != null) {
40+
System.setProperty(SWT_AUTOSCALE_METHOD, originalAutoScaleMethod);
41+
} else {
42+
System.clearProperty(SWT_AUTOSCALE_METHOD);
43+
}
44+
}
45+
2846
@Test
2947
public void testImageIconTypeShouldNotChangeAfterCallingGetHandleForDifferentZoom() {
3048
Image icon = Display.getDefault().getSystemImage(SWT.ICON_ERROR);

0 commit comments

Comments
 (0)