3232class ControlWin32Tests {
3333
3434 @ Test
35- public void testScaleFontCorrectlyInAutoScaleSzenario () {
35+ public void testScaleFontCorrectlyInAutoScaleScenario () {
3636 DPIUtil .setMonitorSpecificScaling (true );
3737 Display display = Display .getDefault ();
3838
@@ -55,15 +55,37 @@ public void testSetFontWithMonitorSpecificScalingEnabled() {
5555 }
5656
5757 @ Test
58- public void testDoNotScaleFontCorrectlyInNoAutoScaleSzenario () {
58+ public void testScaleFontCorrectlyInNoAutoScaleScenario () {
5959 DPIUtil .setMonitorSpecificScaling (false );
6060 Display display = Display .getDefault ();
6161
6262 assertFalse ("Autoscale property is not set to false" , display .isRescalingAtRuntime ());
6363 int scalingFactor = 2 ;
6464 FontComparison fontComparison = updateFont (scalingFactor );
65- assertEquals ("Font height in pixels is different when setting the same font again" ,
66- fontComparison .originalFontHeight , fontComparison .currentFontHeight );
65+ assertEquals ("Font height in pixels is not adjusted according to the scale factor" ,
66+ fontComparison .originalFontHeight * scalingFactor , fontComparison .currentFontHeight );
67+ }
68+
69+ @ Test
70+ public void testDoNotScaleFontInNoAutoScaleScenarioWithLegacyFontRegistry () {
71+ DPIUtil .setMonitorSpecificScaling (false );
72+ String originalValue = System .getProperty ("swt.fontRegistry" );
73+ System .setProperty ("swt.fontRegistry" , "legacy" );
74+ try {
75+ Display display = Display .getDefault ();
76+
77+ assertFalse ("Autoscale property is not set to false" , display .isRescalingAtRuntime ());
78+ int scalingFactor = 2 ;
79+ FontComparison fontComparison = updateFont (scalingFactor );
80+ assertEquals ("Font height in pixels is different when setting the same font again" ,
81+ fontComparison .originalFontHeight , fontComparison .currentFontHeight );
82+ } finally {
83+ if (originalValue != null ) {
84+ System .setProperty ("swt.fontRegistry" , originalValue );
85+ } else {
86+ System .clearProperty ("swt.fontRegistry" );
87+ }
88+ }
6789 }
6890
6991 @ Test
0 commit comments