Skip to content

Commit 7250aa9

Browse files
committed
Set the auto scale method explicitly in tests
- Rename ImagesWin32Tests to ImageSmoothScalingWin32Tests - Set system property "swt.autoScale.method=smooth" so the test works as a proper regression test. Contributes to #1790
1 parent 920fe85 commit 7250aa9

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

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

+19-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,25 @@
2222
import org.junit.jupiter.api.extension.*;
2323

2424
@ExtendWith(PlatformSpecificExecutionExtension.class)
25-
@ExtendWith(WithMonitorSpecificScalingExtension.class)
26-
class ImagesWin32Tests {
25+
class ImageSmoothScalingWin32Tests {
26+
27+
private static final String SWT_AUTOSCALE_METHOD = "swt.autoScale.method";
28+
private static String originalAutoScaleMethod;
29+
30+
@BeforeAll
31+
static void setUpAutoScaleMethodSmooth() {
32+
originalAutoScaleMethod = System.getProperty(SWT_AUTOSCALE_METHOD);
33+
System.setProperty(SWT_AUTOSCALE_METHOD, "smooth");
34+
}
35+
36+
@AfterAll
37+
static void restoreAutoScaleMethod() {
38+
if (originalAutoScaleMethod != null) {
39+
System.setProperty(SWT_AUTOSCALE_METHOD, originalAutoScaleMethod);
40+
} else {
41+
System.clearProperty(SWT_AUTOSCALE_METHOD);
42+
}
43+
}
2744

2845
@Test
2946
public void testImageIconTypeShouldNotChangeAfterCallingGetHandleForDifferentZoom() {

0 commit comments

Comments
 (0)