### Eclipse Workspace Patch 1.0 #P org.eclipse.ercp.swt.core.tests Index: src/org/eclipse/ercp/swt/core/tests/junit/Test_org_eclipse_swt_widgets_Widget.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.ercp/org.eclipse.ercp.swt.core.tests/src/org/eclipse/ercp/swt/core/tests/junit/Test_org_eclipse_swt_widgets_Widget.java,v retrieving revision 1.2 diff -u -r1.2 Test_org_eclipse_swt_widgets_Widget.java --- src/org/eclipse/ercp/swt/core/tests/junit/Test_org_eclipse_swt_widgets_Widget.java 28 Jun 2005 16:25:58 -0000 1.2 +++ src/org/eclipse/ercp/swt/core/tests/junit/Test_org_eclipse_swt_widgets_Widget.java 6 Nov 2008 10:33:31 -0000 @@ -43,7 +43,7 @@ assertEquals(false, widget.isDisposed()); } assertEquals(false, shell.isDisposed()); - shell.dispose(); + if(!shell.isDisposed()) shell.dispose(); if (widget != null) { assertTrue(widget.isDisposed()); } Index: src/org/eclipse/ercp/swt/core/tests/junit/Test_org_eclipse_swt_widgets_Shell.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.ercp/org.eclipse.ercp.swt.core.tests/src/org/eclipse/ercp/swt/core/tests/junit/Test_org_eclipse_swt_widgets_Shell.java,v retrieving revision 1.9 diff -u -r1.9 Test_org_eclipse_swt_widgets_Shell.java --- src/org/eclipse/ercp/swt/core/tests/junit/Test_org_eclipse_swt_widgets_Shell.java 23 Jun 2006 17:22:32 -0000 1.9 +++ src/org/eclipse/ercp/swt/core/tests/junit/Test_org_eclipse_swt_widgets_Shell.java 6 Nov 2008 10:33:30 -0000 @@ -232,10 +232,14 @@ assertTrue(":a:", mode >= 0); } +//Since MobileShell is designed as Top-level shell. +//The setSize() and setLocation() methods of MobileShell are useless on WM. public void test_getLocation() { - testShell.setLocation(10,15); - assertTrue(":a:", testShell.getLocation().x == 10); - assertTrue(":b:", testShell.getLocation().y == 15); + if(!(this.testShell.getClass().toString().equals("class org.eclipse.ercp.swt.mobile.MobileShell"))){ + testShell.setLocation(10,15); + assertTrue(":a:", testShell.getLocation().x == 10); + assertTrue(":b:", testShell.getLocation().y == 15); + } } public void test_getRegion() { @@ -280,10 +284,17 @@ public void test_isFocusControl() { assertTrue(!control.isFocusControl()); testShell.setVisible(true); + control.setVisible(true); + control.setEnabled(true); + control.setFocus(); + assertTrue(control.isFocusControl()); + + testShell.setVisible(false); } + public void test_open() { testShell.open(); } @@ -543,7 +554,10 @@ // } // } } +//Since MobileShell is designed as Top-level shell. +//The setSize() and setLocation() methods of MobileShell are useless on WM. public void test_setSizeII() { + if(!(this.testShell.getClass().toString().equals("class org.eclipse.ercp.swt.mobile.MobileShell"))){ /* windows */ /* note that there is a minimum size for a shell, this test will fail if p1.x < 119 or p1.y < 34 */ /* note that there is a maximum size for a shell, this test will fail if p1.x > 1292 or p1.y > 1036 */ @@ -583,12 +597,18 @@ newSize.y -= 100; } } + } } + public void test_setSizeLorg_eclipse_swt_graphics_Point() { /* windows */ /* note that there is a minimum size for a shell, this test will fail if p1.x < 119 or p1.y < 34 */ /* note that there is a maximum size for a shell, this test will fail if p1.x > 1292 or p1.y > 1036 */ + + //Since MobileShell is designed as Top-level shell. + //The setSize() and setLocation() methods of MobileShell are useless on WM. + if(!(this.testShell.getClass().toString().equals("class org.eclipse.ercp.swt.mobile.MobileShell"))){ if (SwtJunit.isWindows) { Point newSize = new Point(119, 34); for (int i = 0; i < 10; i++) { @@ -625,6 +645,7 @@ newSize.y -= 100; } } + } } Shell testShell; Index: src/org/eclipse/ercp/swt/core/tests/junit/SwtTestCase.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.ercp/org.eclipse.ercp.swt.core.tests/src/org/eclipse/ercp/swt/core/tests/junit/SwtTestCase.java,v retrieving revision 1.7 diff -u -r1.7 SwtTestCase.java --- src/org/eclipse/ercp/swt/core/tests/junit/SwtTestCase.java 23 Apr 2007 10:12:53 -0000 1.7 +++ src/org/eclipse/ercp/swt/core/tests/junit/SwtTestCase.java 6 Nov 2008 10:33:29 -0000 @@ -305,12 +305,12 @@ } // copied exactly from junit.framework.TestCase so that it can be called from here even though private -static private void failNotEquals(String message, Object expected, Object actual) { - String formatted= ""; - if (message != null) - formatted= message+" "; - fail(formatted+"expected:<"+expected+"> but was:<"+actual+">"); -} +//static private void failNotEquals(String message, Object expected, Object actual) { +// String formatted= ""; +// if (message != null) +// formatted= message+" "; +// fail(formatted+"expected:<"+expected+"> but was:<"+actual+">"); +//} protected boolean isReparentablePlatform() { String platform = SWT.getPlatform(); for (int i=0; i - - - - + +