Skip to content

Commit f3eb0e3

Browse files
akoch-yattaHeikoKlare
authored andcommitted
[win32] Use operations for Path manipulation
This commit refactors Path in the win32 implementation to better support multiple handles for different zoom settings of a Path when monitor-specific scaling is enabled. The previous implementation only applied adaptions to the initial handle of the path and relied on the path not to be changed afterwards. This doesn't cover all scenarios and can lead to unexpected behavior when re-using Path objects over different zoom settings.
1 parent ccc69c2 commit f3eb0e3

File tree

5 files changed

+631
-221
lines changed

5 files changed

+631
-221
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*******************************************************************************/
1414
package org.eclipse.swt.graphics;
1515

16+
import static org.junit.Assert.assertFalse;
1617
import static org.junit.Assert.assertTrue;
1718

1819
import java.util.*;
@@ -49,9 +50,11 @@ public void testHandlesExistForEachZoomLevelInHashMap() {
4950
DPIUtil.setDeviceZoom(zoom);
5051
Path path = new Path(display);
5152
path.addArc(0, 0, 10, 10, 0, 90);
53+
path.getHandle(zoom);
54+
assertTrue("zoomLevelToHandle should contain initial zoom's handle", path.toString().contains(zoom + "="));
55+
assertFalse("zoomLevelToHandle should not contains scaled handle", path.toString().contains(scaledZoom + "="));
5256
path.getHandle(scaledZoom);
53-
assertTrue("zoomLevelToHandle contains scaled handle", path.toString().contains(scaledZoom + "="));
54-
assertTrue("zoomLevelToHandle contains initial zoom's handle", path.toString().contains(zoom + "="));
57+
assertTrue("zoomLevelToHandle should contain scaled handle", path.toString().contains(scaledZoom + "="));
5558
}
5659

5760
@Test

0 commit comments

Comments
 (0)