Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.swt.graphics;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.util.*;
Expand Down Expand Up @@ -49,9 +50,11 @@ public void testHandlesExistForEachZoomLevelInHashMap() {
DPIUtil.setDeviceZoom(zoom);
Path path = new Path(display);
path.addArc(0, 0, 10, 10, 0, 90);
path.getHandle(zoom);
assertTrue("zoomLevelToHandle should contain initial zoom's handle", path.toString().contains(zoom + "="));
assertFalse("zoomLevelToHandle should not contains scaled handle", path.toString().contains(scaledZoom + "="));
path.getHandle(scaledZoom);
assertTrue("zoomLevelToHandle contains scaled handle", path.toString().contains(scaledZoom + "="));
assertTrue("zoomLevelToHandle contains initial zoom's handle", path.toString().contains(zoom + "="));
assertTrue("zoomLevelToHandle should contain scaled handle", path.toString().contains(scaledZoom + "="));
}

@Test
Expand All @@ -70,4 +73,22 @@ public void testBoundsAreScaledWRTZoomLevel() {
assertTrue("Height is scaled up wrt the scalingFactor", bounds.Height * scalingFactor == scaledBounds.Height);
assertTrue("Height is scaled up wrt the scalingFactor", bounds.Width * scalingFactor == scaledBounds.Width);
}

@Test
public void testCreatePathHandleWithDisposedPathInvolved() {
Display display = Display.getDefault();

Path path = new Path(display);
path.addArc(0, 0, 10, 10, 0, 90);

Path path2 = new Path(display);
path.addArc(0, 0, 30, 30, 0, 270);

path.addPath(path2);

path2.dispose();
path.getHandle(100);
path.getHandle(200);
path.dispose();
}
}
Loading
Loading