diff options
author | Lynn Kues <lkues> | 2003-09-30 20:02:46 +0000 |
---|---|---|
committer | Lynn Kues <lkues> | 2003-09-30 20:02:46 +0000 |
commit | ae1c23a4d2638dc5a7369e29ff8aaf58fabf2f0b (patch) | |
tree | bcbef741b4a2e73289321302236c8fbeb099ab9a | |
parent | 3c6df677faab1f7d48b8a6abb267c9899b88bdb4 (diff) | |
download | eclipse.platform.swt-ae1c23a4d2638dc5a7369e29ff8aaf58fabf2f0b.tar.gz eclipse.platform.swt-ae1c23a4d2638dc5a7369e29ff8aaf58fabf2f0b.tar.xz eclipse.platform.swt-ae1c23a4d2638dc5a7369e29ff8aaf58fabf2f0b.zip |
43612
13 files changed, 49 insertions, 35 deletions
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java index ebe1df4fdf..d8af31eab5 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java @@ -2703,11 +2703,13 @@ public void test_setFontLorg_eclipse_swt_graphics_Font(){ font = new Font(text.getDisplay(), fontData.getName(), 8, fontData.getStyle()); text.setFont(font); - font.dispose(); lineHeight = text.getLineHeight(); + text.setFont(null); + font.dispose(); font = new Font(text.getDisplay(), fontData.getName(), 12, fontData.getStyle()); text.setFont(font); assertTrue(":a:", text.getLineHeight() > lineHeight && font.equals(text.getFont())); + text.setFont(null); font.dispose(); } diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Color.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Color.java index 19561c505f..95a9a4559d 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Color.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Color.java @@ -31,11 +31,10 @@ public static void main(String[] args) { } protected void setUp() { - display = new Display(); + display = Display.getDefault(); } protected void tearDown() { - display.dispose(); } public void test_ConstructorLorg_eclipse_swt_graphics_DeviceIII() { diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java index a7f55ba791..fcb975e5cd 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java @@ -36,11 +36,10 @@ public static void main(String[] args) { } protected void setUp() { - display = new Display(); + display = Display.getDefault(); } protected void tearDown() { - display.dispose(); } public void test_ConstructorLorg_eclipse_swt_graphics_DeviceI() { diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Font.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Font.java index bae1da8511..ce09710c65 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Font.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Font.java @@ -35,11 +35,10 @@ public static void main(String[] args) { } protected void setUp() { - display = new Display(); + display = Display.getDefault(); } protected void tearDown() { - display.dispose(); } public void test_ConstructorLorg_eclipse_swt_graphics_Device$Lorg_eclipse_swt_graphics_FontData() { diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontMetrics.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontMetrics.java index 3630913942..5d04d83a5c 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontMetrics.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontMetrics.java @@ -32,7 +32,7 @@ public static void main(String[] args) { } protected void setUp() { - display = new Display(); + display = Display.getDefault(); shell = new Shell(display); gc = new GC(shell); } @@ -40,7 +40,6 @@ protected void setUp() { protected void tearDown() { gc.dispose(); shell.dispose(); - display.dispose(); } public void test_equalsLjava_lang_Object() { diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java index fc2b538619..2996ae7c1b 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java @@ -33,7 +33,7 @@ public static void main(String[] args) { } protected void setUp() { - display = new Display(); + display = Display.getDefault(); shell = new Shell(display); shell.setBounds(0,30,240,290); shell.open(); @@ -43,7 +43,6 @@ protected void setUp() { protected void tearDown() { gc.dispose(); shell.dispose(); - display.dispose(); } public void test_ConstructorLorg_eclipse_swt_graphics_Drawable() { @@ -329,6 +328,7 @@ public void test_isClipped() { assertTrue(gc.isClipped()); GC testGC = new GC(shell); assertFalse(testGC.isClipped()); + testGC.dispose(); } public void test_isDisposed() { diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java index 09df7a78ec..83c00bea43 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java @@ -35,11 +35,10 @@ public static void main(String[] args) { } protected void setUp() { - display = new Display(); + display = Display.getDefault(); } protected void tearDown() { - display.dispose(); } public void test_ConstructorLorg_eclipse_swt_graphics_DeviceII() { diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Region.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Region.java index d05189af2c..51fb545b87 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Region.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Region.java @@ -32,11 +32,10 @@ public static void main(String[] args) { } protected void setUp() { - display = new Display(); + display = Display.getDefault(); } protected void tearDown() { - display.dispose(); } public void test_Constructor() { diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Canvas.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Canvas.java index f8146154ea..4c8dff2e72 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Canvas.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Canvas.java @@ -90,6 +90,7 @@ public void test_setFontLorg_eclipse_swt_graphics_Font() { Font font = new Font(canvas.getDisplay(), fontData.getName(), 8, fontData.getStyle()); canvas.setFont(font); assertTrue(":a:", canvas.getFont().equals(font)); + canvas.setFont(null); font.dispose(); } diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Caret.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Caret.java index f8df4c6259..f1977eac66 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Caret.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Caret.java @@ -133,6 +133,8 @@ public void test_setFontLorg_eclipse_swt_graphics_Font() { Font font = caret.getFont(); caret.setFont(font); assertEquals(font, caret.getFont()); + caret.setFont(null); + font.dispose(); font = new Font(caret.getDisplay(), SwtJunit.testFontName, 10, SWT.NORMAL); caret.setFont(font); diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java index 54c6b8d8c9..2d4ff65f18 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java @@ -618,7 +618,11 @@ public void test_setItems$Ljava_lang_String() { public void test_setOrientationI() { combo.setOrientation(SWT.RIGHT_TO_LEFT); - assertTrue(":a:", combo.getOrientation()==SWT.RIGHT_TO_LEFT); + if (SWT.getPlatform().equals("win32")) { + assertTrue(":a:", combo.getOrientation()==SWT.RIGHT_TO_LEFT); + } + combo.setOrientation(SWT.LEFT_TO_RIGHT); + assertTrue(":b:", combo.getOrientation()==SWT.LEFT_TO_RIGHT); } public void test_setSelectionLorg_eclipse_swt_graphics_Point() { diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_List.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_List.java index 5f3cb4ac48..a7cc962b76 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_List.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_List.java @@ -393,12 +393,14 @@ public void test_getItemHeight() { font = new Font(list.getDisplay(), fontData.getName(), 8, fontData.getStyle()); list.setFont(font); - font.dispose(); lineHeight = list.getItemHeight(); + list.setFont(null); + font.dispose(); font = new Font(list.getDisplay(), fontData.getName(), 12, fontData.getStyle()); list.setFont(font); int newLineHeight = list.getItemHeight(); assertTrue(":a:", newLineHeight > lineHeight); + list.setFont(null); font.dispose(); } @@ -1309,11 +1311,13 @@ public void test_setFontLorg_eclipse_swt_graphics_Font() { font = new Font(list.getDisplay(), fontData.getName(), 8, fontData.getStyle()); list.setFont(font); - font.dispose(); lineHeight = list.getItemHeight(); + list.setFont(null); + font.dispose(); font = new Font(list.getDisplay(), fontData.getName(), 12, fontData.getStyle()); list.setFont(font); assertTrue(":a:", list.getItemHeight() > lineHeight && font.equals(list.getFont())); + list.setFont(null); font.dispose(); } diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Text.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Text.java index b462ef5d92..3f6704c7cd 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Text.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Text.java @@ -35,7 +35,8 @@ public static void main(String[] args) { protected void setUp() { super.setUp(); - makeCleanEnvironment(false); // use multi-line by default + makeCleanEnvironment(false); // use multi-line by default + shell.open(); } protected void tearDown() { @@ -554,14 +555,17 @@ public void test_getSelectionText() { } public void test_getTabs() { - text.setTabs(1); - assertTrue(":a:", text.getTabs() == 1); - text.setTabs(8); - assertTrue(":b:", text.getTabs() == 8); - text.setText("Line\t1\r\n"); - assertTrue(":c:", text.getTabs() == 8); - text.setTabs(7); - assertTrue(":d:", text.getTabs() == 7); + if (SWT.getPlatform().equals("win32")) { + // API not supported on all platforms (e.g., Motif) + text.setTabs(1); + assertTrue(":a:", text.getTabs() == 1); + text.setTabs(8); + assertTrue(":b:", text.getTabs() == 8); + text.setText("Line\t1\r\n"); + assertTrue(":c:", text.getTabs() == 8); + text.setTabs(7); + assertTrue(":d:", text.getTabs() == 7); + } } public void test_getText() { @@ -591,14 +595,12 @@ public void test_getTextII() { } public void test_getTextLimit() { - assertTrue(":a:", text.getTextLimit() < 0); text.setTextLimit(10); - assertTrue(":b:", text.getTextLimit() == 10); + assertTrue(":a:", text.getTextLimit() == 10); } public void test_getTopIndex() { - assertEquals(0, text.getTopIndex()); - text.setText("01234567890"); + text.setTopIndex(0); assertEquals(0, text.getTopIndex()); text.append(delimiterString +"01234567890"); assertEquals(0, text.getTopIndex()); @@ -849,17 +851,23 @@ public void test_setFontLorg_eclipse_swt_graphics_Font() { font = new Font(text.getDisplay(), fontData.getName(), 8, fontData.getStyle()); text.setFont(font); - font.dispose(); lineHeight = text.getLineHeight(); + text.setFont(null); + font.dispose(); font = new Font(text.getDisplay(), fontData.getName(), 12, fontData.getStyle()); text.setFont(font); assertTrue(":a:", text.getLineHeight() > lineHeight && font.equals(text.getFont())); + text.setFont(null); font.dispose(); } public void test_setOrientationI() { text.setOrientation(SWT.RIGHT_TO_LEFT); - assertTrue(":a:", text.getOrientation()==SWT.RIGHT_TO_LEFT); + if (SWT.getPlatform().equals("win32")) { + assertTrue(":a:", text.getOrientation()==SWT.RIGHT_TO_LEFT); + } + text.setOrientation(SWT.LEFT_TO_RIGHT); + assertTrue(":b:", text.getOrientation()==SWT.LEFT_TO_RIGHT); } public void test_setRedrawZ() { @@ -1065,10 +1073,9 @@ public void test_setTopIndexI() { // tests a SINGLE line text editor makeCleanEnvironment(true); - assertEquals(0, text.getTopIndex()); text.setText("01234567890"); - assertEquals(0, text.getTopIndex()); text.append(Text.DELIMITER +"01234567890"); + text.setTopIndex(0); assertEquals(0, text.getTopIndex()); text.setTopIndex(1); assertEquals(0, text.getTopIndex()); |