diff options
Diffstat (limited to 'tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/performance/Test_org_eclipse_swt_graphics_Region.java')
-rw-r--r-- | tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/performance/Test_org_eclipse_swt_graphics_Region.java | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/performance/Test_org_eclipse_swt_graphics_Region.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/performance/Test_org_eclipse_swt_graphics_Region.java index aec66577a8..4f2746db53 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/performance/Test_org_eclipse_swt_graphics_Region.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/performance/Test_org_eclipse_swt_graphics_Region.java @@ -23,7 +23,6 @@ import org.eclipse.test.performance.PerformanceMeter; * @see org.eclipse.swt.graphics.Region */ public class Test_org_eclipse_swt_graphics_Region extends SwtPerformanceTestCase { - static final int COUNT = 1000; public Test_org_eclipse_swt_graphics_Region(String name) { super(name); @@ -39,6 +38,7 @@ protected void setUp() throws Exception { } public void test_Constructor() { + final int COUNT = 9000; // 10000 causes No More Handles error Region[] regions = new Region [COUNT]; PerformanceMeter meter = createMeter(); @@ -47,15 +47,17 @@ public void test_Constructor() { regions[i] = new Region (); } meter.stop(); - + for (int i = 0; i < COUNT; i++) { regions[i].dispose(); } - + disposeMeter(meter); } public void test_ConstructorLorg_eclipse_swt_graphics_Device() { + final int COUNT = 9000; // 10000 causes No More Handles error + Region[] regions = new Region [COUNT]; PerformanceMeter meter = createMeter(); @@ -73,6 +75,8 @@ public void test_ConstructorLorg_eclipse_swt_graphics_Device() { } public void test_add$I() { + final int COUNT = 250000; + Region region = new Region(display); int[][] toAdd = new int[COUNT][]; for (int i = 0; i < COUNT; i++) { @@ -92,6 +96,8 @@ public void test_add$I() { } public void test_addLorg_eclipse_swt_graphics_Rectangle() { + final int COUNT = 4000; + Region region = new Region(display); Rectangle[] toAdd = new Rectangle[COUNT]; for (int i = 0; i < COUNT; i++) { @@ -111,6 +117,8 @@ public void test_addLorg_eclipse_swt_graphics_Rectangle() { } public void test_addLorg_eclipse_swt_graphics_Region() { + final int COUNT = 4000; + Region region = new Region(display); Region[] regions = new Region[COUNT]; for (int i = 0; i < COUNT; i++) { @@ -135,6 +143,8 @@ public void test_addLorg_eclipse_swt_graphics_Region() { } public void test_containsII() { + final int COUNT = 25000000; + Region region = new Region (display); region.add(new Rectangle (30,30,30,30)); @@ -165,6 +175,8 @@ public void test_containsII() { } public void test_containsLorg_eclipse_swt_graphics_Point() { + final int COUNT = 20000000; + Region region = new Region (display); Point point = new Point (20,20); region.add(new Rectangle (30,30,30,30)); @@ -196,6 +208,8 @@ public void test_containsLorg_eclipse_swt_graphics_Point() { } public void test_dispose() { + final int COUNT = 9000; // 10000 causes No More Handles error + Region[] regions = new Region [COUNT]; for (int i = 0; i < COUNT; i++) { regions[i] = new Region(display); @@ -222,6 +236,8 @@ public void test_dispose() { } public void test_equalsLjava_lang_Object() { + final int COUNT = 50000000; + // Currently, Regions are only "equal" if they have the same handle. // This is so that identical objects are properly hashed. // We are considering adding a new method that will compare Regions for the same area. @@ -260,6 +276,8 @@ public void test_equalsLjava_lang_Object() { } public void test_getBounds() { + final int COUNT = 4500000; + Region region = new Region(display); region.add(new Rectangle(10,10,20,20)); @@ -276,6 +294,8 @@ public void test_getBounds() { } public void test_hashCode() { + final int COUNT = 700000000; + Region region = new Region(display); region.add(new Rectangle(10,10,20,20)); @@ -292,6 +312,8 @@ public void test_hashCode() { } public void test_intersectLorg_eclipse_swt_graphics_Rectangle() { + final int COUNT = 2000000; + Region region = new Region(display); region.add(new Rectangle(10,10,20,20)); Rectangle rect = new Rectangle(0,0,5,5); @@ -324,6 +346,8 @@ public void test_intersectLorg_eclipse_swt_graphics_Rectangle() { } public void test_intersectLorg_eclipse_swt_graphics_Region() { + final int COUNT = 12000000; + Region region1 = new Region(display); region1.add(new Rectangle(10,10,20,20)); Region region2 = new Region(display); @@ -359,6 +383,8 @@ public void test_intersectLorg_eclipse_swt_graphics_Region() { } public void test_intersectsIIII() { + final int COUNT = 2500000; + Region region = new Region(display); region.add(new Rectangle(10,10,20,20)); @@ -389,6 +415,8 @@ public void test_intersectsIIII() { } public void test_intersectsLorg_eclipse_swt_graphics_Rectangle() { + final int COUNT = 2500000; + Region region = new Region(display); region.add(new Rectangle(10,10,20,20)); Rectangle rect = new Rectangle (0,0,5,5); @@ -421,6 +449,8 @@ public void test_intersectsLorg_eclipse_swt_graphics_Rectangle() { } public void test_isDisposed() { + final int COUNT = 500000000; + Region region = new Region(display); region.add(new Rectangle(10,10,10,10)); @@ -446,6 +476,8 @@ public void test_isDisposed() { } public void test_isEmpty() { + final int COUNT = 5000000; + Region region = new Region (display); PerformanceMeter meter = createMeter("empty"); @@ -472,6 +504,8 @@ public void test_isEmpty() { } public void test_subtract$I() { + final int COUNT = 250000; + Region region = new Region(display); region.add(new Rectangle(0,0,COUNT * 2, COUNT * 2)); int[][] toSubtract = new int[COUNT][]; @@ -492,6 +526,8 @@ public void test_subtract$I() { } public void test_subtractLorg_eclipse_swt_graphics_Rectangle() { + final int COUNT = 3000; + Region region = new Region(display); region.add(new Rectangle(0,0,COUNT * 2, COUNT * 2)); Rectangle[] toSubtract = new Rectangle[COUNT]; @@ -512,6 +548,8 @@ public void test_subtractLorg_eclipse_swt_graphics_Rectangle() { } public void test_subtractLorg_eclipse_swt_graphics_Region() { + final int COUNT = 3000; + Region region = new Region(display); region.add(new Rectangle(0, 0, COUNT*2, COUNT*2)); Region[] regions = new Region[COUNT]; @@ -536,9 +574,6 @@ public void test_subtractLorg_eclipse_swt_graphics_Region() { disposeMeter(meter); } -public void test_win32_newLorg_eclipse_swt_graphics_DeviceI() { -} - public static Test suite() { TestSuite suite = new TestSuite(); java.util.Vector methodNames = methodNames(); @@ -570,7 +605,6 @@ public static java.util.Vector methodNames() { methodNames.addElement("test_subtract$I"); methodNames.addElement("test_subtractLorg_eclipse_swt_graphics_Rectangle"); methodNames.addElement("test_subtractLorg_eclipse_swt_graphics_Region"); - methodNames.addElement("test_win32_newLorg_eclipse_swt_graphics_DeviceI"); return methodNames; } protected void runTest() throws Throwable { @@ -594,7 +628,6 @@ protected void runTest() throws Throwable { else if (getName().equals("test_subtract$I")) test_subtract$I(); else if (getName().equals("test_subtractLorg_eclipse_swt_graphics_Rectangle")) test_subtractLorg_eclipse_swt_graphics_Rectangle(); else if (getName().equals("test_subtractLorg_eclipse_swt_graphics_Region")) test_subtractLorg_eclipse_swt_graphics_Region(); - else if (getName().equals("test_win32_newLorg_eclipse_swt_graphics_DeviceI")) test_win32_newLorg_eclipse_swt_graphics_DeviceI(); } /* custom */ |