diff options
Diffstat (limited to 'tests')
254 files changed, 0 insertions, 45968 deletions
diff --git a/tests/org.eclipse.swt.tests/.classpath b/tests/org.eclipse.swt.tests/.classpath deleted file mode 100644 index bda7e4b3d1..0000000000 --- a/tests/org.eclipse.swt.tests/.classpath +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry sourcepath="JRE_SRC" kind="var" rootpath="JRE_SRCROOT" path="JRE_LIB"/> - <classpathentry kind="src" path="/org.eclipse.swt"/> - <classpathentry kind="src" path="JUnit Tests"/> - <classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.junit_3.8.1/junit.jar"/> - <classpathentry kind="src" path="data"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/tests/org.eclipse.swt.tests/.cvsignore b/tests/org.eclipse.swt.tests/.cvsignore deleted file mode 100644 index c5e82d7458..0000000000 --- a/tests/org.eclipse.swt.tests/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin
\ No newline at end of file diff --git a/tests/org.eclipse.swt.tests/.project b/tests/org.eclipse.swt.tests/.project deleted file mode 100644 index be6b9345f2..0000000000 --- a/tests/org.eclipse.swt.tests/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.swt.tests</name> - <comment></comment> - <projects> - <project>org.eclipse.swt</project> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllBrowserTests.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllBrowserTests.java deleted file mode 100644 index bdd537fe7b..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllBrowserTests.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Suite for testing all of the graphics test cases. - */ -public class AllBrowserTests { - -public static void main(String[] args) { - TestRunner.run (suite()); -} -public static Test suite() { - TestSuite suite = new TestSuite(); - - suite.addTest(Test_org_eclipse_swt_browser_Browser.suite()); - suite.addTest(Test_org_eclipse_swt_browser_CloseWindowListener.suite()); - suite.addTest(Test_org_eclipse_swt_browser_LocationAdapter.suite()); - suite.addTest(Test_org_eclipse_swt_browser_LocationListener.suite()); - suite.addTest(Test_org_eclipse_swt_browser_OpenWindowListener.suite()); - suite.addTest(Test_org_eclipse_swt_browser_ProgressAdapter.suite()); - suite.addTest(Test_org_eclipse_swt_browser_ProgressListener.suite()); - suite.addTest(Test_org_eclipse_swt_browser_StatusTextListener.suite()); - suite.addTest(Test_org_eclipse_swt_browser_TitleListener.suite()); - suite.addTest(Test_org_eclipse_swt_browser_VisibilityWindowAdapter.suite()); - suite.addTest(Test_org_eclipse_swt_browser_VisibilityWindowListener.suite()); - suite.addTest(org.eclipse.swt.tests.junit.browser.Test_BrowserSuite.suite()); - - return suite; -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllGraphicsTests.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllGraphicsTests.java deleted file mode 100644 index ef013c9906..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllGraphicsTests.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Suite for testing all of the graphics test cases. - */ -public class AllGraphicsTests { -public static void main(String[] args) { - TestRunner.run (suite()); -} -public static Test suite() { - TestSuite suite = new TestSuite(); - - suite.addTest(Test_org_eclipse_swt_graphics_Color.suite()); - suite.addTest(Test_org_eclipse_swt_graphics_Cursor.suite()); - suite.addTest(Test_org_eclipse_swt_graphics_DeviceData.suite()); - suite.addTest(Test_org_eclipse_swt_graphics_Font.suite()); - suite.addTest(Test_org_eclipse_swt_graphics_FontData.suite()); - suite.addTest(Test_org_eclipse_swt_graphics_FontMetrics.suite()); - suite.addTest(Test_org_eclipse_swt_graphics_GC.suite()); - suite.addTest(Test_org_eclipse_swt_graphics_GCData.suite()); - suite.addTest(Test_org_eclipse_swt_graphics_Image.suite()); - suite.addTest(Test_org_eclipse_swt_graphics_ImageData.suite()); - suite.addTest(Test_org_eclipse_swt_graphics_PaletteData.suite()); - suite.addTest(Test_org_eclipse_swt_graphics_Point.suite()); - suite.addTest(Test_org_eclipse_swt_graphics_Rectangle.suite()); - suite.addTest(Test_org_eclipse_swt_graphics_Region.suite()); - suite.addTest(Test_org_eclipse_swt_graphics_RGB.suite()); - - - suite.addTest(Test_org_eclipse_swt_graphics_ImageLoader.suite()); - suite.addTest(Test_org_eclipse_swt_graphics_ImageLoaderEvent.suite()); - - return suite; -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllTests.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllTests.java deleted file mode 100644 index 768eb3c050..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllTests.java +++ /dev/null @@ -1,229 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Suite for running all SWT test cases. - */ -public class AllTests extends TestSuite { - -public static void main(String[] args) { - SwtTestCase.unimplementedMethods = 0; - TestRunner.run(suite()); - if (SwtTestCase.unimplementedMethods > 0) { - System.out.println("\nCalls to warnUnimpl: " + SwtTestCase.unimplementedMethods); - } -} -public static Test suite() { - return new AllTests(); -} - -public AllTests() { - super(); - /* The logical order to run the tests in is: - * - SWT, SWTError, SWTException - * - Display - * - graphics classes - * - items and Caret, etc - * - widgets - * - dialogs - * - layout - * - custom widgets - * - printing and program - * - events - * - drag & drop - * - accessibility - * - OLE - * - browser - */ - addTest(Test_org_eclipse_swt_SWT.suite()); - addTest(Test_org_eclipse_swt_SWTException.suite()); - addTest(Test_org_eclipse_swt_SWTError.suite()); - - /* NOTE: If the Display test suite is run, it must be run - * before any other tests that need a display (i.e. graphics - * or widget tests, etc). Otherwise, an InvalidThreadAccess - * exception will be thrown for each Display test. - */ - addTest(Test_org_eclipse_swt_widgets_Display.suite()); - - addTest(Test_org_eclipse_swt_graphics_Image.suite()); - addTest(Test_org_eclipse_swt_graphics_Cursor.suite()); - addTest(Test_org_eclipse_swt_graphics_DeviceData.suite()); - addTest(Test_org_eclipse_swt_graphics_ImageLoaderEvent.suite()); - addTest(Test_org_eclipse_swt_graphics_RGB.suite()); - addTest(Test_org_eclipse_swt_graphics_Font.suite()); - addTest(Test_org_eclipse_swt_graphics_Rectangle.suite()); - addTest(Test_org_eclipse_swt_graphics_FontData.suite()); - addTest(Test_org_eclipse_swt_graphics_GC.suite()); - addTest(Test_org_eclipse_swt_graphics_ImageData.suite()); - addTest(Test_org_eclipse_swt_graphics_Region.suite()); - addTest(Test_org_eclipse_swt_graphics_GCData.suite()); - addTest(Test_org_eclipse_swt_graphics_FontMetrics.suite()); - addTest(Test_org_eclipse_swt_graphics_Color.suite()); - addTest(Test_org_eclipse_swt_graphics_Point.suite()); - addTest(Test_org_eclipse_swt_graphics_PaletteData.suite()); - addTest(Test_org_eclipse_swt_graphics_ImageLoader.suite()); - - addTest(Test_org_eclipse_swt_widgets_MenuItem.suite()); - addTest(Test_org_eclipse_swt_widgets_ToolItem.suite()); - //addTest(Test_org_eclipse_swt_widgets_CoolItem.suite()); - addTest(Test_org_eclipse_swt_widgets_TabItem.suite()); - addTest(Test_org_eclipse_swt_widgets_TableItem.suite()); - addTest(Test_org_eclipse_swt_widgets_TableColumn.suite()); - addTest(Test_org_eclipse_swt_widgets_TreeItem.suite()); - addTest(Test_org_eclipse_swt_widgets_Caret.suite()); - addTest(Test_org_eclipse_swt_widgets_Event.suite()); - addTest(Test_org_eclipse_swt_widgets_TypedListener.suite()); - addTest(Test_org_eclipse_swt_widgets_Menu.suite()); - //addTest(Test_org_eclipse_swt_widgets_Tracker.suite()); - addTest(Test_org_eclipse_swt_widgets_Synchronizer.suite()); - - addTest(Test_org_eclipse_swt_widgets_Shell.suite()); - //addTest(Test_org_eclipse_swt_widgets_Decorations.suite()); - addTest(Test_org_eclipse_swt_widgets_Label.suite()); - addTest(Test_org_eclipse_swt_widgets_Button.suite()); - addTest(Test_org_eclipse_swt_widgets_List.suite()); - addTest(Test_org_eclipse_swt_widgets_Text.suite()); - addTest(Test_org_eclipse_swt_widgets_ScrollBar.suite()); - addTest(Test_org_eclipse_swt_widgets_Sash.suite()); - addTest(Test_org_eclipse_swt_widgets_Tree.suite()); - addTest(Test_org_eclipse_swt_widgets_TabFolder.suite()); - addTest(Test_org_eclipse_swt_widgets_Combo.suite()); - addTest(Test_org_eclipse_swt_widgets_Group.suite()); - addTest(Test_org_eclipse_swt_widgets_ToolBar.suite()); - addTest(Test_org_eclipse_swt_widgets_Table.suite()); - addTest(Test_org_eclipse_swt_widgets_Canvas.suite()); - addTest(Test_org_eclipse_swt_widgets_Scale.suite()); - addTest(Test_org_eclipse_swt_widgets_Slider.suite()); - addTest(Test_org_eclipse_swt_widgets_ProgressBar.suite()); - addTest(Test_org_eclipse_swt_widgets_Composite.suite()); - //addTest(Test_org_eclipse_swt_widgets_CoolBar.suite()); - - addTest(Test_org_eclipse_swt_widgets_ColorDialog.suite()); - addTest(Test_org_eclipse_swt_widgets_FileDialog.suite()); - addTest(Test_org_eclipse_swt_widgets_DirectoryDialog.suite()); - addTest(Test_org_eclipse_swt_widgets_FontDialog.suite()); - addTest(Test_org_eclipse_swt_widgets_MessageBox.suite()); - addTest(Test_org_eclipse_swt_widgets_Monitor.suite()); - addTest(Test_org_eclipse_swt_layout_GridData.suite()); - addTest(Test_org_eclipse_swt_layout_RowData.suite()); - addTest(Test_org_eclipse_swt_layout_GridLayout.suite()); - addTest(Test_org_eclipse_swt_layout_FillLayout.suite()); - addTest(Test_org_eclipse_swt_layout_RowLayout.suite()); - addTest(Test_org_eclipse_swt_layout_FormLayout.suite()); - - addTest(Test_org_eclipse_swt_custom_TableTree.suite()); - addTest(Test_org_eclipse_swt_custom_BidiSegmentEvent.suite()); - addTest(Test_org_eclipse_swt_custom_LineBackgroundEvent.suite()); - addTest(Test_org_eclipse_swt_custom_LineStyleEvent.suite()); - addTest(Test_org_eclipse_swt_custom_SashForm.suite()); - addTest(Test_org_eclipse_swt_custom_TableEditor.suite()); - addTest(Test_org_eclipse_swt_custom_AnimatedProgress.suite()); - addTest(Test_org_eclipse_swt_custom_StyleRange.suite()); - addTest(Test_org_eclipse_swt_custom_TextChangedEvent.suite()); - addTest(Test_org_eclipse_swt_custom_StackLayout.suite()); - addTest(Test_org_eclipse_swt_custom_CTabFolderEvent.suite()); - addTest(Test_org_eclipse_swt_custom_ExtendedModifyEvent.suite()); - addTest(Test_org_eclipse_swt_custom_CCombo.suite()); - addTest(Test_org_eclipse_swt_custom_TableTreeItem.suite()); - addTest(Test_org_eclipse_swt_custom_ViewForm.suite()); - addTest(Test_org_eclipse_swt_custom_CTabFolderAdapter.suite()); - addTest(Test_org_eclipse_swt_custom_CLabel.suite()); - addTest(Test_org_eclipse_swt_custom_TableTreeEditor.suite()); - addTest(Test_org_eclipse_swt_custom_TextChangingEvent.suite()); - addTest(Test_org_eclipse_swt_custom_ScrolledComposite.suite()); - addTest(Test_org_eclipse_swt_custom_TreeEditor.suite()); - addTest(Test_org_eclipse_swt_custom_PopupList.suite()); - addTest(Test_org_eclipse_swt_custom_CTabItem.suite()); - addTest(Test_org_eclipse_swt_custom_BusyIndicator.suite()); - addTest(Test_org_eclipse_swt_custom_StyledText.suite()); - addTest(Test_org_eclipse_swt_custom_ControlEditor.suite()); - addTest(Test_org_eclipse_swt_custom_ST.suite()); - addTest(Test_org_eclipse_swt_custom_CTabFolder.suite()); - - addTest(Test_org_eclipse_swt_events_ControlEvent.suite()); - addTest(Test_org_eclipse_swt_events_ModifyEvent.suite()); - addTest(Test_org_eclipse_swt_events_ArmEvent.suite()); - addTest(Test_org_eclipse_swt_events_ShellEvent.suite()); - addTest(Test_org_eclipse_swt_events_TypedEvent.suite()); - addTest(Test_org_eclipse_swt_events_PaintEvent.suite()); - addTest(Test_org_eclipse_swt_events_VerifyEvent.suite()); - addTest(Test_org_eclipse_swt_events_KeyEvent.suite()); - addTest(Test_org_eclipse_swt_events_TraverseEvent.suite()); - addTest(Test_org_eclipse_swt_events_MouseTrackAdapter.suite()); - addTest(Test_org_eclipse_swt_events_DisposeEvent.suite()); - addTest(Test_org_eclipse_swt_events_SelectionEvent.suite()); - addTest(Test_org_eclipse_swt_events_HelpEvent.suite()); - addTest(Test_org_eclipse_swt_events_FocusEvent.suite()); - addTest(Test_org_eclipse_swt_events_MouseEvent.suite()); - addTest(Test_org_eclipse_swt_events_MenuEvent.suite()); - addTest(Test_org_eclipse_swt_events_TreeEvent.suite()); - - addTest(Test_org_eclipse_swt_printing_PrintDialog.suite()); - addTest(Test_org_eclipse_swt_printing_PrinterData.suite()); - addTest(Test_org_eclipse_swt_printing_Printer.suite()); - - addTest(Test_org_eclipse_swt_program_Program.suite()); - -// addTest(Test_org_eclipse_swt_dnd_FileTransfer.suite()); -// addTest(Test_org_eclipse_swt_dnd_DragSourceAdapter.suite()); -// addTest(Test_org_eclipse_swt_dnd_DropTargetAdapter.suite()); -// addTest(Test_org_eclipse_swt_dnd_TextTransfer.suite()); -// addTest(Test_org_eclipse_swt_dnd_DragSourceEvent.suite()); -// addTest(Test_org_eclipse_swt_dnd_DragSource.suite()); -// addTest(Test_org_eclipse_swt_dnd_DND.suite()); -// addTest(Test_org_eclipse_swt_dnd_TransferData.suite()); -// addTest(Test_org_eclipse_swt_dnd_RTFTransfer.suite()); -// addTest(Test_org_eclipse_swt_dnd_Clipboard.suite()); -// addTest(Test_org_eclipse_swt_dnd_DropTargetEvent.suite()); -// addTest(Test_org_eclipse_swt_dnd_DropTarget.suite()); - - addTest(Test_org_eclipse_swt_accessibility_ACC.suite()); - addTest(Test_org_eclipse_swt_accessibility_Accessible.suite()); - addTest(Test_org_eclipse_swt_accessibility_AccessibleAdapter.suite()); - addTest(Test_org_eclipse_swt_accessibility_AccessibleControlAdapter.suite()); - addTest(Test_org_eclipse_swt_accessibility_AccessibleControlEvent.suite()); - addTest(Test_org_eclipse_swt_accessibility_AccessibleControlListener.suite()); - addTest(Test_org_eclipse_swt_accessibility_AccessibleEvent.suite()); - addTest(Test_org_eclipse_swt_accessibility_AccessibleListener.suite()); - - addTest(Test_org_eclipse_swt_ole_win32_OLE.suite()); - addTest(Test_org_eclipse_swt_ole_win32_OleAutomation.suite()); - addTest(Test_org_eclipse_swt_ole_win32_OleClientSite.suite()); - addTest(Test_org_eclipse_swt_ole_win32_OleControlSite.suite()); - addTest(Test_org_eclipse_swt_ole_win32_OleEvent.suite()); - addTest(Test_org_eclipse_swt_ole_win32_OleFrame.suite()); - addTest(Test_org_eclipse_swt_ole_win32_OleFunctionDescription.suite()); - addTest(Test_org_eclipse_swt_ole_win32_OleListener.suite()); - addTest(Test_org_eclipse_swt_ole_win32_OleParameterDescription.suite()); - addTest(Test_org_eclipse_swt_ole_win32_Variant.suite()); - - addTest(Test_org_eclipse_swt_browser_Browser.suite()); - addTest(Test_org_eclipse_swt_browser_CloseWindowListener.suite()); - addTest(Test_org_eclipse_swt_browser_LocationAdapter.suite()); - addTest(Test_org_eclipse_swt_browser_LocationListener.suite()); - addTest(Test_org_eclipse_swt_browser_OpenWindowListener.suite()); - addTest(Test_org_eclipse_swt_browser_ProgressAdapter.suite()); - addTest(Test_org_eclipse_swt_browser_ProgressListener.suite()); - addTest(Test_org_eclipse_swt_browser_StatusTextListener.suite()); - addTest(Test_org_eclipse_swt_browser_TitleListener.suite()); - addTest(Test_org_eclipse_swt_browser_VisibilityWindowAdapter.suite()); - addTest(Test_org_eclipse_swt_browser_VisibilityWindowListener.suite()); - addTest(org.eclipse.swt.tests.junit.browser.Test_BrowserSuite.suite()); - - -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllWidgetTests.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllWidgetTests.java deleted file mode 100644 index aa4fe37277..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/AllWidgetTests.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Suite for testing all of the widget test cases. - */ -public class AllWidgetTests { -public static void main(String[] args) { - TestRunner.run (suite()); -} -public static Test suite() { - TestSuite suite = new TestSuite(); - - suite.addTest(Test_org_eclipse_swt_widgets_MenuItem.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_ToolItem.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_CoolItem.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_TabItem.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_TableItem.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_TableColumn.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_TreeItem.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Caret.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Event.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_TypedListener.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Menu.suite()); - //suite.addTest(Test_org_eclipse_swt_widgets_Tracker.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Synchronizer.suite()); - - suite.addTest(Test_org_eclipse_swt_widgets_Shell.suite()); - //suite.addTest(Test_org_eclipse_swt_widgets_Decorations.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Label.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Button.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_List.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Text.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_ScrollBar.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Sash.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Tree.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_TabFolder.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Combo.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Group.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_ToolBar.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Table.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Canvas.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Scale.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Slider.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_ProgressBar.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Composite.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_CoolBar.suite()); - - suite.addTest(Test_org_eclipse_swt_widgets_ColorDialog.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_FileDialog.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_DirectoryDialog.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_FontDialog.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_MessageBox.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Monitor.suite()); - - return suite; -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/EmulatedWidgetsTests.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/EmulatedWidgetsTests.java deleted file mode 100644 index fa41b951a0..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/EmulatedWidgetsTests.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Suite for testing widgets that have been emulated on Motif. - */ -public class EmulatedWidgetsTests { - -public static void main(String[] args) { - TestRunner.run (suite()); -} -public static Test suite() { - TestSuite suite = new TestSuite(); - - suite.addTest(Test_org_eclipse_swt_widgets_ColorDialog.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_FontDialog.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_TabFolder.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_TabItem.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Table.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_TableItem.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_TableColumn.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_Tree.suite()); - suite.addTest(Test_org_eclipse_swt_widgets_TreeItem.suite()); - - return suite; -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/StyledTextContentSpec.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/StyledTextContentSpec.java deleted file mode 100644 index 4a6f6c9c59..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/StyledTextContentSpec.java +++ /dev/null @@ -1,1026 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -/** - * Use this test class to validate an implementation of the StyledTextContent - * interface. To perform the validation, copy this class to the package where - * your StyledTextContent implementation lives. Then specify the fully qualified - * name of your StyledTextContent class as an argument to the main method of this - * class. - * - * NOTE: This test class assumes that your StyledTextContent implementation - * handles the following delimiters: - * - * /r - * /n - * /r/n - */ -import org.eclipse.swt.custom.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import java.lang.reflect.*; -public class StyledTextContentSpec implements TextChangeListener { - static String contentClassName; - static int failCount = 0; - static int errorCount = 0; - Class contentClass = null; - StyledTextContent contentInstance = null; - int verify = 0; - Method currentMethod = null; - boolean failed = false; - StyledText widget = null; - Shell shell = null; - -public StyledTextContentSpec() { -} -public void assertTrue(String message, boolean condition) { - System.out.print("\t" + currentMethod.getName() + " " + message); - if (!condition) - fail(message); - else - System.out.println(" passed"); -} -public void fail(String message) { - failed = true; - System.out.println(" FAILED: " + message); - failCount++; -} -public StyledTextContent getContentInstance() { - contentInstance.setText(""); - widget.setContent(contentInstance); - return contentInstance; -} -public static String getTestText() { - return - "This is the first line.\r\n" + - "This is the second line.\r\n" + - "This is the third line.\r\n" + - "This is the fourth line.\r\n" + - "This is the fifth line.\r\n" + - "\r\n" + - "This is the first line again.\r\n" + - "This is the second line again.\r\n" + - "This is the third line again.\r\n" + - "This is the fourth line again.\r\n" + - "This is the fifth line again.\r\n" + - "\r\n" + - "This is the first line once again.\r\n" + - "This is the second line once again.\r\n" + - "This is the third line once again.\r\n" + - "This is the fourth line once again.\r\n" + - "This is the fifth line once again."; -} -public static void main(String[] args) { - StyledTextContentSpec spec = new StyledTextContentSpec(); - if (args.length > 0) { - contentClassName = args[0]; - } else { - MessageBox box = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR); - box.setMessage("Content class must be specified as an execution argument."); //$NON-NLS-1$ - box.open(); - return; - } - spec.run(); - System.out.println(); - System.out.println(failCount + " TEST FAILURES."); - System.out.println(errorCount + " UNEXPECTED ERRORS."); -} -public void run() { - if (contentClassName.equals("")) { - MessageBox box = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR); - box.setMessage("Content class must be specified as an execution argument."); //$NON-NLS-1$ - box.open(); - return; - } - if (contentClass == null) { - try { - contentClass = Class.forName(contentClassName); - } catch (ClassNotFoundException e) { - MessageBox box = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR); - box.setMessage("Content class:\n" + contentClassName + "\nnot found"); //$NON-NLS-1$ - box.open(); - return; - } - } - try { - contentInstance = (StyledTextContent)contentClass.newInstance(); - } catch (IllegalAccessException e) { - MessageBox box = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR); - box.setMessage("Unable to access content class:\n" + contentClassName); //$NON-NLS-1$ - box.open(); - return; - } catch (InstantiationException e) { - MessageBox box = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR); - box.setMessage("Unable to instantiate content class:\n" + contentClassName); //$NON-NLS-1$ - box.open(); - return; - } - Class clazz; - clazz = this.getClass(); - Method[] methods = clazz.getDeclaredMethods(); - for (int i=0; i<methods.length; i++) { - setUp(); - currentMethod = methods[i]; - failed = false; - try { - if (currentMethod.getName().startsWith("test_")) { - System.out.println(); - System.out.println(currentMethod.getName() + "..."); - currentMethod.invoke(this, new Object[0]); - if (!failed) { - System.out.println("PASSED."); - } else { - System.out.println("FAILED"); - } - } - } catch (InvocationTargetException ex) { - System.out.println("\t" + currentMethod.getName() + " ERROR ==> " + ex.getTargetException().toString()); - System.out.println("FAILED"); - errorCount++; - } catch (Exception ex) { - System.out.println("\t" + currentMethod.getName() + " ERROR ==> " + ex.toString()); - System.out.println("FAILED"); - errorCount++; - } - if (verify != 0) { - verify = 0; - contentInstance.removeTextChangeListener(this); - } - tearDown(); - } -} -public void textSet(TextChangedEvent event) { -} -public void textChanged(TextChangedEvent event) { -} -public void textChanging(TextChangingEvent event) { - switch (verify) { - case 1 : { - assertTrue(":1a:", event.replaceLineCount == 0); - assertTrue(":1b:", event.newLineCount == 1); - break; - } - case 2 : { - assertTrue(":2a:", event.replaceLineCount == 2); - assertTrue(":2b:", event.newLineCount == 0); - break; - } - case 3 : { - assertTrue(":3a:", event.replaceLineCount == 0); - assertTrue(":3b:", event.newLineCount == 2); - break; - } - case 4: { - assertTrue(":4:", false); - break; - } - case 5 : { - assertTrue(":5a:", event.replaceLineCount == 0); - assertTrue(":5b:", event.newLineCount == 1); - break; - } - case 6 : { - assertTrue(":6a:", event.replaceLineCount == 1); - assertTrue(":6b:", event.newLineCount == 0); - break; - } - case 8 : { - assertTrue(":8a:", event.replaceLineCount == 1); - assertTrue(":8b:", event.newLineCount == 0); - break; - } - case 9 : { - assertTrue(":9a:", event.replaceLineCount == 1); - assertTrue(":9b:", event.newLineCount == 0); - break; - } - case 10:{ - assertTrue(":10:", false); - break; - } - case 11: { - assertTrue(":11:", false); - break; - } - case 12: { - assertTrue(":12a:", event.replaceLineCount == 0); - assertTrue(":12b:", event.newLineCount == 1); - break; - } - case 13: { - assertTrue(":13a:", event.replaceLineCount == 0); - assertTrue(":13b:", event.newLineCount == 1); - break; - } - case 14: { - assertTrue(":14:", false); - break; - } - case 15: { - assertTrue(":15a:", event.replaceLineCount == 1); - assertTrue(":15b:", event.newLineCount == 2); - break; - } - case 16:{ - assertTrue(":16:", false); - break; - } - case 17: { - assertTrue(":17:", false); - break; - } - case 18: { - assertTrue(":18a:", event.replaceLineCount == 0); - assertTrue(":18b:", event.newLineCount == 2); - break; - } - case 19: { - assertTrue(":19a:", event.replaceLineCount == 0); - assertTrue(":19b:", event.newLineCount == 3); - break; - } - case 20: { - assertTrue(":20:", false); - break; - } - } -} -public void test_Insert() { - StyledTextContent content = getContentInstance(); - String newText; - - content.setText("This\nis a test\r"); - content.replaceTextRange(0, 0, "test\n "); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":1a:", newText.equals("test\n This\nis a test\r")); - assertTrue(":1b:", content.getLineCount() == 4); - assertTrue(":1c:", content.getLine(0).equals("test")); - assertTrue(":1d:", content.getLine(1).equals(" This")); - assertTrue(":1e:", content.getLine(2).equals("is a test")); - assertTrue(":1f:", content.getLine(3).equals("")); - - content.setText("This\nis a test\r"); - content.replaceTextRange(5, 0, "*** "); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":2a:", newText.equals("This\n*** is a test\r")); - assertTrue(":2b:", content.getLineCount() == 3); - assertTrue(":2c:", content.getLine(0).equals("This")); - assertTrue(":2d:", content.getLine(1).equals("*** is a test")); - assertTrue(":2e:", content.getLine(2).equals("")); - - content.setText("Line 1\r\nLine 2"); - content.replaceTextRange(0, 0, "\r"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":3a:", newText.equals("\rLine 1\r\nLine 2")); - assertTrue(":3b:", content.getLineCount() == 3); - assertTrue(":3c:", content.getLine(0).equals("")); - assertTrue(":3d:", content.getLine(1).equals("Line 1")); - assertTrue(":3e:", content.getLine(2).equals("Line 2")); - content.replaceTextRange(9, 0, "\r"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":3f:", newText.equals("\rLine 1\r\n\rLine 2")); - assertTrue(":3g:", content.getLineCount() == 4); - assertTrue(":3h:", content.getLine(0).equals("")); - assertTrue(":3i:", content.getLine(1).equals("Line 1")); - assertTrue(":3j:", content.getLine(2).equals("")); - assertTrue(":3k:", content.getLine(3).equals("Line 2")); - - content.setText("This\nis a test\r"); - content.replaceTextRange(0, 0, "\n"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":4a:", newText.equals("\nThis\nis a test\r")); - assertTrue(":4b:", content.getLineCount() == 4); - assertTrue(":4c:", content.getLine(0).equals("")); - assertTrue(":4d:", content.getLine(1).equals("This")); - assertTrue(":4e:", content.getLine(2).equals("is a test")); - assertTrue(":4f:", content.getLine(3).equals("")); - - content.setText("This\nis a test\r"); - content.replaceTextRange(7, 0, "\r\nnewLine"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":5a:", newText.equals("This\nis\r\nnewLine a test\r")); - assertTrue(":5b:", content.getLineCount() == 4); - assertTrue(":5c:", content.getLine(0).equals("This")); - assertTrue(":5d:", content.getLine(1).equals("is")); - assertTrue(":5e:", content.getLine(2).equals("newLine a test")); - assertTrue(":5f:", content.getLine(3).equals("")); - - content.setText(""); - content.replaceTextRange(0, 0, "This\nis\r\nnewLine a test\r"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":6a:", newText.equals("This\nis\r\nnewLine a test\r")); - assertTrue(":6b:", content.getLineCount() == 4); - assertTrue(":6c:", content.getLine(0).equals("This")); - assertTrue(":6d:", content.getLine(1).equals("is")); - assertTrue(":6e:", content.getLine(2).equals("newLine a test")); - assertTrue(":6f:", content.getLine(3).equals("")); - - // insert at end - content.setText("This"); - content.replaceTextRange(4, 0, "\n "); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":7a:", newText.equals("This\n ")); - assertTrue(":7b:", content.getLineCount() == 2); - assertTrue(":7c:", content.getLine(0).equals("This")); - assertTrue(":7d:", content.getLine(1).equals(" ")); - content.setText("This\n"); - content.replaceTextRange(5, 0, "\n"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":7e:", newText.equals("This\n\n")); - assertTrue(":7f:", content.getLineCount() == 3); - assertTrue(":7g:", content.getLine(0).equals("This")); - assertTrue(":7h:", content.getLine(1).equals("")); - assertTrue(":7i:", content.getLine(2).equals("")); - - // insert at beginning - content.setText("This"); - content.replaceTextRange(0, 0, "\n"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":8a:", newText.equals("\nThis")); - assertTrue(":8b:", content.getLineCount() == 2); - assertTrue(":8c:", content.getLine(0).equals("")); - assertTrue(":8d:", content.getLine(1).equals("This")); - - // insert text - content.setText("This\nis a test\r"); - content.replaceTextRange(5, 0, "*** "); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":9a:", newText.equals("This\n*** is a test\r")); - assertTrue(":9b:", content.getLineCount() == 3); - assertTrue(":9c:", content.getLine(0).equals("This")); - assertTrue(":9d:", content.getLine(1).equals("*** is a test")); - assertTrue(":9e:", content.getLine(2).equals("")); - - content.setText("This\n"); - content.replaceTextRange(5, 0, "line"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":10a:", newText.equals("This\nline")); - assertTrue(":10b:", content.getLineCount() == 2); - assertTrue(":10c:", content.getLine(0).equals("This")); - assertTrue(":10d:", content.getLine(1).equals("line")); - assertTrue(":10e:", content.getLineAtOffset(8) == 1); - assertTrue(":10f:", content.getLineAtOffset(9) == 1); - - // insert at beginning - content.setText("This\n"); - content.replaceTextRange(0, 0, "line\n"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":11a:", newText.equals("line\nThis\n")); - assertTrue(":11b:", content.getLineCount() == 3); - assertTrue(":11c:", content.getLine(0).equals("line")); - assertTrue(":11d:", content.getLine(1).equals("This")); - assertTrue(":11e:", content.getLineAtOffset(5) == 1); - - content.setText("Line 1\r\nLine 2\r\nLine 3"); - content.replaceTextRange(0, 0, "\r"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":12a:", newText.equals("\rLine 1\r\nLine 2\r\nLine 3")); - assertTrue(":12b:", content.getLineCount() == 4); - assertTrue(":12c:", content.getLine(0).equals("")); - assertTrue(":12d:", content.getLine(1).equals("Line 1")); - assertTrue(":12e:", content.getLine(2).equals("Line 2")); - assertTrue(":12f:", content.getLine(3).equals("Line 3")); - - content.setText("Line 1\nLine 2\nLine 3"); - content.replaceTextRange(7, 0, "Line1a\nLine1b\n"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":13a:", newText.equals("Line 1\nLine1a\nLine1b\nLine 2\nLine 3")); - assertTrue(":13b:", content.getLineCount() == 5); - assertTrue(":13c:", content.getLine(0).equals("Line 1")); - assertTrue(":13d:", content.getLine(1).equals("Line1a")); - assertTrue(":13e:", content.getLine(2).equals("Line1b")); - assertTrue(":13f:", content.getLine(3).equals("Line 2")); - assertTrue(":13g:", content.getLine(4).equals("Line 3")); - - content.setText("Line 1\nLine 2\nLine 3"); - content.replaceTextRange(11, 0, "l1a"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":14a:", newText.equals("Line 1\nLinel1a 2\nLine 3")); - assertTrue(":14b:", content.getLineCount() == 3); - assertTrue(":14c:", content.getLine(0).equals("Line 1")); - assertTrue(":14d:", content.getLine(1).equals("Linel1a 2")); - assertTrue(":14e:", content.getLine(2).equals("Line 3")); - - content.setText("Line 1\nLine 2 is a very long line that spans many words\nLine 3"); - content.replaceTextRange(19, 0, "very, very, "); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":15a:", newText.equals("Line 1\nLine 2 is a very, very, very long line that spans many words\nLine 3")); - assertTrue(":15b:", content.getLineCount() == 3); - assertTrue(":15c:", content.getLine(0).equals("Line 1")); - assertTrue(":15d:", content.getLine(1).equals("Line 2 is a very, very, very long line that spans many words")); - assertTrue(":15e:", content.getLine(2).equals("Line 3")); -} - -public void test_Empty() { - StyledTextContent content = getContentInstance(); - assertTrue(":1a:", content.getLineCount() == 1); - assertTrue(":1b:", content.getLine(0).equals("")); - - content.setText("test"); - content.replaceTextRange(0,4,""); - assertTrue(":2a:", content.getLineCount() == 1); - assertTrue(":2b:", content.getLine(0).equals("")); -} -public void test_Line_Conversion() { - StyledTextContent content = getContentInstance(); - - content.setText("This\nis a test\rrepeat\nend\r"); - assertTrue(":1a:", content.getLineCount() == 5); - assertTrue(":1b:", content.getLine(0).equals("This")); - assertTrue(":1c:", content.getOffsetAtLine(0) == 0); - assertTrue(":1d:", content.getLine(1).equals("is a test")); - assertTrue(":1e:", content.getLineAtOffset(4) == 0); - assertTrue(":1f:", content.getOffsetAtLine(1) == 5); - assertTrue(":1g:", content.getLine(2).equals("repeat")); - assertTrue(":1h:", content.getOffsetAtLine(2) == 15); - assertTrue(":1i:", content.getLine(3).equals("end")); - assertTrue(":1j:", content.getOffsetAtLine(3) == 22); - assertTrue(":1k:", content.getLine(4).equals("")); - assertTrue(":1l:", content.getOffsetAtLine(4) == 26); - - content.setText("This\r\nis a test"); - assertTrue(":2a:", content.getLineCount() == 2); - assertTrue(":2b:", content.getLine(1).equals("is a test")); - assertTrue(":2c:", content.getLineAtOffset(4) == 0); - assertTrue(":2d:", content.getLineAtOffset(5) == 0); - - content.setText("This\r\nis a test\r"); - assertTrue(":3a:", content.getLineCount() == 3); - assertTrue(":3b:", content.getLine(1).equals("is a test")); - assertTrue(":3c:", content.getLineAtOffset(15) == 1); - - content.setText("\r\n"); - assertTrue(":4a:", content.getLineCount() == 2); - assertTrue(":4b:", content.getLine(0).equals("")); - assertTrue(":4c:", content.getLine(1).equals("")); - assertTrue(":4d:", content.getLineAtOffset(0) == 0); - assertTrue(":4e:", content.getLineAtOffset(1) == 0); - assertTrue(":4f:", content.getLineAtOffset(2) == 1); - - content.setText("\r\n\n\r\r\n"); - assertTrue(":5a:", content.getLineCount() == 5); - assertTrue(":5b:", content.getLine(0).equals("")); - assertTrue(":5c:", content.getOffsetAtLine(0) == 0); - assertTrue(":5d:", content.getLine(1).equals("")); - assertTrue(":5e:", content.getOffsetAtLine(1) == 2); - assertTrue(":5f:", content.getLine(2).equals("")); - assertTrue(":5g:", content.getOffsetAtLine(2) == 3); - assertTrue(":5h:", content.getLine(3).equals("")); - assertTrue(":5i:", content.getOffsetAtLine(3) == 4); - assertTrue(":5j:", content.getLine(4).equals("")); - assertTrue(":5k:", content.getOffsetAtLine(4) == 6); - - content.setText("test\r\rtest2\r\r"); - assertTrue(":6a:", content.getLineCount() == 5); - assertTrue(":6b:", content.getLine(0).equals("test")); - assertTrue(":6c:", content.getOffsetAtLine(0) == 0); - assertTrue(":6d:", content.getLine(1).equals("")); - assertTrue(":6e:", content.getOffsetAtLine(1) == 5); - assertTrue(":6f:", content.getLine(2).equals("test2")); - assertTrue(":6g:", content.getOffsetAtLine(2) == 6); - assertTrue(":6h:", content.getLine(3).equals("")); - assertTrue(":6i:", content.getOffsetAtLine(3) == 12); - assertTrue(":6j:", content.getLine(4).equals("")); - assertTrue(":6k:", content.getOffsetAtLine(4) == 13); -} -public void test_Offset_To_Line() { - StyledTextContent content = getContentInstance(); - - content.setText("This\nis a test\rrepeat\nend\r"); - assertTrue(":1a:", content.getLineAtOffset(0) == 0); - assertTrue(":1b:", content.getLineAtOffset(3) == 0); - assertTrue(":1c:", content.getLineAtOffset(4) == 0); - assertTrue(":1d:", content.getLineAtOffset(25) == 3); - assertTrue(":1e:", content.getLineAtOffset(26) == 4); - - content.setText("This\r\nis a test"); - assertTrue(":2a:", content.getLineAtOffset(5) == 0); - assertTrue(":2b:", content.getLineAtOffset(6) == 1); - assertTrue(":2c:", content.getLineAtOffset(10) == 1); - - content.setText("\r\n"); - assertTrue(":3a:", content.getLineAtOffset(0) == 0); - assertTrue(":3b:", content.getLineAtOffset(1) == 0); - assertTrue(":3c:", content.getLineAtOffset(2) == 1); - - content.setText("\r\n\n\r\r\n"); - assertTrue(":4a:", content.getLineAtOffset(0) == 0); - assertTrue(":4b:", content.getLineAtOffset(1) == 0); - assertTrue(":4c:", content.getLineAtOffset(2) == 1); - assertTrue(":4d:", content.getLineAtOffset(3) == 2); - assertTrue(":4e:", content.getLineAtOffset(4) == 3); - assertTrue(":4f:", content.getLineAtOffset(5) == 3); - assertTrue(":4g:", content.getLineAtOffset(6) == 4); - - content.setText("\r\n\r\n"); - assertTrue(":5a:", content.getLineAtOffset(0) == 0); - assertTrue(":5b:", content.getLineAtOffset(1) == 0); - assertTrue(":5c:", content.getLineAtOffset(2) == 1); - assertTrue(":5d:", content.getLineAtOffset(3) == 1); - assertTrue(":5e:", content.getLineAtOffset(4) == 2); - - content.setText("\r\r\r\n\r\n"); - assertTrue(":6a:", content.getLineAtOffset(0) == 0); - assertTrue(":6b:", content.getLineAtOffset(1) == 1); - assertTrue(":6c:", content.getLineAtOffset(2) == 2); - assertTrue(":6d:", content.getLineAtOffset(4) == 3); - - content.setText(""); - assertTrue(":7a:", content.getLineAtOffset(0) == 0); - - content = getContentInstance(); - assertTrue(":8a:", content.getLineAtOffset(0) == 0); -} - -public void test_Line_To_Offset() { - StyledTextContent content = getContentInstance(); - - content.setText("This\nis a test\rrepeat\nend\r"); - assertTrue(":1a:", content.getOffsetAtLine(0) == 0); - assertTrue(":1b:", content.getOffsetAtLine(1) == 5); - assertTrue(":1c:", content.getOffsetAtLine(2) == 15); - assertTrue(":1d:", content.getOffsetAtLine(3) == 22); - assertTrue(":1e:", content.getOffsetAtLine(4) == 26); - - content.setText("This\r\nis a test"); - assertTrue(":2a:", content.getOffsetAtLine(0) == 0); - assertTrue(":2b:", content.getOffsetAtLine(1) == 6); - - content.setText("\r\n"); - assertTrue(":3a:", content.getOffsetAtLine(0) == 0); - assertTrue(":3b:", content.getOffsetAtLine(1) == 2); - - content.setText("\r\n\n\r\r\n"); - assertTrue(":4a:", content.getOffsetAtLine(0) == 0); - assertTrue(":4b:", content.getOffsetAtLine(1) == 2); - assertTrue(":4c:", content.getOffsetAtLine(2) == 3); - assertTrue(":4d:", content.getOffsetAtLine(3) == 4); - assertTrue(":4e:", content.getOffsetAtLine(4) == 6); - - content.setText("\r\ntest\r\n"); - assertTrue(":5a:", content.getOffsetAtLine(0) == 0); - assertTrue(":5b:", content.getOffsetAtLine(1) == 2); - assertTrue(":5c:", content.getOffsetAtLine(2) == 8); -} - -public void test_Delete() { - StyledTextContent content = getContentInstance(); - String newText; - - content.setText("This\nis a test\r"); - content.replaceTextRange(6, 2, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":1a:", newText.equals("This\nia test\r")); - assertTrue(":1b:", content.getLine(0).equals("This")); - assertTrue(":1c:", content.getLine(1).equals("ia test")); - - content.setText("This\nis a test\r"); - content.replaceTextRange(5, 9, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":2a:", newText.equals("This\n\r")); - assertTrue(":2b:",content.getLineCount() == 3); - assertTrue(":2c:", content.getLine(0).equals("This")); - assertTrue(":2d:", content.getLine(1).equals("")); - assertTrue(":2e:", content.getLine(2).equals("")); - - content.setText("This\nis a test\nline 3\nline 4"); - content.replaceTextRange(21, 7, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":3a:", newText.equals("This\nis a test\nline 3")); - assertTrue(":3b:", content.getLineCount() == 3); - assertTrue(":3c:", content.getLine(0).equals("This")); - assertTrue(":3d:", content.getLine(1).equals("is a test")); - assertTrue(":3e:", content.getLine(2).equals("line 3")); - - content.setText("This\nis a test\nline 3\nline 4"); - content.replaceTextRange(0, 5, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":4a:", newText.equals("is a test\nline 3\nline 4")); - assertTrue(":4b:", content.getLineCount() == 3); - assertTrue(":4c:", content.getLine(0).equals("is a test")); - assertTrue(":4d:", content.getLine(1).equals("line 3")); - assertTrue(":4e:", content.getLine(2).equals("line 4")); - content.replaceTextRange(16, 7, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":4f:", newText.equals("is a test\nline 3")); - assertTrue(":4g:", content.getLine(0).equals("is a test")); - assertTrue(":4h:", content.getLine(1).equals("line 3")); - content.replaceTextRange(9, 7, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":4i:", newText.equals("is a test")); - assertTrue(":4j:", content.getLine(0).equals("is a test")); - content.replaceTextRange(1, 8, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":4k:", newText.equals("i")); - assertTrue(":4l:", content.getLine(0).equals("i")); - content.replaceTextRange(0, 1, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":4m:", newText.equals("")); - assertTrue(":4n:", content.getLine(0).equals("")); - - content.setText("This\nis a test\r"); - content.replaceTextRange(5, 9, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":5a:", newText.equals("This\n\r")); - assertTrue(":5b:",content.getLineCount() == 3); - assertTrue(":5c:", content.getLine(0).equals("This")); - assertTrue(":5d:", content.getLine(1).equals("")); - assertTrue(":5e:", content.getLine(2).equals("")); - - content.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - content.replaceTextRange(4, 8, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":6a:", newText.equals("L1\r\nL4\r\n")); - assertTrue(":6b:",content.getLineCount() == 3); - assertTrue(":6c:", content.getLine(0).equals("L1")); - assertTrue(":6d:", content.getLine(1).equals("L4")); - assertTrue(":6e:", content.getLine(2).equals("")); - - content.setText("\nL1\r\nL2"); - content.replaceTextRange(0, 1, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":7a:", newText.equals("L1\r\nL2")); - assertTrue(":7b:",content.getLineCount() == 2); - assertTrue(":7c:", content.getLine(0).equals("L1")); - assertTrue(":7d:", content.getLine(1).equals("L2")); - - content.setText("\nL1\r\nL2\r\n"); - content.replaceTextRange(7, 2, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":8a:", newText.equals("\nL1\r\nL2")); - assertTrue(":8b:",content.getLineCount() == 3); - assertTrue(":8c:", content.getLine(0).equals("")); - assertTrue(":8d:", content.getLine(1).equals("L1")); - assertTrue(":8e:", content.getLine(2).equals("L2")); - - content.setText("\nLine 1\nLine 2\n"); - content.replaceTextRange(0, 7, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":9a:", newText.equals("\nLine 2\n")); - assertTrue(":9b:", content.getLineCount() == 3); - assertTrue(":9c:", content.getLine(0).equals("")); - assertTrue(":9d:", content.getLine(1).equals("Line 2")); - assertTrue(":9e:", content.getLine(2).equals("")); - - content.setText("Line 1\nLine 2\n"); - content.replaceTextRange(6, 8, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":10a:", newText.equals("Line 1")); - assertTrue(":10b:", content.getLineCount() == 1); - assertTrue(":10c:", content.getLine(0).equals("Line 1")); - - content.setText("Line one is short\r\nLine 2 is a longer line\r\nLine 3\n"); - content.replaceTextRange(12, 17, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":11a:", newText.equals("Line one is a longer line\r\nLine 3\n")); - assertTrue(":11b:", content.getLineCount() == 3); - assertTrue(":11c:", content.getLine(0).equals("Line one is a longer line")); - assertTrue(":11d:", content.getLine(1).equals("Line 3")); - assertTrue(":11e:", content.getLine(2).equals("")); - -} -public void test_Replace() { - StyledTextContent content = getContentInstance(); - String newText; - - content.setText("This\nis a test\r"); - content.replaceTextRange(5, 4, "a"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":1a:", newText.equals("This\na test\r")); - assertTrue(":1b:",content.getLineCount() == 3); - assertTrue(":1c:", content.getLine(0).equals("This")); - assertTrue(":1d:", content.getLine(1).equals("a test")); - assertTrue(":1e:", content.getLine(2).equals("")); - - content.setText("This\nis a test\r"); - content.replaceTextRange(5, 2, "was"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":2a:", newText.equals("This\nwas a test\r")); - assertTrue(":2b:",content.getLineCount() == 3); - assertTrue(":2c:", content.getLine(0).equals("This")); - assertTrue(":2d:", content.getLine(1).equals("was a test")); - assertTrue(":2e:", content.getLine(2).equals("")); - - content.setText("This is a test\r"); - content.replaceTextRange(5, 2, "was"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":3a:", newText.equals("This was a test\r")); - assertTrue(":3b:",content.getLineCount() == 2); - assertTrue(":3c:", content.getLine(0).equals("This was a test")); - assertTrue(":3d:", content.getLineAtOffset(15) == 0); - - content.setText("Line 1\nLine 2\nLine 3"); - content.replaceTextRange(0, 7, "La\nLb\n"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":4a:", newText.equals("La\nLb\nLine 2\nLine 3")); - assertTrue(":4b:", content.getLine(0).equals("La")); - assertTrue(":4c:", content.getLine(1).equals("Lb")); - assertTrue(":4d:", content.getLine(2).equals("Line 2")); - assertTrue(":4e:", content.getLine(3).equals("Line 3")); - - content.setText(getTestText()); - newText = content.getTextRange(0, content.getCharCount()); - int start = content.getOffsetAtLine(6); - int end = content.getOffsetAtLine(11); - content.replaceTextRange(start, end - start, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":5a:", content.getLineCount() == 12); - assertTrue(":5a:", content.getLine(5).equals("")); - assertTrue(":5a:", content.getLine(6).equals("")); - start = content.getOffsetAtLine(7); - content.replaceTextRange(start, content.getCharCount() - start, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":5a:", content.getLineCount() == 8); - assertTrue(":5a:", content.getLine(5).equals("")); - assertTrue(":5a:", content.getLine(6).equals("")); - assertTrue(":5a:", content.getLine(7).equals("")); - -} -public void test_Special_Cases() { - String newText; - StyledTextContent content = getContentInstance(); - assertTrue(":0a:", content.getLineCount() == 1); - assertTrue(":0b:", content.getOffsetAtLine(0) == 0); - - content.setText("This is the input/output text component."); - content.replaceTextRange(0, 0, "\n"); - assertTrue(":1a:", content.getLine(0).equals("")); - content.replaceTextRange(1, 0, "\n"); - assertTrue(":1b:",content.getLine(0).equals("")); - content.replaceTextRange(2, 0, "\n"); - assertTrue(":1c:",content.getLine(0).equals("")); - content.replaceTextRange(3, 0, "\n"); - assertTrue(":1d:",content.getLine(0).equals("")); - content.replaceTextRange(4, 0, "\n"); - assertTrue(":1e:",content.getLine(0).equals("")); - content.replaceTextRange(5, 0, "\n"); - assertTrue(":1f:",content.getLine(0).equals("")); - content.replaceTextRange(6, 0, "\n"); - assertTrue(":1g:",content.getLine(0).equals("")); - content.replaceTextRange(7, 0, "\n"); - assertTrue(":1h:",content.getLine(0).equals("")); - - content.setText("This is the input/output text component."); - content.replaceTextRange(0, 0, "\n"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":2a:", newText.equals("\nThis is the input/output text component.")); - assertTrue(":2b:", content.getLine(0).equals("")); - assertTrue(":2c:", content.getLine(1).equals("This is the input/output text component.")); - content.replaceTextRange(1, 0, "\n"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":2d:", newText.equals("\n\nThis is the input/output text component.")); - assertTrue(":2e:", content.getLine(0).equals("")); - assertTrue(":2f:", content.getLine(1).equals("")); - assertTrue(":2g:", content.getLine(2).equals("This is the input/output text component.")); - - content.replaceTextRange(2, 0, "\n"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":3a:", newText.equals("\n\n\nThis is the input/output text component.")); - assertTrue(":3b:", content.getLine(0).equals("")); - assertTrue(":3c:", content.getLine(1).equals("")); - assertTrue(":3d:", content.getLine(2).equals("")); - assertTrue(":3e:", content.getLine(3).equals("This is the input/output text component.")); - content.replaceTextRange(3, 0, "\n"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":3f:", newText.equals("\n\n\n\nThis is the input/output text component.")); - assertTrue(":3g:", content.getLine(0).equals("")); - assertTrue(":3h:", content.getLine(1).equals("")); - assertTrue(":3i:", content.getLine(2).equals("")); - assertTrue(":3j:", content.getLine(3).equals("")); - assertTrue(":3k:", content.getLine(4).equals("This is the input/output text component.")); - - content.replaceTextRange(3, 1, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":4a:", newText.equals("\n\n\nThis is the input/output text component.")); - assertTrue(":4b:", content.getLine(0).equals("")); - assertTrue(":4c:", content.getLine(1).equals("")); - assertTrue(":4d:", content.getLine(2).equals("")); - assertTrue(":4e:", content.getLine(3).equals("This is the input/output text component.")); - content.replaceTextRange(2, 1, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":4f:", newText.equals("\n\nThis is the input/output text component.")); - assertTrue(":4g:", content.getLine(0).equals("")); - assertTrue(":4h:", content.getLine(1).equals("")); - assertTrue(":4i:", content.getLine(2).equals("This is the input/output text component.")); - - content.replaceTextRange(2, 0, "a"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":5a:", newText.equals("\n\naThis is the input/output text component.")); - assertTrue(":5b:", content.getLine(0).equals("")); - assertTrue(":5c:", content.getLine(1).equals("")); - assertTrue(":5d:", content.getLine(2).equals("aThis is the input/output text component.")); - - content.setText("abc\r\ndef"); - content.replaceTextRange(1, 1, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":6a:", newText.equals("ac\r\ndef")); - assertTrue(":6b:", content.getLineCount() == 2); - assertTrue(":6c:", content.getLine(0).equals("ac")); - assertTrue(":6d:", content.getLine(1).equals("def")); - content.replaceTextRange(1, 1, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":6e:", newText.equals("a\r\ndef")); - assertTrue(":6f:", content.getLineCount() == 2); - assertTrue(":6g:", content.getLine(0).equals("a")); - assertTrue(":6h:", content.getLine(1).equals("def")); - content.replaceTextRange(1, 2, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":6i:", newText.equals("adef")); - assertTrue(":6j:", content.getLineCount() == 1); - assertTrue(":6k:", content.getLine(0).equals("adef")); - content.replaceTextRange(1, 1, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":6l:", newText.equals("aef")); - assertTrue(":6m:", content.getLineCount() == 1); - assertTrue(":6n:", content.getLine(0).equals("aef")); - content.replaceTextRange(1, 1, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":6o:", newText.equals("af")); - assertTrue(":6p:", content.getLineCount() == 1); - assertTrue(":6q:", content.getLine(0).equals("af")); - - content.setText("abc"); - content.replaceTextRange(0, 1, "1"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":7a:", content.getLineCount() == 1); - assertTrue(":7b:", newText.equals("1bc")); - assertTrue(":7c:", content.getLine(0).equals("1bc")); - content.replaceTextRange(0, 0, "\n"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":7d:", newText.equals("\n1bc")); - assertTrue(":7e:", content.getLineCount() == 2); - assertTrue(":7f:", content.getLine(0).equals("")); - assertTrue(":7g:", content.getLine(1).equals("1bc")); - - content = getContentInstance(); - content.replaceTextRange(0,0,"a"); - - content.setText("package test;\n/* Line 1\n * Line 2\n */\npublic class SimpleClass {\n}"); - content.replaceTextRange(14, 23, "\t/*Line 1\n\t * Line 2\n\t */"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":8a:", newText.equals("package test;\n\t/*Line 1\n\t * Line 2\n\t */\npublic class SimpleClass {\n}")); - assertTrue(":8b:", content.getLineCount() == 6); - assertTrue(":8c:", content.getLine(0).equals("package test;")); - assertTrue(":8d:", content.getLine(1).equals("\t/*Line 1")); - assertTrue(":8e:", content.getLine(2).equals("\t * Line 2")); - assertTrue(":8f:", content.getLine(3).equals("\t */")); - assertTrue(":8g:", content.getLine(4).equals("public class SimpleClass {")); - assertTrue(":8h:", content.getLine(5).equals("}")); -} -public void test_Text_Changed_Event() { - StyledTextContent content = getContentInstance(); - content.addTextChangeListener(this); - verify = 1; - content.setText("testing"); - content.replaceTextRange(0, 0, "\n"); - - verify = 2; - content.setText("\n\n"); - content.replaceTextRange(0, 2, "a"); - - verify = 3; - content.setText("a"); - content.replaceTextRange(0, 1, "\n\n"); - - verify = 4; - content.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - try {content.replaceTextRange(3, 1, "test\n");} - catch (IllegalArgumentException ex) {assertTrue(":4:", true);} - - verify = 5; - content.setText("Line 1\r\nLine 2"); - content.replaceTextRange(0, 0, "\r"); - - verify = 6; - content.setText("This\nis a test\nline 3\nline 4"); - content.replaceTextRange(21, 7, ""); - - verify = 7; - content.setText("This\nis a test\r"); - content.replaceTextRange(5, 9, ""); - - verify = 8; - content.setText("\nL1\r\nL2\r\n"); - content.replaceTextRange(7, 2, ""); - - verify = 9; - content.setText("L1\r\n"); - content.replaceTextRange(2, 2, "test"); - - verify = 10; - content.setText("L1\r\n"); - try {content.replaceTextRange(3, 1, "");} - catch (IllegalArgumentException ex) {assertTrue(":10:", true);} - - verify = 11; - content.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - try {content.replaceTextRange(1, 2, "");} - catch (IllegalArgumentException ex) {assertTrue(":11:", true);} - - verify = 12; - content.setText("L1\r"); - content.replaceTextRange(3, 0, "\n"); - - verify = 13; - content.setText("L1\n"); - content.replaceTextRange(2, 0, "\r"); - - verify = 14; - content.setText("L1\r\n"); - try {content.replaceTextRange(3, 0, "test");} - catch (IllegalArgumentException ex) {assertTrue(":14:", true);} - - verify = 15; - content.setText("L1\r\n"); - content.replaceTextRange(2, 2, "test\n\n"); - - verify = 16; - content.setText("L1\r\n"); - try {content.replaceTextRange(3, 1, "test\r\n");} - catch (IllegalArgumentException ex) {assertTrue(":16:", true);} - - verify = 17; - content.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - try {content.replaceTextRange(1, 2, "test\n\n");} - catch (IllegalArgumentException ex) {assertTrue(":17:", true);} - - verify = 18; - content.setText("L1\r"); - content.replaceTextRange(3, 0, "\ntest\r\n"); - - verify = 19; - content.setText("L1\n"); - content.replaceTextRange(2, 0, "test\r\r\r"); - verify = 20; - content.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - try {content.replaceTextRange(3, 1, "test\n");} - catch (IllegalArgumentException ex) {assertTrue(":20:", true);} - - - verify = 0; - content.removeTextChangeListener(this); -} -public void test_Delimiter_Special_Cases() { - StyledTextContent content = getContentInstance(); - String newText; - - content.setText("\nL1\r\nL2\r\n"); - content.replaceTextRange(7, 2, ""); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":1:", newText.equals("\nL1\r\nL2")); - - content.setText("L1\r\n"); - content.replaceTextRange(2, 2, "test\n\n"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":2:", newText.equals("L1test\n\n")); - -// content.setText("L1\r\n"); -// content.replaceTextRange(3, 1, "test\r\n"); -// newText = content.getTextRange(0, content.getCharCount()); -// assertTrue(":3:", newText.equals("L1\rtest\r\n")); - -// content.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); -// content.replaceTextRange(1, 2, "test\n\n"); -// newText = content.getTextRange(0, content.getCharCount()); -// assertTrue(":4:", newText.equals("Ltest\n\n\nL2\r\nL3\r\nL4\r\n")); - - content.setText("L1\n"); - content.replaceTextRange(2, 0, "test\r\r\r"); - newText = content.getTextRange(0, content.getCharCount()); - assertTrue(":3:", newText.equals("L1test\r\r\r\n")); -} -protected void setUp() { - // create shell - shell = new Shell (); - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - shell.setSize(500, 300); - shell.setLayout(layout); - // create widget - widget = new StyledText (shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); - GridData spec = new GridData(); - spec.horizontalAlignment = GridData.FILL; - spec.grabExcessHorizontalSpace = true; - spec.verticalAlignment = GridData.FILL; - spec.grabExcessVerticalSpace = true; - widget.setLayoutData(spec); - shell.open (); -} -protected void tearDown() { - if (shell != null && !shell.isDisposed ()) - shell.dispose (); - shell = null; - -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtJunit.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtJunit.java deleted file mode 100644 index 3389409b96..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtJunit.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -/** - * Platform-specific constants used in SWT test cases. - */ -public class SwtJunit { - - public static final String testFontName; - public final static boolean isWindows = System.getProperty("os.name").startsWith("Win"); - public final static boolean isLinux = System.getProperty("os.name").equals("Linux"); - public final static boolean isAIX = System.getProperty("os.name").equals("AIX"); - public final static boolean isSolaris = System.getProperty("os.name").equals("Solaris") || System.getProperty("os.name").equals("SunOS"); - public final static boolean isHPUX = System.getProperty("os.name").equals("HP-UX"); - public final static boolean isCarbon = System.getProperty("os.name").startsWith("Mac"); - - public final static boolean isMotif = /*!isGTK &&*/ isLinux || isAIX || isSolaris || isHPUX; - - static { - if (isMotif) { - testFontName = "misc-fixed"; - } - else { - testFontName = "Helvetica"; - } - } -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestCase.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestCase.java deleted file mode 100644 index 5634cbd489..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestCase.java +++ /dev/null @@ -1,194 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; - -import org.eclipse.swt.SWT; - -public class SwtTestCase extends TestCase { - /** - * The following flags are used to mark test cases that - * are not handled correctly by SWT at this time, or test - * cases that maybe themselves dubious (eg. when the correct - * behaviour may not be clear). Most of these flagged test - * cases involve handling error conditions. - * - * Setting these flags to true will run those tests. As api - * is implemented this gives us a convenient way to include - * it in the junit tests. - */ - - // run test cases that may themselves be dubious - // these should be eventually checked to see if - // there is a valid failure or the test is bogus - public static boolean fCheckBogusTestCases = false; - - // check visibility api (eg in menu) - public static boolean fCheckVisibility = false; - - // run test cases that check SWT policy not covered by the flags above - public static boolean fCheckSWTPolicy = false; - - // make dialog open calls, operator must then close them - public static boolean fTestDialogOpen = false; - - // variable to keep track of the number of unimplemented methods - public static int unimplementedMethods; - - // variable to keep track of the number of unimplemented API methods - public static int unimplementedAPI; - - // used to specify verbose mode, if true unimplemented warning messages will - // be written to System.out - public static boolean verbose = false; - - // allow specific image formats to be tested - public static String[] imageFormats = new String[] {"bmp", "jpg", "gif", "png"}; - public static String[] imageFilenames = new String[] {"folder", "folderOpen", "target"}; - - // specify reparentable platforms - public static String[] reparentablePlatforms = new String[] {"win32", "gtk"}; - -public SwtTestCase(String name) { - super(name); -} -static public void assertSame(String message, Object expected[], Object actual[]) { - if (expected == null && actual == null) return; - boolean same = false; - if (expected != null && actual != null && expected.length == actual.length) { - if (expected.length == 0) return; - same = true; - boolean[] matched = new boolean[expected.length]; - for (int i = 0; i < actual.length; i++) { - boolean match = false; - for (int j = 0; j < expected.length; j++) { - if (!matched[j]) { - if ((actual[i] == null && expected [j] == null) || - (actual[i] != null && actual[i].equals(expected[j]))) { - match = true; - matched[j] = true; - break; - } - } - } - if (!match) { - same = false; - break; - } - } - } - if (!same) { - failNotEquals(message, expected, actual); - } -} -static public void assertSame(Object expected[], Object actual[]) { - assertSame(null, expected, actual); -} -static public void assertSame(String message, int expected[], int actual[]) { - if (expected == null && actual == null) return; - boolean same = false; - if (expected != null && actual != null && expected.length == actual.length) { - if (expected.length == 0) return; - same = true; - boolean[] matched = new boolean[expected.length]; - for (int i = 0; i < actual.length; i++) { - boolean match = false; - for (int j = 0; j < expected.length; j++) { - if (!matched[j] && actual[i] == expected[j]) { - match = true; - matched[j] = true; - break; - } - } - if (!match) { - same = false; - break; - } - } - } - if (!same) { - failNotEquals(message, expected, actual); - } -} -static public void assertSame(int expected[], int actual[]) { - assertSame(null, expected, actual); -} -static public void assertEquals(String message, Object expected[], Object actual[]) { - if (expected == null && actual == null) - return; - boolean equal = false; - if (expected != null && actual != null && expected.length == actual.length) { - if (expected.length == 0) - return; - equal = true; - for (int i = 0; i < expected.length; i++) { - if (!expected[i].equals(actual[i])) { - equal = false; - } - } - } - if (!equal) { - failNotEquals(message, expected, actual); - } -} -static public void assertEquals(Object expected[], Object actual[]) { - assertEquals(null, expected, actual); -} -static public void assertEquals(String message, int expected[], int actual[]) { - if (expected == null && actual == null) - return; - boolean equal = false; - if (expected != null && actual != null && expected.length == actual.length) { - if (expected.length == 0) - return; - equal = true; - for (int i = 0; i < expected.length; i++) { - if (expected[i] != actual[i]) { - equal = false; - } - } - } - if (!equal) { - failNotEquals(message, expected, actual); - } -} -static public void assertEquals(int expected[], int actual[]) { - assertEquals(null, expected, actual); -} -// 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+">"); -} -protected boolean isReparentablePlatform() { - String platform = SWT.getPlatform(); - for (int i=0; i<reparentablePlatforms.length; i++) { - if (reparentablePlatforms[i].equals(platform)) return true; - } - return false; -} -protected void warnUnimpl(String message) { - if (verbose) { - System.out.println(this.getClass() + ": " + message); - } - unimplementedMethods++; -} -protected void warnUnimplAPI(String message) { - if (verbose) { - System.out.println("API not implemented " + this.getClass() + " " + getName()); - } - unimplementedAPI++; -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWT.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWT.java deleted file mode 100644 index eb214de7e2..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWT.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; - -/** - * Automated Test Suite for class org.eclipse.swt.SWT - * - * @see org.eclipse.swt.SWT - */ -public class Test_org_eclipse_swt_SWT extends SwtTestCase { - -public Test_org_eclipse_swt_SWT(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - // Do nothing. Class SWT is not intended to be subclassed. -} - -public void test_errorI() { - // Test that we throw the expected kinds of errors for the given error types. - boolean passed = false; - try { - SWT.error(SWT.ERROR_NULL_ARGUMENT); - } catch (IllegalArgumentException ex) { - passed = true; - } catch (Throwable t) { } - assertTrue ("did not correctly throw exception for ERROR_NULL_ARGUMENT", passed); - passed = false; - try { - SWT.error(SWT.ERROR_FAILED_EXEC); - } catch (SWTException ex) { - passed = true; - } catch (Throwable t) { } - assertTrue ("did not correctly throw exception for ERROR_FAILED_EXEC", passed); - passed = false; - try { - SWT.error(SWT.ERROR_NO_HANDLES); - } catch (SWTError ex) { - passed = true; - } catch (Throwable t) { } - assertTrue ("did not correctly throw exception for ERROR_NO_HANDLES", passed); - passed = false; - try { - SWT.error(-1); - } catch (SWTError ex) { - passed = true; - } catch (Throwable t) { } - assertTrue ("did not correctly throw exception for error(-1)", passed); -} - -public void test_errorILjava_lang_Throwable() { - // Test that the causing throwable is filled in. - Throwable cause = new RuntimeException("Just for testing"); - boolean passed = false; - try { - SWT.error(SWT.ERROR_UNSUPPORTED_FORMAT, cause); - } catch (SWTException ex) { - passed = ex.throwable == cause; - } catch (Throwable t) { } - assertTrue ("did not correctly throw exception for ERROR_UNSUPPORTED_FORMAT", passed); - passed = false; - try { - SWT.error(SWT.ERROR_NOT_IMPLEMENTED, cause); - } catch (SWTError ex) { - passed = ex.throwable == cause; - } catch (Throwable t) { } - assertTrue ("did not correctly throw exception for ERROR_NOT_IMPLEMENTED", passed); - passed = false; - try { - SWT.error(-1, cause); - } catch (SWTError ex) { - passed = ex.throwable == cause; - } catch (Throwable t) { } - assertTrue ("did not correctly throw exception for error(-1)", passed); -} - -public void test_getMessageLjava_lang_String() { - boolean passed = false; - try { - passed = false; - SWT.getMessage(null); - } catch (IllegalArgumentException ex) { - passed = true; - } - assertTrue ("did not correctly throw exception with null argument", passed); - try { - SWT.getMessage("SWT_Yes"); - } catch (Throwable t) { - fail ("exception " + t + " generated for SWT_Yes"); - } - assertTrue ( - "invalid key did not return as itself", - "_NOT_FOUND_IN_PROPERTIES_".equals(SWT.getMessage("_NOT_FOUND_IN_PROPERTIES_"))); - -} - -public void test_getPlatform() { - // Can't test the list of platforms, since this may change, - // so just test to see it returns something. - assertTrue ("returned null platform name", SWT.getPlatform() != null); -} - -public void test_getVersion() { - // Test that the version number which is returned is reasonable. - int ver = SWT.getVersion(); - assertTrue ("unreasonable value returned", ver > 0 && ver < 1000000); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_SWT((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_errorI"); - methodNames.addElement("test_errorILjava_lang_Throwable"); - methodNames.addElement("test_getMessageLjava_lang_String"); - methodNames.addElement("test_getPlatform"); - methodNames.addElement("test_getVersion"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_errorI")) test_errorI(); - else if (getName().equals("test_errorILjava_lang_Throwable")) test_errorILjava_lang_Throwable(); - else if (getName().equals("test_getMessageLjava_lang_String")) test_getMessageLjava_lang_String(); - else if (getName().equals("test_getPlatform")) test_getPlatform(); - else if (getName().equals("test_getVersion")) test_getVersion(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTError.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTError.java deleted file mode 100644 index 9729fee8a1..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTError.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; - -/** - * Automated Test Suite for class org.eclipse.swt.SWTError - * - * @see org.eclipse.swt.SWTError - */ -public class Test_org_eclipse_swt_SWTError extends SwtTestCase { - -public Test_org_eclipse_swt_SWTError(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - assertTrue ( - "did not fill in code properly", - new SWTError().code == SWT.ERROR_UNSPECIFIED); -} - -public void test_ConstructorI() { - assertTrue ( - "did not fill in code properly", - new SWTError(SWT.ERROR_CANNOT_BE_ZERO).code == SWT.ERROR_CANNOT_BE_ZERO); -} - -public void test_ConstructorILjava_lang_String() { - assertTrue ( - "did not fill in code properly", - new SWTError(SWT.ERROR_CANNOT_BE_ZERO, "An uninteresting message").code - == SWT.ERROR_CANNOT_BE_ZERO); -} - -public void test_ConstructorLjava_lang_String() { - assertTrue ( - "did not fill in code properly", - new SWTError("An uninteresting message").code == SWT.ERROR_UNSPECIFIED); -} - -public void test_getMessage() { - assertTrue ( - "did not include creation string in result", - new SWTError(SWT.ERROR_CANNOT_BE_ZERO, "An interesting message").getMessage() - .indexOf("An interesting message") >= 0); -} - -public void test_printStackTrace() { - warnUnimpl("Test test_printStackTrace not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_SWTError((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorI"); - methodNames.addElement("test_ConstructorILjava_lang_String"); - methodNames.addElement("test_ConstructorLjava_lang_String"); - methodNames.addElement("test_getMessage"); - methodNames.addElement("test_printStackTrace"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorI")) test_ConstructorI(); - else if (getName().equals("test_ConstructorILjava_lang_String")) test_ConstructorILjava_lang_String(); - else if (getName().equals("test_ConstructorLjava_lang_String")) test_ConstructorLjava_lang_String(); - else if (getName().equals("test_getMessage")) test_getMessage(); - else if (getName().equals("test_printStackTrace")) test_printStackTrace(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTException.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTException.java deleted file mode 100644 index 66f9a4f851..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_SWTException.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; - -/** - * Automated Test Suite for class org.eclipse.swt.SWTException - * - * @see org.eclipse.swt.SWTException - */ -public class Test_org_eclipse_swt_SWTException extends SwtTestCase { - -public Test_org_eclipse_swt_SWTException(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - assertTrue ( - "did not fill in code properly", - new SWTException().code == SWT.ERROR_UNSPECIFIED); -} - -public void test_ConstructorI() { - assertTrue ( - "did not fill in code properly", - new SWTException(SWT.ERROR_CANNOT_BE_ZERO).code == SWT.ERROR_CANNOT_BE_ZERO); -} - -public void test_ConstructorILjava_lang_String() { - assertTrue ( - "did not fill in code properly", - new SWTException(SWT.ERROR_CANNOT_BE_ZERO, "An uninteresting message").code - == SWT.ERROR_CANNOT_BE_ZERO); -} - -public void test_ConstructorLjava_lang_String() { - assertTrue ( - "did not fill in code properly", - new SWTException("An uninteresting message").code == SWT.ERROR_UNSPECIFIED); -} - -public void test_getMessage() { - assertTrue ( - "did not include creation string in result", - new SWTException(SWT.ERROR_CANNOT_BE_ZERO, "An interesting message").getMessage() - .indexOf("An interesting message") >= 0); -} - -public void test_printStackTrace() { - warnUnimpl("Test test_printStackTrace not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_SWTException((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorI"); - methodNames.addElement("test_ConstructorILjava_lang_String"); - methodNames.addElement("test_ConstructorLjava_lang_String"); - methodNames.addElement("test_getMessage"); - methodNames.addElement("test_printStackTrace"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorI")) test_ConstructorI(); - else if (getName().equals("test_ConstructorILjava_lang_String")) test_ConstructorILjava_lang_String(); - else if (getName().equals("test_ConstructorLjava_lang_String")) test_ConstructorLjava_lang_String(); - else if (getName().equals("test_getMessage")) test_getMessage(); - else if (getName().equals("test_printStackTrace")) test_printStackTrace(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_ACC.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_ACC.java deleted file mode 100644 index cccdd4e8a5..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_ACC.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.accessibility.ACC - * - * @see org.eclipse.swt.accessibility.ACC - */ -public class Test_org_eclipse_swt_accessibility_ACC extends SwtTestCase { - -public Test_org_eclipse_swt_accessibility_ACC(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_accessibility_ACC((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_Accessible.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_Accessible.java deleted file mode 100644 index aab129fb5b..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_Accessible.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.accessibility.*; - -/** - * Automated Test Suite for class org.eclipse.swt.accessibility.Accessible - * - * @see org.eclipse.swt.accessibility.Accessible - */ -public class Test_org_eclipse_swt_accessibility_Accessible extends SwtTestCase { - -public Test_org_eclipse_swt_accessibility_Accessible(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - shell = new Shell(); - accessible = shell.getAccessible(); -} - -protected void tearDown() { - assertEquals(false, shell.isDisposed()); - shell.dispose(); - assertTrue(shell.isDisposed()); -} - -public void test_addAccessibleControlListenerLorg_eclipse_swt_accessibility_AccessibleControlListener() { - AccessibleControlListener listener = new AccessibleControlListener() { - public void getValue(AccessibleControlEvent e) { - } - public void getChild(AccessibleControlEvent e) { - } - public void getChildAtPoint(AccessibleControlEvent e) { - } - public void getChildCount(AccessibleControlEvent e) { - } - public void getChildren(AccessibleControlEvent e) { - } - public void getDefaultAction(AccessibleControlEvent e) { - } - public void getFocus(AccessibleControlEvent e) { - } - public void getLocation(AccessibleControlEvent e) { - } - public void getRole(AccessibleControlEvent e) { - } - public void getSelection(AccessibleControlEvent e) { - } - public void getState(AccessibleControlEvent e) { - } - }; - accessible.addAccessibleControlListener(listener); - accessible.removeAccessibleControlListener(listener); -} - -public void test_addAccessibleListenerLorg_eclipse_swt_accessibility_AccessibleListener() { - AccessibleListener listener = new AccessibleListener() { - public void getName(AccessibleEvent e) { - } - public void getDescription(AccessibleEvent e) { - } - public void getHelp(AccessibleEvent e) { - } - public void getKeyboardShortcut(AccessibleEvent e) { - } - }; - accessible.addAccessibleListener(listener); - accessible.removeAccessibleListener(listener); -} - -public void test_addAccessibleTextListenerLorg_eclipse_swt_accessibility_AccessibleTextListener() { - AccessibleTextListener listener = new AccessibleTextListener() { - public void getSelectionRange(AccessibleTextEvent e) { - } - public void getCaretOffset(AccessibleTextEvent e) { - } - }; - accessible.addAccessibleTextListener(listener); - accessible.removeAccessibleTextListener(listener); -} - -public void test_getControl() { - assertEquals(shell, accessible.getControl()); -} - -public void test_internal_WM_GETOBJECTII() { - warnUnimpl("Test test_internal_WM_GETOBJECTII not written"); -} - -public void test_internal_dispose_Accessible() { - warnUnimpl("Test test_internal_dispose_Accessible not written"); -} - -public void test_internal_new_AccessibleLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_internal_new_AccessibleLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_removeAccessibleControlListenerLorg_eclipse_swt_accessibility_AccessibleControlListener() { - // Tested in test_addAccessibleControlListenerLorg_eclipse_swt_accessibility_AccessibleControlListener. -} - -public void test_removeAccessibleListenerLorg_eclipse_swt_accessibility_AccessibleListener() { - // Tested in test_addAccessibleListenerLorg_eclipse_swt_accessibility_AccessibleListener. -} - -public void test_removeAccessibleTextListenerLorg_eclipse_swt_accessibility_AccessibleTextListener() { - // Tested in test_addAccessibleTextListenerLorg_eclipse_swt_accessibility_AccessibleTextListener. -} - -public void test_selectionChanged() { - warnUnimpl("Test test_selectionChanged not written"); -} - -public void test_setFocusI() { - warnUnimpl("Test test_setFocusI not written"); -} - -public void test_textCaretMovedI() { - warnUnimpl("Test test_textCaretMovedI not written"); -} - -public void test_textChangedIII() { - warnUnimpl("Test test_textChangedIII not written"); -} - -public void test_textSelectionChanged() { - warnUnimpl("Test test_textSelectionChanged not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_accessibility_Accessible((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_addAccessibleControlListenerLorg_eclipse_swt_accessibility_AccessibleControlListener"); - methodNames.addElement("test_addAccessibleListenerLorg_eclipse_swt_accessibility_AccessibleListener"); - methodNames.addElement("test_addAccessibleTextListenerLorg_eclipse_swt_accessibility_AccessibleTextListener"); - methodNames.addElement("test_getControl"); - methodNames.addElement("test_internal_WM_GETOBJECTII"); - methodNames.addElement("test_internal_dispose_Accessible"); - methodNames.addElement("test_internal_new_AccessibleLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_removeAccessibleControlListenerLorg_eclipse_swt_accessibility_AccessibleControlListener"); - methodNames.addElement("test_removeAccessibleListenerLorg_eclipse_swt_accessibility_AccessibleListener"); - methodNames.addElement("test_removeAccessibleTextListenerLorg_eclipse_swt_accessibility_AccessibleTextListener"); - methodNames.addElement("test_selectionChanged"); - methodNames.addElement("test_setFocusI"); - methodNames.addElement("test_textCaretMovedI"); - methodNames.addElement("test_textChangedIII"); - methodNames.addElement("test_textSelectionChanged"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_addAccessibleControlListenerLorg_eclipse_swt_accessibility_AccessibleControlListener")) test_addAccessibleControlListenerLorg_eclipse_swt_accessibility_AccessibleControlListener(); - else if (getName().equals("test_addAccessibleListenerLorg_eclipse_swt_accessibility_AccessibleListener")) test_addAccessibleListenerLorg_eclipse_swt_accessibility_AccessibleListener(); - else if (getName().equals("test_addAccessibleTextListenerLorg_eclipse_swt_accessibility_AccessibleTextListener")) test_addAccessibleTextListenerLorg_eclipse_swt_accessibility_AccessibleTextListener(); - else if (getName().equals("test_getControl")) test_getControl(); - else if (getName().equals("test_internal_WM_GETOBJECTII")) test_internal_WM_GETOBJECTII(); - else if (getName().equals("test_internal_dispose_Accessible")) test_internal_dispose_Accessible(); - else if (getName().equals("test_internal_new_AccessibleLorg_eclipse_swt_widgets_Control")) test_internal_new_AccessibleLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_removeAccessibleControlListenerLorg_eclipse_swt_accessibility_AccessibleControlListener")) test_removeAccessibleControlListenerLorg_eclipse_swt_accessibility_AccessibleControlListener(); - else if (getName().equals("test_removeAccessibleListenerLorg_eclipse_swt_accessibility_AccessibleListener")) test_removeAccessibleListenerLorg_eclipse_swt_accessibility_AccessibleListener(); - else if (getName().equals("test_removeAccessibleTextListenerLorg_eclipse_swt_accessibility_AccessibleTextListener")) test_removeAccessibleTextListenerLorg_eclipse_swt_accessibility_AccessibleTextListener(); - else if (getName().equals("test_selectionChanged")) test_selectionChanged(); - else if (getName().equals("test_setFocusI")) test_setFocusI(); - else if (getName().equals("test_textCaretMovedI")) test_textCaretMovedI(); - else if (getName().equals("test_textChangedIII")) test_textChangedIII(); - else if (getName().equals("test_textSelectionChanged")) test_textSelectionChanged(); -} - -/* custom */ -private Shell shell; -private Accessible accessible; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleAdapter.java deleted file mode 100644 index cf41b889ff..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleAdapter.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.accessibility.AccessibleAdapter - * - * @see org.eclipse.swt.accessibility.AccessibleAdapter - */ -public class Test_org_eclipse_swt_accessibility_AccessibleAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_accessibility_AccessibleAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_getDescriptionLorg_eclipse_swt_accessibility_AccessibleEvent() { - warnUnimpl("Test test_getDescriptionLorg_eclipse_swt_accessibility_AccessibleEvent not written"); -} - -public void test_getHelpLorg_eclipse_swt_accessibility_AccessibleEvent() { - warnUnimpl("Test test_getHelpLorg_eclipse_swt_accessibility_AccessibleEvent not written"); -} - -public void test_getKeyboardShortcutLorg_eclipse_swt_accessibility_AccessibleEvent() { - warnUnimpl("Test test_getKeyboardShortcutLorg_eclipse_swt_accessibility_AccessibleEvent not written"); -} - -public void test_getNameLorg_eclipse_swt_accessibility_AccessibleEvent() { - warnUnimpl("Test test_getNameLorg_eclipse_swt_accessibility_AccessibleEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_accessibility_AccessibleAdapter((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_getDescriptionLorg_eclipse_swt_accessibility_AccessibleEvent"); - methodNames.addElement("test_getHelpLorg_eclipse_swt_accessibility_AccessibleEvent"); - methodNames.addElement("test_getKeyboardShortcutLorg_eclipse_swt_accessibility_AccessibleEvent"); - methodNames.addElement("test_getNameLorg_eclipse_swt_accessibility_AccessibleEvent"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_getDescriptionLorg_eclipse_swt_accessibility_AccessibleEvent")) test_getDescriptionLorg_eclipse_swt_accessibility_AccessibleEvent(); - else if (getName().equals("test_getHelpLorg_eclipse_swt_accessibility_AccessibleEvent")) test_getHelpLorg_eclipse_swt_accessibility_AccessibleEvent(); - else if (getName().equals("test_getKeyboardShortcutLorg_eclipse_swt_accessibility_AccessibleEvent")) test_getKeyboardShortcutLorg_eclipse_swt_accessibility_AccessibleEvent(); - else if (getName().equals("test_getNameLorg_eclipse_swt_accessibility_AccessibleEvent")) test_getNameLorg_eclipse_swt_accessibility_AccessibleEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleControlAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleControlAdapter.java deleted file mode 100644 index a905c260f0..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleControlAdapter.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.accessibility.AccessibleControlAdapter - * - * @see org.eclipse.swt.accessibility.AccessibleControlAdapter - */ -public class Test_org_eclipse_swt_accessibility_AccessibleControlAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_accessibility_AccessibleControlAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_getChildAtPointLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getChildAtPointLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getChildCountLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getChildCountLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getChildLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getChildLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getChildrenLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getChildrenLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getDefaultActionLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getDefaultActionLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getFocusLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getFocusLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getLocationLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getLocationLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getRoleLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getRoleLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getSelectionLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getSelectionLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getStateLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getStateLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getValueLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getValueLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_accessibility_AccessibleControlAdapter((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_getChildAtPointLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getChildCountLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getChildLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getChildrenLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getDefaultActionLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getFocusLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getLocationLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getRoleLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getSelectionLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getStateLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getValueLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_getChildAtPointLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getChildAtPointLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getChildCountLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getChildCountLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getChildLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getChildLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getChildrenLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getChildrenLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getDefaultActionLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getDefaultActionLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getFocusLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getFocusLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getLocationLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getLocationLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getRoleLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getRoleLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getSelectionLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getSelectionLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getStateLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getStateLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getValueLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getValueLorg_eclipse_swt_accessibility_AccessibleControlEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleControlEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleControlEvent.java deleted file mode 100644 index 616648371c..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleControlEvent.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.accessibility.*; - -/** - * Automated Test Suite for class org.eclipse.swt.accessibility.AccessibleControlEvent - * - * @see org.eclipse.swt.accessibility.AccessibleControlEvent - */ -public class Test_org_eclipse_swt_accessibility_AccessibleControlEvent extends SwtTestCase { - -public Test_org_eclipse_swt_accessibility_AccessibleControlEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - shell = new Shell(); -} - -protected void tearDown() { - shell.dispose(); -} - -public void test_ConstructorLjava_lang_Object() { - // Object will typically be a widget. - AccessibleControlEvent event = new AccessibleControlEvent(shell); - assertNotNull(event); - - // Test with some other object also. - event = new AccessibleControlEvent(new Integer(5)); - assertNotNull(event); -} - -public void test_toString() { - AccessibleControlEvent event = new AccessibleControlEvent(shell); - assertNotNull(event.toString()); - assertTrue(event.toString().length() > 0); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_accessibility_AccessibleControlEvent((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLjava_lang_Object"); - methodNames.addElement("test_toString"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLjava_lang_Object")) test_ConstructorLjava_lang_Object(); - else if (getName().equals("test_toString")) test_toString(); -} - -/* custom */ -public Shell shell; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleControlListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleControlListener.java deleted file mode 100644 index 06dd19a476..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleControlListener.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.accessibility.AccessibleControlListener - * - * @see org.eclipse.swt.accessibility.AccessibleControlListener - */ -public class Test_org_eclipse_swt_accessibility_AccessibleControlListener extends SwtTestCase { - -public Test_org_eclipse_swt_accessibility_AccessibleControlListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_getChildAtPointLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getChildAtPointLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getChildCountLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getChildCountLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getChildLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getChildLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getChildrenLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getChildrenLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getDefaultActionLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getDefaultActionLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getFocusLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getFocusLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getLocationLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getLocationLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getRoleLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getRoleLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getSelectionLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getSelectionLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getStateLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getStateLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - -public void test_getValueLorg_eclipse_swt_accessibility_AccessibleControlEvent() { - warnUnimpl("Test test_getValueLorg_eclipse_swt_accessibility_AccessibleControlEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_accessibility_AccessibleControlListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_getChildAtPointLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getChildCountLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getChildLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getChildrenLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getDefaultActionLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getFocusLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getLocationLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getRoleLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getSelectionLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getStateLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - methodNames.addElement("test_getValueLorg_eclipse_swt_accessibility_AccessibleControlEvent"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_getChildAtPointLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getChildAtPointLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getChildCountLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getChildCountLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getChildLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getChildLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getChildrenLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getChildrenLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getDefaultActionLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getDefaultActionLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getFocusLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getFocusLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getLocationLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getLocationLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getRoleLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getRoleLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getSelectionLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getSelectionLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getStateLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getStateLorg_eclipse_swt_accessibility_AccessibleControlEvent(); - else if (getName().equals("test_getValueLorg_eclipse_swt_accessibility_AccessibleControlEvent")) test_getValueLorg_eclipse_swt_accessibility_AccessibleControlEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleEvent.java deleted file mode 100644 index 5da25bca84..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleEvent.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.accessibility.*; - -/** - * Automated Test Suite for class org.eclipse.swt.accessibility.AccessibleEvent - * - * @see org.eclipse.swt.accessibility.AccessibleEvent - */ -public class Test_org_eclipse_swt_accessibility_AccessibleEvent extends SwtTestCase { - -public Test_org_eclipse_swt_accessibility_AccessibleEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - shell = new Shell(); -} - -protected void tearDown() { - shell.dispose(); -} - -public void test_ConstructorLjava_lang_Object() { - // Object will typically be a widget. - AccessibleEvent event = new AccessibleEvent(shell); - assertNotNull(event); - - // Test with some other object also. - event = new AccessibleEvent(new Integer(5)); - assertNotNull(event); -} - -public void test_toString() { - AccessibleEvent event = new AccessibleEvent(shell); - assertNotNull(event.toString()); - assertTrue(event.toString().length() > 0); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_accessibility_AccessibleEvent((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLjava_lang_Object"); - methodNames.addElement("test_toString"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLjava_lang_Object")) test_ConstructorLjava_lang_Object(); - else if (getName().equals("test_toString")) test_toString(); -} - -/* custom */ -public Shell shell; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleListener.java deleted file mode 100644 index d93344fad6..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleListener.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.accessibility.AccessibleListener - * - * @see org.eclipse.swt.accessibility.AccessibleListener - */ -public class Test_org_eclipse_swt_accessibility_AccessibleListener extends SwtTestCase { - -public Test_org_eclipse_swt_accessibility_AccessibleListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_getDescriptionLorg_eclipse_swt_accessibility_AccessibleEvent() { - warnUnimpl("Test test_getDescriptionLorg_eclipse_swt_accessibility_AccessibleEvent not written"); -} - -public void test_getHelpLorg_eclipse_swt_accessibility_AccessibleEvent() { - warnUnimpl("Test test_getHelpLorg_eclipse_swt_accessibility_AccessibleEvent not written"); -} - -public void test_getKeyboardShortcutLorg_eclipse_swt_accessibility_AccessibleEvent() { - warnUnimpl("Test test_getKeyboardShortcutLorg_eclipse_swt_accessibility_AccessibleEvent not written"); -} - -public void test_getNameLorg_eclipse_swt_accessibility_AccessibleEvent() { - warnUnimpl("Test test_getNameLorg_eclipse_swt_accessibility_AccessibleEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_accessibility_AccessibleListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_getDescriptionLorg_eclipse_swt_accessibility_AccessibleEvent"); - methodNames.addElement("test_getHelpLorg_eclipse_swt_accessibility_AccessibleEvent"); - methodNames.addElement("test_getKeyboardShortcutLorg_eclipse_swt_accessibility_AccessibleEvent"); - methodNames.addElement("test_getNameLorg_eclipse_swt_accessibility_AccessibleEvent"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_getDescriptionLorg_eclipse_swt_accessibility_AccessibleEvent")) test_getDescriptionLorg_eclipse_swt_accessibility_AccessibleEvent(); - else if (getName().equals("test_getHelpLorg_eclipse_swt_accessibility_AccessibleEvent")) test_getHelpLorg_eclipse_swt_accessibility_AccessibleEvent(); - else if (getName().equals("test_getKeyboardShortcutLorg_eclipse_swt_accessibility_AccessibleEvent")) test_getKeyboardShortcutLorg_eclipse_swt_accessibility_AccessibleEvent(); - else if (getName().equals("test_getNameLorg_eclipse_swt_accessibility_AccessibleEvent")) test_getNameLorg_eclipse_swt_accessibility_AccessibleEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleTextAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleTextAdapter.java deleted file mode 100644 index 28cdb15a1b..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleTextAdapter.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.accessibility.AccessibleTextAdapter - * - * @see org.eclipse.swt.accessibility.AccessibleTextAdapter - */ -public class Test_org_eclipse_swt_accessibility_AccessibleTextAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_accessibility_AccessibleTextAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_getCaretOffsetLorg_eclipse_swt_accessibility_AccessibleTextEvent() { - warnUnimpl("Test test_getCaretOffsetLorg_eclipse_swt_accessibility_AccessibleTextEvent not written"); -} - -public void test_getSelectionRangeLorg_eclipse_swt_accessibility_AccessibleTextEvent() { - warnUnimpl("Test test_getSelectionRangeLorg_eclipse_swt_accessibility_AccessibleTextEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_accessibility_AccessibleTextAdapter((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_getCaretOffsetLorg_eclipse_swt_accessibility_AccessibleTextEvent"); - methodNames.addElement("test_getSelectionRangeLorg_eclipse_swt_accessibility_AccessibleTextEvent"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_getCaretOffsetLorg_eclipse_swt_accessibility_AccessibleTextEvent")) test_getCaretOffsetLorg_eclipse_swt_accessibility_AccessibleTextEvent(); - else if (getName().equals("test_getSelectionRangeLorg_eclipse_swt_accessibility_AccessibleTextEvent")) test_getSelectionRangeLorg_eclipse_swt_accessibility_AccessibleTextEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleTextEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleTextEvent.java deleted file mode 100644 index d6b1d4de1a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleTextEvent.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.accessibility.*; - -/** - * Automated Test Suite for class org.eclipse.swt.accessibility.AccessibleTextEvent - * - * @see org.eclipse.swt.accessibility.AccessibleTextEvent - */ -public class Test_org_eclipse_swt_accessibility_AccessibleTextEvent extends SwtTestCase { - -public Test_org_eclipse_swt_accessibility_AccessibleTextEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - shell = new Shell(); -} - -protected void tearDown() { - shell.dispose(); -} - -public void test_ConstructorLjava_lang_Object() { - // Object will typically be a widget. - AccessibleTextEvent event = new AccessibleTextEvent(shell); - assertNotNull(event); - - // Test with some other object also. - event = new AccessibleTextEvent(new Integer(5)); - assertNotNull(event); -} - -public void test_toString() { - AccessibleTextEvent event = new AccessibleTextEvent(shell); - assertNotNull(event.toString()); - assertTrue(event.toString().length() > 0); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_accessibility_AccessibleTextEvent((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLjava_lang_Object"); - methodNames.addElement("test_toString"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLjava_lang_Object")) test_ConstructorLjava_lang_Object(); - else if (getName().equals("test_toString")) test_toString(); -} - -/* custom */ -public Shell shell; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleTextListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleTextListener.java deleted file mode 100644 index 4922d02b0c..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_accessibility_AccessibleTextListener.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.accessibility.AccessibleTextListener - * - * @see org.eclipse.swt.accessibility.AccessibleTextListener - */ -public class Test_org_eclipse_swt_accessibility_AccessibleTextListener extends SwtTestCase { - -public Test_org_eclipse_swt_accessibility_AccessibleTextListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_getCaretOffsetLorg_eclipse_swt_accessibility_AccessibleTextEvent() { - warnUnimpl("Test test_getCaretOffsetLorg_eclipse_swt_accessibility_AccessibleTextEvent not written"); -} - -public void test_getSelectionRangeLorg_eclipse_swt_accessibility_AccessibleTextEvent() { - warnUnimpl("Test test_getSelectionRangeLorg_eclipse_swt_accessibility_AccessibleTextEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_accessibility_AccessibleTextListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_getCaretOffsetLorg_eclipse_swt_accessibility_AccessibleTextEvent"); - methodNames.addElement("test_getSelectionRangeLorg_eclipse_swt_accessibility_AccessibleTextEvent"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_getCaretOffsetLorg_eclipse_swt_accessibility_AccessibleTextEvent")) test_getCaretOffsetLorg_eclipse_swt_accessibility_AccessibleTextEvent(); - else if (getName().equals("test_getSelectionRangeLorg_eclipse_swt_accessibility_AccessibleTextEvent")) test_getSelectionRangeLorg_eclipse_swt_accessibility_AccessibleTextEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_awt_SWT_AWT.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_awt_SWT_AWT.java deleted file mode 100644 index e9e1eb2520..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_awt_SWT_AWT.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.awt.SWT_AWT - * - * @see org.eclipse.swt.awt.SWT_AWT - */ -public class Test_org_eclipse_swt_awt_SWT_AWT extends SwtTestCase { - -public Test_org_eclipse_swt_awt_SWT_AWT(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_new_FrameLorg_eclipse_swt_widgets_Composite() { - warnUnimpl("Test test_new_FrameLorg_eclipse_swt_widgets_Composite not written"); -} - -public void test_new_ShellLorg_eclipse_swt_widgets_DisplayLjava_awt_Canvas() { - warnUnimpl("Test test_new_ShellLorg_eclipse_swt_widgets_DisplayLjava_awt_Canvas not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_awt_SWT_AWT((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_new_FrameLorg_eclipse_swt_widgets_Composite"); - methodNames.addElement("test_new_ShellLorg_eclipse_swt_widgets_DisplayLjava_awt_Canvas"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_new_FrameLorg_eclipse_swt_widgets_Composite")) test_new_FrameLorg_eclipse_swt_widgets_Composite(); - else if (getName().equals("test_new_ShellLorg_eclipse_swt_widgets_DisplayLjava_awt_Canvas")) test_new_ShellLorg_eclipse_swt_widgets_DisplayLjava_awt_Canvas(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java deleted file mode 100644 index 654dbc4ef2..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java +++ /dev/null @@ -1,456 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.browser.Browser - * - * @see org.eclipse.swt.browser.Browser - */ -public class Test_org_eclipse_swt_browser_Browser extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_browser_Browser(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - shell.setLayout(new FillLayout()); - browser = new Browser(shell, SWT.NONE); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - shell.setText("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - Browser browser = new Browser(shell, SWT.NONE); - browser.dispose(); - browser = new Browser(shell, SWT.BORDER); - browser.dispose(); - try { - browser = new Browser(null, SWT.NONE); - fail("No exception thrown for parent == null"); - } catch (IllegalArgumentException e) { - } -} - -public void test_addCloseWindowListenerLorg_eclipse_swt_browser_CloseWindowListener() { - shell.setText("test_addCloseWindowListenerLorg_eclipse_swt_browser_CloseWindowListener"); - try { - browser.addCloseWindowListener(null); - fail("No exception thrown for listener == null"); - } - catch (IllegalArgumentException e) { - } - - CloseWindowListener listener = new CloseWindowListener() { - public void close(WindowEvent event) { - } - }; - for (int i = 0; i < 100; i++) browser.addCloseWindowListener(listener); - for (int i = 0; i < 100; i++) browser.removeCloseWindowListener(listener); -} - -public void test_addLocationListenerLorg_eclipse_swt_browser_LocationListener() { - shell.setText("test_addLocationListenerLorg_eclipse_swt_browser_LocationListener"); - try { - browser.addLocationListener(null); - fail("No exception thrown for listener == null"); - } - catch (IllegalArgumentException e) { - } - - LocationListener listener = new LocationListener() { - public void changed(LocationEvent event) { - } - public void changing(LocationEvent event) { - } - }; - for (int i = 0; i < 100; i++) browser.addLocationListener(listener); - for (int i = 0; i < 100; i++) browser.removeLocationListener(listener); -} - -public void test_addOpenWindowListenerLorg_eclipse_swt_browser_OpenWindowListener() { - shell.setText("test_addOpenWindowListenerLorg_eclipse_swt_browser_OpenWindowListener"); - try { - browser.addOpenWindowListener(null); - fail("No exception thrown for listener == null"); - } - catch (IllegalArgumentException e) { - } - - OpenWindowListener listener = new OpenWindowListener() { - public void open(WindowEvent event) { - } - }; - for (int i = 0; i < 100; i++) browser.addOpenWindowListener(listener); - for (int i = 0; i < 100; i++) browser.removeOpenWindowListener(listener); -} - -public void test_addProgressListenerLorg_eclipse_swt_browser_ProgressListener() { - shell.setText("test_addProgressListenerLorg_eclipse_swt_browser_ProgressListener"); - try { - browser.addProgressListener(null); - fail("No exception thrown for listener == null"); - } - catch (IllegalArgumentException e) { - } - - ProgressListener listener = new ProgressListener() { - public void changed(ProgressEvent event) { - } - public void completed(ProgressEvent event) { - } - }; - for (int i = 0; i < 100; i++) browser.addProgressListener(listener); - for (int i = 0; i < 100; i++) browser.removeProgressListener(listener); -} - -public void test_addStatusTextListenerLorg_eclipse_swt_browser_StatusTextListener() { - shell.setText("test_addStatusTextListenerLorg_eclipse_swt_browser_StatusTextListener"); - try { - browser.addStatusTextListener(null); - fail("No exception thrown for listener == null"); - } - catch (IllegalArgumentException e) { - } - - StatusTextListener listener = new StatusTextListener() { - public void changed(StatusTextEvent event) { - } - }; - for (int i = 0; i < 100; i++) browser.addStatusTextListener(listener); - for (int i = 0; i < 100; i++) browser.removeStatusTextListener(listener); -} - -public void test_addTitleListenerLorg_eclipse_swt_browser_TitleListener() { - shell.setText("test_addTitleLorg_eclipse_swt_browser_TitleListener"); - try { - browser.addTitleListener(null); - fail("No exception thrown for listener == null"); - } - catch (IllegalArgumentException e) { - } - - TitleListener listener = new TitleListener() { - public void changed(TitleEvent event) { - } - }; - for (int i = 0; i < 100; i++) browser.addTitleListener(listener); - for (int i = 0; i < 100; i++) browser.removeTitleListener(listener); -} - -public void test_addVisibilityWindowListenerLorg_eclipse_swt_browser_VisibilityWindowListener() { - shell.setText("test_addVisibilityWindowListenerLorg_eclipse_swt_browser_VisibilityWindowListener"); - try { - browser.addVisibilityWindowListener(null); - fail("No exception thrown for listener == null"); - } - catch (IllegalArgumentException e) { - } - - VisibilityWindowListener listener = new VisibilityWindowListener() { - public void hide(WindowEvent event) { - } - public void show(WindowEvent event) { - } - }; - for (int i = 0; i < 100; i++) browser.addVisibilityWindowListener(listener); - for (int i = 0; i < 100; i++) browser.removeVisibilityWindowListener(listener); -} - -public void test_back() { - shell.setText("test_back"); - for (int i = 0; i < 10; i++) { - browser.back(); - runLoopTimer(1); - } - /* returning 10 times in history - expecting false is returned */ - boolean result = browser.back(); - assertFalse(result); -} - -public void test_forward() { - shell.setText("test_forward"); - for (int i = 0; i < 10; i++) { - browser.forward(); - runLoopTimer(1); - } - /* going forward 10 times in history - expecting false is returned */ - boolean result = browser.forward(); - assertFalse(result); -} - -public void test_getUrl() { - shell.setText("test_getUrl"); - String string = browser.getUrl(); - assertTrue(string != null); -} - -public void test_isBackEnabled() { - shell.setText("test_isBackEnabled"); - - /* back should return the same value that isBackEnabled previously returned */ - assertEquals(browser.isBackEnabled(), browser.back()); - - for (int i = 0; i < 10; i++) { - browser.back(); - runLoopTimer(1); - } - /* going back 10 times in history - expecting false is returned */ - boolean result = browser.isBackEnabled(); - assertFalse(result); -} - -public void test_isForwardEnabled() { - shell.setText("test_isForwardEnabled"); - - /* forward should return the same value that isForwardEnabled previously returned */ - assertEquals(browser.isForwardEnabled(), browser.forward()); - - for (int i = 0; i < 10; i++) { - browser.forward(); - runLoopTimer(1); - } - /* going forward 10 times in history - expecting false is returned */ - boolean result = browser.isForwardEnabled(); - assertFalse(result); -} - -public void test_refresh() { - shell.setText("test_refresh"); - for (int i = 0; i < 10; i++) { - browser.refresh(); - runLoopTimer(1); - } -} - -public void test_removeCloseWindowListenerLorg_eclipse_swt_browser_CloseWindowListener() { - try { - browser.removeCloseWindowListener(null); - fail("No exception thrown for listener == null"); - } - catch (IllegalArgumentException e) { - } - // tested in addCloseWindowListener -} - -public void test_removeLocationListenerLorg_eclipse_swt_browser_LocationListener() { - try { - browser.removeLocationListener(null); - fail("No exception thrown for listener == null"); - } - catch (IllegalArgumentException e) { - } - // tested in addLocationListener -} - -public void test_removeOpenWindowListenerLorg_eclipse_swt_browser_OpenWindowListener() { - try { - browser.removeOpenWindowListener(null); - fail("No exception thrown for listener == null"); - } - catch (IllegalArgumentException e) { - } - // tested in addOpenWindowListener -} - -public void test_removeProgressListenerLorg_eclipse_swt_browser_ProgressListener() { - try { - browser.removeProgressListener(null); - fail("No exception thrown for listener == null"); - } - catch (IllegalArgumentException e) { - } - // tested in addProgressListener -} - -public void test_removeStatusTextListenerLorg_eclipse_swt_browser_StatusTextListener() { - try { - browser.removeStatusTextListener(null); - fail("No exception thrown for listener == null"); - } - catch (IllegalArgumentException e) { - } - // tested in addStatusTextListener -} - -public void test_removeTitleListenerLorg_eclipse_swt_browser_TitleListener() { - try { - browser.removeTitleListener(null); - fail("No exception thrown for listener == null"); - } - catch (IllegalArgumentException e) { - } - // tested in addTitleListener -} - -public void test_removeVisibilityWindowListenerLorg_eclipse_swt_browser_VisibilityWindowListener() { - try { - browser.removeVisibilityWindowListener(null); - fail("No exception thrown for listener == null"); - } - catch (IllegalArgumentException e) { - } - // tested in addVisibilityWindowListener -} - -public void test_setTextLjava_lang_String() { - shell.setText("test_setTextLjava_lang_String"); - - String html = "<HTML><HEAD><TITLE>HTML example 2</TITLE></HEAD><BODY><H1>HTML example 2</H1>"; - for (int i = 0; i < 1000; i++) { - html +="<P>That is a test line with the number "+i+"</P>"; - } - html += "</BODY></HTML>"; - boolean result = browser.setText(html); - assertTrue(result); - runLoopTimer(10); - - try { - browser.setText(null); - fail("No exception thrown for text == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_setUrlLjava_lang_String() { - shell.setText("test_setUrlLjava_lang_String"); - try { - browser.setUrl(null); - fail("No exception thrown for url == null"); - } - catch (IllegalArgumentException e) { - } - - - /* THIS TEST REQUIRES WEB ACCESS! How else can we really test the http:// part of a browser widget? */ - browser.setUrl("http://www.eclipse.org/swt"); - runLoopTimer(10); -} - -public void test_stop() { - shell.setText("test_stop"); - /* THIS TEST REQUIRES WEB ACCESS! How else can we really test the http:// part of a browser widget? */ - browser.setUrl("http://www.eclipse.org/swt"); - runLoopTimer(1); - browser.stop(); - runLoopTimer(10); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_browser_Browser((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addCloseWindowListenerLorg_eclipse_swt_browser_CloseWindowListener"); - methodNames.addElement("test_addLocationListenerLorg_eclipse_swt_browser_LocationListener"); - methodNames.addElement("test_addOpenWindowListenerLorg_eclipse_swt_browser_OpenWindowListener"); - methodNames.addElement("test_addProgressListenerLorg_eclipse_swt_browser_ProgressListener"); - methodNames.addElement("test_addStatusTextListenerLorg_eclipse_swt_browser_StatusTextListener"); - methodNames.addElement("test_addTitleListenerLorg_eclipse_swt_browser_TitleListener"); - methodNames.addElement("test_addVisibilityWindowListenerLorg_eclipse_swt_browser_VisibilityWindowListener"); - methodNames.addElement("test_back"); - methodNames.addElement("test_forward"); - methodNames.addElement("test_getUrl"); - methodNames.addElement("test_isBackEnabled"); - methodNames.addElement("test_isForwardEnabled"); - methodNames.addElement("test_refresh"); - methodNames.addElement("test_removeCloseWindowListenerLorg_eclipse_swt_browser_CloseWindowListener"); - methodNames.addElement("test_removeLocationListenerLorg_eclipse_swt_browser_LocationListener"); - methodNames.addElement("test_removeOpenWindowListenerLorg_eclipse_swt_browser_OpenWindowListener"); - methodNames.addElement("test_removeProgressListenerLorg_eclipse_swt_browser_ProgressListener"); - methodNames.addElement("test_removeStatusTextListenerLorg_eclipse_swt_browser_StatusTextListener"); - methodNames.addElement("test_removeTitleListenerLorg_eclipse_swt_browser_TitleListener"); - methodNames.addElement("test_removeVisibilityWindowListenerLorg_eclipse_swt_browser_VisibilityWindowListener"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setUrlLjava_lang_String"); - methodNames.addElement("test_stop"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addCloseWindowListenerLorg_eclipse_swt_browser_CloseWindowListener")) test_addCloseWindowListenerLorg_eclipse_swt_browser_CloseWindowListener(); - else if (getName().equals("test_addLocationListenerLorg_eclipse_swt_browser_LocationListener")) test_addLocationListenerLorg_eclipse_swt_browser_LocationListener(); - else if (getName().equals("test_addOpenWindowListenerLorg_eclipse_swt_browser_OpenWindowListener")) test_addOpenWindowListenerLorg_eclipse_swt_browser_OpenWindowListener(); - else if (getName().equals("test_addProgressListenerLorg_eclipse_swt_browser_ProgressListener")) test_addProgressListenerLorg_eclipse_swt_browser_ProgressListener(); - else if (getName().equals("test_addStatusTextListenerLorg_eclipse_swt_browser_StatusTextListener")) test_addStatusTextListenerLorg_eclipse_swt_browser_StatusTextListener(); - else if (getName().equals("test_addTitleListenerLorg_eclipse_swt_browser_TitleListener")) test_addTitleListenerLorg_eclipse_swt_browser_TitleListener(); - else if (getName().equals("test_addVisibilityWindowListenerLorg_eclipse_swt_browser_VisibilityWindowListener")) test_addVisibilityWindowListenerLorg_eclipse_swt_browser_VisibilityWindowListener(); - else if (getName().equals("test_back")) test_back(); - else if (getName().equals("test_forward")) test_forward(); - else if (getName().equals("test_getUrl")) test_getUrl(); - else if (getName().equals("test_isBackEnabled")) test_isBackEnabled(); - else if (getName().equals("test_isForwardEnabled")) test_isForwardEnabled(); - else if (getName().equals("test_refresh")) test_refresh(); - else if (getName().equals("test_removeCloseWindowListenerLorg_eclipse_swt_browser_CloseWindowListener")) test_removeCloseWindowListenerLorg_eclipse_swt_browser_CloseWindowListener(); - else if (getName().equals("test_removeLocationListenerLorg_eclipse_swt_browser_LocationListener")) test_removeLocationListenerLorg_eclipse_swt_browser_LocationListener(); - else if (getName().equals("test_removeOpenWindowListenerLorg_eclipse_swt_browser_OpenWindowListener")) test_removeOpenWindowListenerLorg_eclipse_swt_browser_OpenWindowListener(); - else if (getName().equals("test_removeProgressListenerLorg_eclipse_swt_browser_ProgressListener")) test_removeProgressListenerLorg_eclipse_swt_browser_ProgressListener(); - else if (getName().equals("test_removeStatusTextListenerLorg_eclipse_swt_browser_StatusTextListener")) test_removeStatusTextListenerLorg_eclipse_swt_browser_StatusTextListener(); - else if (getName().equals("test_removeTitleListenerLorg_eclipse_swt_browser_TitleListener")) test_removeTitleListenerLorg_eclipse_swt_browser_TitleListener(); - else if (getName().equals("test_removeVisibilityWindowListenerLorg_eclipse_swt_browser_VisibilityWindowListener")) test_removeVisibilityWindowListenerLorg_eclipse_swt_browser_VisibilityWindowListener(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setUrlLjava_lang_String")) test_setUrlLjava_lang_String(); - else if (getName().equals("test_stop")) test_stop(); - else super.runTest(); -} - -/* custom */ -Browser browser; - -void runLoopTimer(final int seconds) { - final boolean[] exit = {false}; - new Thread() { - public void run() { - try {Thread.sleep(seconds * 1000);} catch (Exception e) {} - exit[0] = true; - /* wake up the event loop */ - Display display = Display.getDefault(); - if (!display.isDisposed()) { - display.asyncExec(new Runnable() { - public void run() { - if (!shell.isDisposed()) shell.redraw(); - } - }); - } - } - }.start(); - shell.open(); - Display display = Display.getCurrent(); - while (!exit[0] && !shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_CloseWindowListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_CloseWindowListener.java deleted file mode 100644 index 7c5da2509a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_CloseWindowListener.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.browser.CloseWindowListener - * - * @see org.eclipse.swt.browser.CloseWindowListener - */ -public class Test_org_eclipse_swt_browser_CloseWindowListener extends SwtTestCase { - -public Test_org_eclipse_swt_browser_CloseWindowListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_closeLorg_eclipse_swt_browser_WindowEvent() { - Display display = Display.getCurrent(); - Shell shell = new Shell(display); - Browser browser = new Browser(shell, SWT.NONE); - browser.addCloseWindowListener(new CloseWindowListener() { - public void close(WindowEvent event) { - } - }); - shell.close(); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_browser_CloseWindowListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_closeLorg_eclipse_swt_browser_WindowEvent"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_closeLorg_eclipse_swt_browser_WindowEvent")) test_closeLorg_eclipse_swt_browser_WindowEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_LocationAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_LocationAdapter.java deleted file mode 100644 index 78397933f3..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_LocationAdapter.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.browser.LocationAdapter - * - * @see org.eclipse.swt.browser.LocationAdapter - */ -public class Test_org_eclipse_swt_browser_LocationAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_browser_LocationAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - LocationAdapter adapter = new LocationAdapter() {}; -} - -public void test_changedLorg_eclipse_swt_browser_LocationEvent() { - Display display = Display.getCurrent(); - Shell shell = new Shell(display); - Browser browser = new Browser(shell, SWT.NONE); - LocationAdapter adapter = new LocationAdapter() { - }; - browser.addLocationListener(adapter); - shell.close(); -} - -public void test_changingLorg_eclipse_swt_browser_LocationEvent() { - // tested in test_changedLorg_eclipse_swt_browser_LocationEvent -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_browser_LocationAdapter((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_changedLorg_eclipse_swt_browser_LocationEvent"); - methodNames.addElement("test_changingLorg_eclipse_swt_browser_LocationEvent"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_changedLorg_eclipse_swt_browser_LocationEvent")) test_changedLorg_eclipse_swt_browser_LocationEvent(); - else if (getName().equals("test_changingLorg_eclipse_swt_browser_LocationEvent")) test_changingLorg_eclipse_swt_browser_LocationEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_LocationListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_LocationListener.java deleted file mode 100644 index c5dcfb88b2..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_LocationListener.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.browser.LocationListener - * - * @see org.eclipse.swt.browser.LocationListener - */ -public class Test_org_eclipse_swt_browser_LocationListener extends SwtTestCase { - -public Test_org_eclipse_swt_browser_LocationListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_changedLorg_eclipse_swt_browser_LocationEvent() { - Display display = Display.getCurrent(); - Shell shell = new Shell(display); - Browser browser = new Browser(shell, SWT.NONE); - browser.addLocationListener(new LocationListener() { - public void changed(LocationEvent event) { - } - public void changing(LocationEvent event) { - } - }); - shell.close(); -} - -public void test_changingLorg_eclipse_swt_browser_LocationEvent() { - // tested in test_changedLorg_eclipse_swt_browser_LocationEvent -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_browser_LocationListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_changedLorg_eclipse_swt_browser_LocationEvent"); - methodNames.addElement("test_changingLorg_eclipse_swt_browser_LocationEvent"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_changedLorg_eclipse_swt_browser_LocationEvent")) test_changedLorg_eclipse_swt_browser_LocationEvent(); - else if (getName().equals("test_changingLorg_eclipse_swt_browser_LocationEvent")) test_changingLorg_eclipse_swt_browser_LocationEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_OpenWindowListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_OpenWindowListener.java deleted file mode 100644 index 021ffd2286..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_OpenWindowListener.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.browser.OpenWindowListener - * - * @see org.eclipse.swt.browser.OpenWindowListener - */ -public class Test_org_eclipse_swt_browser_OpenWindowListener extends SwtTestCase { - -public Test_org_eclipse_swt_browser_OpenWindowListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_openWindowLorg_eclipse_swt_browser_WindowEvent() { - Display display = Display.getCurrent(); - Shell shell = new Shell(display); - Browser browser = new Browser(shell, SWT.NONE); - browser.addOpenWindowListener(new OpenWindowListener() { - public void open(WindowEvent event) { - } - }); - shell.close(); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_browser_OpenWindowListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_openWindowLorg_eclipse_swt_browser_WindowEvent"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_openWindowLorg_eclipse_swt_browser_WindowEvent")) test_openWindowLorg_eclipse_swt_browser_WindowEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_ProgressAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_ProgressAdapter.java deleted file mode 100644 index 70db06c6ed..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_ProgressAdapter.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.browser.ProgressAdapter - * - * @see org.eclipse.swt.browser.ProgressAdapter - */ -public class Test_org_eclipse_swt_browser_ProgressAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_browser_ProgressAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - ProgressAdapter adapter = new ProgressAdapter() {}; -} - -public void test_changedLorg_eclipse_swt_browser_ProgressEvent() { - Display display = Display.getCurrent(); - Shell shell = new Shell(display); - Browser browser = new Browser(shell, SWT.NONE); - browser.addProgressListener(new ProgressAdapter() {}); - shell.close(); -} - -public void test_completedLorg_eclipse_swt_browser_ProgressEvent() { - warnUnimpl("Test test_completedLorg_eclipse_swt_browser_ProgressEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_browser_ProgressAdapter((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_changedLorg_eclipse_swt_browser_ProgressEvent"); - methodNames.addElement("test_completedLorg_eclipse_swt_browser_ProgressEvent"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_changedLorg_eclipse_swt_browser_ProgressEvent")) test_changedLorg_eclipse_swt_browser_ProgressEvent(); - else if (getName().equals("test_completedLorg_eclipse_swt_browser_ProgressEvent")) test_completedLorg_eclipse_swt_browser_ProgressEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_ProgressListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_ProgressListener.java deleted file mode 100644 index c41ca3d712..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_ProgressListener.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.browser.ProgressListener - * - * @see org.eclipse.swt.browser.ProgressListener - */ -public class Test_org_eclipse_swt_browser_ProgressListener extends SwtTestCase { - -public Test_org_eclipse_swt_browser_ProgressListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_changedLorg_eclipse_swt_browser_ProgressEvent() { - Display display = Display.getCurrent(); - Shell shell = new Shell(display); - Browser browser = new Browser(shell, SWT.NONE); - browser.addProgressListener(new ProgressListener() { - public void changed(ProgressEvent event) { - } - public void completed(ProgressEvent event) { - } - }); - shell.close(); -} - -public void test_completedLorg_eclipse_swt_browser_ProgressEvent() { - // tested in test_changedLorg_eclipse_swt_browser_ProgressEvent -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_browser_ProgressListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_changedLorg_eclipse_swt_browser_ProgressEvent"); - methodNames.addElement("test_completedLorg_eclipse_swt_browser_ProgressEvent"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_changedLorg_eclipse_swt_browser_ProgressEvent")) test_changedLorg_eclipse_swt_browser_ProgressEvent(); - else if (getName().equals("test_completedLorg_eclipse_swt_browser_ProgressEvent")) test_completedLorg_eclipse_swt_browser_ProgressEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_StatusTextListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_StatusTextListener.java deleted file mode 100644 index 9d74dd851b..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_StatusTextListener.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.browser.StatusTextListener - * - * @see org.eclipse.swt.browser.StatusTextListener - */ -public class Test_org_eclipse_swt_browser_StatusTextListener extends SwtTestCase { - -public Test_org_eclipse_swt_browser_StatusTextListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_changedLorg_eclipse_swt_browser_StatusTextEvent() { - Display display = Display.getCurrent(); - Shell shell = new Shell(display); - Browser browser = new Browser(shell, SWT.NONE); - browser.addStatusTextListener(new StatusTextListener() { - public void changed(StatusTextEvent event) { - } - }); - shell.close(); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_browser_StatusTextListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_changedLorg_eclipse_swt_browser_StatusTextEvent"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_changedLorg_eclipse_swt_browser_StatusTextEvent")) test_changedLorg_eclipse_swt_browser_StatusTextEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_TitleListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_TitleListener.java deleted file mode 100644 index 5024e5c6cf..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_TitleListener.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.browser.TitleListener - * - * @see org.eclipse.swt.browser.TitleListener - */ -public class Test_org_eclipse_swt_browser_TitleListener extends SwtTestCase { - -public Test_org_eclipse_swt_browser_TitleListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_changedLorg_eclipse_swt_browser_TitleEvent() { - Display display = Display.getCurrent(); - Shell shell = new Shell(display); - Browser browser = new Browser(shell, SWT.NONE); - browser.addTitleListener(new TitleListener() { - public void changed(TitleEvent event) { - } - }); - shell.close(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_browser_TitleListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_changedLorg_eclipse_swt_browser_TitleEvent"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_changedLorg_eclipse_swt_browser_TitleEvent")) test_changedLorg_eclipse_swt_browser_TitleEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_VisibilityWindowAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_VisibilityWindowAdapter.java deleted file mode 100644 index 3bfe0fa640..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_VisibilityWindowAdapter.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.browser.VisibilityWindowAdapter - * - * @see org.eclipse.swt.browser.VisibilityWindowAdapter - */ -public class Test_org_eclipse_swt_browser_VisibilityWindowAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_browser_VisibilityWindowAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - new VisibilityWindowAdapter() {}; -} - -public void test_hideLorg_eclipse_swt_browser_WindowEvent() { - Display display = Display.getCurrent(); - Shell shell = new Shell(display); - Browser browser = new Browser(shell, SWT.NONE); - browser.addVisibilityWindowListener(new VisibilityWindowAdapter(){}); - shell.close(); -} - -public void test_showLorg_eclipse_swt_browser_WindowEvent() { - // tested in test_hideLorg_eclipse_swt_browser_WindowEvent -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_browser_VisibilityWindowAdapter((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_hideLorg_eclipse_swt_browser_WindowEvent"); - methodNames.addElement("test_showLorg_eclipse_swt_browser_WindowEvent"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_hideLorg_eclipse_swt_browser_WindowEvent")) test_hideLorg_eclipse_swt_browser_WindowEvent(); - else if (getName().equals("test_showLorg_eclipse_swt_browser_WindowEvent")) test_showLorg_eclipse_swt_browser_WindowEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_VisibilityWindowListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_VisibilityWindowListener.java deleted file mode 100644 index ab344c1566..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_VisibilityWindowListener.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.browser.VisibilityWindowListener - * - * @see org.eclipse.swt.browser.VisibilityWindowListener - */ -public class Test_org_eclipse_swt_browser_VisibilityWindowListener extends SwtTestCase { - -public Test_org_eclipse_swt_browser_VisibilityWindowListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_hideLorg_eclipse_swt_browser_WindowEvent() { - Display display = Display.getCurrent(); - Shell shell = new Shell(display); - Browser browser = new Browser(shell, SWT.NONE); - browser.addVisibilityWindowListener(new VisibilityWindowListener() { - public void hide(WindowEvent event) { - } - public void show(WindowEvent event) { - } - }); - shell.close(); -} - -public void test_showLorg_eclipse_swt_browser_WindowEvent() { - // tested in test_hideLorg_eclipse_swt_browser_WindowEvent -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_browser_VisibilityWindowListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_hideLorg_eclipse_swt_browser_WindowEvent"); - methodNames.addElement("test_showLorg_eclipse_swt_browser_WindowEvent"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_hideLorg_eclipse_swt_browser_WindowEvent")) test_hideLorg_eclipse_swt_browser_WindowEvent(); - else if (getName().equals("test_showLorg_eclipse_swt_browser_WindowEvent")) test_showLorg_eclipse_swt_browser_WindowEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_AnimatedProgress.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_AnimatedProgress.java deleted file mode 100644 index 7d80cb2b30..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_AnimatedProgress.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.AnimatedProgress - * - * @see org.eclipse.swt.custom.AnimatedProgress - */ -public class Test_org_eclipse_swt_custom_AnimatedProgress extends Test_org_eclipse_swt_widgets_Canvas { - -public Test_org_eclipse_swt_custom_AnimatedProgress(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_clear() { - warnUnimpl("Test test_clear not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_start() { - warnUnimpl("Test test_start not written"); -} - -public void test_stop() { - warnUnimpl("Test test_stop not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_AnimatedProgress((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_clear"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_start"); - methodNames.addElement("test_stop"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Canvas.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_clear")) test_clear(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_start")) test_start(); - else if (getName().equals("test_stop")) test_stop(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentEvent.java deleted file mode 100644 index 64840e7e12..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentEvent.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.BidiSegmentEvent - * - * @see org.eclipse.swt.custom.BidiSegmentEvent - */ -public class Test_org_eclipse_swt_custom_BidiSegmentEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_custom_BidiSegmentEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_BidiSegmentEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentListener.java deleted file mode 100644 index 85919e6460..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BidiSegmentListener.java +++ /dev/null @@ -1,190 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.Test; -import junit.framework.TestSuite; -import junit.textui.TestRunner; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.BidiSegmentEvent; -import org.eclipse.swt.custom.BidiSegmentListener; -import org.eclipse.swt.custom.StyleRange; -import org.eclipse.swt.custom.StyledText; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.internal.BidiUtil; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.BidiSegmentListener - * - * @see org.eclipse.swt.custom.BidiSegmentListener - */ -public class Test_org_eclipse_swt_custom_BidiSegmentListener extends SwtTestCase { - Shell shell; - StyledText text; - boolean listenerCalled; - String line = "Line1"; - -public static void main(String[] args) { - TestRunner.run(suite()); -} -public Test_org_eclipse_swt_custom_BidiSegmentListener(String name) { - super(name); -} - -private boolean isBidi() { - return BidiUtil.isBidiPlatform(); -} -protected void setUp() { - shell = new Shell(); - text = new StyledText(shell, SWT.NULL); -} -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_BidiSegmentListener((String)e.nextElement())); - } - return suite; -} -protected void tearDown() { - shell.dispose(); -} -private void testListener(final String message, final int[] segments, boolean exceptionExpected) { - boolean exceptionThrown = false; - BidiSegmentListener listener = new BidiSegmentListener() { - public void lineGetSegments(BidiSegmentEvent event) { - assertEquals(message + " incorrect BidiSegmentEvent", 0, event.lineOffset); - assertEquals(message + " incorrect BidiSegmentEvent", line, event.lineText); - - event.segments = segments; - listenerCalled = true; - } - }; - - listenerCalled = false; - try { - text.addBidiSegmentListener(listener); - text.getLocationAtOffset(0); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - finally { - text.removeBidiSegmentListener(listener); - } - if (exceptionExpected) { - assertTrue(message + " expected exception not thrown", exceptionThrown); - } - else { - assertTrue(message + " unexpected exception thrown", exceptionThrown == false); - } - if (isBidi()) { - assertTrue(message + " listener not called", listenerCalled); - } - else { - assertTrue(message + " listener called when it shouldn't be", listenerCalled == false); - } -} -private void testStyleRangeSegmenting(final int[] segments, int[] boldRanges) { - boolean exceptionThrown = false; - BidiSegmentListener listener = new BidiSegmentListener() { - public void lineGetSegments(BidiSegmentEvent event) { - assertEquals(" incorrect BidiSegmentEvent", 0, event.lineOffset); - assertEquals(" incorrect BidiSegmentEvent", line, event.lineText); - - event.segments = segments; - listenerCalled = true; - } - }; - - listenerCalled = false; - try { - text.addBidiSegmentListener(listener); - text.setStyleRange(null); - for (int i=0; i<boldRanges.length; i+=2) { - StyleRange styleRange = new StyleRange(boldRanges[i], boldRanges[i+1], null, null, SWT.BOLD); - text.setStyleRange(styleRange); - }; - text.getLocationAtOffset(0); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - finally { - text.removeBidiSegmentListener(listener); - } - assertTrue(" unexpected exception thrown", exceptionThrown == false); - if (isBidi()) { - assertTrue(" listener not called", listenerCalled); - } - else { - assertTrue(" listener called when it shouldn't be", listenerCalled == false); - } -} - -public void test_lineGetSegmentsLorg_eclipse_swt_custom_BidiSegmentEvent() { - int lineLength = line.length(); - - text.setText(line); - // should not cause an exception - testListener(":a:", null, false); - testListener(":b:", new int[] {0, lineLength / 2, lineLength}, false); - testListener(":c:", new int[] {0, lineLength / 2}, false); - - // should all cause an exception on a bidi platform - if (isBidi()) { - testListener(":d:", new int[] {lineLength / 2}, true); - testListener(":e:", new int[] {0, 1, 1, lineLength / 2}, true); - testListener(":f:", new int[] {0, 1, 2, lineLength + 1}, true); - testListener(":g:", new int[] {0, 1, lineLength + 1, lineLength + 1}, true); - testListener(":h:", new int[] {0, 2, 1}, true); - testListener(":i:", new int[] {0, -1, 2}, true); - testListener(":j:", new int[] {0, -1, 2}, true); - } - - // test bold segmenting - line = "this is a line with 50 chars - **** **** **** ****"; - text.setText(line); - // should segment as int[] {0,5,5,2,12,3,20,5} - testStyleRangeSegmenting(new int[] {0,5,10,15,20,25}, new int[] {0,5,5,2,12,3,20,5}); - // should segment as int[] {0,5,5,1,7,3,10,3,15,5,20,5} - testStyleRangeSegmenting(new int[] {0,5,10,15,20,25}, new int[] {0,6,7,6,15,10}); - // should segment as int[] {0,5,5,5,10,5} - testStyleRangeSegmenting(new int[] {0,5,10,15}, new int[] {0,15}); - // should segment as int[] {0,5} - testStyleRangeSegmenting(new int[] {0,5}, new int[] {0,5}); - // should segment as int[] {2,3} - testStyleRangeSegmenting(new int[] {0,5}, new int[] {2,3}); - // should segment as int[] {0,2} - testStyleRangeSegmenting(new int[] {0,5}, new int[] {0,2}); - // should segment as int[] {10,5} - testStyleRangeSegmenting(new int[] {0,5,10,15}, new int[] {10,5}); - // should segment as int[] {12,3} - testStyleRangeSegmenting(new int[] {0,5,10,15}, new int[] {12,3}); - // should segment as int[] {3,2,5,5,10,3,21,4,25,3} - testStyleRangeSegmenting(new int[] {0,5,10,15,20,25,30}, new int[] {3,10,21,7}); - // should segment as int[] {10,2} - line = "test1test2/r/n"; - text.setText(line); - testStyleRangeSegmenting(new int[] {0,5}, new int[] {10,2}); -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_lineGetSegmentsLorg_eclipse_swt_custom_BidiSegmentEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_lineGetSegmentsLorg_eclipse_swt_custom_BidiSegmentEvent")) test_lineGetSegmentsLorg_eclipse_swt_custom_BidiSegmentEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BusyIndicator.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BusyIndicator.java deleted file mode 100644 index 6c07f50960..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_BusyIndicator.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.BusyIndicator - * - * @see org.eclipse.swt.custom.BusyIndicator - */ -public class Test_org_eclipse_swt_custom_BusyIndicator extends SwtTestCase { - -public Test_org_eclipse_swt_custom_BusyIndicator(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_showWhileLorg_eclipse_swt_widgets_DisplayLjava_lang_Runnable() { - warnUnimpl("Test test_showWhileLorg_eclipse_swt_widgets_DisplayLjava_lang_Runnable not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_BusyIndicator((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_showWhileLorg_eclipse_swt_widgets_DisplayLjava_lang_Runnable"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_showWhileLorg_eclipse_swt_widgets_DisplayLjava_lang_Runnable")) test_showWhileLorg_eclipse_swt_widgets_DisplayLjava_lang_Runnable(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java deleted file mode 100644 index 76d3299e70..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CCombo.java +++ /dev/null @@ -1,335 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.CCombo - * - * @see org.eclipse.swt.custom.CCombo - */ -public class Test_org_eclipse_swt_custom_CCombo extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_custom_CCombo(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_addLjava_lang_String() { - warnUnimpl("Test test_addLjava_lang_String not written"); -} - -public void test_addLjava_lang_StringI() { - warnUnimpl("Test test_addLjava_lang_StringI not written"); -} - -public void test_addModifyListenerLorg_eclipse_swt_events_ModifyListener() { - warnUnimpl("Test test_addModifyListenerLorg_eclipse_swt_events_ModifyListener not written"); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_clearSelection() { - warnUnimpl("Test test_clearSelection not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_deselectAll() { - warnUnimpl("Test test_deselectAll not written"); -} - -public void test_deselectI() { - warnUnimpl("Test test_deselectI not written"); -} - -public void test_getChildren() { - warnUnimpl("Test test_getChildren not written"); -} - -public void test_getEditable() { - warnUnimpl("Test test_getEditable not written"); -} - -public void test_getItemCount() { - warnUnimpl("Test test_getItemCount not written"); -} - -public void test_getItemHeight() { - warnUnimpl("Test test_getItemHeight not written"); -} - -public void test_getItemI() { - warnUnimpl("Test test_getItemI not written"); -} - -public void test_getItems() { - warnUnimpl("Test test_getItems not written"); -} - -public void test_getSelection() { - warnUnimpl("Test test_getSelection not written"); -} - -public void test_getSelectionIndex() { - warnUnimpl("Test test_getSelectionIndex not written"); -} - -public void test_getStyle() { - warnUnimpl("Test test_getStyle not written"); -} - -public void test_getText() { - warnUnimpl("Test test_getText not written"); -} - -public void test_getTextHeight() { - warnUnimpl("Test test_getTextHeight not written"); -} - -public void test_getTextLimit() { - warnUnimpl("Test test_getTextLimit not written"); -} - -public void test_indexOfLjava_lang_String() { - warnUnimpl("Test test_indexOfLjava_lang_String not written"); -} - -public void test_indexOfLjava_lang_StringI() { - warnUnimpl("Test test_indexOfLjava_lang_StringI not written"); -} - -public void test_isFocusControl() { - warnUnimpl("Test test_isFocusControl not written"); -} - -public void test_redraw() { - warnUnimpl("Test test_redraw not written"); -} - -public void test_redrawIIIIZ() { - warnUnimpl("Test test_redrawIIIIZ not written"); -} - -public void test_removeAll() { - warnUnimpl("Test test_removeAll not written"); -} - -public void test_removeI() { - warnUnimpl("Test test_removeI not written"); -} - -public void test_removeII() { - warnUnimpl("Test test_removeII not written"); -} - -public void test_removeLjava_lang_String() { - warnUnimpl("Test test_removeLjava_lang_String not written"); -} - -public void test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener() { - warnUnimpl("Test test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_selectI() { - warnUnimpl("Test test_selectI not written"); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setEditableZ() { - warnUnimpl("Test test_setEditableZ not written"); -} - -public void test_setEnabledZ() { - warnUnimpl("Test test_setEnabledZ not written"); -} - -public void test_setFocus() { - warnUnimpl("Test test_setFocus not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written"); -} - -public void test_setForegroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setForegroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setItemILjava_lang_String() { - warnUnimpl("Test test_setItemILjava_lang_String not written"); -} - -public void test_setItems$Ljava_lang_String() { - warnUnimpl("Test test_setItems$Ljava_lang_String not written"); -} - -public void test_setSelectionLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_setSelectionLorg_eclipse_swt_graphics_Point not written"); -} - -public void test_setTextLimitI() { - warnUnimpl("Test test_setTextLimitI not written"); -} - -public void test_setTextLjava_lang_String() { - warnUnimpl("Test test_setTextLjava_lang_String not written"); -} - -public void test_setToolTipTextLjava_lang_String() { - warnUnimpl("Test test_setToolTipTextLjava_lang_String not written"); -} - -public void test_setVisibleZ() { - warnUnimpl("Test test_setVisibleZ not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_CCombo((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addLjava_lang_String"); - methodNames.addElement("test_addLjava_lang_StringI"); - methodNames.addElement("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_clearSelection"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_deselectAll"); - methodNames.addElement("test_deselectI"); - methodNames.addElement("test_getChildren"); - methodNames.addElement("test_getEditable"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItemHeight"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionIndex"); - methodNames.addElement("test_getStyle"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_getTextHeight"); - methodNames.addElement("test_getTextLimit"); - methodNames.addElement("test_indexOfLjava_lang_String"); - methodNames.addElement("test_indexOfLjava_lang_StringI"); - methodNames.addElement("test_isFocusControl"); - methodNames.addElement("test_redraw"); - methodNames.addElement("test_redrawIIIIZ"); - methodNames.addElement("test_removeAll"); - methodNames.addElement("test_removeI"); - methodNames.addElement("test_removeII"); - methodNames.addElement("test_removeLjava_lang_String"); - methodNames.addElement("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_selectI"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setEditableZ"); - methodNames.addElement("test_setEnabledZ"); - methodNames.addElement("test_setFocus"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setItemILjava_lang_String"); - methodNames.addElement("test_setItems$Ljava_lang_String"); - methodNames.addElement("test_setSelectionLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setTextLimitI"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setToolTipTextLjava_lang_String"); - methodNames.addElement("test_setVisibleZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addLjava_lang_String")) test_addLjava_lang_String(); - else if (getName().equals("test_addLjava_lang_StringI")) test_addLjava_lang_StringI(); - else if (getName().equals("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_addModifyListenerLorg_eclipse_swt_events_ModifyListener(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_clearSelection")) test_clearSelection(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_deselectAll")) test_deselectAll(); - else if (getName().equals("test_deselectI")) test_deselectI(); - else if (getName().equals("test_getChildren")) test_getChildren(); - else if (getName().equals("test_getEditable")) test_getEditable(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItemHeight")) test_getItemHeight(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionIndex")) test_getSelectionIndex(); - else if (getName().equals("test_getStyle")) test_getStyle(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_getTextHeight")) test_getTextHeight(); - else if (getName().equals("test_getTextLimit")) test_getTextLimit(); - else if (getName().equals("test_indexOfLjava_lang_String")) test_indexOfLjava_lang_String(); - else if (getName().equals("test_indexOfLjava_lang_StringI")) test_indexOfLjava_lang_StringI(); - else if (getName().equals("test_isFocusControl")) test_isFocusControl(); - else if (getName().equals("test_redraw")) test_redraw(); - else if (getName().equals("test_redrawIIIIZ")) test_redrawIIIIZ(); - else if (getName().equals("test_removeAll")) test_removeAll(); - else if (getName().equals("test_removeI")) test_removeI(); - else if (getName().equals("test_removeII")) test_removeII(); - else if (getName().equals("test_removeLjava_lang_String")) test_removeLjava_lang_String(); - else if (getName().equals("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_selectI")) test_selectI(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setEditableZ")) test_setEditableZ(); - else if (getName().equals("test_setEnabledZ")) test_setEnabledZ(); - else if (getName().equals("test_setFocus")) test_setFocus(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setItemILjava_lang_String")) test_setItemILjava_lang_String(); - else if (getName().equals("test_setItems$Ljava_lang_String")) test_setItems$Ljava_lang_String(); - else if (getName().equals("test_setSelectionLorg_eclipse_swt_graphics_Point")) test_setSelectionLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setTextLimitI")) test_setTextLimitI(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setToolTipTextLjava_lang_String")) test_setToolTipTextLjava_lang_String(); - else if (getName().equals("test_setVisibleZ")) test_setVisibleZ(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CLabel.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CLabel.java deleted file mode 100644 index e67ac9a1df..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CLabel.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.CLabel - * - * @see org.eclipse.swt.custom.CLabel - */ -public class Test_org_eclipse_swt_custom_CLabel extends Test_org_eclipse_swt_widgets_Canvas { - -public Test_org_eclipse_swt_custom_CLabel(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_getAlignment() { - warnUnimpl("Test test_getAlignment not written"); -} - -public void test_getImage() { - warnUnimpl("Test test_getImage not written"); -} - -public void test_getText() { - warnUnimpl("Test test_getText not written"); -} - -public void test_getToolTipText() { - warnUnimpl("Test test_getToolTipText not written"); -} - -public void test_setAlignmentI() { - warnUnimpl("Test test_setAlignmentI not written"); -} - -public void test_setBackground$Lorg_eclipse_swt_graphics_Color$I() { - warnUnimpl("Test test_setBackground$Lorg_eclipse_swt_graphics_Color$I not written"); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written"); -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setTextLjava_lang_String() { - warnUnimpl("Test test_setTextLjava_lang_String not written"); -} - -public void test_setToolTipTextLjava_lang_String() { - warnUnimpl("Test test_setToolTipTextLjava_lang_String not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_CLabel((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getAlignment"); - methodNames.addElement("test_getImage"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_getToolTipText"); - methodNames.addElement("test_setAlignmentI"); - methodNames.addElement("test_setBackground$Lorg_eclipse_swt_graphics_Color$I"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setToolTipTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Canvas.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getAlignment")) test_getAlignment(); - else if (getName().equals("test_getImage")) test_getImage(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_getToolTipText")) test_getToolTipText(); - else if (getName().equals("test_setAlignmentI")) test_setAlignmentI(); - else if (getName().equals("test_setBackground$Lorg_eclipse_swt_graphics_Color$I")) test_setBackground$Lorg_eclipse_swt_graphics_Color$I(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Image")) test_setBackgroundLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setToolTipTextLjava_lang_String")) test_setToolTipTextLjava_lang_String(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolder.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolder.java deleted file mode 100644 index e0276cd77d..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolder.java +++ /dev/null @@ -1,244 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.CTabFolder - * - * @see org.eclipse.swt.custom.CTabFolder - */ -public class Test_org_eclipse_swt_custom_CTabFolder extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_custom_CTabFolder(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_addCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener() { - warnUnimpl("Test test_addCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener not written"); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_computeTrimIIII() { - warnUnimpl("Test test_computeTrimIIII not written"); -} - -public void test_getClientArea() { - warnUnimpl("Test test_getClientArea not written"); -} - -public void test_getItemCount() { - warnUnimpl("Test test_getItemCount not written"); -} - -public void test_getItemI() { - warnUnimpl("Test test_getItemI not written"); -} - -public void test_getItemLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_getItemLorg_eclipse_swt_graphics_Point not written"); -} - -public void test_getItems() { - warnUnimpl("Test test_getItems not written"); -} - -public void test_getSelection() { - warnUnimpl("Test test_getSelection not written"); -} - -public void test_getSelectionIndex() { - warnUnimpl("Test test_getSelectionIndex not written"); -} - -public void test_getTabHeight() { - warnUnimpl("Test test_getTabHeight not written"); -} - -public void test_getTopRight() { - warnUnimpl("Test test_getTopRight not written"); -} - -public void test_indexOfLorg_eclipse_swt_custom_CTabItem() { - warnUnimpl("Test test_indexOfLorg_eclipse_swt_custom_CTabItem not written"); -} - -public void test_removeCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener() { - warnUnimpl("Test test_removeCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setBorderVisibleZ() { - warnUnimpl("Test test_setBorderVisibleZ not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written"); -} - -public void test_setInsertMarkIZ() { - warnUnimpl("Test test_setInsertMarkIZ not written"); -} - -public void test_setInsertMarkLorg_eclipse_swt_custom_CTabItemZ() { - warnUnimpl("Test test_setInsertMarkLorg_eclipse_swt_custom_CTabItemZ not written"); -} - -public void test_setSelectionBackground$Lorg_eclipse_swt_graphics_Color$I() { - warnUnimpl("Test test_setSelectionBackground$Lorg_eclipse_swt_graphics_Color$I not written"); -} - -public void test_setSelectionBackgroundLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setSelectionBackgroundLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setSelectionForegroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setSelectionForegroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setSelectionI() { - warnUnimpl("Test test_setSelectionI not written"); -} - -public void test_setSelectionLorg_eclipse_swt_custom_CTabItem() { - warnUnimpl("Test test_setSelectionLorg_eclipse_swt_custom_CTabItem not written"); -} - -public void test_setTabHeightI() { - warnUnimpl("Test test_setTabHeightI not written"); -} - -public void test_setTopRightLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setTopRightLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_showItemLorg_eclipse_swt_custom_CTabItem() { - warnUnimpl("Test test_showItemLorg_eclipse_swt_custom_CTabItem not written"); -} - -public void test_showSelection() { - warnUnimpl("Test test_showSelection not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_CTabFolder((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_computeTrimIIII"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItemLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionIndex"); - methodNames.addElement("test_getTabHeight"); - methodNames.addElement("test_getTopRight"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_custom_CTabItem"); - methodNames.addElement("test_removeCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setBorderVisibleZ"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setInsertMarkIZ"); - methodNames.addElement("test_setInsertMarkLorg_eclipse_swt_custom_CTabItemZ"); - methodNames.addElement("test_setSelectionBackground$Lorg_eclipse_swt_graphics_Color$I"); - methodNames.addElement("test_setSelectionBackgroundLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setSelectionForegroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setSelectionI"); - methodNames.addElement("test_setSelectionLorg_eclipse_swt_custom_CTabItem"); - methodNames.addElement("test_setTabHeightI"); - methodNames.addElement("test_setTopRightLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_showItemLorg_eclipse_swt_custom_CTabItem"); - methodNames.addElement("test_showSelection"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener")) test_addCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItemLorg_eclipse_swt_graphics_Point")) test_getItemLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionIndex")) test_getSelectionIndex(); - else if (getName().equals("test_getTabHeight")) test_getTabHeight(); - else if (getName().equals("test_getTopRight")) test_getTopRight(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_custom_CTabItem")) test_indexOfLorg_eclipse_swt_custom_CTabItem(); - else if (getName().equals("test_removeCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener")) test_removeCTabFolderListenerLorg_eclipse_swt_custom_CTabFolderListener(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setBorderVisibleZ")) test_setBorderVisibleZ(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setInsertMarkIZ")) test_setInsertMarkIZ(); - else if (getName().equals("test_setInsertMarkLorg_eclipse_swt_custom_CTabItemZ")) test_setInsertMarkLorg_eclipse_swt_custom_CTabItemZ(); - else if (getName().equals("test_setSelectionBackground$Lorg_eclipse_swt_graphics_Color$I")) test_setSelectionBackground$Lorg_eclipse_swt_graphics_Color$I(); - else if (getName().equals("test_setSelectionBackgroundLorg_eclipse_swt_graphics_Image")) test_setSelectionBackgroundLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setSelectionForegroundLorg_eclipse_swt_graphics_Color")) test_setSelectionForegroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else if (getName().equals("test_setSelectionLorg_eclipse_swt_custom_CTabItem")) test_setSelectionLorg_eclipse_swt_custom_CTabItem(); - else if (getName().equals("test_setTabHeightI")) test_setTabHeightI(); - else if (getName().equals("test_setTopRightLorg_eclipse_swt_widgets_Control")) test_setTopRightLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_showItemLorg_eclipse_swt_custom_CTabItem")) test_showItemLorg_eclipse_swt_custom_CTabItem(); - else if (getName().equals("test_showSelection")) test_showSelection(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderAdapter.java deleted file mode 100644 index 058fae56e3..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderAdapter.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.CTabFolderAdapter - * - * @see org.eclipse.swt.custom.CTabFolderAdapter - */ -public class Test_org_eclipse_swt_custom_CTabFolderAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_custom_CTabFolderAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent() { - warnUnimpl("Test test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_CTabFolderAdapter((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent")) test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderEvent.java deleted file mode 100644 index 7ab9667578..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderEvent.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.CTabFolderEvent - * - * @see org.eclipse.swt.custom.CTabFolderEvent - */ -public class Test_org_eclipse_swt_custom_CTabFolderEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_custom_CTabFolderEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_CTabFolderEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderListener.java deleted file mode 100644 index 6c78461bfb..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabFolderListener.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.CTabFolderListener - * - * @see org.eclipse.swt.custom.CTabFolderListener - */ -public class Test_org_eclipse_swt_custom_CTabFolderListener extends SwtTestCase { - -public Test_org_eclipse_swt_custom_CTabFolderListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent() { - warnUnimpl("Test test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_CTabFolderListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent")) test_itemClosedLorg_eclipse_swt_custom_CTabFolderEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabItem.java deleted file mode 100644 index c6dcfe868f..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_CTabItem.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.CTabItem - * - * @see org.eclipse.swt.custom.CTabItem - */ -public class Test_org_eclipse_swt_custom_CTabItem extends Test_org_eclipse_swt_widgets_Item { - - CTabFolder cTabFolder; - CTabItem cTabItem; - -public Test_org_eclipse_swt_custom_CTabItem(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - cTabFolder = new CTabFolder(shell, SWT.NONE); - cTabItem = new CTabItem(cTabFolder, SWT.NONE); - setWidget(cTabItem); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_custom_CTabFolderI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_CTabFolderI not written"); -} - -public void test_ConstructorLorg_eclipse_swt_custom_CTabFolderII() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_CTabFolderII not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_getBounds() { - warnUnimpl("Test test_getBounds not written"); -} - -public void test_getControl() { - warnUnimpl("Test test_getControl not written"); -} - -public void test_getDisabledImage() { - warnUnimpl("Test test_getDisabledImage not written"); -} - -public void test_getParent() { - warnUnimpl("Test test_getParent not written"); -} - -public void test_getToolTipText() { - warnUnimpl("Test test_getToolTipText not written"); -} - -public void test_setControlLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setControlLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_setDisabledImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setDisabledImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setTextLjava_lang_String() { - warnUnimpl("Test test_setTextLjava_lang_String not written"); -} - -public void test_setToolTipTextLjava_lang_String() { - warnUnimpl("Test test_setToolTipTextLjava_lang_String not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_CTabItem((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_CTabFolderI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_CTabFolderII"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getControl"); - methodNames.addElement("test_getDisabledImage"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getToolTipText"); - methodNames.addElement("test_setControlLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setDisabledImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setToolTipTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_CTabFolderI")) test_ConstructorLorg_eclipse_swt_custom_CTabFolderI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_CTabFolderII")) test_ConstructorLorg_eclipse_swt_custom_CTabFolderII(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getControl")) test_getControl(); - else if (getName().equals("test_getDisabledImage")) test_getDisabledImage(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getToolTipText")) test_getToolTipText(); - else if (getName().equals("test_setControlLorg_eclipse_swt_widgets_Control")) test_setControlLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setDisabledImageLorg_eclipse_swt_graphics_Image")) test_setDisabledImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setToolTipTextLjava_lang_String")) test_setToolTipTextLjava_lang_String(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ControlEditor.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ControlEditor.java deleted file mode 100644 index ed4b089683..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ControlEditor.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.ControlEditor - * - * @see org.eclipse.swt.custom.ControlEditor - */ -public class Test_org_eclipse_swt_custom_ControlEditor extends SwtTestCase { - -public Test_org_eclipse_swt_custom_ControlEditor(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Composite() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Composite not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_getEditor() { - warnUnimpl("Test test_getEditor not written"); -} - -public void test_layout() { - warnUnimpl("Test test_layout not written"); -} - -public void test_setEditorLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setEditorLorg_eclipse_swt_widgets_Control not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_ControlEditor((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Composite"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getEditor"); - methodNames.addElement("test_layout"); - methodNames.addElement("test_setEditorLorg_eclipse_swt_widgets_Control"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Composite")) test_ConstructorLorg_eclipse_swt_widgets_Composite(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getEditor")) test_getEditor(); - else if (getName().equals("test_layout")) test_layout(); - else if (getName().equals("test_setEditorLorg_eclipse_swt_widgets_Control")) test_setEditorLorg_eclipse_swt_widgets_Control(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyEvent.java deleted file mode 100644 index 8a5631acae..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyEvent.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.ExtendedModifyEvent - * - * @see org.eclipse.swt.custom.ExtendedModifyEvent - */ -public class Test_org_eclipse_swt_custom_ExtendedModifyEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_custom_ExtendedModifyEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent() { - // this method tested by other test classes -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_ExtendedModifyEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent")) test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyListener.java deleted file mode 100644 index a745ab7a2e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ExtendedModifyListener.java +++ /dev/null @@ -1,325 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.ExtendedModifyListener - * - * @see org.eclipse.swt.custom.ExtendedModifyListener - */ -public class Test_org_eclipse_swt_custom_ExtendedModifyListener extends SwtTestCase { - Shell shell; - StyledText styledText; - int verify = -1; - -public Test_org_eclipse_swt_custom_ExtendedModifyListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} -protected void setUp() { - shell = new Shell(); - styledText = new StyledText(shell, SWT.NULL); - shell.open(); -} - -protected void tearDown() { -} - -public void test_modifyTextLorg_eclipse_swt_custom_ExtendedModifyEvent() { - ExtendedModifyListener listener = new ExtendedModifyListener() { - public void modifyText(ExtendedModifyEvent event) { - switch(verify) { - case 1 : { - assertTrue(":1a:", event.start == 0); - assertTrue(":1b:", event.length == 1); - assertTrue(":1c:", event.replacedText.equals("")); - break; - } - case 2 : { - assertTrue(":2a:", event.start == 0); - assertTrue(":2b:", event.length == 1); - assertTrue(":2c:", event.replacedText.equals("\n\n")); - break; - } - case 3 : { - assertTrue(":3a:", event.start == 0); - assertTrue(":3b:", event.length == 2); - assertTrue(":3c:", event.replacedText.equals("a")); - break; - } - case 4: { - assertTrue(":4:", false); - break; - } - case 5 : { - assertTrue(":5a:", event.start == 0); - assertTrue(":5b:", event.length == 1); - assertTrue(":5c:", event.replacedText.equals("")); - break; - } - case 6 : { - assertTrue(":6a:", event.start == 21); - assertTrue(":6b:", event.length == 0); - assertTrue(":6c:", event.replacedText.equals("\nline 4")); - break; - } - case 7 : { - assertTrue(":7a:", event.start == 5); - assertTrue(":7b:", event.length == 0); - assertTrue(":7c:", event.replacedText.equals("is a test")); - break; - } - case 8 : { - assertTrue(":8a:", event.start == 7); - assertTrue(":8b:", event.length == 0); - assertTrue(":8c:", event.replacedText.equals("\r\n")); - break; - } - case 9 : { - assertTrue(":9a:", event.start == 2); - assertTrue(":9b:", event.length == 4); - assertTrue(":9c:", event.replacedText.equals("\r\n")); - break; - } - case 10:{ - assertTrue(":10:", false); - break; - } - case 11: { - assertTrue(":11:", false); - break; - } - case 12: { - assertTrue(":12a:", event.start == 3); - assertTrue(":12b:", event.length == 1); - assertTrue(":12c:", event.replacedText.equals("")); - break; - } - case 13: { - assertTrue(":13a:", event.start == 2); - assertTrue(":13b:", event.length == 1); - assertTrue(":13c:", event.replacedText.equals("")); - break; - } - case 14: { - assertTrue(":14:", false); - break; - } - case 15: { - assertTrue(":15a:", event.start == 2); - assertTrue(":15b:", event.length == 6); - assertTrue(":15c:", event.replacedText.equals("\r\n")); - break; - } - case 16:{ - assertTrue(":16:", false); - break; - } - case 17: { - assertTrue(":17:", false); - break; - } - case 18: { - assertTrue(":18a:", event.start == 3); - assertTrue(":18b:", event.length == 7); - assertTrue(":18c:", event.replacedText.equals("")); - break; - } - case 19: { - assertTrue(":19a:", event.start == 2); - assertTrue(":19b:", event.length == 7); - assertTrue(":19c:", event.replacedText.equals("")); - break; - } - case 20: { - assertTrue(":20:", false); - break; - } - case 21: { - assertTrue(":21a:", event.start == 0); - assertTrue(":21b:", event.length == 16); - assertTrue(":21c:", event.replacedText.equals("L1\r\nL2\r\nL3\r\nL4\r\n")); - break; - } - } - } - }; - styledText.addExtendedModifyListener(listener); - - boolean exceptionHandled = false; - verify = 0; - styledText.setText("testing"); - verify = 1; - styledText.replaceTextRange(0, 0, "\n"); - - verify = 0; - styledText.setText("\n\n"); - verify = 2; - styledText.replaceTextRange(0, 2, "a"); - - verify = 0; - styledText.setText("a"); - verify = 3; - styledText.replaceTextRange(0, 1, "\n\n"); - - verify = 0; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - verify = 4; - try {styledText.replaceTextRange(3, 1, "test\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":4: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("Line 1\r\nLine 2"); - verify = 5; - styledText.replaceTextRange(0, 0, "\r"); - - verify = 0; - styledText.setText("This\nis a test\nline 3\nline 4"); - verify = 6; - styledText.replaceTextRange(21, 7, ""); - - verify = 0; - styledText.setText("This\nis a test\r"); - verify = 7; - styledText.replaceTextRange(5, 9, ""); - - verify = 0; - styledText.setText("\nL1\r\nL2\r\n"); - verify = 8; - styledText.replaceTextRange(7, 2, ""); - - verify = 0; - styledText.setText("L1\r\n"); - verify = 9; - styledText.replaceTextRange(2, 2, "test"); - - verify = 0; - styledText.setText("L1\r\n"); - verify = 10; - try {styledText.replaceTextRange(3, 1, "");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":10: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - verify = 11; - try {styledText.replaceTextRange(1, 2, "");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":11: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r"); - verify = 12; - styledText.replaceTextRange(3, 0, "\n"); - - verify = 0; - styledText.setText("L1\n"); - verify = 13; - styledText.replaceTextRange(2, 0, "\r"); - - verify = 0; - styledText.setText("L1\r\n"); - verify = 14; - try {styledText.replaceTextRange(3, 0, "test");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":14: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r\n"); - verify = 15; - styledText.replaceTextRange(2, 2, "test\n\n"); - - verify = 0; - styledText.setText("L1\r\n"); - verify = 16; - try {styledText.replaceTextRange(3, 1, "test\r\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":16: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - verify = 17; - try {styledText.replaceTextRange(1, 2, "test\n\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":17: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r"); - verify = 18; - styledText.replaceTextRange(3, 0, "\ntest\r\n"); - - verify = 0; - styledText.setText("L1\n"); - verify = 19; - styledText.replaceTextRange(2, 0, "test\r\r\r"); - - verify = 0; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - verify = 20; - try {styledText.replaceTextRange(3, 1, "test\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":20: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 21; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - styledText.removeExtendedModifyListener(listener); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_ExtendedModifyListener((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_modifyTextLorg_eclipse_swt_custom_ExtendedModifyEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_modifyTextLorg_eclipse_swt_custom_ExtendedModifyEvent")) test_modifyTextLorg_eclipse_swt_custom_ExtendedModifyEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundEvent.java deleted file mode 100644 index f2473fa66a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundEvent.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.LineBackgroundEvent - * - * @see org.eclipse.swt.custom.LineBackgroundEvent - */ -public class Test_org_eclipse_swt_custom_LineBackgroundEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_custom_LineBackgroundEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent() { - // this method tested by other test classes -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_LineBackgroundEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent")) test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundListener.java deleted file mode 100644 index a7661d8d07..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineBackgroundListener.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.LineBackgroundListener - * - * @see org.eclipse.swt.custom.LineBackgroundListener - */ -public class Test_org_eclipse_swt_custom_LineBackgroundListener extends SwtTestCase { - Shell shell; - StyledText styledText; - -public Test_org_eclipse_swt_custom_LineBackgroundListener(String name) { - super(name); -} -public static void main(String[] args) { - TestRunner.run(suite()); -} -protected void setUp() { - shell = new Shell(); - styledText = new StyledText(shell, SWT.NULL); - shell.open(); -} -protected void tearDown() { -} - -public void test_lineGetBackgroundLorg_eclipse_swt_custom_LineBackgroundEvent() { - LineBackgroundListener listener = new LineBackgroundListener() { - public void lineGetBackground(LineBackgroundEvent event) { - assertTrue(":1:", event.lineOffset==0); - assertTrue(":2:",event.lineText.equals("0123456789")); - } - }; - styledText.addLineBackgroundListener(listener); - styledText.setText("0123456789"); - // force get line bg callback - styledText.selectAll(); - styledText.copy(); - styledText.removeLineBackgroundListener(listener); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_LineBackgroundListener((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_lineGetBackgroundLorg_eclipse_swt_custom_LineBackgroundEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_lineGetBackgroundLorg_eclipse_swt_custom_LineBackgroundEvent")) test_lineGetBackgroundLorg_eclipse_swt_custom_LineBackgroundEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleEvent.java deleted file mode 100644 index d23bb3cbbe..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleEvent.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.LineStyleEvent - * - * @see org.eclipse.swt.custom.LineStyleEvent - */ -public class Test_org_eclipse_swt_custom_LineStyleEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_custom_LineStyleEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent() { - // this method tested by other test classes -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_LineStyleEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent")) test_ConstructorLorg_eclipse_swt_custom_StyledTextEvent(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleListener.java deleted file mode 100644 index 66206e5f8b..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_LineStyleListener.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.LineStyleListener - * - * @see org.eclipse.swt.custom.LineStyleListener - */ -public class Test_org_eclipse_swt_custom_LineStyleListener extends SwtTestCase { - Shell shell; - StyledText styledText; - -public Test_org_eclipse_swt_custom_LineStyleListener(String name) { - super(name); -} -public static void main(String[] args) { - TestRunner.run(suite()); -} -protected void setUp() { - shell = new Shell(); - styledText = new StyledText(shell, SWT.NULL); - shell.open(); -} - -protected void tearDown() { -} - -public void test_lineGetStyleLorg_eclipse_swt_custom_LineStyleEvent() { - LineStyleListener listener = new LineStyleListener() { - public void lineGetStyle(LineStyleEvent event) { - assertTrue(":1:", event.lineOffset==0); - assertTrue(":2:",event.lineText.equals("0123456789")); - } - }; - styledText.addLineStyleListener(listener); - styledText.setText("0123456789"); - // force get line styles callback - styledText.getLocationAtOffset(5); - styledText.removeLineStyleListener(listener); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_LineStyleListener((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_lineGetStyleLorg_eclipse_swt_custom_LineStyleEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_lineGetStyleLorg_eclipse_swt_custom_LineStyleEvent")) test_lineGetStyleLorg_eclipse_swt_custom_LineStyleEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_PopupList.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_PopupList.java deleted file mode 100644 index debe40cc7a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_PopupList.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.PopupList - * - * @see org.eclipse.swt.custom.PopupList - */ -public class Test_org_eclipse_swt_custom_PopupList extends SwtTestCase { - -public Test_org_eclipse_swt_custom_PopupList(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Shell() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Shell not written"); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ShellI not written"); -} - -public void test_getFont() { - warnUnimpl("Test test_getFont not written"); -} - -public void test_getItems() { - warnUnimpl("Test test_getItems not written"); -} - -public void test_getMinimumWidth() { - warnUnimpl("Test test_getMinimumWidth not written"); -} - -public void test_openLorg_eclipse_swt_graphics_Rectangle() { - warnUnimpl("Test test_openLorg_eclipse_swt_graphics_Rectangle not written"); -} - -public void test_selectLjava_lang_String() { - warnUnimpl("Test test_selectLjava_lang_String not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written"); -} - -public void test_setItems$Ljava_lang_String() { - warnUnimpl("Test test_setItems$Ljava_lang_String not written"); -} - -public void test_setMinimumWidthI() { - warnUnimpl("Test test_setMinimumWidthI not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_PopupList((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI"); - methodNames.addElement("test_getFont"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getMinimumWidth"); - methodNames.addElement("test_openLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_selectLjava_lang_String"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setItems$Ljava_lang_String"); - methodNames.addElement("test_setMinimumWidthI"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI(); - else if (getName().equals("test_getFont")) test_getFont(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getMinimumWidth")) test_getMinimumWidth(); - else if (getName().equals("test_openLorg_eclipse_swt_graphics_Rectangle")) test_openLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_selectLjava_lang_String")) test_selectLjava_lang_String(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setItems$Ljava_lang_String")) test_setItems$Ljava_lang_String(); - else if (getName().equals("test_setMinimumWidthI")) test_setMinimumWidthI(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ST.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ST.java deleted file mode 100644 index 6e1295e915..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ST.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.ST - * - * @see org.eclipse.swt.custom.ST - */ -public class Test_org_eclipse_swt_custom_ST extends SwtTestCase { - -public Test_org_eclipse_swt_custom_ST(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - // doesn't make sense to test this, ST is constants class -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_ST((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_SashForm.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_SashForm.java deleted file mode 100644 index 31993b918a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_SashForm.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.SashForm - * - * @see org.eclipse.swt.custom.SashForm - */ -public class Test_org_eclipse_swt_custom_SashForm extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_custom_SashForm(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_getMaximizedControl() { - warnUnimpl("Test test_getMaximizedControl not written"); -} - -public void test_getOrientation() { - warnUnimpl("Test test_getOrientation not written"); -} - -public void test_getWeights() { - warnUnimpl("Test test_getWeights not written"); -} - -public void test_layoutZ() { - warnUnimpl("Test test_layoutZ not written"); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setForegroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setForegroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setLayoutLorg_eclipse_swt_widgets_Layout() { - warnUnimpl("Test test_setLayoutLorg_eclipse_swt_widgets_Layout not written"); -} - -public void test_setMaximizedControlLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setMaximizedControlLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_setOrientationI() { - warnUnimpl("Test test_setOrientationI not written"); -} - -public void test_setWeights$I() { - warnUnimpl("Test test_setWeights$I not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_SashForm((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getMaximizedControl"); - methodNames.addElement("test_getOrientation"); - methodNames.addElement("test_getWeights"); - methodNames.addElement("test_layoutZ"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setLayoutLorg_eclipse_swt_widgets_Layout"); - methodNames.addElement("test_setMaximizedControlLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setOrientationI"); - methodNames.addElement("test_setWeights$I"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getMaximizedControl")) test_getMaximizedControl(); - else if (getName().equals("test_getOrientation")) test_getOrientation(); - else if (getName().equals("test_getWeights")) test_getWeights(); - else if (getName().equals("test_layoutZ")) test_layoutZ(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setLayoutLorg_eclipse_swt_widgets_Layout")) test_setLayoutLorg_eclipse_swt_widgets_Layout(); - else if (getName().equals("test_setMaximizedControlLorg_eclipse_swt_widgets_Control")) test_setMaximizedControlLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setOrientationI")) test_setOrientationI(); - else if (getName().equals("test_setWeights$I")) test_setWeights$I(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ScrolledComposite.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ScrolledComposite.java deleted file mode 100644 index cfcbf37b8a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ScrolledComposite.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.ScrolledComposite - * - * @see org.eclipse.swt.custom.ScrolledComposite - */ -public class Test_org_eclipse_swt_custom_ScrolledComposite extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_custom_ScrolledComposite(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_getAlwaysShowScrollBars() { - warnUnimpl("Test test_getAlwaysShowScrollBars not written"); -} - -public void test_getContent() { - warnUnimpl("Test test_getContent not written"); -} - -public void test_getOrigin() { - warnUnimpl("Test test_getOrigin not written"); -} - -public void test_layoutZ() { - warnUnimpl("Test test_layoutZ not written"); -} - -public void test_setAlwaysShowScrollBarsZ() { - warnUnimpl("Test test_setAlwaysShowScrollBarsZ not written"); -} - -public void test_setContentLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setContentLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_setExpandHorizontalZ() { - warnUnimpl("Test test_setExpandHorizontalZ not written"); -} - -public void test_setExpandVerticalZ() { - warnUnimpl("Test test_setExpandVerticalZ not written"); -} - -public void test_setLayoutLorg_eclipse_swt_widgets_Layout() { - warnUnimpl("Test test_setLayoutLorg_eclipse_swt_widgets_Layout not written"); -} - -public void test_setMinHeightI() { - warnUnimpl("Test test_setMinHeightI not written"); -} - -public void test_setMinSizeII() { - warnUnimpl("Test test_setMinSizeII not written"); -} - -public void test_setMinSizeLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_setMinSizeLorg_eclipse_swt_graphics_Point not written"); -} - -public void test_setMinWidthI() { - warnUnimpl("Test test_setMinWidthI not written"); -} - -public void test_setOriginII() { - warnUnimpl("Test test_setOriginII not written"); -} - -public void test_setOriginLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_setOriginLorg_eclipse_swt_graphics_Point not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_ScrolledComposite((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getAlwaysShowScrollBars"); - methodNames.addElement("test_getContent"); - methodNames.addElement("test_getOrigin"); - methodNames.addElement("test_layoutZ"); - methodNames.addElement("test_setAlwaysShowScrollBarsZ"); - methodNames.addElement("test_setContentLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setExpandHorizontalZ"); - methodNames.addElement("test_setExpandVerticalZ"); - methodNames.addElement("test_setLayoutLorg_eclipse_swt_widgets_Layout"); - methodNames.addElement("test_setMinHeightI"); - methodNames.addElement("test_setMinSizeII"); - methodNames.addElement("test_setMinSizeLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setMinWidthI"); - methodNames.addElement("test_setOriginII"); - methodNames.addElement("test_setOriginLorg_eclipse_swt_graphics_Point"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getAlwaysShowScrollBars")) test_getAlwaysShowScrollBars(); - else if (getName().equals("test_getContent")) test_getContent(); - else if (getName().equals("test_getOrigin")) test_getOrigin(); - else if (getName().equals("test_layoutZ")) test_layoutZ(); - else if (getName().equals("test_setAlwaysShowScrollBarsZ")) test_setAlwaysShowScrollBarsZ(); - else if (getName().equals("test_setContentLorg_eclipse_swt_widgets_Control")) test_setContentLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setExpandHorizontalZ")) test_setExpandHorizontalZ(); - else if (getName().equals("test_setExpandVerticalZ")) test_setExpandVerticalZ(); - else if (getName().equals("test_setLayoutLorg_eclipse_swt_widgets_Layout")) test_setLayoutLorg_eclipse_swt_widgets_Layout(); - else if (getName().equals("test_setMinHeightI")) test_setMinHeightI(); - else if (getName().equals("test_setMinSizeII")) test_setMinSizeII(); - else if (getName().equals("test_setMinSizeLorg_eclipse_swt_graphics_Point")) test_setMinSizeLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setMinWidthI")) test_setMinWidthI(); - else if (getName().equals("test_setOriginII")) test_setOriginII(); - else if (getName().equals("test_setOriginLorg_eclipse_swt_graphics_Point")) test_setOriginLorg_eclipse_swt_graphics_Point(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StackLayout.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StackLayout.java deleted file mode 100644 index 30e8b7c4a9..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StackLayout.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.StackLayout - * - * @see org.eclipse.swt.custom.StackLayout - */ -public class Test_org_eclipse_swt_custom_StackLayout extends Test_org_eclipse_swt_widgets_Layout { - -public Test_org_eclipse_swt_custom_StackLayout(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_StackLayout((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Layout.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java deleted file mode 100644 index 74a57cc582..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyleRange.java +++ /dev/null @@ -1,190 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import java.util.*; - -import junit.framework.Test; -import junit.framework.TestSuite; -import junit.textui.TestRunner; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.StyleRange; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.widgets.Display; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.StyleRange - * - * @see org.eclipse.swt.custom.StyleRange - */ -public class Test_org_eclipse_swt_custom_StyleRange extends SwtTestCase { - final static RGB RED = new RGB(255,0,0); - final static RGB BLUE = new RGB(0,0,255); - final static RGB GREEN = new RGB(0,255,0); - Hashtable colors = new Hashtable(); -public Test_org_eclipse_swt_custom_StyleRange(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} -private Color getColor(RGB rgb) { - return (Color)colors.get(rgb); -} -protected void initializeColors() { - Display display = Display.getDefault(); - colors.put(RED, new Color (display, RED)); - colors.put(GREEN, new Color (display, GREEN)); - colors.put(BLUE, new Color (display, BLUE)); -} - -protected void setUp() { - initializeColors(); -} - -protected void tearDown() { - Enumeration enum = colors.keys(); - while (enum.hasMoreElements()) { - Color color = (Color)colors.get((RGB)enum.nextElement()); - color.dispose(); - } -} - -public void test_Constructor() { - StyleRange styleRange = new StyleRange(); - assertTrue(":a:", styleRange.start == 0); - assertTrue(":a:", styleRange.length == 0); - assertTrue(":a:", styleRange.foreground == null); - assertTrue(":a:", styleRange.background == null); - assertTrue(":a:", styleRange.fontStyle == SWT.NORMAL); -} - -public void test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_Color() { - StyleRange styleRange = new StyleRange(5, 10, getColor(RED), getColor(BLUE)); - assertTrue(":b:", styleRange.start == 5); - assertTrue(":b:", styleRange.length == 10); - assertTrue(":b:", styleRange.foreground == getColor(RED)); - assertTrue(":b:", styleRange.background == getColor(BLUE)); - assertTrue(":b:", styleRange.fontStyle == SWT.NORMAL); -} - -public void test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_ColorI() { - StyleRange styleRange = new StyleRange(5, 10, getColor(RED), getColor(BLUE), SWT.BOLD); - assertTrue(":c:", styleRange.start == 5); - assertTrue(":c:", styleRange.length == 10); - assertTrue(":c:", styleRange.foreground == getColor(RED)); - assertTrue(":c:", styleRange.background == getColor(BLUE)); - assertTrue(":c:", styleRange.fontStyle == SWT.BOLD); -} - -public void test_clone() { - StyleRange styleRangeA = new StyleRange(6, 10, null, getColor(BLUE), SWT.NORMAL); - StyleRange styleRangeB = (StyleRange)styleRangeA.clone(); - assertTrue(":g:", styleRangeA.equals(styleRangeB)); -} - -public void test_equalsLjava_lang_Object() { - StyleRange styleRangeA = new StyleRange(5, 10, getColor(RED), getColor(BLUE), SWT.BOLD); - StyleRange styleRangeB = new StyleRange(5, 10, getColor(RED), getColor(BLUE), SWT.BOLD); - StyleRange styleRangeC = new StyleRange(5, 10, getColor(BLUE), getColor(BLUE), SWT.BOLD); - StyleRange styleRangeD = new StyleRange(6, 10, getColor(RED), getColor(BLUE), SWT.BOLD); - StyleRange styleRangeE = new StyleRange(5, 11, getColor(RED), getColor(BLUE), SWT.BOLD); - StyleRange styleRangeF = new StyleRange(5, 11, getColor(RED), getColor(RED), SWT.BOLD); - StyleRange styleRangeG = new StyleRange(5, 11, getColor(RED), getColor(BLUE), SWT.NORMAL); - assertTrue(":d:", styleRangeA.equals(styleRangeB)); - assertTrue(":d:",!styleRangeA.equals(styleRangeC)); - assertTrue(":d:",!styleRangeA.equals(styleRangeD)); - assertTrue(":d:",!styleRangeA.equals(styleRangeE)); - assertTrue(":d:",!styleRangeA.equals(styleRangeF)); - assertTrue(":d:",!styleRangeA.equals(styleRangeG)); -} - -public void test_hashCode() { - Set set = new HashSet(); - Color testColor = new Color(Display.getDefault(), 0, 0, 0); - - //regression test for bug 30924 - set.add(new StyleRange()); - set.add(new StyleRange(0, 1, testColor, null)); - set.add(new StyleRange(0, 1, testColor, testColor)); - set.add(new StyleRange(0, 1, testColor, testColor, SWT.BOLD)); - testColor.dispose(); -} - -public void test_isUnstyled() { - StyleRange styleRangeA = new StyleRange(5, 10, null, null, SWT.NORMAL); - StyleRange styleRangeB = new StyleRange(5, 10, getColor(RED), null, SWT.NORMAL); - StyleRange styleRangeC = new StyleRange(5, 10, null, null, SWT.BOLD); - StyleRange styleRangeD = new StyleRange(6, 10, null, getColor(BLUE), SWT.NORMAL); - StyleRange styleRangeE = new StyleRange(5, 10, null, null); - assertTrue(":e:", styleRangeA.isUnstyled()); - assertTrue(":e:",!styleRangeB.isUnstyled()); - assertTrue(":e:",!styleRangeC.isUnstyled()); - assertTrue(":e:",!styleRangeD.isUnstyled()); - assertTrue(":e:", styleRangeE.isUnstyled()); -} - -public void test_similarToLorg_eclipse_swt_custom_StyleRange() { - StyleRange styleRangeA = new StyleRange(6, 10, getColor(RED), getColor(BLUE), SWT.NORMAL); - StyleRange styleRangeB = new StyleRange(5, 5, getColor(RED), getColor(BLUE), SWT.NORMAL); - StyleRange styleRangeC = new StyleRange(6, 10, getColor(RED), getColor(BLUE), SWT.NORMAL); - StyleRange styleRangeD = new StyleRange(6, 10, getColor(BLUE), getColor(BLUE), SWT.NORMAL); - StyleRange styleRangeE = new StyleRange(6, 10, getColor(RED), getColor(RED), SWT.NORMAL); - StyleRange styleRangeF = new StyleRange(6, 10, getColor(RED), getColor(BLUE), SWT.BOLD); - assertTrue(":f:", styleRangeA.similarTo(styleRangeB)); - assertTrue(":f:", styleRangeA.similarTo(styleRangeC)); - assertTrue(":f:", !styleRangeA.similarTo(styleRangeD)); - assertTrue(":f:", !styleRangeA.similarTo(styleRangeE)); - assertTrue(":f:", !styleRangeA.similarTo(styleRangeF)); -} - -public void test_toString() { - StyleRange styleRange = new StyleRange(6, 10, null, getColor(BLUE), SWT.NORMAL); - styleRange.toString(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_StyleRange((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_ColorI"); - methodNames.addElement("test_clone"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_isUnstyled"); - methodNames.addElement("test_similarToLorg_eclipse_swt_custom_StyleRange"); - methodNames.addElement("test_toString"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_Color")) test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_ColorI")) test_ConstructorIILorg_eclipse_swt_graphics_ColorLorg_eclipse_swt_graphics_ColorI(); - else if (getName().equals("test_clone")) test_clone(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_isUnstyled")) test_isUnstyled(); - else if (getName().equals("test_similarToLorg_eclipse_swt_custom_StyleRange")) test_similarToLorg_eclipse_swt_custom_StyleRange(); - else if (getName().equals("test_toString")) test_toString(); -} -} 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 deleted file mode 100644 index b6920c405a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledText.java +++ /dev/null @@ -1,4362 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import java.util.*; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.dnd.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.printing.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.internal.BidiUtil; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.StyledText - * - * @see org.eclipse.swt.custom.StyledText - */ -public class Test_org_eclipse_swt_custom_StyledText extends Test_org_eclipse_swt_widgets_Canvas { - -StyledText text; -final static RGB RED = new RGB(255,0,0); -final static RGB BLUE = new RGB(0,0,255); -final static RGB GREEN = new RGB(0,255,0); -final static RGB YELLOW = new RGB(255,255,0); -final static RGB CYAN = new RGB(0,255,255); -final static RGB PURPLE = new RGB(255,0,255); -final static String PLATFORM_LINE_DELIMITER = System.getProperty("line.separator"); -Hashtable colors = new Hashtable(); -private boolean listenerCalled; -private boolean listener2Called; - -public Test_org_eclipse_swt_custom_StyledText(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - initializeColors(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); -} - -protected void tearDown() { - Enumeration enum = colors.keys(); - while (enum.hasMoreElements()) { - Color color = (Color)colors.get((RGB)enum.nextElement()); - color.dispose(); - } - super.tearDown(); - -} - -// this method must not be public so that the auto-gen tool keeps it -private StyleRange[] defaultStyles() { - return new StyleRange[] { - getStyle(0,48,RED,YELLOW), - getStyle(58,10,BLUE,CYAN), - getStyle(68,10,GREEN,PURPLE)}; -} -// this method must not be public so that the auto-gen tool keeps it -protected void getLineBackgrounds() { - for (int i=0; i<text.getLineCount(); i++) { - text.getLineBackground(i); - } -} -// this method must not be public so that the auto-gen tool keeps it -private String textString() { - return "This is the text component in testing\nNew Line1\nNew Line2\nNew Line3\nNew Line4."; -} -private boolean isBidi() { - return BidiUtil.isBidiPlatform(); -} -// this method must not be public so that the auto-gen tool keeps it -private StyleRange getStyle(int start, int length, RGB fg, RGB bg) { - StyleRange style = new StyleRange(); - style.start = start; - style.length = length; - if (fg != null) style.foreground = getColor(fg); - else style.foreground = null; - if (bg != null) style.background = getColor(bg); - else style.background = null; - return style; -} -// this method must not be public so that the auto-gen tool keeps it -private Color getColor(RGB rgb) { - return (Color)colors.get(rgb); -} -// this method must not be public so that the auto-gen tool keeps it -protected void initializeColors() { - Display display = Display.getDefault(); - colors.put(RED, new Color (display, RED)); - colors.put(BLUE, new Color (display, BLUE)); - colors.put(GREEN, new Color (display, GREEN)); - colors.put(YELLOW, new Color (display, YELLOW)); - colors.put(CYAN, new Color (display, CYAN)); - colors.put(PURPLE, new Color (display, PURPLE)); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){ - StyledText text = new StyledText(shell, SWT.READ_ONLY); - - assertTrue(":a:", text.getEditable() == false); - text.dispose(); - - text = new StyledText(shell, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE); - assertTrue(":b:", text.getVerticalBar() == null); - assertTrue(":c:", text.getHorizontalBar() == null); - text.dispose(); -} - -public void test_addExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener() { - final String line = "Line1"; - boolean exceptionThrown = false; - ExtendedModifyListener listener = new ExtendedModifyListener() { - public void modifyText(ExtendedModifyEvent event) { - listenerCalled = true; - assertEquals("ExtendedModify event data invalid", 0, event.start); - assertEquals("ExtendedModify event data invalid", line.length(), event.length); - assertEquals("ExtendedModify event data invalid", "", event.replacedText); - } - }; - - try { - text.addExtendedModifyListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - // test whether all content modifying API methods send an ExtendedModify event - text.addExtendedModifyListener(listener); - - listenerCalled = false; - text.append(line); - assertTrue("append does not send event", listenerCalled); - - listenerCalled = false; - text.insert(line); - assertTrue("replaceTextRange does not send event", listenerCalled); - - listenerCalled = false; - text.removeExtendedModifyListener(listener); - listener = new ExtendedModifyListener() { - public void modifyText(ExtendedModifyEvent event) { - listenerCalled = true; - assertEquals("ExtendedModify event data invalid", 0, event.start); - assertEquals("ExtendedModify event data invalid", line.length(), event.length); - assertEquals("ExtendedModify event data invalid", line.substring(0, 1), event.replacedText); - } - }; - text.addExtendedModifyListener(listener); - text.replaceTextRange(0, 1, line); - assertTrue("replaceTextRange does not send event", listenerCalled); - - listenerCalled = false; - text.removeExtendedModifyListener(listener); - listener = new ExtendedModifyListener() { - public void modifyText(ExtendedModifyEvent event) { - listenerCalled = true; - assertEquals("ExtendedModify event data invalid", 0, event.start); - assertEquals("ExtendedModify event data invalid", line.length(), event.length); - assertEquals("ExtendedModify event data invalid", line + line.substring(1, line.length()) + line, event.replacedText); - } - }; - text.addExtendedModifyListener(listener); - text.setText(line); - assertTrue("setText does not send event", listenerCalled); - - listenerCalled = false; - text.removeExtendedModifyListener(listener); - // cause StyledText to call the listener. - text.setText(line); - assertTrue("Listener not removed", listenerCalled == false); -} - -public void test_setKeyBindingII(){ - text.setKeyBinding(SWT.DEL, SWT.NULL); - assertTrue(":a:", text.getKeyBinding(SWT.DEL) == SWT.NULL); - text.setKeyBinding(SWT.DEL, ST.LINE_UP); - assertTrue(":b:", text.getKeyBinding(SWT.DEL) == ST.LINE_UP); - text.setKeyBinding(SWT.DEL | SWT.MOD2, ST.SELECT_PAGE_UP); - assertTrue(":c:", text.getKeyBinding(SWT.DEL | SWT.MOD2) == ST.SELECT_PAGE_UP); - text.setKeyBinding(SWT.DEL | SWT.MOD2, ST.PAGE_UP); - assertTrue(":d:", text.getKeyBinding(SWT.DEL | SWT.MOD2) == ST.PAGE_UP); - text.setKeyBinding(-1, ST.PAGE_UP); - text.setKeyBinding(-1, -1); -} - -public void test_addBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener() { - String line = "Line1"; - boolean exceptionThrown = false; - BidiSegmentListener listener = new BidiSegmentListener() { - public void lineGetSegments(BidiSegmentEvent event) { - listenerCalled = true; - } - }; - - try { - text.addBidiSegmentListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - listenerCalled = false; - text.setText(line); - text.addBidiSegmentListener(listener); - // cause StyledText to call the BidiSegmentListener. - text.getLocationAtOffset(0); - if (isBidi()) { - assertTrue("Listener not called", listenerCalled); - } - else { - assertTrue("Listener called when it shouldn't be", listenerCalled == false); - } - listenerCalled = false; - text.removeBidiSegmentListener(listener); - // cause StyledText to call the BidiSegmentListener. - text.getLocationAtOffset(0); - assertTrue("Listener not removed", listenerCalled == false); -} - -public void test_addLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener() { - String line = "Line1"; - boolean exceptionThrown = false; - LineBackgroundListener listener = new LineBackgroundListener() { - public void lineGetBackground(LineBackgroundEvent event) { - listenerCalled = true; - } - }; - - try { - text.addLineBackgroundListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - listenerCalled = false; - text.setText(line); - text.addLineBackgroundListener(listener); - // cause StyledText to call the listener. - text.setSelection(0, text.getCharCount()); - text.copy(); - assertTrue("Listener not called", listenerCalled); - - listenerCalled = false; - text.removeLineBackgroundListener(listener); - // cause StyledText to call the listener. - text.setText(line); - text.setSelection(0, text.getCharCount()); - text.copy(); - assertTrue("Listener not removed", listenerCalled == false); -} - -public void test_addLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener() { - String line = "Line1"; - boolean exceptionThrown = false; - LineStyleListener listener = new LineStyleListener() { - public void lineGetStyle(LineStyleEvent event) { - listenerCalled = true; - } - }; - - try { - text.addLineStyleListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - listenerCalled = false; - text.setText(line); - text.addLineStyleListener(listener); - // cause StyledText to call the listener. - text.setSelection(0, text.getCharCount()); - text.copy(); - assertTrue("Listener not called", listenerCalled); - - listenerCalled = false; - text.removeLineStyleListener(listener); - // cause StyledText to call the listener. - text.setText(line); - text.setSelection(0, text.getCharCount()); - text.copy(); - assertTrue("Listener not removed", listenerCalled == false); -} - -public void test_addModifyListenerLorg_eclipse_swt_events_ModifyListener() { - String line = "Line1"; - boolean exceptionThrown = false; - ModifyListener listener = new ModifyListener() { - public void modifyText(ModifyEvent event) { - listenerCalled = true; - } - }; - - try { - text.addModifyListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - // test whether all content modifying API methods send a Modify event - text.addModifyListener(listener); - - listenerCalled = false; - text.append(line); - assertTrue("append does not send event", listenerCalled); - - listenerCalled = false; - text.insert(line); - assertTrue("replaceTextRange does not send event", listenerCalled); - - listenerCalled = false; - text.replaceTextRange(0, 1, line); - assertTrue("replaceTextRange does not send event", listenerCalled); - - listenerCalled = false; - text.setText(line); - assertTrue("setText does not send event", listenerCalled); - - listenerCalled = false; - text.removeModifyListener(listener); - // cause StyledText to call the listener. - text.setText(line); - assertTrue("Listener not removed", listenerCalled == false); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - String line = "Line1"; - boolean exceptionThrown = false; - SelectionListener listener = new SelectionListener() { - public void widgetSelected(SelectionEvent event) { - listenerCalled = true; - } - public void widgetDefaultSelected(SelectionEvent event) { - listener2Called = true; - } - }; - - try { - text.addSelectionListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - text.setText(line); - listenerCalled = false; - listener2Called = false; - text.addSelectionListener(listener); - // cause StyledText to call the listener. - text.invokeAction(ST.SELECT_LINE_END); - assertTrue("Listener not called", listenerCalled); - assertTrue("Listener called unexpectedly", listener2Called == false); - - listenerCalled = false; - listener2Called = false; - text.removeSelectionListener(listener); - // cause StyledText to call the listener. - text.invokeAction(ST.SELECT_LINE_END); - assertTrue("Listener not removed", listenerCalled == false); - assertTrue("Listener called unexpectedly", listener2Called == false); -} - -public void test_addVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener() { - boolean exceptionThrown = false; - VerifyKeyListener listener = new VerifyKeyListener() { - public void verifyKey(VerifyEvent event) { - } - }; - - try { - text.addVerifyKeyListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - // only test whether listener can be added and removed. - // can't test listener because VerifyKey is user driven. - text.addVerifyKeyListener(listener); - text.removeVerifyKeyListener(listener); -} - -public void test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener() { - final String line = "Line1"; - final String newLine = "NewLine1"; - final int textLength; - boolean exceptionThrown = false; - VerifyListener listener = new VerifyListener() { - public void verifyText(VerifyEvent event) { - listenerCalled = true; - assertEquals("Verify event data invalid", 0, event.start); - assertEquals("Verify event data invalid", 0, event.end); - assertEquals("Verify event data invalid", line, event.text); - event.start = 2; - event.end = 5; - event.text = newLine; - } - }; - - try { - text.addVerifyListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - // test whether all content modifying API sends a Verify event - text.addVerifyListener(listener); - - listenerCalled = false; - text.append(line); - assertTrue("append does not send event", listenerCalled); - assertEquals("Listener failed", newLine, text.getText()); - - listenerCalled = false; - text.insert(line); - assertTrue("replaceTextRange does not send event", listenerCalled); - assertEquals("Listener failed", newLine + newLine, text.getText()); - - listenerCalled = false; - text.removeVerifyListener(listener); - listener = new VerifyListener() { - public void verifyText(VerifyEvent event) { - listenerCalled = true; - assertEquals("Verify event data invalid", 0, event.start); - assertEquals("Verify event data invalid", 1, event.end); - assertEquals("Verify event data invalid", line, event.text); - event.start = 2; - event.end = 5; - event.text = newLine; - } - }; - text.addVerifyListener(listener); - textLength = text.getCharCount() - 1 + newLine.length(); - text.replaceTextRange(0, 1, line); - assertTrue("replaceTextRange does not send event", listenerCalled); - assertEquals("Listener failed", newLine + newLine.substring(1, newLine.length()) + newLine, text.getText()); - - listenerCalled = false; - text.removeVerifyListener(listener); - listener = new VerifyListener() { - public void verifyText(VerifyEvent event) { - listenerCalled = true; - assertEquals("Verify event data invalid", 0, event.start); - assertEquals("Verify event data invalid", textLength, event.end); - assertEquals("Verify event data invalid", line, event.text); - event.start = 2; - event.end = 5; - event.text = newLine; - } - }; - text.addVerifyListener(listener); - text.setText(line); - assertTrue("setText does not send event", listenerCalled); - assertEquals("Listener failed", newLine, text.getText()); - - text.removeVerifyListener(listener); - - listenerCalled = false; - listener = new VerifyListener() { - public void verifyText(VerifyEvent event) { - listenerCalled = true; - assertEquals("Verify event data invalid", 2, event.start); - assertEquals("Verify event data invalid", newLine.length(), event.end); - assertEquals("Verify event data invalid", line, event.text); - event.doit = false; - } - }; - text.addVerifyListener(listener); - // cause StyledText to call the listener. - text.replaceTextRange(2, text.getCharCount() - 2, line); - assertTrue("Listener not called", listenerCalled); - assertEquals("Listener failed", newLine, text.getText()); - - listenerCalled = false; - text.removeVerifyListener(listener); - // cause StyledText to call the listener. - text.setText(line); - assertTrue("Listener not removed", listenerCalled == false); -} - -public void test_appendLjava_lang_String() { - boolean exceptionThrown; - String line = "Line1"; - - text.append(line); - assertEquals("append to empty text", line, text.getText()); - - exceptionThrown = false; - try { - text.append(null); - } - catch (IllegalArgumentException exception) { - exceptionThrown = true; - } - assertTrue("append null string", exceptionThrown); - - text.append(""); - assertEquals("append empty string", line, text.getText()); - - text.append(line); - assertEquals("append non-empty string", line + line, text.getText()); - - text.setText(""); - String text2 = "line\r"; - text.append(text2); - assertEquals("append string ending with line delimiter", text2, text.getText()); - - String text3 = "line\r\nline3"; - text.append(text3); - assertEquals("append multi line string", text2 + text3, text.getText()); -} - -public void test_computeSizeIIZ() { - // inherited test is sufficient -} - -public void test_copy() { - Clipboard clipboard = new Clipboard(text.getDisplay()); - TextTransfer transfer = TextTransfer.getInstance(); - String clipboardText; - String convertedText; - - String before = (String) clipboard.getContents(transfer); - text.setSelectionRange(0, 0); - text.copy(); - clipboardText = (String) clipboard.getContents(transfer); - assertTrue(":a:", before == null ? clipboardText == null : before.equals(clipboardText)); - - before = (String) clipboard.getContents(transfer); - text.setText("0123456789"); - text.setSelectionRange(0, 0); - text.copy(); - clipboardText = (String) clipboard.getContents(transfer); - assertTrue(":c:", before == null ? clipboardText == null : before.equals(clipboardText)); - - text.setSelectionRange(0, 1); - text.copy(); - clipboardText = (String) clipboard.getContents(transfer); - assertTrue(":d:", clipboardText != null && clipboardText.equals("0")); - - text.setSelectionRange(1, 2); - text.copy(); - clipboardText = (String) clipboard.getContents(transfer); - assertTrue(":e:", clipboardText != null && clipboardText.equals("12")); - - // test line delimiter conversion - text.setText("\rLine1\nLine2\r\nLine3\n\rLine4\n"); - text.setSelectionRange(0, text.getCharCount()); - text.copy(); - clipboardText = (String) clipboard.getContents(transfer); - if (SwtJunit.isWindows) { - convertedText = "\r\nLine1\r\nLine2\r\nLine3\r\n\r\nLine4\r\n"; - } - else { - convertedText = "\nLine1\nLine2\nLine3\n\nLine4\n"; - } - assertTrue(":f:", clipboardText != null && clipboardText.equals(convertedText)); - - // test line delimiter conversion - text.setText("Line1\r\nLine2"); - text.setSelectionRange(0, text.getCharCount()); - text.copy(); - clipboardText = (String) clipboard.getContents(transfer); - if (SwtJunit.isWindows) { - convertedText = "Line1\r\nLine2"; - } - else { - convertedText = "Line1\nLine2"; - } - assertTrue(":g:", clipboardText != null && clipboardText.equals(convertedText)); - - testRtfCopy(); - clipboard.dispose(); -} - -public void test_cut() { - Clipboard clipboard = new Clipboard(text.getDisplay()); - TextTransfer transfer = TextTransfer.getInstance(); - String clipboardText; - String convertedText; - - String before = (String) clipboard.getContents(transfer); - text.setSelectionRange(0, 0); - text.cut(); - clipboardText = (String) clipboard.getContents(transfer); - assertTrue(":a:", before == null ? clipboardText == null : before.equals(clipboardText)); - - before = (String) clipboard.getContents(transfer); - text.setText("0123456789"); - text.setSelectionRange(0, 0); - text.cut(); - clipboardText = (String) clipboard.getContents(transfer); - assertTrue(":c:", before == null ? clipboardText == null : before.equals(clipboardText)); - - text.setSelectionRange(0, 1); - text.cut(); - clipboardText = (String) clipboard.getContents(transfer); - assertTrue(":d:", clipboardText != null && clipboardText.equals("0")); - - text.setSelectionRange(1, 2); - text.cut(); - clipboardText = (String) clipboard.getContents(transfer); - assertTrue(":e:", clipboardText != null && clipboardText.equals("23")); - - // test line delimiter conversion - text.setText("\rLine1\nLine2\r\nLine3\n\rLine4\n"); - text.setSelectionRange(0, text.getCharCount()); - text.cut(); - clipboardText = (String) clipboard.getContents(transfer); - if (SwtJunit.isWindows) { - convertedText = "\r\nLine1\r\nLine2\r\nLine3\r\n\r\nLine4\r\n"; - } - else { - convertedText = "\nLine1\nLine2\nLine3\n\nLine4\n"; - } - assertTrue(":f:", clipboardText != null && clipboardText.equals(convertedText)); - - // test line delimiter conversion - text.setText("Line1\r\nLine2"); - text.setSelectionRange(0, text.getCharCount()); - text.cut(); - clipboardText = (String) clipboard.getContents(transfer); - if (SwtJunit.isWindows) { - convertedText = "Line1\r\nLine2"; - } - else { - convertedText = "Line1\nLine2"; - } - assertTrue(":g:", clipboardText != null && clipboardText.equals(convertedText)); - - clipboard.dispose(); -} - -public void test_getBidiColoring() { - /// getBidiColoring is deprecated and will be removed. - warnUnimpl("Test test_getBidiColoring not written"); -} - -public void test_getCaretOffset() { - assertTrue(":a:", text.getCaretOffset() == 0); - text.setText("Line0\r\n"); - assertTrue(":b:", text.getCaretOffset() == 0); - text.setTopIndex(1); - assertTrue(":c:", text.getCaretOffset() == 0); - - text.replaceTextRange(text.getCharCount(), 0, "Line1"); - assertTrue(":d:", text.getCaretOffset() == 0); - String newText = "Line-1\r\n"; - text.replaceTextRange(0, 0, newText); - assertTrue(":e:", text.getCaretOffset() == 0); - - text.setCaretOffset(1); - assertTrue(":f:", text.getCaretOffset() == 1); - text.replaceTextRange(2, 0, newText); - assertTrue(":g:", text.getCaretOffset() == 1); - text.replaceTextRange(0, 0, newText); - assertTrue(":h:", text.getCaretOffset() == newText.length() + 1); -} - -public void test_getContent() { - StyledTextContent content = text.getContent(); - - assertTrue(content != null); - content = new StyledTextContent() { - public void addTextChangeListener(TextChangeListener listener) { - } - public int getCharCount() { - return 0; - } - public String getLine(int lineIndex) { - return ""; - } - public int getLineAtOffset(int offset) { - return 0; - } - public int getLineCount() { - return 0; - } - public String getLineDelimiter() { - return ""; - } - public int getOffsetAtLine(int lineIndex) { - return 0; - } - public String getTextRange(int start, int length) { - return ""; - } - public void removeTextChangeListener(TextChangeListener listener) { - } - public void replaceTextRange(int start, int replaceLength, String text) { - } - public void setText(String text) { - } - }; - text.setContent(content); - assertEquals(content, text.getContent()); -} - -public void test_getDoubleClickEnabled() { - assertTrue(":a:", text.getDoubleClickEnabled() == true); - text.setDoubleClickEnabled(true); - assertTrue(":b:", text.getDoubleClickEnabled() == true); - text.setDoubleClickEnabled(false); - assertTrue(":c:", text.getDoubleClickEnabled() == false); - text.setDoubleClickEnabled(false); - assertTrue(":d:", text.getDoubleClickEnabled() == false); - text.setDoubleClickEnabled(true); - assertTrue(":e:", text.getDoubleClickEnabled() == true); -} - -public void test_getEditable() { - assertTrue(":a:", text.getEditable() == true); - text.setEditable(true); - assertTrue(":b:", text.getEditable() == true); - text.setEditable(false); - assertTrue(":c:", text.getEditable() == false); - text.setEditable(false); - assertTrue(":d:", text.getEditable() == false); - text.setEditable(true); - assertTrue(":e:", text.getEditable() == true); -} - -public void test_getHorizontalIndex() { - assertTrue(":a:", text.getHorizontalIndex() == 0); - text.setHorizontalIndex(-1); - assertTrue(":b:", text.getHorizontalIndex() == 0); - text.setHorizontalIndex(1); - assertTrue(":c:", text.getHorizontalIndex() == 0); - - text.setText("Line0"); - assertTrue(":d:", text.getHorizontalIndex() == 0); - text.setHorizontalIndex(-1); - assertTrue(":e:", text.getHorizontalIndex() == 0); - text.setHorizontalIndex(1); - assertTrue(":f:", text.getHorizontalIndex() == 1); - text.setHorizontalIndex(500); - assertTrue(":g:", text.getHorizontalIndex() > 0); - text.setHorizontalIndex(-1); - assertTrue(":h:", text.getHorizontalIndex() == 0); - text.setHorizontalIndex(1); - assertTrue(":i:", text.getHorizontalIndex() == 1); - // make sure the widget can be scrolled - shell.open(); - text.setSize(10, 50); - text.setText("Line0"); - text.setHorizontalIndex(1); - assertTrue(":j:", text.getHorizontalIndex() == 1); -} - -public void test_getHorizontalPixel() { - assertTrue(":a:", text.getHorizontalPixel() == 0); - text.setHorizontalIndex(-1); - assertTrue(":b:", text.getHorizontalPixel() == 0); - text.setHorizontalIndex(1); - assertTrue(":c:", text.getHorizontalPixel() == 0); - - text.setText("Line0"); - assertTrue(":d:", text.getHorizontalPixel() == 0); - text.setHorizontalIndex(-1); - assertTrue(":e:", text.getHorizontalPixel() == 0); - text.setHorizontalIndex(1); - assertTrue(":f:", text.getHorizontalPixel() > 0); - text.setHorizontalIndex(-1); - assertTrue(":g:", text.getHorizontalPixel() == 0); - text.setHorizontalIndex(1); - assertTrue(":h:", text.getHorizontalPixel() > 0); - // make sure the widget can be scrolled - shell.open(); - text.setSize(10, 50); - text.setText("Line0"); - text.setHorizontalIndex(1); - assertTrue(":i:", text.getHorizontalPixel() > 0); -} - -public void test_getKeyBindingI() { - assertTrue(":a:", text.getKeyBinding(SWT.DEL) == ST.DELETE_NEXT); - text.setKeyBinding(SWT.DEL, ST.LINE_UP); - assertTrue(":b:", text.getKeyBinding(SWT.DEL) == ST.LINE_UP); - text.setKeyBinding(SWT.DEL | SWT.MOD2, ST.SELECT_PAGE_UP); - assertTrue(":c:", text.getKeyBinding(SWT.DEL | SWT.MOD2) == ST.SELECT_PAGE_UP); - text.setKeyBinding(SWT.DEL | SWT.MOD2, ST.PAGE_UP); - assertTrue(":d:", text.getKeyBinding(SWT.DEL | SWT.MOD2) == ST.PAGE_UP); - assertTrue(":e:", text.getKeyBinding(-1) == SWT.NULL); - assertTrue(":f:", text.getKeyBinding(SWT.F2) == SWT.NULL); -} - -public void test_getCharCount() { - assertTrue(":a:", text.getCharCount() == 0); - text.setText("Line0"); - assertTrue(":b:", text.getCharCount() == 5); - text.setText(""); - assertTrue(":c:", text.getCharCount() == 0); - text.setText("Line0\n"); - assertTrue(":d:", text.getCharCount() == 6); -} - -public void test_getLineBackgroundI() { - String textString = "L1\nL2\nL3\nL4"; - text.setText(textString); - assertTrue(":1:", text.getLineBackground(0) == null); - text.setLineBackground(1,1,getColor(YELLOW)); - text.setLineBackground(2,1,getColor(BLUE)); - assertTrue(":1:", text.getLineBackground(1) == getColor(YELLOW)); - assertTrue(":1:", text.getLineBackground(2) == getColor(BLUE)); -} - -public void test_getLineCount() { - String delimiterString = "\r\n"; - assertTrue(":a:", text.getLineCount()==1); - text.append("dddasd" + delimiterString); - assertTrue(":b:", text.getLineCount()==2); - text.append("ddasdasdasdasd" + delimiterString); - assertTrue(":c:", text.getLineCount()==3); - - - text.setText("01234567890"); - text.setSelection(4); - assertTrue(":a:", text.getLineCount()==1); - text.insert(delimiterString); - assertTrue(":b:", text.getLineCount()==2); -} - -public void test_getLineAtOffsetI() { - boolean exceptionThrown = false; - - assertTrue(":a:", text.getLineAtOffset(0) == 0); - try { - text.getLineAtOffset(-1); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":b:", exceptionThrown == true); - exceptionThrown = false; - - try { - text.getLineAtOffset(100); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":c:", exceptionThrown == true); - exceptionThrown = false; - - text.setText("Line0\r\n"); - assertTrue(":d:", text.getLineAtOffset(4) == 0); - assertTrue(":e:", text.getLineAtOffset(5) == 0); - assertTrue(":f:", text.getLineAtOffset(6) == 0); - assertTrue(":g:", text.getLineAtOffset(7) == 1); - try { - text.getLineAtOffset(8); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":h:", exceptionThrown == true); - exceptionThrown = false; -} - -public void test_getLineDelimiter() { - final String lineDelimiter = "\n"; - StyledTextContent content = text.getContent(); - - assertEquals(content.getLineDelimiter(), text.getLineDelimiter()); - - content = new StyledTextContent() { - public void addTextChangeListener(TextChangeListener listener) { - } - public int getCharCount() { - return 0; - } - public String getLine(int lineIndex) { - return ""; - } - public int getLineAtOffset(int offset) { - return 0; - } - public int getLineCount() { - return 0; - } - public String getLineDelimiter() { - return lineDelimiter; - } - public int getOffsetAtLine(int lineIndex) { - return 0; - } - public String getTextRange(int start, int length) { - return ""; - } - public void removeTextChangeListener(TextChangeListener listener) { - } - public void replaceTextRange(int start, int replaceLength, String text) { - } - public void setText(String text) { - } - }; - text.setContent(content); - assertEquals(lineDelimiter, text.getLineDelimiter()); -} - -public void test_getLineHeight() { - assertTrue(":a:", text.getLineHeight() > 0); -} - -public void test_getLocationAtOffsetI(){ - // copy from StyledText, has to match value used by StyledText - final int XINSET; - if (isBidi()) XINSET = 3; - else XINSET = 0; - - assertTrue(":a:", text.getLocationAtOffset(0).equals(new Point(0, 0))); - try { - text.getLocationAtOffset(-1); - fail("No exception thrown for offset == -1"); - } - catch (IllegalArgumentException e) { - } - - try { - text.getLocationAtOffset(100); - fail("No exception thrown for illegal offset argument"); - } - catch (IllegalArgumentException e) { - } - - text.setText("Line0\r\nLine1"); - assertTrue(":d:", text.getLocationAtOffset(4).x > 0 && text.getLocationAtOffset(4).y == 0); - assertTrue(":e:", text.getLocationAtOffset(6).x > 0 && text.getLocationAtOffset(6).y == 0); - // x location will == StyledText x inset on bidi platforms - assertTrue(":f:", text.getLocationAtOffset(7).x == XINSET && text.getLocationAtOffset(7).y > 0); - try { - text.getLocationAtOffset(13); - fail("No exception thrown for illegal offset argument"); - } - catch (IllegalArgumentException e) { - } - - text.setTopIndex(1); - assertTrue(":h:", text.getLocationAtOffset(4).x > 0 && text.getLocationAtOffset(4).y < 0); - // x location will == StyledText x inset on bidi platforms - assertTrue(":i:", text.getLocationAtOffset(7).x == XINSET && text.getLocationAtOffset(7).y == 0); - - text.setHorizontalIndex(1); - assertTrue(":j:", text.getLocationAtOffset(0).x < 0 && text.getLocationAtOffset(0).y < 0); - assertTrue(":k:", text.getLocationAtOffset(7).x < 0 && text.getLocationAtOffset(7).y == 0); -} -public void test_getOffsetAtLineI() { - boolean exceptionThrown = false; - - assertEquals(":a:", 0, text.getOffsetAtLine(0)); - try { - text.getOffsetAtLine(-1); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":b:", exceptionThrown); - exceptionThrown = false; - - try { - text.getOffsetAtLine(100); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":c:", exceptionThrown); - exceptionThrown = false; - - text.setText("Line0\r\n"); - assertEquals(":d:", 0, text.getOffsetAtLine(0)); - assertEquals(":e:", 7, text.getOffsetAtLine(1)); - - try { - text.getOffsetAtLine(2); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":f:", exceptionThrown); - exceptionThrown = false; - - text.setText(""); - assertEquals(":g:", 0, text.getOffsetAtLine(0)); -} -public void test_getOffsetAtLocationLorg_eclipse_swt_graphics_Point() { - boolean exceptionThrown = false; - Point location; - - assertTrue(":a:", text.getOffsetAtLocation(new Point(0, 0)) == 0); - try { - text.getOffsetAtLocation(new Point(-1, 0)); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":b:", exceptionThrown == true); - exceptionThrown = false; - - try { - text.getOffsetAtLocation(new Point(0, -1)); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":c:", exceptionThrown == true); - exceptionThrown = false; - - text.setText("Line0\r\nLine1"); - location = text.getLocationAtOffset(5); - assertTrue(":d:", text.getOffsetAtLocation(new Point(10, 0)) > 0); - assertTrue(":e:", text.getOffsetAtLocation(new Point(location.x - 1, 0)) == 4); - location = text.getLocationAtOffset(7); - assertTrue(":f:", text.getOffsetAtLocation(location) == 7); - try { - text.getOffsetAtLocation(new Point(100, 0)); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":g:", exceptionThrown == true); - exceptionThrown = false; - - try { - text.getOffsetAtLocation(new Point(100, 50)); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":h:", exceptionThrown == true); - exceptionThrown = false; - - text.setTopIndex(1); - assertTrue(":i:", text.getOffsetAtLocation(new Point(0, -5)) == 0); - assertTrue(":j:", text.getOffsetAtLocation(new Point(0, 0)) == 7); - - text.setHorizontalIndex(1); - assertTrue(":k:", text.getOffsetAtLocation(new Point(-5, -5)) == 0); - assertTrue(":l:", text.getOffsetAtLocation(new Point(-5, 0)) == 7); - - // 1GL4ZVE - assertTrue(":m:", text.getOffsetAtLocation(text.getLocationAtOffset(2)) == 2); - text.setHorizontalIndex(0); - assertTrue(":n:", text.getOffsetAtLocation(text.getLocationAtOffset(2)) == 2); -} - -public void test_getOrientation() { - warnUnimpl("Test test_getOrientation not written"); -} - -public void test_getSelection(){ - text.setText("01234567890"); - text.setSelection(new Point(2, 2)); - assertTrue(":b:", text.getSelection().equals(new Point(2, 2))); - text.setSelection(new Point(2, 3)); - assertTrue(":c:", text.getSelection().equals(new Point(2, 3))); - text.setSelection(new Point(3, 11)); - assertTrue(":d:", text.getSelection().equals(new Point(3, 11))); - text.setText("01234567890"); - text.setSelection(4); - assertTrue(":a:", text.getSelection().equals(new Point(4, 4))); - text.setSelection(11); - assertTrue(":b:", text.getSelection().equals(new Point(11, 11))); - text.setSelection(new Point(3, 2)); - assertTrue(":c:", text.getSelection().equals(new Point(2, 3))); -} -public void test_getSelectionBackground() { - assertTrue(":1:", text.getSelectionBackground() != null); - text.setSelectionBackground(getColor(YELLOW)); - assertTrue(":1:", text.getSelectionBackground() == getColor(YELLOW)); -} -public void test_getSelectionForeground() { - assertTrue(":1:", text.getSelectionForeground() != null); - text.setSelectionForeground(getColor(RED)); - assertTrue(":1:", text.getSelectionForeground() == getColor(RED)); -} -public void test_getSelectionRange() { - String testText = "Line1\r\nLine2"; - int invalidRanges [][] = {{-1, 0}, {-1, -1}, {100, 1}, {100, -1}, {12, 1}, {11, 2}, {2, -3}, {50, -1}}; - int selectionRanges [][] = {{0, 1}, {0, 0}, {2, 3}, {12, 0}, {2, -2}, {5, -1}}; - boolean exceptionThrown; - - for (int i = 0; i < invalidRanges.length; i++) { - int start = invalidRanges[i][0]; - int length = invalidRanges[i][1]; - - exceptionThrown = false; - try { - text.setSelectionRange(start, length); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":a:", exceptionThrown); - } - - text.setSelectionRange(0, 0); - assertTrue(":b:", text.getSelectionRange().x == 0 && text.getSelectionRange().y == 0); - text.setText(testText); - for (int i = 0; i < selectionRanges.length; i++) { - int start = selectionRanges[i][0]; - int length = selectionRanges[i][1]; - text.setSelectionRange(start, length); - if (length < 0) { - start += length; - length *= -1; - assertEquals(":c:a:" + i, start, text.getCaretOffset()); - } - else { - assertEquals(":c:a:" + i, start + length, text.getCaretOffset()); - } - assertTrue(":c:" + i, text.getSelectionRange().x == start && text.getSelectionRange().y == length); - } - - for (int i = 0; i < invalidRanges.length; i++) { - int start = invalidRanges[i][0]; - int length = invalidRanges[i][1]; - - exceptionThrown = false; - try { - text.setSelectionRange(start, length); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":a:", exceptionThrown); - } -} - -public void test_getSelectionCount(){ - text.setText("01234567890"); - assertTrue(":a:", text.getSelectionCount()==0); - text.setSelection(2, 4); - assertTrue(":b:", text.getSelectionCount()==2); - text.setSelection(2, 11); - assertTrue(":c:", text.getSelectionCount()==9); - text.setText("0123\n4567890"); - assertTrue(":d:", text.getSelectionCount()==0); - text.setSelection(2, 4); - assertTrue(":e:", text.getSelectionCount()==2); - text.setSelection(2, 12); - assertTrue(":f:", text.getSelectionCount()==10); -} - -public void test_getSelectionText() { - String testText = "Line1\r\nLine2"; - int selectionRanges [][] = {{0, 1}, {0, 0}, {2, 3}, {12, 0}}; - - text.setSelectionRange(0, 0); - assertEquals(":b:", "", text.getSelectionText()); - text.setText(testText); - for (int i = 0; i < selectionRanges.length; i++) { - int start = selectionRanges[i][0]; - int length = selectionRanges[i][1]; - text.setSelectionRange(start, length); - assertEquals(":c:" + i, testText.substring(start, start + length), text.getSelectionText()); - } -} - -public void test_getStyleRangeAtOffsetI() { - String line = "Line1\r\nLine2"; - int styleStart = 0; - int styleLength = 5; - int i; - boolean exceptionThrown = false; - StyleRange style = new StyleRange(styleStart, styleLength, getColor(BLUE), getColor(RED), SWT.BOLD); - - try { - text.getStyleRangeAtOffset(0); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("offset out of range no text", exceptionThrown); - - text.setText(line); - exceptionThrown = false; - try { - text.getStyleRangeAtOffset(-1); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("offset out of range negative", exceptionThrown); - - exceptionThrown = false; - try { - text.getStyleRangeAtOffset(line.length()); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("offset out of range positive", exceptionThrown); - - text.setStyleRange(style); - style.length = 1; - for (i = styleStart; i < styleStart + styleLength; i++) { - style.start = i; - assertEquals(style, text.getStyleRangeAtOffset(i)); - } - assertEquals(null, text.getStyleRangeAtOffset(i)); - - // test offset at line delimiter - style = new StyleRange(5, 2, null, getColor(BLUE), SWT.NORMAL); - text.setStyleRange(style); - style.length = 1; - assertEquals(style, text.getStyleRangeAtOffset(5)); - style.start = 6; - assertEquals(style, text.getStyleRangeAtOffset(6)); - assertEquals(null, text.getStyleRangeAtOffset(10)); -} - -public void test_getStyleRanges() { - text.setText("package test;\n/* Line 1\n * Line 2\n */\npublic class SimpleClass {\n}"); - text.setStyleRange(getStyle(0,7,BLUE,null)); - text.setStyleRange(getStyle(14,23,RED,null)); - text.setStyleRange(getStyle(38,6,BLUE,null)); - text.setStyleRange(getStyle(45,5,BLUE,null)); - text.replaceTextRange(14, 23, "\t/*Line 1\n\t * Line 2\n\t */"); - String newText = text.getTextRange(0, text.getCharCount()); - assertTrue(":1:", newText.equals("package test;\n\t/*Line 1\n\t * Line 2\n\t */\npublic class SimpleClass {\n}")); - StyleRange[] styles = text.getStyleRanges(); - assertTrue(":1:", styles.length == 3); - assertTrue(":1:", styles[0].equals(getStyle(0,7,BLUE,null))); - assertTrue(":1:", styles[1].equals(getStyle(40,6,BLUE,null))); - assertTrue(":1:", styles[2].equals(getStyle(47,5,BLUE,null))); -} - -public void test_getStyleRangesII() { - text.setText("0123456789"); -// 0 -// 1234 -// 56 -// 78 -// 9 - text.setStyleRange(getStyle(1,4,BLUE,null)); - text.setStyleRange(getStyle(5,2,RED,null)); - text.setStyleRange(getStyle(7,2,YELLOW,null)); - - StyleRange[] styles = text.getStyleRanges(0,1); - assertTrue(":1:", styles.length == 0); - styles = text.getStyleRanges(0,5); - assertTrue(":2:", styles.length == 1); - assertTrue(":2:", styles[0].equals(getStyle(1,4,BLUE,null))); - styles = text.getStyleRanges(7,3); - assertTrue(":3:", styles.length == 1); - assertTrue(":3:", styles[0].equals(getStyle(7,2,YELLOW,null))); - styles = text.getStyleRanges(0,10); - assertTrue(":4:", styles.length == 3); - assertTrue(":4:", styles[0].equals(getStyle(1,4,BLUE,null))); - assertTrue(":4:", styles[1].equals(getStyle(5,2,RED,null))); - assertTrue(":4:", styles[2].equals(getStyle(7,2,YELLOW,null))); - styles = text.getStyleRanges(0,4); - assertTrue(":5:", styles.length == 1); - assertTrue(":5:", styles[0].equals(getStyle(1,3,BLUE,null))); - styles = text.getStyleRanges(2,6); - assertTrue(":6:", styles.length == 3); - assertTrue(":6:", styles[0].equals(getStyle(2,3,BLUE,null))); - assertTrue(":6:", styles[1].equals(getStyle(5,2,RED,null))); - assertTrue(":6:", styles[2].equals(getStyle(7,1,YELLOW,null))); - - text.setText("0123456789\r\nABCDEFGHIJKL"); - text.setStyleRange(getStyle(4,3,BLUE,null)); - text.setStyleRange(getStyle(7,5,RED,null)); - text.setStyleRange(getStyle(15,1,YELLOW,null)); - styles = text.getStyleRanges(15,1); - assertTrue(":1a:", styles.length == 1); - assertTrue(":1a:", styles[0].equals(getStyle(15,1,YELLOW,null))); - styles = text.getStyleRanges(15,0); - assertTrue(":2a:", styles.length == 0); - styles = text.getStyleRanges(0,20); - assertTrue(":3a:", styles.length == 3); - assertTrue(":3a:", styles[0].equals(getStyle(4,3,BLUE,null))); - assertTrue(":3a:", styles[1].equals(getStyle(7,5,RED,null))); - assertTrue(":3a:", styles[2].equals(getStyle(15,1,YELLOW,null))); - styles = text.getStyleRanges(8,2); - assertTrue(":4a:", styles.length == 1); - assertTrue(":4a:", styles[0].equals(getStyle(8,2,RED,null))); - -} - -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); -} - -public void test_getText() { - String testText = "Line1\r\nLine2"; - - assertTrue(":a:", text.getText().length() == 0); - text.setText(testText); - assertTrue(":b:", text.getText().equals(testText)); - text.setText(""); - assertTrue(":c:", text.getText().length() == 0); - - text.setText(testText); - assertTrue(":a:", text.getText().equals(testText)); - text.setText(testText + "\r\n"); - assertTrue(":b:", text.getText().equals(testText + "\r\n")); - text.setText(""); - assertTrue(":c:", text.getText().length() == 0); -} - -public void test_getTextII() { - boolean exceptionThrown; - String testText = "Line1\r\nLine2"; - int invalidRanges[][] = {{-1, 0}, {0, -1}, {-1, -1}, {100, 1}, {100, -1}, {2, testText.length()}, {5, 2}}; - int ranges[][] = {{0, 1}, {0, 0}, {2, 5}, {7, 11}}; - - for (int i = 0; i < invalidRanges.length; i++) { - int start = invalidRanges[i][0]; - int end = invalidRanges[i][1]; - - exceptionThrown = false; - try { - text.getText(start, end); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":a:", exceptionThrown); - } - text.setText(testText); - for (int i = 0; i < ranges.length; i++) { - int start = ranges[i][0]; - int end = ranges[i][1]; - assertEquals(":b:" + i, testText.substring(start, end + 1), text.getText(start, end)); - } - for (int i = 0; i < invalidRanges.length; i++) { - int start = invalidRanges[i][0]; - int end = invalidRanges[i][1]; - - exceptionThrown = false; - try { - text.getText(start, end); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":a:", exceptionThrown); - } - text.setText("testing"); - assertTrue(":d:", text.getText(0,0).equals("t")); - assertTrue(":d:", text.getText(0,1).equals("te")); - assertTrue(":d:", text.getText(1,5).equals("estin")); -} - -public void test_getTextRangeII() { - boolean exceptionThrown; - String testText = "Line1\r\nLine2"; - int invalidRanges[][] = {{-1, 0}, {0, -1}, {-1, -1}, {100, 1}, {100, -1}, {1, testText.length()}, {5, -1}}; - int ranges[][] = {{0, 1}, {0, 0}, {5, 1}, {7, 5}, {12, 0}}; - - for (int i = 0; i < invalidRanges.length; i++) { - int start = invalidRanges[i][0]; - int length = invalidRanges[i][1]; - - exceptionThrown = false; - try { - text.getTextRange(start, length); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":a:", exceptionThrown); - } - text.setText(testText); - for (int i = 0; i < ranges.length; i++) { - int start = ranges[i][0]; - int length = ranges[i][1]; - assertEquals(":b:" + i, testText.substring(start, start + length), text.getTextRange(start, length)); - } - for (int i = 0; i < invalidRanges.length; i++) { - int start = invalidRanges[i][0]; - int length = invalidRanges[i][1]; - - exceptionThrown = false; - try { - text.getTextRange(start, length); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":a:", exceptionThrown); - } - text.setText("testing"); - assertTrue(":d:", text.getTextRange(0,0).equals("")); - assertTrue(":d:", text.getTextRange(0,1).equals("t")); - assertTrue(":d:", text.getTextRange(0,2).equals("te")); - assertTrue(":d:", text.getTextRange(1,5).equals("estin")); -} - -public void test_getTextLimit() { - assertTrue(":a:", text.getTextLimit() < 0); - text.setTextLimit(10); - assertTrue(":b:", text.getTextLimit() == 10); -} - -public void test_getTopIndex() { - text.setText("Line0\r\nLine0a\r\n"); - - assertTrue(":a:", text.getTopIndex() == 0); - text.setTopIndex(-2); - assertTrue(":b:", text.getTopIndex() == 0); - text.setTopIndex(-1); - assertTrue(":c:", text.getTopIndex() == 0); - text.setTopIndex(1); - assertTrue(":d:", text.getTopIndex() == 1); - text.setTopIndex(2); - assertTrue(":e:", text.getTopIndex() == 2); - text.setTopIndex(0); - assertTrue(":f:", text.getTopIndex() == 0); - text.setTopIndex(3); - assertTrue(":g:", text.getTopIndex() == 2); - text.replaceTextRange(text.getCharCount(), 0, "Line1"); - assertTrue(":h:", text.getTopIndex() == 2); - text.setText(""); - assertTrue(":i:", text.getTopIndex() == 0); -} - -public void test_getTopPixel() { - text.setText("Line0\r\nLine0a\r\n"); - - assertTrue(":a:", text.getTopPixel() == 0); - text.setTopIndex(-2); - assertTrue(":b:", text.getTopPixel() == 0); - text.setTopIndex(-1); - assertTrue(":c:", text.getTopPixel() == 0); - text.setTopIndex(1); - assertTrue(":d:", text.getTopPixel() == text.getLineHeight()); - text.setTopIndex(2); - assertTrue(":e:", text.getTopPixel() == text.getLineHeight() * 2); - text.setTopIndex(0); - assertTrue(":f:", text.getTopPixel() == 0); - text.setTopIndex(3); - assertTrue(":g:", text.getTopPixel() == text.getLineHeight() * 2); - text.replaceTextRange(text.getCharCount(), 0, "Line1"); - assertTrue(":h:", text.getTopPixel() == text.getLineHeight() * 2); - text.setText(""); - assertTrue(":i:", text.getTopPixel() == 0); -} -public void test_getWordWrap() { - assertTrue(":a:", text.getWordWrap() == false); - text.setWordWrap(true); - assertTrue(":b:", text.getWordWrap()); - text.setWordWrap(false); - assertTrue(":c:", text.getWordWrap() == false); - text.setWordWrap(false); - assertTrue(":d:", text.getWordWrap() == false); - text.setWordWrap(true); - assertTrue(":e:", text.getWordWrap()); -} -public void test_insertLjava_lang_String(){ - String delimiterString = "\n"; - try { - text.insert(null); - fail("No exception thrown for string == null"); - } - catch (IllegalArgumentException e) { - } - assertTrue(":a:", text.getText().equals("")); - text.insert(""); - assertTrue(":b:", text.getText().equals("")); - text.insert("fred"); - assertTrue(":c:", text.getText().equals("fred")); - text.setSelection(2); - text.insert("helmut"); - assertTrue(":d:", text.getText().equals("frhelmuted")); - text.setText("01234567890"); - text.setSelection(4); - assertTrue(":e:", text.getLineCount()==1); - text.insert(delimiterString); - assertTrue(":f:", text.getLineCount()==2); -} - -public void test_invokeActionI() { - // invoking actions on an empty text should not crash - text.invokeAction(ST.LINE_DOWN); - text.invokeAction(ST.LINE_UP); - text.invokeAction(ST.LINE_END); - text.invokeAction(ST.LINE_START); - text.invokeAction(ST.COLUMN_NEXT); - text.invokeAction(ST.PAGE_DOWN); - text.invokeAction(ST.PAGE_UP); - text.invokeAction(ST.WORD_NEXT); - text.invokeAction(ST.WORD_PREVIOUS); - text.invokeAction(ST.TEXT_END); - text.invokeAction(ST.TEXT_START); - text.invokeAction(ST.WINDOW_END); - text.invokeAction(ST.WINDOW_START); - text.invokeAction(ST.SELECT_LINE_DOWN); - text.invokeAction(ST.SELECT_LINE_UP); - text.invokeAction(ST.SELECT_LINE_START); - text.invokeAction(ST.SELECT_LINE_END); - text.invokeAction(ST.SELECT_COLUMN_PREVIOUS); - text.invokeAction(ST.SELECT_COLUMN_NEXT); - text.invokeAction(ST.SELECT_PAGE_UP); - text.invokeAction(ST.SELECT_PAGE_DOWN); - text.invokeAction(ST.SELECT_WORD_PREVIOUS); - text.invokeAction(ST.SELECT_WORD_NEXT); - text.invokeAction(ST.SELECT_TEXT_END); - text.invokeAction(ST.SELECT_TEXT_START); - text.invokeAction(ST.SELECT_WINDOW_START); - text.invokeAction(ST.SELECT_WINDOW_END); - text.invokeAction(ST.CUT); - text.invokeAction(ST.COPY); - text.invokeAction(ST.PASTE); - text.invokeAction(ST.DELETE_PREVIOUS); - text.invokeAction(ST.DELETE_NEXT); - text.invokeAction(ST.TOGGLE_OVERWRITE); - - text.setText("Line1\r\nLine2"); - text.invokeAction(ST.LINE_DOWN); - assertEquals(7, text.getCaretOffset()); - - text.invokeAction(ST.LINE_UP); - assertEquals(0, text.getCaretOffset()); - - text.invokeAction(ST.LINE_END); - assertEquals(5, text.getCaretOffset()); - - text.invokeAction(ST.LINE_START); - assertEquals(0, text.getCaretOffset()); - - text.invokeAction(ST.COLUMN_NEXT); - assertEquals(1, text.getCaretOffset()); - - text.invokeAction(ST.PAGE_DOWN); - assertEquals(8, text.getCaretOffset()); - - text.invokeAction(ST.PAGE_UP); - assertEquals(1, text.getCaretOffset()); - - text.invokeAction(ST.TEXT_START); - text.invokeAction(ST.WORD_NEXT); - text.invokeAction(ST.WORD_NEXT); - assertEquals(7, text.getCaretOffset()); - - text.invokeAction(ST.WORD_PREVIOUS); - assertEquals(5, text.getCaretOffset()); - - text.invokeAction(ST.TEXT_END); - assertEquals(text.getCharCount(), text.getCaretOffset()); - - text.invokeAction(ST.TEXT_START); - assertEquals(0, text.getCaretOffset()); - - text.invokeAction(ST.WINDOW_END); - assertEquals(5, text.getCaretOffset()); - - text.invokeAction(ST.WINDOW_START); - assertEquals(0, text.getCaretOffset()); - - text.invokeAction(ST.SELECT_LINE_DOWN); - assertEquals("Line1\r\n", text.getSelectionText()); - - text.invokeAction(ST.LINE_END); - text.invokeAction(ST.SELECT_LINE_UP); - assertEquals("\r\nLine2", text.getSelectionText()); - - text.invokeAction(ST.SELECT_LINE_START); - assertEquals("Line1\r\nLine2", text.getSelectionText()); - - text.invokeAction(ST.LINE_START); - text.invokeAction(ST.SELECT_LINE_END); - assertEquals("Line1", text.getSelectionText()); - - text.invokeAction(ST.LINE_END); - text.invokeAction(ST.SELECT_COLUMN_PREVIOUS); - assertEquals("1", text.getSelectionText()); - - text.invokeAction(ST.SELECT_COLUMN_NEXT); - assertEquals("", text.getSelectionText()); - - text.invokeAction(ST.SELECT_PAGE_UP); - assertEquals("", text.getSelectionText()); - - text.invokeAction(ST.SELECT_PAGE_DOWN); - assertEquals("\r\nLine2", text.getSelectionText()); - - text.invokeAction(ST.LINE_END); - text.invokeAction(ST.SELECT_WORD_PREVIOUS); - assertEquals("Line2", text.getSelectionText()); - - text.invokeAction(ST.LINE_START); - text.invokeAction(ST.SELECT_WORD_NEXT); - assertEquals("Line2", text.getSelectionText()); - - text.invokeAction(ST.LINE_START); - text.invokeAction(ST.SELECT_TEXT_END); - assertEquals("Line2", text.getSelectionText()); - - text.invokeAction(ST.SELECT_TEXT_START); - assertEquals("Line1\r\n", text.getSelectionText()); - - text.invokeAction(ST.LINE_START); - text.invokeAction(ST.SELECT_WINDOW_START); - assertEquals("", text.getSelectionText()); - - text.invokeAction(ST.SELECT_WINDOW_END); - assertEquals("Line1", text.getSelectionText()); - - text.invokeAction(ST.SELECT_LINE_END); - text.invokeAction(ST.CUT); - assertEquals("\r\nLine2", text.getText()); - - text.invokeAction(ST.SELECT_LINE_DOWN); - text.invokeAction(ST.COPY); - assertEquals("\r\nLine2", text.getText()); - - text.invokeAction(ST.LINE_END); - text.invokeAction(ST.PASTE); - assertEquals("\r\nLine2" + PLATFORM_LINE_DELIMITER, text.getText()); - - text.invokeAction(ST.DELETE_PREVIOUS); - assertEquals("\r\nLine2", text.getText()); - - text.invokeAction(ST.TEXT_START); - text.invokeAction(ST.DELETE_NEXT); - assertEquals("Line2", text.getText()); - - text.invokeAction(ST.TOGGLE_OVERWRITE); -} - -public void test_paste(){ - Clipboard clipboard = new Clipboard(text.getDisplay()); - TextTransfer transfer = TextTransfer.getInstance(); - String convertedText; - - clipboard.setContents(new String[]{"x"}, new Transfer[]{transfer}); - - text.copy(); - text.paste(); - assertTrue(":a:", text.getCharCount() == 1); - - text.setSelectionRange(0, 0); - text.copy(); - text.paste(); - assertTrue(":b:", text.getCharCount() == 2); - - text.setText("0123456789"); - text.setSelectionRange(0, 1); - text.copy(); - text.setCaretOffset(0); - text.paste(); - assertTrue(":c:", text.getText().equals("00123456789")); - text.setSelectionRange(1, 2); - text.copy(); - text.setText(""); - text.paste(); - assertTrue(":d:", text.getText().equals("01")); - text.setText(""); - - // test line delimiter conversion - clipboard.setContents(new String[]{"\rLine1\nLine2\r\nLine3\n\rLine4\n"}, new Transfer[]{transfer}); - text.paste(); - if (SwtJunit.isWindows) { - convertedText = "\r\nLine1\r\nLine2\r\nLine3\r\n\r\nLine4\r\n"; - } - else { - convertedText = "\nLine1\nLine2\nLine3\n\nLine4\n"; - } - assertTrue(":f:", text.getText() != null && text.getText().equals(convertedText)); - text.setText(""); - - // test line delimiter conversion - clipboard.setContents(new String[]{"Line1\r\nLine2"}, new Transfer[]{transfer}); - text.paste(); - if (SwtJunit.isWindows) { - convertedText = "Line1\r\nLine2"; - } - else { - convertedText = "Line1\nLine2"; - } - assertTrue(":g:", text.getText() != null && text.getText().equals(convertedText)); - text.setText(""); - - // test line delimiter conversion - clipboard.setContents(new String[]{"Line1\rLine2"}, new Transfer[]{transfer}); - text.paste(); - if (SwtJunit.isWindows) { - convertedText = "Line1\r\nLine2"; - } - else { - convertedText = "Line1\nLine2"; - } - assertTrue(":h:", text.getText() != null && text.getText().equals(convertedText)); - text.setText(""); - - - // test line delimiter conversion - clipboard.setContents(new String[]{"Line1\nLine2"}, new Transfer[]{transfer}); - text.paste(); - if (SwtJunit.isWindows) { - convertedText = "Line1\r\nLine2"; - } - else { - convertedText = "Line1\nLine2"; - } - assertTrue(":i:", text.getText() != null && text.getText().equals(convertedText)); - text.setText(""); - - - clipboard.dispose(); -} - -public void test_print() { - // if there aren't any printers, don't do this test - if (Printer.getDefaultPrinterData() == null) return; - - /* We don't really want to run this test, because it wastes paper. - * Almost all of the print() method is tested in print(Printer), below. - */ -// text.print(); -// text.setText("Line1"); -// text.print(); -} - -public void test_printLorg_eclipse_swt_printing_Printer() { - // if there aren't any printers, don't do this test - if (Printer.getDefaultPrinterData() == null) return; - - boolean exceptionThrown = false; - try { - text.print(null); - } catch (IllegalArgumentException ex) { - exceptionThrown = true; - } - assertTrue("no exception thrown for print(null)", exceptionThrown); - - Printer printer = new Printer(); - text.print(printer); // don't run the runnable, to save paper - text.setText("Line1"); - text.print(printer); // don't run the runnable, to save paper - printer.dispose(); -} - -public void test_printLorg_eclipse_swt_printing_PrinterLorg_eclipse_swt_custom_StyledTextPrintOptions() { - warnUnimpl("Test test_printLorg_eclipse_swt_printing_PrinterLorg_eclipse_swt_custom_StyledTextPrintOptions not written"); -} - -public void test_redraw() { - // inherited test is sufficient -} - -public void test_redrawIIIIZ() { - // inherited test is sufficient -} - -public void test_redrawRangeIIZ() { - boolean exceptionThrown = false; - - text.redrawRange(0, 0, true); - text.redrawRange(0, 0, false); - - try { - text.redrawRange(0, 1, true); - } - catch (IllegalArgumentException e) { - if (e.getMessage().equals("Index out of bounds")) { - exceptionThrown = true; - } - } - assertTrue(exceptionThrown); - - exceptionThrown = false; - try { - text.redrawRange(0, 1, false); - } - catch (IllegalArgumentException e) { - if (e.getMessage().equals("Index out of bounds")) { - exceptionThrown = true; - } - } - assertTrue(exceptionThrown); - - exceptionThrown = false; - try { - text.redrawRange(-1, 2, true); - } - catch (IllegalArgumentException e) { - if (e.getMessage().equals("Index out of bounds")) { - exceptionThrown = true; - } - } - assertTrue(exceptionThrown); - - exceptionThrown = false; - try { - text.redrawRange(-1, 2, false); - } - catch (IllegalArgumentException e) { - if (e.getMessage().equals("Index out of bounds")) { - exceptionThrown = true; - } - } - assertTrue(exceptionThrown); - - text.setText("0123456789"); - text.redrawRange(0, 0, true); - text.redrawRange(0, 0, false); - text.redrawRange(0, 1, true); - text.redrawRange(0, 1, false); - text.redrawRange(8, 2, true); - text.redrawRange(8, 2, false); - text.redrawRange(10, 0, true); - text.redrawRange(10, 0, false); - - exceptionThrown = false; - try { - text.redrawRange(10, 1, true); - } - catch (IllegalArgumentException e) { - if (e.getMessage().equals("Index out of bounds")) { - exceptionThrown = true; - } - } - assertTrue(exceptionThrown); - - exceptionThrown = false; - try { - text.redrawRange(10, 1, false); - } - catch (IllegalArgumentException e) { - if (e.getMessage().equals("Index out of bounds")) { - exceptionThrown = true; - } - } - assertTrue(exceptionThrown); -} - -public void test_removeBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener() { - // tested in test_addBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener -} - -public void test_removeExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener() { - // tested in test_addExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener -} - -public void test_removeLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener() { - // tested in test_addLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener -} - -public void test_removeLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener() { - // tested in test_addLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener -} - -public void test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener() { - // tested in test_addModifyListenerLorg_eclipse_swt_events_ModifyListener -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - // tested in test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener -} - -public void test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener() { - // tested in test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener -} - -public void test_removeVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener() { - // tested in test_addVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener -} -public void test_replaceStyleRangesII$Lorg_eclipse_swt_custom_StyleRange() { - StyleRange[] styles; - String textString = textString(); - - /* - defaultStyles - - (0,48,RED,YELLOW), - (58,10,BLUE,CYAN), - (68,10,GREEN,PURPLE) - */ - - - text.setText(textString); - - text.replaceStyleRanges(0, text.getCharCount(), defaultStyles()); - text.replaceStyleRanges(0, 78, new StyleRange[] {}); - styles = text.getStyleRanges(); - assertTrue(":0:", styles.length == 0); - text.setText(textString); - styles = text.getStyleRanges(); - assertTrue(":0:", styles.length == 0); - text.replaceStyleRanges(0, 78, new StyleRange[] {}); - styles = text.getStyleRanges(); - assertTrue(":0:", styles.length == 0); - text.replaceStyleRanges(0, text.getCharCount(), defaultStyles()); - styles = text.getStyleRanges(); - assertTrue(":0:", styles.length == 3); - assertTrue(":0:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":0:", styles[1].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":0:", styles[2].equals(getStyle(68,10,GREEN,PURPLE))); - - // No overlap with existing styles - text.replaceStyleRanges(0, text.getCharCount(), defaultStyles()); - text.replaceStyleRanges(48, 5, new StyleRange[] {getStyle(48,5,YELLOW,RED)}); - styles = text.getStyleRanges(); - assertTrue(":1:", styles.length == 4); - assertTrue(":1:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":1:", styles[1].equals(getStyle(48,5,YELLOW,RED))); - assertTrue(":1:", styles[2].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":1:", styles[3].equals(getStyle(68,10,GREEN,PURPLE))); - - // Overlap middle of one style - partial - text.replaceStyleRanges(0, text.getCharCount(), defaultStyles()); - text.replaceStyleRanges(10, 10, new StyleRange[] {getStyle(10,10,YELLOW,RED)}); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 5); - assertTrue(":2:", styles[0].equals(getStyle(0,10,RED,YELLOW))); - assertTrue(":2:", styles[1].equals(getStyle(10,10,YELLOW,RED))); - assertTrue(":2:", styles[2].equals(getStyle(20,28,RED,YELLOW))); - assertTrue(":2:", styles[3].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":2:", styles[4].equals(getStyle(68,10,GREEN,PURPLE))); - text.replaceStyleRanges(0, text.getCharCount(), new StyleRange[] {}); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 0); - - // Overlap middle of one style - full - text.replaceStyleRanges(0, text.getCharCount(), defaultStyles()); - text.replaceStyleRanges(58, 10, new StyleRange[] {getStyle(58,10,YELLOW,RED)}); - styles = text.getStyleRanges(); - assertTrue(":3:", styles.length == 3); - assertTrue(":3:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":3:", styles[1].equals(getStyle(58,10,YELLOW,RED))); - assertTrue(":3:", styles[2].equals(getStyle(68,10,GREEN,PURPLE))); - - // Overlap end of one style - text.replaceStyleRanges(0, text.getCharCount(), defaultStyles()); - text.replaceStyleRanges(38, 15, new StyleRange[] {getStyle(38,15,YELLOW,RED)}); - styles = text.getStyleRanges(); - assertTrue(":4:", styles.length == 4); - assertTrue(":4:", styles[0].equals(getStyle(0,38,RED,YELLOW))); - assertTrue(":4:", styles[1].equals(getStyle(38,15,YELLOW,RED))); - assertTrue(":4:", styles[2].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":4:", styles[3].equals(getStyle(68,10,GREEN,PURPLE))); - - // Overlap beginning of one style - text.replaceStyleRanges(0, text.getCharCount(), defaultStyles()); - text.replaceStyleRanges(50, 10, new StyleRange[] {getStyle(50,10,YELLOW,RED)}); - styles = text.getStyleRanges(); - assertTrue(":5:", styles.length == 4); - assertTrue(":5:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":5:", styles[1].equals(getStyle(50,10,YELLOW,RED))); - assertTrue(":5:", styles[2].equals(getStyle(60,8,BLUE,CYAN))); - assertTrue(":5:", styles[3].equals(getStyle(68,10,GREEN,PURPLE))); - - // Overlap complete style - text.replaceStyleRanges(0, text.getCharCount(), defaultStyles()); - text.replaceStyleRanges(48, 20, new StyleRange[] {getStyle(48,20,YELLOW,RED)}); - styles = text.getStyleRanges(); - assertTrue(":6:", styles.length == 3); - assertTrue(":6:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":6:", styles[1].equals(getStyle(48,20,YELLOW,RED))); - assertTrue(":6:", styles[2].equals(getStyle(68,10,GREEN,PURPLE))); - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - text.setText(textString); - StyleRange ranges[] = new StyleRange[3]; - ranges[0] = getStyle(0,48,RED,YELLOW); - ranges[1] = getStyle(48,20,BLUE,CYAN); - ranges[2] = getStyle(68,10,GREEN,PURPLE); - text.replaceStyleRanges(0, 78, ranges); - styles = text.getStyleRanges(); - assertTrue(":7:", styles.length == 3); - assertTrue(":7:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":7:", styles[1].equals(getStyle(48,20,BLUE,CYAN))); - assertTrue(":7:", styles[2].equals(getStyle(68,10,GREEN,PURPLE))); - - text.setText("012345678901234"); - ranges = new StyleRange[2]; - ranges[0] = getStyle(0,5,RED,YELLOW); - ranges[1] = getStyle(10,5,BLUE,CYAN); - text.replaceStyleRanges(0, 15, ranges); - styles = text.getStyleRanges(); - assertTrue(":8:", styles.length == 2); - assertTrue(":8:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":8:", styles[1].equals(getStyle(10,5,BLUE,CYAN))); - - text.setText("redgreenblueyellowcyanpurple"); - ranges = new StyleRange[4]; - ranges[0] = getStyle(0,3,RED,null); - ranges[1] = getStyle(3,5,GREEN,null); - ranges[2] = getStyle(8,4,BLUE,null); - ranges[3] = getStyle(12,6,YELLOW,null); - text.replaceStyleRanges(0, 18, ranges); - styles = text.getStyleRanges(); - assertTrue(":9:", styles.length == 4); - assertTrue(":9:", styles[0].equals(getStyle(0,3,RED,null))); - assertTrue(":9:", styles[1].equals(getStyle(3,5,GREEN,null))); - assertTrue(":9:", styles[2].equals(getStyle(8,4,BLUE, null))); - assertTrue(":9:", styles[3].equals(getStyle(12,6,YELLOW,null))); - ranges = new StyleRange[2]; - ranges[0] = getStyle(18,4,CYAN,null); - ranges[1] = getStyle(22,6,PURPLE,null); - text.replaceStyleRanges(18, 10, ranges); - styles = text.getStyleRanges(); - assertTrue(":9:", styles.length == 6); - assertTrue(":9:", styles[4].equals(getStyle(18,4,CYAN,null))); - assertTrue(":9:", styles[5].equals(getStyle(22,6,PURPLE,null))); - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - textString = textString(); - - text.setText(textString); - ranges = new StyleRange[2]; - ranges[0] = getStyle(0,10,RED,YELLOW); - ranges[1] = getStyle(25,10,GREEN,PURPLE); - text.replaceStyleRanges(0, 35, ranges); - ranges = new StyleRange[2]; - ranges[0] = getStyle(5,15,BLUE,CYAN); - ranges[1] = getStyle(20,10,GREEN,PURPLE); - text.replaceStyleRanges(5, 25, ranges); - styles = text.getStyleRanges(); - assertTrue(":10:", styles.length == 4); - assertTrue(":10:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":10:", styles[1].equals(getStyle(5,15,BLUE,CYAN))); - assertTrue(":10:", styles[2].equals(getStyle(20,10,GREEN,PURPLE))); - assertTrue(":10:", styles[3].equals(getStyle(30,5,GREEN,PURPLE))); - - text.setText("01234567890123456789"); - ranges = new StyleRange[2]; - ranges[0] = getStyle(0,10,RED,YELLOW); - ranges[1] = getStyle(10,10,BLUE,CYAN); - text.replaceStyleRanges(0, 20, ranges); - ranges = new StyleRange[2]; - ranges[0] = getStyle(5,3,RED,YELLOW); - ranges[1] = getStyle(12,5,BLUE,CYAN); - text.replaceStyleRanges(5, 12, ranges); - styles = text.getStyleRanges(); - assertTrue(":11:", styles.length == 4); - assertTrue(":11:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":11:", styles[1].equals(getStyle(5,3,RED,YELLOW))); - assertTrue(":11:", styles[2].equals(getStyle(12,5,BLUE,CYAN))); - assertTrue(":11:", styles[3].equals(getStyle(17,3,BLUE,CYAN))); - - text.setText("0123456789012345"); - ranges = new StyleRange[3]; - ranges[0] = getStyle(0,5,RED,YELLOW); - ranges[1] = getStyle(5,5,BLUE,CYAN); - ranges[2] = getStyle(10,5,GREEN,PURPLE); - text.replaceStyleRanges(0, 15, ranges); - ranges = new StyleRange[2]; - ranges[0] = getStyle(5,5,RED,YELLOW); - ranges[1] = getStyle(10,5,RED,YELLOW); - text.replaceStyleRanges(5, 10, ranges); - styles = text.getStyleRanges(); - assertTrue(":12:", styles.length == 3); - assertTrue(":12:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":12:", styles[1].equals(getStyle(5,5,RED,YELLOW))); - assertTrue(":12:", styles[2].equals(getStyle(10,5,RED,YELLOW))); - - text.setText("0123456789012345"); - ranges = new StyleRange[1]; - ranges[0] = getStyle(10,5,GREEN,PURPLE); - text.replaceStyleRanges(0, 15, ranges); - ranges = new StyleRange[2]; - ranges[0] = getStyle(0,5,RED,YELLOW); - ranges[1] = getStyle(5,5,BLUE,CYAN); - text.replaceStyleRanges(0, 10, ranges); - styles = text.getStyleRanges(); - assertTrue(":13:", styles.length == 3); - assertTrue(":13:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":13:", styles[1].equals(getStyle(5,5,BLUE,CYAN))); - assertTrue(":13:", styles[2].equals(getStyle(10,5,GREEN,PURPLE))); - - text.setText("012345678901234"); - ranges = new StyleRange[2]; - ranges[0] = getStyle(0,5,RED,YELLOW); - ranges[1] = getStyle(10,5,BLUE,CYAN); - text.replaceStyleRanges(0, 15, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(5,7,BLUE,CYAN); - text.replaceStyleRanges(5, 7, ranges); - styles = text.getStyleRanges(); - assertTrue(":14:", styles.length == 3); - assertTrue(":14:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":14:", styles[1].equals(getStyle(5,7,BLUE,CYAN))); - assertTrue(":14:", styles[2].equals(getStyle(12,3,BLUE,CYAN))); - - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - textString = textString(); - - - /* - defaultStyles - - (0,48,RED,YELLOW), - (58,10,BLUE,CYAN), - (68,10,GREEN,PURPLE) - */ - - - // End/Beginning overlap - text.setText(textString); - text.setStyleRanges(defaultStyles()); - ranges = new StyleRange[1]; - ranges[0] = getStyle(38,25,YELLOW,RED); - text.replaceStyleRanges(38, 25, ranges); - styles = text.getStyleRanges(); - assertTrue(":1a:", styles.length == 4); - assertTrue(":1a:", styles[0].equals(getStyle(0,38,RED,YELLOW))); - assertTrue(":1a:", styles[1].equals(getStyle(38,25,YELLOW,RED))); - assertTrue(":1a:", styles[2].equals(getStyle(63,5,BLUE,CYAN))); - assertTrue(":1a:", styles[3].equals(getStyle(68,10,GREEN,PURPLE))); - text.setStyleRanges(defaultStyles()); - ranges = new StyleRange[1]; - ranges[0] = getStyle(63,10,YELLOW,RED); - text.replaceStyleRanges(63, 10, ranges); - styles = text.getStyleRanges(); - assertTrue(":1a:", styles.length == 4); - assertTrue(":1a:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":1a:", styles[1].equals(getStyle(58,5,BLUE,CYAN))); - assertTrue(":1a:", styles[2].equals(getStyle(63,10,YELLOW,RED))); - assertTrue(":1a:", styles[3].equals(getStyle(73,5,GREEN,PURPLE))); - - // Complete overlap - text.setStyleRanges(defaultStyles()); - ranges = new StyleRange[1]; - ranges[0] = getStyle(0,78,YELLOW,RED); - text.replaceStyleRanges(0, 78, ranges); - styles = text.getStyleRanges(); - styles = text.getStyleRanges(); - assertTrue(":2a:", styles.length == 1); - assertTrue(":2a:", styles[0].equals(getStyle(0,78,YELLOW,RED))); - - text.setStyleRanges(defaultStyles()); - ranges = new StyleRange[1]; - ranges[0] = getStyle(0,68,YELLOW,RED); - text.replaceStyleRanges(0, 68, ranges); - styles = text.getStyleRanges(); - assertTrue(":2a:", styles.length == 2); - assertTrue(":2a:", styles[0].equals(getStyle(0,68,YELLOW,RED))); - assertTrue(":2a:", styles[1].equals(getStyle(68,10,GREEN,PURPLE))); - text.setStyleRanges(defaultStyles()); - ranges = new StyleRange[1]; - ranges[0] = getStyle(58,20,YELLOW,RED); - text.replaceStyleRanges(58, 20, ranges); - styles = text.getStyleRanges(); - assertTrue(":2a:", styles.length == 2); - assertTrue(":2a:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":2a:", styles[1].equals(getStyle(58,20,YELLOW,RED))); - - // 1-N complete, beginning - text.setText("012345678901234567890123456789"); - text.setStyleRanges( - new StyleRange[] {getStyle(0,5,RED,RED), getStyle(5,5,YELLOW,YELLOW), - getStyle(10,5,CYAN,CYAN), getStyle(15,5,BLUE,BLUE), - getStyle(20,5,GREEN,GREEN), getStyle(25,5,PURPLE,PURPLE)} - ); - ranges = new StyleRange[1]; - ranges[0] = getStyle(5,23,YELLOW,RED); - text.replaceStyleRanges(5, 23, ranges); - styles = text.getStyleRanges(); - assertTrue(":3a:", styles.length == 3); - assertTrue(":3a:", styles[0].equals(getStyle(0,5,RED,RED))); - assertTrue(":3a:", styles[1].equals(getStyle(5,23,YELLOW,RED))); - assertTrue(":3a:", styles[2].equals(getStyle(28,2,PURPLE,PURPLE))); - - // end, 1-N complete, beginning - text.setStyleRanges( - new StyleRange[] {getStyle(0,5,RED,RED), getStyle(5,5,YELLOW,YELLOW), - getStyle(10,5,CYAN,CYAN), getStyle(15,5,BLUE,BLUE), - getStyle(20,5,GREEN,GREEN), getStyle(25,5,PURPLE,PURPLE)} - ); - ranges = new StyleRange[1]; - ranges[0] = getStyle(13,12,YELLOW,RED); - text.replaceStyleRanges(13, 12, ranges); - styles = text.getStyleRanges(); - assertTrue(":3a:", styles.length == 5); - assertTrue(":3a:", styles[0].equals(getStyle(0,5,RED,RED))); - assertTrue(":3a:", styles[1].equals(getStyle(5,5,YELLOW,YELLOW))); - assertTrue(":3a:", styles[2].equals(getStyle(10,3,CYAN,CYAN))); - assertTrue(":3a:", styles[3].equals(getStyle(13,12,YELLOW,RED))); - assertTrue(":3a:", styles[4].equals(getStyle(25,5,PURPLE,PURPLE))); - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - // insert with no styles - text.setText("01234567890123456789"); - ranges = new StyleRange[1]; - ranges[0] = getStyle(0,5,RED,YELLOW); - text.replaceStyleRanges(0, 10, ranges); - styles = text.getStyleRanges(); - assertTrue(":1xa:", styles.length == 1); - assertTrue(":1xa:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - - // insert before 1 style - text.setText("01234567890123456789"); - ranges = new StyleRange[1]; - ranges[0] = getStyle(5,3,RED,YELLOW); - text.replaceStyleRanges(0, 10, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(0,3,PURPLE,PURPLE); - text.replaceStyleRanges(0, 3, ranges); - styles = text.getStyleRanges(); - assertTrue(":1xb:", styles.length == 2); - assertTrue(":1xb:", styles[0].equals(getStyle(0,3,PURPLE,PURPLE))); - assertTrue(":1xb:", styles[1].equals(getStyle(5,3,RED,YELLOW))); - - // insert after 1 style - text.setText("01234567890123456789"); - ranges = new StyleRange[1]; - ranges[0] = getStyle(5,3,RED,YELLOW); - text.replaceStyleRanges(0, 10, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(8,1,PURPLE,PURPLE); - text.replaceStyleRanges(8, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":1xc:", styles.length == 2); - assertTrue(":1xc:", styles[0].equals(getStyle(5,3,RED,YELLOW))); - assertTrue(":1xc:", styles[1].equals(getStyle(8,1,PURPLE,PURPLE))); - - // insert before 2 styles - text.setText("01234567890123456789"); - ranges = new StyleRange[2]; - ranges[0] = getStyle(5,2,RED,YELLOW); - ranges[1] = getStyle(10,2,RED,YELLOW); - text.replaceStyleRanges(0, 20, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(2,1,PURPLE,PURPLE); - text.replaceStyleRanges(2, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":1xe:", styles.length == 3); - assertTrue(":1xe:", styles[0].equals(getStyle(2,1,PURPLE,PURPLE))); - assertTrue(":1xe:", styles[1].equals(getStyle(5,2,RED,YELLOW))); - assertTrue(":1xe:", styles[2].equals(getStyle(10,2,RED,YELLOW))); - - // insert after 2 styles - text.setText("01234567890123456789"); - ranges = new StyleRange[2]; - ranges[0] = getStyle(5,2,RED,YELLOW); - ranges[1] = getStyle(10,2,RED,YELLOW); - text.replaceStyleRanges(0, 20, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(12,1,PURPLE,PURPLE); - text.replaceStyleRanges(12, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":1xf:", styles.length == 3); - assertTrue(":1xf:", styles[0].equals(getStyle(5,2,RED,YELLOW))); - assertTrue(":1xf:", styles[1].equals(getStyle(10,2,RED,YELLOW))); - assertTrue(":1xf:", styles[2].equals(getStyle(12,1,PURPLE,PURPLE))); - - // insert middle 2 styles - text.setText("01234567890123456789"); - ranges = new StyleRange[2]; - ranges[0] = getStyle(1,2,RED,YELLOW); - ranges[1] = getStyle(12,2,RED,YELLOW); - text.replaceStyleRanges(0, 20, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(5,3,PURPLE,PURPLE); - text.replaceStyleRanges(5, 3, ranges); - styles = text.getStyleRanges(); - assertTrue(":1xg:", styles.length == 3); - assertTrue(":1xg:", styles[0].equals(getStyle(1,2,RED,YELLOW))); - assertTrue(":1xg:", styles[1].equals(getStyle(5,3,PURPLE,PURPLE))); - assertTrue(":1xg:", styles[2].equals(getStyle(12,2,RED,YELLOW))); - - // insert middle 3 styles - text.setText("01234567890123456789"); - ranges = new StyleRange[3]; - ranges[0] = getStyle(1,3,RED,PURPLE); - ranges[1] = getStyle(6,3,PURPLE,YELLOW); - ranges[2] = getStyle(12,3,RED,YELLOW); - text.replaceStyleRanges(0, 20, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(4,2,PURPLE,PURPLE); - text.replaceStyleRanges(4, 2, ranges); - styles = text.getStyleRanges(); - assertTrue(":1xh:", styles.length == 4); - assertTrue(":1xh:", styles[0].equals(getStyle(1,3,RED,PURPLE))); - assertTrue(":1xh:", styles[1].equals(getStyle(4,2,PURPLE,PURPLE))); - assertTrue(":1xh:", styles[2].equals(getStyle(6,3,PURPLE,YELLOW))); - assertTrue(":1xh:", styles[3].equals(getStyle(12,3,RED,YELLOW))); - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - text.setText("0"); - ranges = new StyleRange[1]; - ranges[0] = getStyle(0,1,PURPLE,PURPLE); - text.replaceStyleRanges(0, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":2xa:", styles.length == 1); - - text.setText("01"); - ranges = new StyleRange[2]; - ranges[0] = getStyle(0,1,PURPLE,PURPLE); - ranges[1] = getStyle(1,1,RED,RED); - text.replaceStyleRanges(0, 2, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(0,1,YELLOW,YELLOW); - text.replaceStyleRanges(0, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":2xb:", styles.length == 2); - assertTrue(":2xb:", styles[0].equals(getStyle(0,1,YELLOW,YELLOW))); - assertTrue(":2xb:", styles[1].equals(getStyle(1,1,RED,RED))); - - text.setText("01"); - ranges = new StyleRange[2]; - ranges[0] = getStyle(0,1,PURPLE,PURPLE); - ranges[1] = getStyle(1,1,RED,RED); - text.replaceStyleRanges(0, 2, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(1,1,YELLOW,YELLOW); - text.replaceStyleRanges(1, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":2xc:", styles.length == 2); - assertTrue(":2xc:", styles[0].equals(getStyle(0,1,PURPLE,PURPLE))); - assertTrue(":2xc:", styles[1].equals(getStyle(1,1,YELLOW,YELLOW))); - - text.setText("012"); - ranges = new StyleRange[2]; - ranges[0] = getStyle(0,1,PURPLE,PURPLE); - ranges[1] = getStyle(1,1,RED,RED); - text.replaceStyleRanges(0, 2, ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(2,1,YELLOW,YELLOW); - text.replaceStyleRanges(2, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":2xd:", styles.length == 3); - assertTrue(":2xd:", styles[0].equals(getStyle(0,1,PURPLE,PURPLE))); - assertTrue(":2xd:", styles[1].equals(getStyle(1,1,RED,RED))); - assertTrue(":2xd:", styles[2].equals(getStyle(2,1,YELLOW,YELLOW))); - - text.setText("01234"); - ranges = new StyleRange[3]; - ranges[0] = getStyle(1,1,PURPLE,PURPLE); - ranges[1] = getStyle(2,1,RED,RED); - ranges[2] = getStyle(3,1,PURPLE,PURPLE); - text.setStyleRanges(ranges); - ranges = new StyleRange[1]; - ranges[0] = getStyle(4,1,YELLOW,YELLOW); - text.replaceStyleRanges(4, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":2xe:", styles.length == 4); - assertTrue(":2xe:", styles[3].equals(getStyle(4,1,YELLOW,YELLOW))); - - text.setText("01234"); - ranges = new StyleRange[1]; - ranges[0] = getStyle(4,1,YELLOW,YELLOW); - text.replaceStyleRanges(4, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":2xf:", styles.length == 1); - assertTrue(":2xf:", styles[0].equals(getStyle(4,1,YELLOW,YELLOW))); - - text.setText("01234"); - ranges = new StyleRange[1]; - ranges[0] = getStyle(4,1,YELLOW,YELLOW); - text.replaceStyleRanges(4, 1, ranges); - ranges = new StyleRange[0]; - text.replaceStyleRanges(4, 1, ranges); - styles = text.getStyleRanges(); - assertTrue(":2xg:", styles.length == 0); - -} - -public void test_replaceTextRangeIILjava_lang_String(){ - String defaultText = "line0\n\rline1\n\rline2\n\r"; - int defaultTextLength = defaultText.length(); - int selectionStart = 7; - int selectionLength = 7; - int replaceStart = selectionStart + selectionLength + 1; - int replaceLength = 5; - boolean exceptionThrown = false; - String newText = "newline0\n\rnewline1"; - int newTextLength = newText.length(); - - // insert text - // within range - // after selection - text.setText(defaultText); - // select 2nd line including line break - text.setSelectionRange(selectionStart, selectionLength); - text.replaceTextRange(replaceStart, 0, newText); - assertTrue(":a:", text.getCharCount() == defaultTextLength + newTextLength); - assertTrue(":b:", text.getSelectionRange().x == selectionStart && text.getSelectionRange().y == selectionLength); - - // before selection - text.setText(defaultText); - // select 2nd line including line break - text.setSelectionRange(selectionStart, selectionLength); - text.replaceTextRange(0, 0, newText); - assertTrue(":c:", text.getCharCount() == defaultTextLength + newTextLength); - assertTrue(":d:", text.getSelectionRange().x == selectionStart + newTextLength && text.getSelectionRange().y == selectionLength); - - - // intersecting selection - text.setText(defaultText); - // select 2nd line including line break - text.setSelectionRange(selectionStart, selectionLength); - text.replaceTextRange(selectionStart + 1, 0, newText); - assertTrue(":e:", text.getCharCount() == defaultTextLength + newTextLength); - assertTrue(":f:", text.getSelectionRange().x == selectionStart + 1 + newTextLength && text.getSelectionRange().y == 0); - - // out of range - text.setText(defaultText); - // select 2nd line including line break - text.setSelectionRange(selectionStart, selectionLength); - try { - text.replaceTextRange(-1, 0, newText); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":g:", exceptionThrown); - exceptionThrown = false; - try { - text.replaceTextRange(text.getCharCount() + 1, 0, newText); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - - exceptionThrown = false; - try { - text.replaceTextRange(0, 0, null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - - assertTrue(":h:", exceptionThrown); - assertTrue(":i:", text.getSelectionRange().x == selectionStart && text.getSelectionRange().y == selectionLength); - exceptionThrown = false; - - // append text - // append in empty widget - text.setText(""); - text.replaceTextRange(text.getCharCount(), 0, newText); - assertTrue(":j:", text.getCharCount() == newTextLength); - assertTrue(":k:", text.getSelectionRange().x == 0 && text.getSelectionRange().y == 0); - - // append in non-empty widget (selection should always be preserved) - text.setText(defaultText); - // select 2nd line including line break - text.setSelectionRange(selectionStart, selectionLength); - text.replaceTextRange(text.getCharCount(), 0, newText); - assertTrue(":l:", text.getCharCount() == defaultTextLength + newTextLength); - assertTrue(":m:", text.getSelectionRange().x == selectionStart && text.getSelectionRange().y == selectionLength); - - // place caret at end of text - text.setText(defaultText); - text.setSelectionRange(text.getCharCount(), 0); - text.replaceTextRange(text.getCharCount(), 0, newText); - assertTrue(":n:", text.getCharCount() == defaultTextLength + newTextLength); - assertTrue(":o:", text.getSelectionRange().x == text.getCharCount() - newTextLength && text.getSelectionRange().y == 0); - - // replace text - // within range - // after selection - text.setText(defaultText); - // select 2nd line including line break - text.setSelectionRange(selectionStart, selectionLength); - text.replaceTextRange(replaceStart, replaceLength, newText); - assertTrue(":p:", text.getCharCount() == defaultTextLength + newTextLength - replaceLength); - assertTrue(":q:", text.getSelectionRange().x == selectionStart && text.getSelectionRange().y == selectionLength); - - // before selection - text.setText(defaultText); - // select 2nd line including line break - text.setSelectionRange(selectionStart, selectionLength); - text.replaceTextRange(0, replaceLength, newText); - assertTrue(":r:", text.getCharCount() == defaultTextLength + newTextLength - replaceLength); - assertTrue(":s:", text.getSelectionRange().x == selectionStart + newTextLength - replaceLength && text.getSelectionRange().y == selectionLength); - - // intersecting selection - text.setText(defaultText); - // select 2nd line including line break - text.setSelectionRange(selectionStart, selectionLength); - text.replaceTextRange(selectionStart + 1, replaceLength, newText); - assertTrue(":t:", text.getCharCount() == defaultTextLength + newTextLength - replaceLength); - assertTrue(":u:", text.getSelectionRange().x == selectionStart + 1 + newTextLength && text.getSelectionRange().y == 0); - - // out of range - text.setText(defaultText); - // select 2nd line including line break - text.setSelectionRange(selectionStart, selectionLength); - try { - text.replaceTextRange(-1, replaceLength, newText); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":v:", exceptionThrown); - exceptionThrown = false; - try { - text.replaceTextRange(text.getCharCount() + 1, replaceLength, newText); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":w:", exceptionThrown); - assertTrue(":x:", text.getSelectionRange().x == selectionStart && text.getSelectionRange().y == selectionLength); -} - -public void test_selectAll() { - String line = "Line1\rLine2"; - - text.selectAll(); - assertEquals("", text.getSelectionText()); - - text.setText(line); - text.selectAll(); - assertEquals(line, text.getSelectionText()); - - text.setText(""); - text.selectAll(); - assertEquals("", text.getSelectionText()); -} - -public void test_setCaretLorg_eclipse_swt_widgets_Caret() { - Caret caret = new Caret(text, SWT.NONE); - final int XINSET; - - if (isBidi()) { - XINSET = 3; - } - else { - XINSET = 0; - } - - text.setCaret(caret); - assertEquals(XINSET, text.getCaret().getLocation().x); - assertEquals(0, text.getCaret().getLocation().y); - - text.setCaret(null); - text.setText("\rLine2"); - text.setSelection(2); - - text.setTopIndex(0); - text.setCaret(caret); - assertTrue(text.getCaret().getLocation().x > 0); - assertEquals(text.getLineHeight(), text.getCaret().getLocation().y); -} - -public void test_setBidiColoringZ() { - /// setBidiColoring is deprecated and will be removed. - warnUnimpl("Test test_setBidiColoringZ not written"); -} - -public void test_setCaretOffsetI(){ - text.setCaretOffset(-2); - assertTrue(":a:", text.getCaretOffset() == 0); - text.setCaretOffset(1); - assertTrue(":b:", text.getCaretOffset() == 0); - text.setCaretOffset(0); - assertTrue(":c:", text.getCaretOffset() == 0); - - text.setText("Line0\r\n"); - text.setCaretOffset(-2); - assertTrue(":d:", text.getCaretOffset() == 0); - text.setCaretOffset(1); - assertTrue(":e:", text.getCaretOffset() == 1); - text.setCaretOffset(0); - assertTrue(":f:", text.getCaretOffset() == 0); - - text.setCaretOffset(text.getCharCount()); - assertTrue(":g:", text.getCaretOffset() == text.getCharCount()); - text.setCaretOffset(text.getCharCount() + 1); - assertTrue(":h:", text.getCaretOffset() == text.getCharCount()); - text.setCaretOffset(5); - assertTrue(":i:", text.getCaretOffset() == 5); - - text.setText(""); - text.setCaretOffset(-2); - assertTrue(":j:", text.getCaretOffset() == 0); - text.setCaretOffset(1); - assertTrue(":k:", text.getCaretOffset() == 0); - text.setCaretOffset(0); - assertTrue(":l:", text.getCaretOffset() == 0); -} - -public void test_setContentLorg_eclipse_swt_custom_StyledTextContent() { - boolean exceptionThrown; - StyledTextContent content = new StyledTextContent() { - public void addTextChangeListener(TextChangeListener listener) { - } - public int getCharCount() { - return 0; - } - public String getLine(int lineIndex) { - return ""; - } - public int getLineAtOffset(int offset) { - return 0; - } - public int getLineCount() { - return 0; - } - public String getLineDelimiter() { - return ""; - } - public int getOffsetAtLine(int lineIndex) { - return 0; - } - public String getTextRange(int start, int length) { - return ""; - } - public void removeTextChangeListener(TextChangeListener listener) { - } - public void replaceTextRange(int start, int replaceLength, String text) { - } - public void setText(String text) { - } - }; - text.setContent(content); - assertEquals(content, text.getContent()); - - exceptionThrown = false; - try { - text.setContent(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); -} - -public void test_setDoubleClickEnabledZ(){ - text.setDoubleClickEnabled(true); - assertTrue(":a:", text.getDoubleClickEnabled() == true); - text.setDoubleClickEnabled(false); - assertTrue(":b:", text.getDoubleClickEnabled() == false); - text.setDoubleClickEnabled(false); - assertTrue(":c:", text.getDoubleClickEnabled() == false); - text.setDoubleClickEnabled(true); - assertTrue(":d:", text.getDoubleClickEnabled() == true); -} - -public void test_setEditableZ(){ - text.setEditable(true); - assertTrue(":a:", text.getEditable() == true); - text.setEditable(false); - assertTrue(":b:", text.getEditable() == false); - text.setEditable(false); - assertTrue(":c:", text.getEditable() == false); - text.setEditable(true); - assertTrue(":d:", text.getEditable() == true); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font(){ - FontData fontData = text.getFont().getFontData()[0]; - int lineHeight; - Font font; - - font = new Font(text.getDisplay(), fontData.getName(), 20, fontData.getStyle()); - text.setFont(font); - lineHeight = text.getLineHeight(); - text.setFont(null); - font.dispose(); - font = new Font(text.getDisplay(), fontData.getName(), 25, fontData.getStyle()); - text.setFont(font); - assertTrue(":a:", text.getLineHeight() > lineHeight && font.equals(text.getFont())); - text.setFont(null); - font.dispose(); -} - -public void test_setHorizontalIndexI(){ - text.setHorizontalIndex(-1); - assertTrue(":a:", text.getHorizontalIndex() == 0); - text.setHorizontalIndex(1); - assertTrue(":b:", text.getHorizontalIndex() == 0); - - text.setText("Line0"); - text.setHorizontalIndex(-1); - assertTrue(":c:", text.getHorizontalIndex() == 0); - text.setHorizontalIndex(1); - assertTrue(":d:", text.getHorizontalIndex() == 1); - text.setHorizontalIndex(500); - assertTrue(":e:", text.getHorizontalIndex() > 0); - text.setHorizontalIndex(-1); - assertTrue(":f:", text.getHorizontalIndex() == 0); - text.setHorizontalIndex(1); - assertTrue(":g:", text.getHorizontalIndex() == 1); - - text.setText(""); - text.setHorizontalIndex(2); - assertTrue(":h:", text.getHorizontalIndex() == 0); - - // make sure the widget can be scrolled - shell.open(); - text.setSize(10, 50); - text.setText("Line0"); - text.setHorizontalIndex(1); - assertTrue(":i:", text.getHorizontalIndex() == 1); -} - -public void test_setHorizontalPixelI(){ - text.setHorizontalPixel(-1); - assertTrue(":a:", text.getHorizontalPixel() == 0); - text.setHorizontalPixel(1); - assertTrue(":b:", text.getHorizontalPixel() == 0); - - text.setText("Line0"); - text.setHorizontalPixel(-1); - assertTrue(":c:", text.getHorizontalPixel() == 0); - text.setHorizontalPixel(1); - assertTrue(":d:", text.getHorizontalPixel() == 1); - text.setHorizontalPixel(500); - assertTrue(":e:", text.getHorizontalPixel() > 0); - text.setHorizontalPixel(-1); - assertTrue(":f:", text.getHorizontalPixel() == 0); - text.setHorizontalPixel(25); - assertTrue(":g:", text.getHorizontalPixel() == 25); - - text.setText(""); - text.setHorizontalPixel(2); - assertTrue(":h:", text.getHorizontalPixel() == 0); - - // make sure the widget can be scrolled - shell.open(); - text.setSize(10, 50); - text.setText("Line0"); - text.setHorizontalPixel(5); - assertTrue(":i:", text.getHorizontalPixel() == 5); -} - -public void test_setLineBackgroundIILorg_eclipse_swt_graphics_Color(){ - String textString; - - textString = "L1\nL2\nL3\nL4"; - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.setLineBackground(2,1,getColor(BLUE)); - text.setLineBackground(3,1,getColor(GREEN)); - text.replaceTextRange(1,5,""); - assertTrue(":0a:", text.getLineBackground(0) == getColor(RED)); - assertTrue(":0a:", text.getLineBackground(1) == getColor(GREEN)); - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.setLineBackground(2,1,getColor(BLUE)); - text.setLineBackground(3,1,getColor(GREEN)); - text.replaceTextRange(0,4,""); - assertTrue(":0b:", text.getLineBackground(0) == getColor(YELLOW)); - assertTrue(":0b:", text.getLineBackground(1) == getColor(BLUE)); - assertTrue(":0b:", text.getLineBackground(2) == getColor(GREEN)); - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.setLineBackground(2,1,getColor(BLUE)); - text.setLineBackground(3,1,getColor(GREEN)); - text.replaceTextRange(1,1,""); - assertTrue(":0c:", text.getLineBackground(0) == getColor(RED)); - assertTrue(":0c:", text.getLineBackground(1) == getColor(YELLOW)); - assertTrue(":0c:", text.getLineBackground(2) == getColor(BLUE)); - assertTrue(":0c:", text.getLineBackground(3) == getColor(GREEN)); - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.setLineBackground(2,1,getColor(BLUE)); - text.setLineBackground(3,1,getColor(GREEN)); - text.replaceTextRange(0,6,""); - assertTrue(":0d:", text.getLineBackground(0) == getColor(BLUE)); - assertTrue(":0d:", text.getLineBackground(1) == getColor(GREEN)); - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.setLineBackground(2,1,getColor(BLUE)); - text.setLineBackground(3,1,getColor(GREEN)); - text.replaceTextRange(1,3,""); - assertTrue(":0e:", text.getLineBackground(0) == getColor(RED)); - assertTrue(":0e:", text.getLineBackground(1) == getColor(BLUE)); - assertTrue(":0e:", text.getLineBackground(2) == getColor(GREEN)); - - textString = "L1\nL2"; - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.replaceTextRange(1,4,""); - assertTrue(":0a1:", text.getLineBackground(0) == getColor(RED)); - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.replaceTextRange(0,4,""); - assertTrue(":0b1:", text.getLineBackground(0) == getColor(YELLOW)); - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.replaceTextRange(1,1,""); - assertTrue(":0c1:", text.getLineBackground(0) == getColor(RED)); - assertTrue(":0c1:", text.getLineBackground(1) == getColor(YELLOW)); - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.replaceTextRange(0,5,""); - assertTrue(":0d1:", text.getLineBackground(0) == null); - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.replaceTextRange(1,3,""); - assertTrue(":0e1:", text.getLineBackground(0) == getColor(RED)); - assertTrue(":0e1:", text.getLineBackground(1) == getColor(YELLOW)); - textString = "L1\nL2"; - text.setText(textString); - text.setLineBackground(1,1,getColor(YELLOW)); - text.replaceTextRange(1,4,""); - assertTrue(":0f1:", text.getLineBackground(0) == null); - text.setText(textString+"\n"); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.replaceTextRange(0,6,""); - assertTrue(":0g1:", text.getLineBackground(0) == null); - - text.setText(textString); - text.setLineBackground(0,0,getColor(RED)); - assertTrue(":1:", text.getLineBackground(0) == null); - text.setLineBackground(0,1,getColor(RED)); - assertTrue(":1:", text.getLineBackground(0) == getColor(RED)); - - textString = "New Line1\nNew Line2\nNew Line3\nNew Line4"; - text.setText(textString); - text.setLineBackground(0,2,getColor(RED)); - text.setLineBackground(2,2,getColor(YELLOW)); - text.replaceTextRange(0,0,"\n"); - assertTrue(":2:", text.getLineBackground(0) == null); - assertTrue(":2:", text.getLineBackground(1) == getColor(RED)); - assertTrue(":2:", text.getLineBackground(2) == getColor(RED)); - assertTrue(":2:", text.getLineBackground(3) == getColor(YELLOW)); - assertTrue(":2:", text.getLineBackground(4) == getColor(YELLOW)); - - textString = "New Line1\nNew Line2\nNew Line3\nNew Line4"; - text.setText(textString); - text.setLineBackground(0,2,getColor(RED)); - text.setLineBackground(2,2,getColor(YELLOW)); - text.replaceTextRange(0,20,""); - assertTrue(":3:", text.getLineBackground(0) == getColor(YELLOW)); - assertTrue(":3:", text.getLineBackground(1) == getColor(YELLOW)); - - textString = "Line1\nLine2\nLine3\nLine4"; - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(2,1,getColor(YELLOW)); - text.replaceTextRange(0,18,""); - assertTrue(":4:", text.getLineBackground(0) == null); - - textString = "Line1\nLine2\nLine3\nLine4"; - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(2,1,getColor(YELLOW)); - text.replaceTextRange(0,18,"L1\nL2\nL3\n"); - assertTrue(":5:", text.getLineBackground(0) == null); - assertTrue(":5:", text.getLineBackground(1) == null); - assertTrue(":5:", text.getLineBackground(2) == null); - assertTrue(":5:", text.getLineBackground(3) == null); - - textString = "Line1\nLine2\nLine3\nLine4"; - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.setLineBackground(2,1,getColor(BLUE)); - text.setLineBackground(3,1,getColor(GREEN)); - text.replaceTextRange(3,9,"L1\nL2\n"); - assertTrue(":6a:", text.getLineBackground(0) == getColor(RED)); - assertTrue(":6a:", text.getLineBackground(1) == null); - textString = "Line1\nLine2\nLine3\nLine4"; - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.setLineBackground(2,1,getColor(BLUE)); - text.setLineBackground(3,1,getColor(GREEN)); - text.replaceTextRange(11,11,"L3\nL4"); - assertTrue(":6b:", text.getLineBackground(2) == null); - assertTrue(":6b:", text.getLineBackground(3) == getColor(GREEN)); - - textString = "Line1\nLine2\nLine3\nLine4"; - text.setText(textString); - text.setLineBackground(0,1,getColor(RED)); - text.setLineBackground(1,1,getColor(YELLOW)); - text.setLineBackground(2,1,getColor(BLUE)); - text.setLineBackground(3,1,getColor(GREEN)); - text.replaceTextRange(0,18,"L1\n"); - assertTrue(":7:", text.getLineBackground(0) == null); - assertTrue(":7:", text.getLineBackground(1) == getColor(GREEN)); -} - -public void test_setOrientationI() { - warnUnimpl("Test test_setOrientationI not written"); -} - -public void test_setSelectionI() { - int[] invalid = {-1, 100, 12}; - boolean exceptionThrown; - - for (int i = 0; i < invalid.length; i++) { - exceptionThrown = false; - try { - text.setSelection(invalid[i]); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - } - text.setText("01234567890"); - assertEquals(0, text.getCaretOffset()); - text.setSelection(1); - assertEquals(1, text.getCaretOffset()); - text.setSelection(11); - assertEquals(11, text.getCaretOffset()); - - for (int i = 0; i < invalid.length; i++) { - exceptionThrown = false; - try { - text.setSelection(invalid[i]); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - } -} - -public void test_setSelectionLorg_eclipse_swt_graphics_Point() { - Point[] invalidRanges = {new Point(-1, 0), new Point(-1, -1), new Point(100, 1), - new Point(100, -1), new Point(11, 12), new Point(10, 12)}; - boolean exceptionThrown; - - for (int i = 0; i < invalidRanges.length; i++) { - exceptionThrown = false; - try { - text.setSelection(invalidRanges[i]); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - } - text.setText("01234567890"); - assertEquals("", text.getSelectionText()); - text.setSelection(3, 7); - assertEquals("3456", text.getSelectionText()); - - for (int i = 0; i < invalidRanges.length; i++) { - exceptionThrown = false; - try { - text.setSelection(invalidRanges[i]); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - } -} - -public void test_setSelectionII(){ - int[][] invalidRanges = {{-1, 0}, {-1, -1}, {100, 1}, {100, -1}, {11, 12}, {10, 12}, {2, -3}, {50, -1}}; - boolean exceptionThrown; - - for (int i = 0; i < invalidRanges.length; i++) { - int start = invalidRanges[i][0]; - int end = invalidRanges[i][1]; - - exceptionThrown = false; - try { - text.setSelection(start, end); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - } - text.setText("01234567890"); - assertEquals("", text.getSelectionText()); - text.setSelection(3, 7); - assertEquals("3456", text.getSelectionText()); - text.setSelection(3, 0); - assertEquals("012", text.getSelectionText()); - assertEquals(0, text.getCaretOffset()); - - for (int i = 0; i < invalidRanges.length; i++) { - int start = invalidRanges[i][0]; - int end = invalidRanges[i][1]; - - exceptionThrown = false; - try { - text.setSelection(start, end); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - } -} -public void test_setSelectionBackgroundLorg_eclipse_swt_graphics_Color(){ - text.setSelectionBackground(getColor(YELLOW)); - assertTrue(":1a:", text.getSelectionBackground() == getColor(YELLOW)); - text.setSelectionBackground(null); - assertTrue(":1b:", text.getSelectionBackground().equals(text.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION))); -} -public void test_setSelectionForegroundLorg_eclipse_swt_graphics_Color(){ - text.setSelectionForeground(getColor(RED)); - assertTrue(":1a:", text.getSelectionForeground() == getColor(RED)); - text.setSelectionForeground(null); - assertTrue(":1b:", text.getSelectionForeground().equals(text.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT))); -} - -public void test_setSelectionRangeII(){ - // setSelectionRange already tested in test_getSelectionRange -} - -public void test_setStyleRangeLorg_eclipse_swt_custom_StyleRange(){ - StyleRange[] styles; - String textString = textString(); - - /* - defaultStyles - - (0,48,RED,YELLOW), - (58,10,BLUE,CYAN), - (68,10,GREEN,PURPLE) - */ - - - text.setText(textString); - - // No overlap with existing styles - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(48,5,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":1:", styles.length == 4); - assertTrue(":1:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":1:", styles[1].equals(getStyle(48,5,YELLOW,RED))); - assertTrue(":1:", styles[2].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":1:", styles[3].equals(getStyle(68,10,GREEN,PURPLE))); - - // Overlap middle of one style - partial - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(10,10,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 5); - assertTrue(":2:", styles[0].equals(getStyle(0,10,RED,YELLOW))); - assertTrue(":2:", styles[1].equals(getStyle(10,10,YELLOW,RED))); - assertTrue(":2:", styles[2].equals(getStyle(20,28,RED,YELLOW))); - assertTrue(":2:", styles[3].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":2:", styles[4].equals(getStyle(68,10,GREEN,PURPLE))); - text.setStyleRange(null); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 0); - - // Overlap middle of one style - full - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(58,10,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":3:", styles.length == 3); - assertTrue(":3:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":3:", styles[1].equals(getStyle(58,10,YELLOW,RED))); - assertTrue(":3:", styles[2].equals(getStyle(68,10,GREEN,PURPLE))); - - // Overlap end of one style - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(38,15,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":4:", styles.length == 4); - assertTrue(":4:", styles[0].equals(getStyle(0,38,RED,YELLOW))); - assertTrue(":4:", styles[1].equals(getStyle(38,15,YELLOW,RED))); - assertTrue(":4:", styles[2].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":4:", styles[3].equals(getStyle(68,10,GREEN,PURPLE))); - - // Overlap beginning of one style - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(50,10,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":5:", styles.length == 4); - assertTrue(":5:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":5:", styles[1].equals(getStyle(50,10,YELLOW,RED))); - assertTrue(":5:", styles[2].equals(getStyle(60,8,BLUE,CYAN))); - assertTrue(":5:", styles[3].equals(getStyle(68,10,GREEN,PURPLE))); - - // Overlap complete style - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(48,20,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":6:", styles.length == 3); - assertTrue(":6:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":6:", styles[1].equals(getStyle(48,20,YELLOW,RED))); - assertTrue(":6:", styles[2].equals(getStyle(68,10,GREEN,PURPLE))); - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - text.setText(textString); - text.setStyleRange(getStyle(0,48,RED,YELLOW)); - text.setStyleRange(getStyle(48,20,BLUE,CYAN)); - text.setStyleRange(getStyle(68,10,GREEN,PURPLE)); - // should be merged with style before it - text.setStyleRange(getStyle(48,10,RED,YELLOW)); - styles = text.getStyleRanges(); - assertTrue(":1:", styles.length == 3); - assertTrue(":1:", styles[0].equals(getStyle(0,58,RED,YELLOW))); - assertTrue(":1:", styles[1].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":1:", styles[2].equals(getStyle(68,10,GREEN,PURPLE))); - - text.setText(textString); - text.setStyleRange(getStyle(0,10,RED,YELLOW)); - text.setStyleRange(getStyle(15,10,BLUE,CYAN)); - text.setStyleRange(getStyle(25,10,GREEN,PURPLE)); - // should be merged with style after it - text.setStyleRange(getStyle(11,4,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 3); - assertTrue(":2:", styles[0].equals(getStyle(0,10,RED,YELLOW))); - assertTrue(":2:", styles[1].equals(getStyle(11,14,BLUE,CYAN))); - assertTrue(":2:", styles[2].equals(getStyle(25,10,GREEN,PURPLE))); - - text.setText(textString); - text.setStyleRange(getStyle(0,10,RED,YELLOW)); - text.setStyleRange(getStyle(15,10,BLUE,CYAN)); - text.setStyleRange(getStyle(25,10,GREEN,PURPLE)); - // should be merged with style after it - text.setStyleRange(getStyle(5,15,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":3:", styles.length == 3); - assertTrue(":3:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":3:", styles[1].equals(getStyle(5,20,BLUE,CYAN))); - assertTrue(":3:", styles[2].equals(getStyle(25,10,GREEN,PURPLE))); - - text.setText("01234567890123456789"); - text.setStyleRange(getStyle(0,10,RED,YELLOW)); - text.setStyleRange(getStyle(10,10,BLUE,CYAN)); - text.setStyleRange(getStyle(5,3,RED,YELLOW)); - text.setStyleRange(getStyle(12,5,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":4:", styles.length == 2); - assertTrue(":4:", styles[0].equals(getStyle(0,10,RED,YELLOW))); - assertTrue(":4:", styles[1].equals(getStyle(10,10,BLUE,CYAN))); - - text.setText("0123456789012345"); - text.setStyleRange(getStyle(0,5,RED,YELLOW)); - text.setStyleRange(getStyle(5,5,BLUE,CYAN)); - text.setStyleRange(getStyle(10,5,GREEN,PURPLE)); - // no merging since styles are completely overlapping existing - // styles - text.setStyleRange(getStyle(5,5,RED,YELLOW)); - text.setStyleRange(getStyle(10,5,RED,YELLOW)); - styles = text.getStyleRanges(); - assertTrue(":5:", styles.length == 3); - assertTrue(":5:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":5:", styles[1].equals(getStyle(5,5,RED,YELLOW))); - assertTrue(":5:", styles[2].equals(getStyle(10,5,RED,YELLOW))); - - text.setText("012345678901234"); - text.setStyleRange(getStyle(0,5,RED,YELLOW)); - text.setStyleRange(getStyle(10,5,BLUE,CYAN)); - // should be merged - text.setStyleRange(getStyle(5,7,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":6:", styles.length == 2); - assertTrue(":6:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":6:", styles[1].equals(getStyle(5,10,BLUE,CYAN))); - - text.setText("123 456 789"); - text.setStyleRange(getStyle(4,3,BLUE,null)); - text.setStyleRange(getStyle(8,3,RED,null)); - text.setStyleRange(getStyle(5,2,BLUE,null)); - styles = text.getStyleRanges(); - assertTrue(":7:", styles.length == 2); - assertTrue(":7:", styles[0].equals(getStyle(4,3,BLUE,null))); - assertTrue(":7:", styles[1].equals(getStyle(8,3,RED,null))); - - text.setText("123 456 789"); - text.setStyleRange(getStyle(4,3,BLUE,null)); - text.setStyleRange(getStyle(8,3,RED,null)); - text.setStyleRange(getStyle(7,4,BLUE,null)); - styles = text.getStyleRanges(); - assertTrue(":8:", styles.length == 2); - assertTrue(":8:", styles[0].equals(getStyle(4,3,BLUE,null))); - assertTrue(":8:", styles[1].equals(getStyle(7,4,BLUE,null))); - - text.setText("123 456 789 ABC DEF"); - text.setStyleRange(getStyle(0,4,BLUE,null)); - text.setStyleRange(getStyle(4,4,RED,null)); - text.setStyleRange(getStyle(8,4,BLUE,null)); - text.setStyleRange(getStyle(12,4,RED,null)); - text.setStyleRange(getStyle(16,3,BLUE,null)); - text.setStyleRange(getStyle(5,14,RED,null)); - styles = text.getStyleRanges(); - assertTrue(":9:", styles.length == 2); - assertTrue(":9:", styles[0].equals(getStyle(0,4,BLUE,null))); - assertTrue(":9:", styles[1].equals(getStyle(4,15,RED,null))); - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - text.setText(textString); - text.setStyleRange(getStyle(0,48,RED,YELLOW)); - text.setStyleRange(getStyle(48,20,BLUE,CYAN)); - text.setStyleRange(getStyle(68,10,GREEN,PURPLE)); - text.setStyleRange(getStyle(38,20,null,null)); - styles = text.getStyleRanges(); - assertTrue(":1:", styles.length == 3); - assertTrue(":1:", styles[0].equals(getStyle(0,38,RED,YELLOW))); - assertTrue(":1:", styles[1].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":1:", styles[2].equals(getStyle(68,10,GREEN,PURPLE))); - - text.setText(textString); - int length = textString.length(); - text.setStyleRange(getStyle(0,48,RED,YELLOW)); - text.setStyleRange(getStyle(48,20,BLUE,CYAN)); - text.setStyleRange(getStyle(68,10,GREEN,PURPLE)); - text.setStyleRange(getStyle(0,length,null,null)); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 0); - - text.setText("01234567890123456789"); - text.setStyleRange(getStyle(0,3,RED,YELLOW)); - text.setStyleRange(getStyle(5,3,BLUE,CYAN)); - text.setStyleRange(getStyle(9,8,GREEN,PURPLE)); - text.setStyleRange(getStyle(0,10,GREEN,PURPLE)); - styles = text.getStyleRanges(); - assertTrue(":3:", styles.length == 2); - assertTrue(":3:", styles[0].equals(getStyle(0,10,GREEN,PURPLE))); - assertTrue(":3:", styles[1].equals(getStyle(10,7,GREEN,PURPLE))); - - text.setText("0123456789012345"); - text.setStyleRange(getStyle(0,5,RED,YELLOW)); - text.setStyleRange(getStyle(5,5,BLUE,CYAN)); - text.setStyleRange(getStyle(10,5,GREEN,PURPLE)); - text.setStyleRange(getStyle(7,9,RED,YELLOW)); - styles = text.getStyleRanges(); - assertTrue(":4:", styles.length == 3); - assertTrue(":4:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":4:", styles[1].equals(getStyle(5,2,BLUE,CYAN))); - assertTrue(":4:", styles[2].equals(getStyle(7,9,RED,YELLOW))); - - text.setText("012345678901234"); - text.setStyleRange(getStyle(0,5,RED,YELLOW)); - text.setStyleRange(getStyle(10,5,BLUE,CYAN)); - text.setStyleRange(getStyle(3,10,GREEN,PURPLE)); - styles = text.getStyleRanges(); - assertTrue(":5:", styles.length == 3); - assertTrue(":5:", styles[0].equals(getStyle(0,3,RED,YELLOW))); - assertTrue(":5:", styles[1].equals(getStyle(3,10,GREEN,PURPLE))); - assertTrue(":5:", styles[2].equals(getStyle(13,2,BLUE,CYAN))); - - text.setText("redgreenblueyellowcyanpurple"); - text.setStyleRange(getStyle(0,3,RED,null)); - text.setStyleRange(getStyle(3,5,GREEN,null)); - text.setStyleRange(getStyle(8,4,BLUE,null)); - text.setStyleRange(getStyle(12,6,YELLOW,null)); - text.setStyleRange(getStyle(18,4,CYAN,null)); - text.setStyleRange(getStyle(22,6,PURPLE,null)); - text.setStyleRange(getStyle(8,14,null,RED)); - styles = text.getStyleRanges(); - assertTrue(":6:", styles.length == 4); - assertTrue(":6:", styles[0].equals(getStyle(0,3,RED,null))); - assertTrue(":6:", styles[1].equals(getStyle(3,5,GREEN,null))); - assertTrue(":6:", styles[2].equals(getStyle(8,14,null,RED))); - assertTrue(":6:", styles[3].equals(getStyle(22,6,PURPLE,null))); - - - text.setText("redgreenblueyellowcyanpurple"); - text.setStyleRange(getStyle(0,3,RED,null)); - text.setStyleRange(getStyle(3,5,GREEN,null)); - text.setStyleRange(getStyle(8,4,BLUE,null)); - text.setStyleRange(getStyle(12,6,YELLOW,null)); - text.setStyleRange(getStyle(18,4,CYAN,null)); - text.setStyleRange(getStyle(22,6,PURPLE,null)); - text.setStyleRange(getStyle(0,28,null,null)); - styles = text.getStyleRanges(); - assertTrue(":7:", styles.length == 0); - - -/* - text.setText("This\r\na\tAnother line."); - text.setStyleRange(getStyle(3,3,BLUE,null)); - text.setStyleRange(getStyle(7,8,BLUE,null)); - text.setStyleRange(getStyle(6,1,BLUE,null)); - StyledTextEvent event = new StyledTextEvent(); - event.detail = 6; - event.text = "a\tAnother line."; - text.notifyListener(ST.LineGetStyle, event); - assertTrue(":8:", event.styles[0].equals(getStyle(3,4,BLUE,null))); -*/ - - - text.setText("123 456 789"); - text.setStyleRange(getStyle(4,3,BLUE,null)); - text.setStyleRange(getStyle(8,3,RED,null)); - text.setStyleRange(getStyle(5,5,BLUE,null)); - styles = text.getStyleRanges(); - assertTrue(":9:", styles.length == 2); - assertTrue(":9:", styles[0].equals(getStyle(4,6,BLUE,null))); - assertTrue(":9:", styles[1].equals(getStyle(10,1,RED,null))); - - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - textString = textString(); - - text.setText(textString); - text.setStyleRange(getStyle(0,48,RED,YELLOW)); - text.setStyleRange(getStyle(48,20,BLUE,CYAN)); - text.setStyleRange(getStyle(68,10,GREEN,PURPLE)); - // should be merged with style before it - text.setStyleRange(getStyle(48,10,RED,YELLOW)); - styles = text.getStyleRanges(); - assertTrue(":1:", styles.length == 3); - assertTrue(":1:", styles[0].equals(getStyle(0,58,RED,YELLOW))); - assertTrue(":1:", styles[1].equals(getStyle(58,10,BLUE,CYAN))); - assertTrue(":1:", styles[2].equals(getStyle(68,10,GREEN,PURPLE))); - - - text.setText(textString); - text.setStyleRange(getStyle(0,10,RED,YELLOW)); - text.setStyleRange(getStyle(15,10,BLUE,CYAN)); - text.setStyleRange(getStyle(25,10,GREEN,PURPLE)); - // should be merged with style after it - text.setStyleRange(getStyle(11,4,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 3); - assertTrue(":2:", styles[0].equals(getStyle(0,10,RED,YELLOW))); - assertTrue(":2:", styles[1].equals(getStyle(11,14,BLUE,CYAN))); - assertTrue(":2:", styles[2].equals(getStyle(25,10,GREEN,PURPLE))); - - text.setText(textString); - text.setStyleRange(getStyle(0,10,RED,YELLOW)); - text.setStyleRange(getStyle(15,10,BLUE,CYAN)); - text.setStyleRange(getStyle(25,10,GREEN,PURPLE)); - // should be merged with style after it - text.setStyleRange(getStyle(5,15,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":3:", styles.length == 3); - assertTrue(":3:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":3:", styles[1].equals(getStyle(5,20,BLUE,CYAN))); - assertTrue(":3:", styles[2].equals(getStyle(25,10,GREEN,PURPLE))); - - - - text.setText("01234567890123456789"); - text.setStyleRange(getStyle(0,10,RED,YELLOW)); - text.setStyleRange(getStyle(10,10,BLUE,CYAN)); - text.setStyleRange(getStyle(5,3,RED,YELLOW)); - text.setStyleRange(getStyle(12,5,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":4:", styles.length == 2); - assertTrue(":4:", styles[0].equals(getStyle(0,10,RED,YELLOW))); - assertTrue(":4:", styles[1].equals(getStyle(10,10,BLUE,CYAN))); - - text.setText("0123456789012345"); - text.setStyleRange(getStyle(0,5,RED,YELLOW)); - text.setStyleRange(getStyle(5,5,BLUE,CYAN)); - text.setStyleRange(getStyle(10,5,GREEN,PURPLE)); - // no merging since styles are completely overlapping existing - // styles - text.setStyleRange(getStyle(5,5,RED,YELLOW)); - text.setStyleRange(getStyle(10,5,RED,YELLOW)); - styles = text.getStyleRanges(); - assertTrue(":5:", styles.length == 3); - assertTrue(":5:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":5:", styles[1].equals(getStyle(5,5,RED,YELLOW))); - assertTrue(":5:", styles[2].equals(getStyle(10,5,RED,YELLOW))); - - text.setText("012345678901234"); - text.setStyleRange(getStyle(0,5,RED,YELLOW)); - text.setStyleRange(getStyle(10,5,BLUE,CYAN)); - // should be merged - text.setStyleRange(getStyle(5,7,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":6:", styles.length == 2); - assertTrue(":6:", styles[0].equals(getStyle(0,5,RED,YELLOW))); - assertTrue(":6:", styles[1].equals(getStyle(5,10,BLUE,CYAN))); - - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - textString = textString(); - - - /* - defaultStyles - - (0,48,RED,YELLOW), - (58,10,BLUE,CYAN), - (68,10,GREEN,PURPLE) - */ - - - text.setText(textString); - - // End/Beginning overlap - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(38,25,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":1:", styles.length == 4); - assertTrue(":1:", styles[0].equals(getStyle(0,38,RED,YELLOW))); - assertTrue(":1:", styles[1].equals(getStyle(38,25,YELLOW,RED))); - assertTrue(":1:", styles[2].equals(getStyle(63,5,BLUE,CYAN))); - assertTrue(":1:", styles[3].equals(getStyle(68,10,GREEN,PURPLE))); - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(63,10,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":1:", styles.length == 4); - assertTrue(":1:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":1:", styles[1].equals(getStyle(58,5,BLUE,CYAN))); - assertTrue(":1:", styles[2].equals(getStyle(63,10,YELLOW,RED))); - assertTrue(":1:", styles[3].equals(getStyle(73,5,GREEN,PURPLE))); - - - // Complete overlap - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(0,78,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 1); - assertTrue(":2:", styles[0].equals(getStyle(0,78,YELLOW,RED))); - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(0,68,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 2); - assertTrue(":2:", styles[0].equals(getStyle(0,68,YELLOW,RED))); - assertTrue(":2:", styles[1].equals(getStyle(68,10,GREEN,PURPLE))); - text.setStyleRanges(defaultStyles()); - text.setStyleRange(getStyle(58,20,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 2); - assertTrue(":2:", styles[0].equals(getStyle(0,48,RED,YELLOW))); - assertTrue(":2:", styles[1].equals(getStyle(58,20,YELLOW,RED))); - - - // 1-N complete, beginning - text.setText("012345678901234567890123456789"); - text.setStyleRanges( - new StyleRange[] {getStyle(0,5,RED,RED), getStyle(5,5,YELLOW,YELLOW), - getStyle(10,5,CYAN,CYAN), getStyle(15,5,BLUE,BLUE), - getStyle(20,5,GREEN,GREEN), getStyle(25,5,PURPLE,PURPLE)} - ); - text.setStyleRange(getStyle(5,23,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":3:", styles.length == 3); - assertTrue(":3:", styles[0].equals(getStyle(0,5,RED,RED))); - assertTrue(":3:", styles[1].equals(getStyle(5,23,YELLOW,RED))); - assertTrue(":3:", styles[2].equals(getStyle(28,2,PURPLE,PURPLE))); - - // end, 1-N complete, beginning - text.setStyleRanges( - new StyleRange[] {getStyle(0,5,RED,RED), getStyle(5,5,YELLOW,YELLOW), - getStyle(10,5,CYAN,CYAN), getStyle(15,5,BLUE,BLUE), - getStyle(20,5,GREEN,GREEN), getStyle(25,5,PURPLE,PURPLE)} - ); - text.setStyleRange(getStyle(13,12,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":3:", styles.length == 5); - assertTrue(":3:", styles[0].equals(getStyle(0,5,RED,RED))); - assertTrue(":3:", styles[1].equals(getStyle(5,5,YELLOW,YELLOW))); - assertTrue(":3:", styles[2].equals(getStyle(10,3,CYAN,CYAN))); - assertTrue(":3:", styles[3].equals(getStyle(13,12,YELLOW,RED))); - assertTrue(":3:", styles[4].equals(getStyle(25,5,PURPLE,PURPLE))); - - - text.setText("x/"); - text.setStyleRange(getStyle(0,2,YELLOW,null)); - styles = text.getStyleRanges(); - assertTrue(":4:", styles.length == 1); - assertTrue(":4:", styles[0].equals(getStyle(0,2,YELLOW,null))); - text.replaceTextRange(2,0,"/"); - styles = text.getStyleRanges(); - assertTrue(":4:", styles.length == 1); - assertTrue(":4:", styles[0].equals(getStyle(0,2,YELLOW,null))); - text.setStyleRange(getStyle(0,1,YELLOW,null)); - assertTrue(":4:", styles.length == 1); - assertTrue(":4:", styles[0].equals(getStyle(0,2,YELLOW,null))); - text.setStyleRange(getStyle(1,2,RED,null)); - styles = text.getStyleRanges(); - assertTrue(":4:", styles.length == 2); - assertTrue(":4:", styles[0].equals(getStyle(0,1,YELLOW,null))); - assertTrue(":4:", styles[1].equals(getStyle(1,2,RED,null))); - - - text.setText("xxx/"); - text.setStyleRange(getStyle(0,2,RED,null)); - text.setStyleRange(getStyle(2,2,YELLOW,null)); - styles = text.getStyleRanges(); - assertTrue(":4a:", styles.length == 2); - assertTrue(":4a:", styles[0].equals(getStyle(0,2,RED,null))); - assertTrue(":4a:", styles[1].equals(getStyle(2,2,YELLOW,null))); - text.replaceTextRange(4,0,"/"); - styles = text.getStyleRanges(); - assertTrue(":4a:", styles.length == 2); - assertTrue(":4a:", styles[0].equals(getStyle(0,2,RED,null))); - assertTrue(":4a:", styles[1].equals(getStyle(2,2,YELLOW,null))); - text.setStyleRange(getStyle(2,1,YELLOW,null)); - assertTrue(":4a:", styles.length == 2); - assertTrue(":4a:", styles[0].equals(getStyle(0,2,RED,null))); - assertTrue(":4a:", styles[1].equals(getStyle(2,2,YELLOW,null))); - text.setStyleRange(getStyle(3,2,RED,null)); - styles = text.getStyleRanges(); - assertTrue(":4a:", styles.length == 3); - assertTrue(":4a:", styles[0].equals(getStyle(0,2,RED,null))); - assertTrue(":4a:", styles[1].equals(getStyle(2,1,YELLOW,null))); - assertTrue(":4a:", styles[2].equals(getStyle(3,2,RED,null))); - - - text.setText("xxx/"); - text.setStyleRange(getStyle(0,2,RED,null)); - text.setStyleRange(getStyle(2,2,YELLOW,null)); - text.replaceTextRange(4,0,"/"); - styles = text.getStyleRanges(); - text.setStyleRange(getStyle(2,1,YELLOW,null)); - text.setStyleRange(getStyle(2,3,RED,null)); - styles = text.getStyleRanges(); - assertTrue(":4b:", styles.length == 2); - assertTrue(":4b:", styles[0].equals(getStyle(0,2,RED,null))); - assertTrue(":4b:", styles[1].equals(getStyle(2,3,RED,null))); - - - text.setText("xxx/"); - text.setStyleRange(getStyle(0,2,RED,null)); - text.setStyleRange(getStyle(2,2,YELLOW,null)); - text.replaceTextRange(4,0,"/"); - styles = text.getStyleRanges(); - text.setStyleRange(getStyle(2,1,YELLOW,null)); - text.setStyleRange(getStyle(1,4,YELLOW,null)); - styles = text.getStyleRanges(); - assertTrue(":4c:", styles.length == 2); - assertTrue(":4c:", styles[0].equals(getStyle(0,1,RED,null))); - assertTrue(":4c:", styles[1].equals(getStyle(1,4,YELLOW,null))); - - - text.setText("New\r\n"); - StyleRange style = getStyle(0,5,null,null); - style.fontStyle = SWT.BOLD; - text.setStyleRange(style); - // styles (0,5,BOLD) - text.replaceTextRange(3,0,"a"); // "Newa\r\n" - // styles (0,3,BOLD), (4,2,BOLD) - style = text.getStyleRangeAtOffset(4); - style.start = 3; - style.length = 1; - text.setStyleRange(style); - // styles (0,6,BOLD) - text.replaceTextRange(0,0,"a"); // "aNewa\r\n" - // styles (1,6,BOLD) - style = text.getStyleRangeAtOffset(1); - style.start = 0; - style.length = 1; - text.setStyleRange(style); - // styles (0,7,BOLD) - text.replaceTextRange(0,1,""); // "Newa\r\n" - // styles (0,6,BOLD) - for (int i=0; i<6; i++) { - style = text.getStyleRangeAtOffset(i); - assertTrue(":5:", style.fontStyle == SWT.BOLD); - } - - - text.setText("New L 1\r\nNew L 2\r\n"); - style = getStyle(0,9,null,null); - style.fontStyle = SWT.BOLD; - text.setStyleRange(style); - // styles (0,9,BOLD) - text.replaceTextRange(7,0,"a"); - // styles (0,7,BOLD), (8,2,BOLD) - style = text.getStyleRangeAtOffset(8); - if (style != null) { - style.start = 7; - style.length = 1; - text.setStyleRange(style); - } - // styles (0,10,BOLD) - text.replaceTextRange(4,0,"a"); - // styles (0,4,BOLD), (5,6,BOLD) - style = text.getStyleRangeAtOffset(5); - if (style != null) { - style.start = 4; - style.length = 1; - text.setStyleRange(style); - } - // styles (0,11,BOLD) - text.replaceTextRange(2,3,""); - // styles (0,8,BOLD) - for (int i=0; i<8; i++) { - style = text.getStyleRangeAtOffset(i); - assertTrue(":5a:", style.fontStyle == SWT.BOLD); - } - - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - - // "01234567890123" - textString = "1234 1234 1234"; - - - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(5,2,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":1a:", styles.length == 1); - assertTrue(":1a:", styles[0].equals(getStyle(5,4,YELLOW,RED))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(7,2,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":2a:", styles.length == 1); - assertTrue(":2a:", styles[0].equals(getStyle(5,4,YELLOW,RED))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(6,2,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":3a:", styles.length == 1); - assertTrue(":3a:", styles[0].equals(getStyle(5,4,YELLOW,RED))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(3,4,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":4a:", styles.length == 1); - assertTrue(":4a:", styles[0].equals(getStyle(3,6,YELLOW,RED))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(7,4,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":5a:", styles.length == 1); - assertTrue(":5a:", styles[0].equals(getStyle(5,6,YELLOW,RED))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":6a:", styles.length == 1); - assertTrue(":6a:", styles[0].equals(getStyle(5,4,YELLOW,RED))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(3,10,YELLOW,RED)); - styles = text.getStyleRanges(); - assertTrue(":7a:", styles.length == 1); - assertTrue(":7a:", styles[0].equals(getStyle(3,10,YELLOW,RED))); - - - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(5,2,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":1b:", styles.length == 2); - assertTrue(":1b:", styles[0].equals(getStyle(5,2,BLUE,CYAN))); - assertTrue(":1b:", styles[1].equals(getStyle(7,2,YELLOW,RED))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(7,2,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":2b:", styles.length == 2); - assertTrue(":2b:", styles[0].equals(getStyle(5,2,YELLOW,RED))); - assertTrue(":2b:", styles[1].equals(getStyle(7,2,BLUE,CYAN))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(6,2,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":3b:", styles.length == 3); - assertTrue(":3b:", styles[0].equals(getStyle(5,1,YELLOW,RED))); - assertTrue(":3b:", styles[1].equals(getStyle(6,2,BLUE,CYAN))); - assertTrue(":3b:", styles[2].equals(getStyle(8,1,YELLOW,RED))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(3,4,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":4b:", styles.length == 2); - assertTrue(":4b:", styles[0].equals(getStyle(3,4,BLUE,CYAN))); - assertTrue(":4b:", styles[1].equals(getStyle(7,2,YELLOW,RED))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(7,4,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":5b:", styles.length == 2); - assertTrue(":5b:", styles[0].equals(getStyle(5,2,YELLOW,RED))); - assertTrue(":5b:", styles[1].equals(getStyle(7,4,BLUE,CYAN))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":6b:", styles.length == 1); - assertTrue(":6b:", styles[0].equals(getStyle(5,4,BLUE,CYAN))); - text.setText("1234 1234 1234"); - text.setStyleRange(getStyle(5,4,YELLOW,RED)); - text.setStyleRange(getStyle(3,10,BLUE,CYAN)); - styles = text.getStyleRanges(); - assertTrue(":7b:", styles.length == 1); - assertTrue(":7b:", styles[0].equals(getStyle(3,10,BLUE,CYAN))); - - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - // "012345678901234567890123" - String testString= "1234 1234 1234 1234 1234"; - - text.setText(testString); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(12,2,""); - styles = text.getStyleRanges(); - assertTrue(":1:", styles.length == 1); - assertTrue(":1:", styles[0].equals(getStyle(10,2,YELLOW,RED))); - text.setText(testString); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(10,2,""); - styles = text.getStyleRanges(); - assertTrue(":2:", styles.length == 1); - assertTrue(":2:", styles[0].equals(getStyle(10,2,YELLOW,RED))); - - - text.setText(testString); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(12,4,""); - styles = text.getStyleRanges(); - assertTrue(":3:", styles.length == 1); - assertTrue(":3:", styles[0].equals(getStyle(10,2,YELLOW,RED))); - text.setText(testString); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(8,4,""); - styles = text.getStyleRanges(); - assertTrue(":4:", styles.length == 1); - assertTrue(":4:", styles[0].equals(getStyle(8,2,YELLOW,RED))); - - - text.setText(testString); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(8,6,""); - styles = text.getStyleRanges(); - assertTrue(":5:", styles.length == 0); - text.setText(testString); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(10,6,""); - styles = text.getStyleRanges(); - assertTrue(":6:", styles.length == 0); - text.setText(testString); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(8,12,""); - styles = text.getStyleRanges(); - assertTrue(":7:", styles.length == 0); - - // "012345678901234567890123" - // String testString= "1234 1234 1234 1234 1234"; - - text.setText(testString); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(5,7,""); - styles = text.getStyleRanges(); - assertTrue(":8:", styles.length == 1); - assertTrue(":8:", styles[0].equals(getStyle(5,2,YELLOW,RED))); - text.setText(testString); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(7,7,""); - styles = text.getStyleRanges(); - assertTrue(":9:", styles.length == 1); - assertTrue(":9:", styles[0].equals(getStyle(5,2,BLUE,CYAN))); - - - text.setText(testString); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(2,10,""); - styles = text.getStyleRanges(); - assertTrue(":10:", styles.length == 1); - assertTrue(":10:", styles[0].equals(getStyle(2,2,YELLOW,RED))); - text.setText(testString); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(7,9,""); - styles = text.getStyleRanges(); - assertTrue(":11:", styles.length == 1); - assertTrue(":11:", styles[0].equals(getStyle(5,2,BLUE,CYAN))); - - - text.setText(testString); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(5,9,""); - styles = text.getStyleRanges(); - assertTrue(":12:", styles.length == 0); - text.setText(testString); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.replaceTextRange(3,13,""); - styles = text.getStyleRanges(); - assertTrue(":11:", styles.length == 0); - - - // "012345678901234567890123" - // String testString= "1234 1234 1234 1234 1234"; - - text.setText(testString); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.setStyleRange(getStyle(15,4,GREEN,PURPLE)); - text.replaceTextRange(7,12,""); - styles = text.getStyleRanges(); - assertTrue(":14:", styles.length == 1); - assertTrue(":14:", styles[0].equals(getStyle(5,2,BLUE,CYAN))); - text.setText(testString); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.setStyleRange(getStyle(15,4,GREEN,PURPLE)); - text.replaceTextRange(5,12,""); - styles = text.getStyleRanges(); - assertTrue(":15:", styles.length == 1); - assertTrue(":15:", styles[0].equals(getStyle(5,2,GREEN,PURPLE))); - - - text.setText(testString); - text.setStyleRange(getStyle(5,4,BLUE,CYAN)); - text.setStyleRange(getStyle(10,4,YELLOW,RED)); - text.setStyleRange(getStyle(15,4,GREEN,PURPLE)); - text.replaceTextRange(9,10,""); - styles = text.getStyleRanges(); - assertTrue(":16:", styles.length == 1); - assertTrue(":16:", styles[0].equals(getStyle(5,4,BLUE,CYAN))); - - - // reset the environment - text.dispose(); - text = new StyledText(shell, SWT.NULL); - setWidget(text); - - StyleRange style1 = getStyle(0,0,null,null); - - - StyleRange style2 = getStyle(0,0,RED,YELLOW); - - - assertTrue(":1:", !style1.equals(style2)); - assertTrue(":1:", !style1.similarTo(style2)); - - - assertTrue(":1:", !style2.equals(style1)); - - - assertTrue(":1:", !style2.similarTo(style1)); - - - - style1 = getStyle(0,10,RED,YELLOW); - style2 = getStyle(11,5,RED,YELLOW); - - - assertTrue(":2:", !style1.equals(style2)); - - - assertTrue(":2:", !style2.equals(style1)); - assertTrue(":2:", style1.similarTo(style2)); - - - assertTrue(":2:", style2.similarTo(style1)); - - -} - -public void test_setStyleRanges$Lorg_eclipse_swt_custom_StyleRange() { - boolean exceptionThrown = false; - StyleRange[] ranges = new StyleRange[] { - new StyleRange(0, 1, getColor(RED), null), - new StyleRange(2, 1, getColor(RED), null)}; - - text.setText("Line0\r\n"); - try { - text.setStyleRanges(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - - text.setStyleRanges(ranges); - StyleRange[] currentRanges = text.getStyleRanges(); - assertEquals(ranges.length, currentRanges.length); - for (int i = 0; i < currentRanges.length; i++) { - assertEquals(ranges[i], currentRanges[i]); - } - text.setStyleRanges(new StyleRange[] {}); - assertEquals(0, text.getStyleRanges().length); -} - -public void test_setTabsI(){ - text.setTabs(1); - assertTrue(":a:", text.getTabs() == 1); - - text.setTabs(8); - assertTrue(":b:", text.getTabs() == 8); - text.setText("Line\t1\r\n"); - text.setTabs(7); - assertTrue(":c:", text.getTabs() == 7); -} - -public void test_setTextLjava_lang_String(){ - boolean exceptionThrown = false; - - text.setText(""); - assertEquals("", text.getText()); - text.setText("01234567890"); - assertEquals("01234567890", text.getText()); - - try { - text.setText(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - - assertEquals("01234567890", text.getText()); - text.setText(""); - assertEquals("", text.getText()); -} - -public void test_setTextLimitI(){ - boolean exceptionThrown = false; - - text.setTextLimit(10); - assertTrue(":a:", text.getTextLimit() == 10); - - text.setTextLimit(-1); - assertTrue(":b:", text.getTextLimit() == -1); - - try { - text.setTextLimit(0); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":c:", exceptionThrown == true); - exceptionThrown = false; -} - -public void test_setTopIndexI(){ - text.setTopIndex(-1); - assertTrue(":a:", text.getTopIndex() == 0); - text.setTopIndex(1); - assertTrue(":b:", text.getTopIndex() == 0); - - text.setText("Line0\r\nLine0a\r\n"); - - text.setTopIndex(-2); - assertTrue(":c:", text.getTopIndex() == 0); - text.setTopIndex(-1); - assertTrue(":d:", text.getTopIndex() == 0); - text.setTopIndex(1); - assertTrue(":e:", text.getTopIndex() == 1); - text.setTopIndex(2); - assertTrue(":f:", text.getTopIndex() == 2); - text.setTopIndex(0); - assertTrue(":g:", text.getTopIndex() == 0); - text.setTopIndex(3); - assertTrue(":h:", text.getTopIndex() == 2); - - text.setText(""); - text.setTopIndex(2); - assertTrue(":i:", text.getTopIndex() == 0); -} -public void test_setTopPixelI(){ - int lineHeight = text.getLineHeight(); - - text.setTopPixel(-1); - assertTrue(":a:", text.getTopPixel() == 0); - text.setTopPixel(1); - assertTrue(":b:", text.getTopPixel() == 0); - - text.setText("Line0\r\n"); - - text.setTopPixel(-2); - assertTrue(":c:", text.getTopPixel() == 0); - text.setTopPixel(-1); - assertTrue(":d:", text.getTopPixel() == 0); - text.setTopPixel(1); - assertTrue(":e:", text.getTopPixel() == 1); - text.setTopPixel(2 * lineHeight); - assertTrue(":f:", text.getTopPixel() == 2 * lineHeight); - text.setTopPixel(0); - assertTrue(":g:", text.getTopPixel() == 0); - text.setTopPixel(3 * lineHeight); - assertTrue(":h:", text.getTopPixel() == 2 * lineHeight); - - text.setText(""); - text.setTopPixel(2 * lineHeight); - assertTrue(":i:", text.getTopPixel() == 0); -} -public void test_setWordWrapZ(){ - String testString = "Line1\nLine2"; - - text.setWordWrap(true); - assertTrue(":a:", text.getWordWrap()); - text.setWordWrap(false); - assertTrue(":b:", text.getWordWrap() == false); - text.setWordWrap(false); - assertTrue(":c:", text.getWordWrap() == false); - text.setWordWrap(true); - assertTrue(":d:", text.getWordWrap()); - - text.setText(testString); - assertEquals(":e:", testString, text.getText()); - assertEquals(":f:", 2, text.getLineCount()); -} - -public void test_showSelection() { - text.showSelection(); - text.setSelectionRange(0, 0); - text.showSelection(); - text.setText("Line0\r\n"); - text.showSelection(); - text.setSelectionRange(5, 2); - text.showSelection(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_StyledText((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener"); - methodNames.addElement("test_addExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener"); - methodNames.addElement("test_addLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener"); - methodNames.addElement("test_addLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener"); - methodNames.addElement("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_addVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener"); - methodNames.addElement("test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener"); - methodNames.addElement("test_appendLjava_lang_String"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_copy"); - methodNames.addElement("test_cut"); - methodNames.addElement("test_getBackground"); - methodNames.addElement("test_getBidiColoring"); - methodNames.addElement("test_getCaretOffset"); - methodNames.addElement("test_getCharCount"); - methodNames.addElement("test_getContent"); - methodNames.addElement("test_getDoubleClickEnabled"); - methodNames.addElement("test_getEditable"); - methodNames.addElement("test_getForeground"); - methodNames.addElement("test_getHorizontalIndex"); - methodNames.addElement("test_getHorizontalPixel"); - methodNames.addElement("test_getKeyBindingI"); - methodNames.addElement("test_getLineAtOffsetI"); - methodNames.addElement("test_getLineBackgroundI"); - methodNames.addElement("test_getLineCount"); - methodNames.addElement("test_getLineDelimiter"); - methodNames.addElement("test_getLineHeight"); - methodNames.addElement("test_getLocationAtOffsetI"); - methodNames.addElement("test_getOffsetAtLineI"); - methodNames.addElement("test_getOffsetAtLocationLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_getOrientation"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionBackground"); - methodNames.addElement("test_getSelectionCount"); - methodNames.addElement("test_getSelectionForeground"); - methodNames.addElement("test_getSelectionRange"); - methodNames.addElement("test_getSelectionText"); - methodNames.addElement("test_getStyle"); - methodNames.addElement("test_getStyleRangeAtOffsetI"); - methodNames.addElement("test_getStyleRanges"); - methodNames.addElement("test_getStyleRangesII"); - methodNames.addElement("test_getTabs"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_getTextII"); - methodNames.addElement("test_getTextLimit"); - methodNames.addElement("test_getTextRangeII"); - methodNames.addElement("test_getTopIndex"); - methodNames.addElement("test_getTopPixel"); - methodNames.addElement("test_getWordWrap"); - methodNames.addElement("test_insertLjava_lang_String"); - methodNames.addElement("test_invokeActionI"); - methodNames.addElement("test_paste"); - methodNames.addElement("test_print"); - methodNames.addElement("test_printLorg_eclipse_swt_printing_Printer"); - methodNames.addElement("test_printLorg_eclipse_swt_printing_PrinterLorg_eclipse_swt_custom_StyledTextPrintOptions"); - methodNames.addElement("test_redraw"); - methodNames.addElement("test_redrawIIIIZ"); - methodNames.addElement("test_redrawRangeIIZ"); - methodNames.addElement("test_removeBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener"); - methodNames.addElement("test_removeExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener"); - methodNames.addElement("test_removeLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener"); - methodNames.addElement("test_removeLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener"); - methodNames.addElement("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_removeVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener"); - methodNames.addElement("test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener"); - methodNames.addElement("test_replaceStyleRangesII$Lorg_eclipse_swt_custom_StyleRange"); - methodNames.addElement("test_replaceTextRangeIILjava_lang_String"); - methodNames.addElement("test_selectAll"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setBidiColoringZ"); - methodNames.addElement("test_setCaretLorg_eclipse_swt_widgets_Caret"); - methodNames.addElement("test_setCaretOffsetI"); - methodNames.addElement("test_setContentLorg_eclipse_swt_custom_StyledTextContent"); - methodNames.addElement("test_setCursorLorg_eclipse_swt_graphics_Cursor"); - methodNames.addElement("test_setDoubleClickEnabledZ"); - methodNames.addElement("test_setEditableZ"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setHorizontalIndexI"); - methodNames.addElement("test_setHorizontalPixelI"); - methodNames.addElement("test_setKeyBindingII"); - methodNames.addElement("test_setLineBackgroundIILorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setOrientationI"); - methodNames.addElement("test_setSelectionBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setSelectionForegroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setSelectionI"); - methodNames.addElement("test_setSelectionII"); - methodNames.addElement("test_setSelectionLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setSelectionRangeII"); - methodNames.addElement("test_setStyleRangeLorg_eclipse_swt_custom_StyleRange"); - methodNames.addElement("test_setStyleRanges$Lorg_eclipse_swt_custom_StyleRange"); - methodNames.addElement("test_setTabsI"); - methodNames.addElement("test_setTextLimitI"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setTopIndexI"); - methodNames.addElement("test_setTopPixelI"); - methodNames.addElement("test_setWordWrapZ"); - methodNames.addElement("test_showSelection"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Canvas.methodNames()); // add superclass method names - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener")) test_addBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener(); - else if (getName().equals("test_addExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener")) test_addExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener(); - else if (getName().equals("test_addLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener")) test_addLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener(); - else if (getName().equals("test_addLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener")) test_addLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener(); - else if (getName().equals("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_addModifyListenerLorg_eclipse_swt_events_ModifyListener(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_addVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener")) test_addVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener(); - else if (getName().equals("test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener")) test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener(); - else if (getName().equals("test_appendLjava_lang_String")) test_appendLjava_lang_String(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_copy")) test_copy(); - else if (getName().equals("test_cut")) test_cut(); - else if (getName().equals("test_getBackground")) test_getBackground(); - else if (getName().equals("test_getBidiColoring")) test_getBidiColoring(); - else if (getName().equals("test_getCaretOffset")) test_getCaretOffset(); - else if (getName().equals("test_getCharCount")) test_getCharCount(); - else if (getName().equals("test_getContent")) test_getContent(); - else if (getName().equals("test_getDoubleClickEnabled")) test_getDoubleClickEnabled(); - else if (getName().equals("test_getEditable")) test_getEditable(); - else if (getName().equals("test_getForeground")) test_getForeground(); - else if (getName().equals("test_getHorizontalIndex")) test_getHorizontalIndex(); - else if (getName().equals("test_getHorizontalPixel")) test_getHorizontalPixel(); - else if (getName().equals("test_getKeyBindingI")) test_getKeyBindingI(); - else if (getName().equals("test_getLineAtOffsetI")) test_getLineAtOffsetI(); - else if (getName().equals("test_getLineBackgroundI")) test_getLineBackgroundI(); - else if (getName().equals("test_getLineCount")) test_getLineCount(); - else if (getName().equals("test_getLineDelimiter")) test_getLineDelimiter(); - else if (getName().equals("test_getLineHeight")) test_getLineHeight(); - else if (getName().equals("test_getLocationAtOffsetI")) test_getLocationAtOffsetI(); - else if (getName().equals("test_getOffsetAtLineI")) test_getOffsetAtLineI(); - else if (getName().equals("test_getOffsetAtLocationLorg_eclipse_swt_graphics_Point")) test_getOffsetAtLocationLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_getOrientation")) test_getOrientation(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionBackground")) test_getSelectionBackground(); - else if (getName().equals("test_getSelectionCount")) test_getSelectionCount(); - else if (getName().equals("test_getSelectionForeground")) test_getSelectionForeground(); - else if (getName().equals("test_getSelectionRange")) test_getSelectionRange(); - else if (getName().equals("test_getSelectionText")) test_getSelectionText(); - else if (getName().equals("test_getStyle")) test_getStyle(); - else if (getName().equals("test_getStyleRangeAtOffsetI")) test_getStyleRangeAtOffsetI(); - else if (getName().equals("test_getStyleRanges")) test_getStyleRanges(); - else if (getName().equals("test_getStyleRangesII")) test_getStyleRangesII(); - else if (getName().equals("test_getTabs")) test_getTabs(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_getTextII")) test_getTextII(); - else if (getName().equals("test_getTextLimit")) test_getTextLimit(); - else if (getName().equals("test_getTextRangeII")) test_getTextRangeII(); - else if (getName().equals("test_getTopIndex")) test_getTopIndex(); - else if (getName().equals("test_getTopPixel")) test_getTopPixel(); - else if (getName().equals("test_getWordWrap")) test_getWordWrap(); - else if (getName().equals("test_insertLjava_lang_String")) test_insertLjava_lang_String(); - else if (getName().equals("test_invokeActionI")) test_invokeActionI(); - else if (getName().equals("test_paste")) test_paste(); - else if (getName().equals("test_print")) test_print(); - else if (getName().equals("test_printLorg_eclipse_swt_printing_Printer")) test_printLorg_eclipse_swt_printing_Printer(); - else if (getName().equals("test_printLorg_eclipse_swt_printing_PrinterLorg_eclipse_swt_custom_StyledTextPrintOptions")) test_printLorg_eclipse_swt_printing_PrinterLorg_eclipse_swt_custom_StyledTextPrintOptions(); - else if (getName().equals("test_redraw")) test_redraw(); - else if (getName().equals("test_redrawIIIIZ")) test_redrawIIIIZ(); - else if (getName().equals("test_redrawRangeIIZ")) test_redrawRangeIIZ(); - else if (getName().equals("test_removeBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener")) test_removeBidiSegmentListenerLorg_eclipse_swt_custom_BidiSegmentListener(); - else if (getName().equals("test_removeExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener")) test_removeExtendedModifyListenerLorg_eclipse_swt_custom_ExtendedModifyListener(); - else if (getName().equals("test_removeLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener")) test_removeLineBackgroundListenerLorg_eclipse_swt_custom_LineBackgroundListener(); - else if (getName().equals("test_removeLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener")) test_removeLineStyleListenerLorg_eclipse_swt_custom_LineStyleListener(); - else if (getName().equals("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_removeVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener")) test_removeVerifyKeyListenerLorg_eclipse_swt_custom_VerifyKeyListener(); - else if (getName().equals("test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener")) test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener(); - else if (getName().equals("test_replaceStyleRangesII$Lorg_eclipse_swt_custom_StyleRange")) test_replaceStyleRangesII$Lorg_eclipse_swt_custom_StyleRange(); - else if (getName().equals("test_replaceTextRangeIILjava_lang_String")) test_replaceTextRangeIILjava_lang_String(); - else if (getName().equals("test_selectAll")) test_selectAll(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setBidiColoringZ")) test_setBidiColoringZ(); - else if (getName().equals("test_setCaretLorg_eclipse_swt_widgets_Caret")) test_setCaretLorg_eclipse_swt_widgets_Caret(); - else if (getName().equals("test_setCaretOffsetI")) test_setCaretOffsetI(); - else if (getName().equals("test_setContentLorg_eclipse_swt_custom_StyledTextContent")) test_setContentLorg_eclipse_swt_custom_StyledTextContent(); - else if (getName().equals("test_setCursorLorg_eclipse_swt_graphics_Cursor")) test_setCursorLorg_eclipse_swt_graphics_Cursor(); - else if (getName().equals("test_setDoubleClickEnabledZ")) test_setDoubleClickEnabledZ(); - else if (getName().equals("test_setEditableZ")) test_setEditableZ(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setHorizontalIndexI")) test_setHorizontalIndexI(); - else if (getName().equals("test_setHorizontalPixelI")) test_setHorizontalPixelI(); - else if (getName().equals("test_setKeyBindingII")) test_setKeyBindingII(); - else if (getName().equals("test_setLineBackgroundIILorg_eclipse_swt_graphics_Color")) test_setLineBackgroundIILorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setOrientationI")) test_setOrientationI(); - else if (getName().equals("test_setSelectionBackgroundLorg_eclipse_swt_graphics_Color")) test_setSelectionBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setSelectionForegroundLorg_eclipse_swt_graphics_Color")) test_setSelectionForegroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else if (getName().equals("test_setSelectionII")) test_setSelectionII(); - else if (getName().equals("test_setSelectionLorg_eclipse_swt_graphics_Point")) test_setSelectionLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setSelectionRangeII")) test_setSelectionRangeII(); - else if (getName().equals("test_setStyleRangeLorg_eclipse_swt_custom_StyleRange")) test_setStyleRangeLorg_eclipse_swt_custom_StyleRange(); - else if (getName().equals("test_setStyleRanges$Lorg_eclipse_swt_custom_StyleRange")) test_setStyleRanges$Lorg_eclipse_swt_custom_StyleRange(); - else if (getName().equals("test_setTabsI")) test_setTabsI(); - else if (getName().equals("test_setTextLimitI")) test_setTextLimitI(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setTopIndexI")) test_setTopIndexI(); - else if (getName().equals("test_setTopPixelI")) test_setTopPixelI(); - else if (getName().equals("test_setWordWrapZ")) test_setWordWrapZ(); - else if (getName().equals("test_showSelection")) test_showSelection(); - else super.runTest(); -} -/** - * Regression test for bug 19985 - */ -protected void testRtfCopy() { - String lines = "Line0\nLine1\nLine2\nLine3\nLine4\nLine5"; - final int[] linesCalled = new int[] {0}; - LineStyleListener listener = new LineStyleListener() { - public void lineGetStyle(LineStyleEvent event) { - Display display = Display.getDefault(); - Color red = display.getSystemColor(SWT.COLOR_RED); - StyledText styledText = (StyledText) event.widget; - int lineIndex = styledText.getLineAtOffset(event.lineOffset); - int lineStart = event.lineOffset; - int lineEnd = lineStart + event.lineText.length(); - StyleRange goodRange = new StyleRange(0, 1, red, red); - - event.styles = new StyleRange[2]; - switch (lineIndex % 6) { - case 0: - event.styles[0] = goodRange; - event.styles[1] = new StyleRange(lineEnd, 1, red, red); - linesCalled[0]++; - break; - case 1: - event.styles[0] = goodRange; - event.styles[1] = new StyleRange(lineEnd, -1, red, red); - linesCalled[0]++; - break; - case 2: - event.styles[0] = goodRange; - event.styles[1] = new StyleRange(lineEnd - 1, -1, red, red); - linesCalled[0]++; - break; - case 3: - event.styles[0] = goodRange; - event.styles[1] = new StyleRange(lineStart, -1, red, red); - linesCalled[0]++; - break; - case 4: - event.styles[0] = new StyleRange(lineStart, 1, red, red); - event.styles[1] = new StyleRange(lineStart, -1, red, red); - linesCalled[0]++; - break; - case 5: - event.styles[0] = new StyleRange(lineEnd / 2, 1, red, red); - event.styles[1] = new StyleRange(lineEnd / 2, -1, red, red); - linesCalled[0]++; - break; - } - } - }; - text.setText(lines); - // cause StyledText to call the listener. - text.setSelection(0, text.getCharCount()); - text.addLineStyleListener(listener); - text.copy(); - assertTrue("not all lines tested for RTF copy", linesCalled[0] == text.getLineCount()); - - Clipboard clipboard = new Clipboard(text.getDisplay()); - RTFTransfer rtfTranfer = RTFTransfer.getInstance(); - String clipboardText = (String) clipboard.getContents(rtfTranfer); - assertTrue("RTF copy failed", clipboardText.length() > 0); - - clipboard.dispose(); - text.removeLineStyleListener(listener); -} - -} - diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledTextContent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledTextContent.java deleted file mode 100644 index 1c47b98d9c..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_StyledTextContent.java +++ /dev/null @@ -1,178 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.internal.BidiUtil; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.StyledTextContent - * - * @see org.eclipse.swt.custom.StyledTextContent - */ -public class Test_org_eclipse_swt_custom_StyledTextContent extends SwtTestCase { - int XINSET = 0; - - class ContentImplementation implements StyledTextContent { - String textContent = ""; - - public void addTextChangeListener(TextChangeListener listener){ - } - public int getCharCount() { - return 0; - } - public String getLine(int lineIndex) { - return "getLine"; - } - public int getLineAtOffset(int offset) { - return 0; - } - public int getLineCount() { - return 0; - } - public String getLineDelimiter() { - return "getLineDelimiter"; - } - public int getOffsetAtLine(int lineIndex) { - return 0; - } - public String getTextRange(int start, int length) { - return textContent; - } - public void removeTextChangeListener(TextChangeListener listener) { - } - public void replaceTextRange(int start, int replaceLength, String text) { - textContent = text; - } - public void setText(String text) { - textContent = text; - } - } - StyledTextContent content = new ContentImplementation(); - Shell shell; - StyledText styledText; - -public Test_org_eclipse_swt_custom_StyledTextContent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -private boolean isBidi() { - return BidiUtil.isBidiPlatform(); -} -protected void setUp() { - if (isBidi()) XINSET = 3; - else XINSET = 0; - shell = new Shell(); - styledText = new StyledText(shell, SWT.NULL); - styledText.setContent(content); -} - -protected void tearDown() { -} - -public void test_addTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener() { - // does not make sense to test, not called by StyledText -} - -public void test_getCharCount() { - assertTrue(":a:", styledText.getCharCount() == 0); -} - -public void test_getLineAtOffsetI() { - assertTrue(":c:", styledText.getLineAtOffset(0) == 0); -} - -public void test_getLineCount() { - assertTrue(":d:", styledText.getLineCount() == 1); -} - -public void test_getLineDelimiter() { - assertTrue(":e:", styledText.getLineDelimiter().equals("getLineDelimiter")); -} - -public void test_getLineI() { - // will indirectly cause getLine to be called - assertTrue(":b:", styledText.getLocationAtOffset(0).equals(new Point(XINSET,0))); -} - -public void test_getOffsetAtLineI() { - // will indirectly cause getOffsetAtLine to be called - assertTrue(":f:", styledText.getLocationAtOffset(0).equals(new Point(XINSET,0))); -} - -public void test_getTextRangeII() { - assertTrue(":g:", styledText.getTextRange(0,0).equals("")); -} - -public void test_removeTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener() { - // does not make sense to test, not called by StyledText -} - -public void test_replaceTextRangeIILjava_lang_String() { - styledText.replaceTextRange(0,0,"test1"); - assertTrue(":h:", styledText.getText().equals("test1")); -} - -public void test_setTextLjava_lang_String() { - styledText.replaceTextRange(0,0,"test2"); - assertTrue(":i:", styledText.getText().equals("test2")); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_StyledTextContent((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_addTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener"); - methodNames.addElement("test_getCharCount"); - methodNames.addElement("test_getLineAtOffsetI"); - methodNames.addElement("test_getLineCount"); - methodNames.addElement("test_getLineDelimiter"); - methodNames.addElement("test_getLineI"); - methodNames.addElement("test_getOffsetAtLineI"); - methodNames.addElement("test_getTextRangeII"); - methodNames.addElement("test_removeTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener"); - methodNames.addElement("test_replaceTextRangeIILjava_lang_String"); - methodNames.addElement("test_setTextLjava_lang_String"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_addTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener")) test_addTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener(); - else if (getName().equals("test_getCharCount")) test_getCharCount(); - else if (getName().equals("test_getLineAtOffsetI")) test_getLineAtOffsetI(); - else if (getName().equals("test_getLineCount")) test_getLineCount(); - else if (getName().equals("test_getLineDelimiter")) test_getLineDelimiter(); - else if (getName().equals("test_getLineI")) test_getLineI(); - else if (getName().equals("test_getOffsetAtLineI")) test_getOffsetAtLineI(); - else if (getName().equals("test_getTextRangeII")) test_getTextRangeII(); - else if (getName().equals("test_removeTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener")) test_removeTextChangeListenerLorg_eclipse_swt_custom_TextChangeListener(); - else if (getName().equals("test_replaceTextRangeIILjava_lang_String")) test_replaceTextRangeIILjava_lang_String(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableCursor.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableCursor.java deleted file mode 100644 index 2a85c917f3..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableCursor.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.TableCursor - * - * @see org.eclipse.swt.custom.TableCursor - */ -public class Test_org_eclipse_swt_custom_TableCursor extends Test_org_eclipse_swt_widgets_Canvas { - -public Test_org_eclipse_swt_custom_TableCursor(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TableI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_TableI not written"); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_getColumn() { - warnUnimpl("Test test_getColumn not written"); -} - -public void test_getRow() { - warnUnimpl("Test test_getRow not written"); -} - -public void test_setSelectionII() { - warnUnimpl("Test test_setSelectionII not written"); -} - -public void test_setSelectionLorg_eclipse_swt_widgets_TableItemI() { - warnUnimpl("Test test_setSelectionLorg_eclipse_swt_widgets_TableItemI not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_TableCursor((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TableI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_getColumn"); - methodNames.addElement("test_getRow"); - methodNames.addElement("test_setSelectionII"); - methodNames.addElement("test_setSelectionLorg_eclipse_swt_widgets_TableItemI"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Canvas.methodNames()); // add superclass method names - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TableI")) test_ConstructorLorg_eclipse_swt_widgets_TableI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_getColumn")) test_getColumn(); - else if (getName().equals("test_getRow")) test_getRow(); - else if (getName().equals("test_setSelectionII")) test_setSelectionII(); - else if (getName().equals("test_setSelectionLorg_eclipse_swt_widgets_TableItemI")) test_setSelectionLorg_eclipse_swt_widgets_TableItemI(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableEditor.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableEditor.java deleted file mode 100644 index 80ddf3a4b5..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableEditor.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.TableEditor - * - * @see org.eclipse.swt.custom.TableEditor - */ -public class Test_org_eclipse_swt_custom_TableEditor extends Test_org_eclipse_swt_custom_ControlEditor { - -public Test_org_eclipse_swt_custom_TableEditor(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Table() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Table not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_getColumn() { - warnUnimpl("Test test_getColumn not written"); -} - -public void test_getItem() { - warnUnimpl("Test test_getItem not written"); -} - -public void test_setColumnI() { - warnUnimpl("Test test_setColumnI not written"); -} - -public void test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TableItemI() { - warnUnimpl("Test test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TableItemI not written"); -} - -public void test_setItemLorg_eclipse_swt_widgets_TableItem() { - warnUnimpl("Test test_setItemLorg_eclipse_swt_widgets_TableItem not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_TableEditor((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Table"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getColumn"); - methodNames.addElement("test_getItem"); - methodNames.addElement("test_setColumnI"); - methodNames.addElement("test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TableItemI"); - methodNames.addElement("test_setItemLorg_eclipse_swt_widgets_TableItem"); - methodNames.addAll(Test_org_eclipse_swt_custom_ControlEditor.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Table")) test_ConstructorLorg_eclipse_swt_widgets_Table(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getColumn")) test_getColumn(); - else if (getName().equals("test_getItem")) test_getItem(); - else if (getName().equals("test_setColumnI")) test_setColumnI(); - else if (getName().equals("test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TableItemI")) test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TableItemI(); - else if (getName().equals("test_setItemLorg_eclipse_swt_widgets_TableItem")) test_setItemLorg_eclipse_swt_widgets_TableItem(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTree.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTree.java deleted file mode 100644 index 7a02849bbc..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTree.java +++ /dev/null @@ -1,171 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.TableTree - * - * @see org.eclipse.swt.custom.TableTree - */ -public class Test_org_eclipse_swt_custom_TableTree extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_custom_TableTree(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_addTreeListenerLorg_eclipse_swt_events_TreeListener() { - warnUnimpl("Test test_addTreeListenerLorg_eclipse_swt_events_TreeListener not written"); -} - -public void test_deselectAll() { - warnUnimpl("Test test_deselectAll not written"); -} - -public void test_getItemCount() { - warnUnimpl("Test test_getItemCount not written"); -} - -public void test_getItemHeight() { - warnUnimpl("Test test_getItemHeight not written"); -} - -public void test_getItemLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_getItemLorg_eclipse_swt_graphics_Point not written"); -} - -public void test_getItems() { - warnUnimpl("Test test_getItems not written"); -} - -public void test_getSelection() { - warnUnimpl("Test test_getSelection not written"); -} - -public void test_getSelectionCount() { - warnUnimpl("Test test_getSelectionCount not written"); -} - -public void test_getTable() { - warnUnimpl("Test test_getTable not written"); -} - -public void test_indexOfLorg_eclipse_swt_custom_TableTreeItem() { - warnUnimpl("Test test_indexOfLorg_eclipse_swt_custom_TableTreeItem not written"); -} - -public void test_removeAll() { - warnUnimpl("Test test_removeAll not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_removeTreeListenerLorg_eclipse_swt_events_TreeListener() { - warnUnimpl("Test test_removeTreeListenerLorg_eclipse_swt_events_TreeListener not written"); -} - -public void test_selectAll() { - warnUnimpl("Test test_selectAll not written"); -} - -public void test_setSelection$Lorg_eclipse_swt_custom_TableTreeItem() { - warnUnimpl("Test test_setSelection$Lorg_eclipse_swt_custom_TableTreeItem not written"); -} - -public void test_showItemLorg_eclipse_swt_custom_TableTreeItem() { - warnUnimpl("Test test_showItemLorg_eclipse_swt_custom_TableTreeItem not written"); -} - -public void test_showSelection() { - warnUnimpl("Test test_showSelection not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_TableTree((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_addTreeListenerLorg_eclipse_swt_events_TreeListener"); - methodNames.addElement("test_deselectAll"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItemHeight"); - methodNames.addElement("test_getItemLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionCount"); - methodNames.addElement("test_getTable"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_custom_TableTreeItem"); - methodNames.addElement("test_removeAll"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_removeTreeListenerLorg_eclipse_swt_events_TreeListener"); - methodNames.addElement("test_selectAll"); - methodNames.addElement("test_setSelection$Lorg_eclipse_swt_custom_TableTreeItem"); - methodNames.addElement("test_showItemLorg_eclipse_swt_custom_TableTreeItem"); - methodNames.addElement("test_showSelection"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_addTreeListenerLorg_eclipse_swt_events_TreeListener")) test_addTreeListenerLorg_eclipse_swt_events_TreeListener(); - else if (getName().equals("test_deselectAll")) test_deselectAll(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItemHeight")) test_getItemHeight(); - else if (getName().equals("test_getItemLorg_eclipse_swt_graphics_Point")) test_getItemLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionCount")) test_getSelectionCount(); - else if (getName().equals("test_getTable")) test_getTable(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_custom_TableTreeItem")) test_indexOfLorg_eclipse_swt_custom_TableTreeItem(); - else if (getName().equals("test_removeAll")) test_removeAll(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_removeTreeListenerLorg_eclipse_swt_events_TreeListener")) test_removeTreeListenerLorg_eclipse_swt_events_TreeListener(); - else if (getName().equals("test_selectAll")) test_selectAll(); - else if (getName().equals("test_setSelection$Lorg_eclipse_swt_custom_TableTreeItem")) test_setSelection$Lorg_eclipse_swt_custom_TableTreeItem(); - else if (getName().equals("test_showItemLorg_eclipse_swt_custom_TableTreeItem")) test_showItemLorg_eclipse_swt_custom_TableTreeItem(); - else if (getName().equals("test_showSelection")) test_showSelection(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeEditor.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeEditor.java deleted file mode 100644 index 1b38872d42..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeEditor.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.TableTreeEditor - * - * @see org.eclipse.swt.custom.TableTreeEditor - */ -public class Test_org_eclipse_swt_custom_TableTreeEditor extends Test_org_eclipse_swt_custom_ControlEditor { - -public Test_org_eclipse_swt_custom_TableTreeEditor(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_custom_TableTree() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_TableTree not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_getColumn() { - warnUnimpl("Test test_getColumn not written"); -} - -public void test_getItem() { - warnUnimpl("Test test_getItem not written"); -} - -public void test_setColumnI() { - warnUnimpl("Test test_setColumnI not written"); -} - -public void test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_custom_TableTreeItemI() { - warnUnimpl("Test test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_custom_TableTreeItemI not written"); -} - -public void test_setItemLorg_eclipse_swt_custom_TableTreeItem() { - warnUnimpl("Test test_setItemLorg_eclipse_swt_custom_TableTreeItem not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_TableTreeEditor((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_TableTree"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getColumn"); - methodNames.addElement("test_getItem"); - methodNames.addElement("test_setColumnI"); - methodNames.addElement("test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_custom_TableTreeItemI"); - methodNames.addElement("test_setItemLorg_eclipse_swt_custom_TableTreeItem"); - methodNames.addAll(Test_org_eclipse_swt_custom_ControlEditor.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_TableTree")) test_ConstructorLorg_eclipse_swt_custom_TableTree(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getColumn")) test_getColumn(); - else if (getName().equals("test_getItem")) test_getItem(); - else if (getName().equals("test_setColumnI")) test_setColumnI(); - else if (getName().equals("test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_custom_TableTreeItemI")) test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_custom_TableTreeItemI(); - else if (getName().equals("test_setItemLorg_eclipse_swt_custom_TableTreeItem")) test_setItemLorg_eclipse_swt_custom_TableTreeItem(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeItem.java deleted file mode 100644 index c67181fad9..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TableTreeItem.java +++ /dev/null @@ -1,232 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.TableTreeItem - * - * @see org.eclipse.swt.custom.TableTreeItem - */ -public class Test_org_eclipse_swt_custom_TableTreeItem extends Test_org_eclipse_swt_widgets_Item { - - TableTree tableTree; - TableTreeItem tableTreeItem; - -public Test_org_eclipse_swt_custom_TableTreeItem(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - tableTree = new TableTree(shell, 0); - tableTreeItem = new TableTreeItem(tableTree, 0); - setWidget(tableTreeItem); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_custom_TableTreeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_TableTreeI not written"); -} - -public void test_ConstructorLorg_eclipse_swt_custom_TableTreeII() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_TableTreeII not written"); -} - -public void test_ConstructorLorg_eclipse_swt_custom_TableTreeItemI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_TableTreeItemI not written"); -} - -public void test_ConstructorLorg_eclipse_swt_custom_TableTreeItemII() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_custom_TableTreeItemII not written"); -} - -public void test_getBackground() { - warnUnimpl("Test test_getBackground not written"); -} - -public void test_getBoundsI() { - warnUnimpl("Test test_getBoundsI not written"); -} - -public void test_getChecked() { - warnUnimpl("Test test_getChecked not written"); -} - -public void test_getExpanded() { - warnUnimpl("Test test_getExpanded not written"); -} - -public void test_getForeground() { - warnUnimpl("Test test_getForeground not written"); -} - -public void test_getGrayed() { - warnUnimpl("Test test_getGrayed not written"); -} - -public void test_getImage() { - warnUnimpl("Test test_getImage not written"); -} - -public void test_getImageI() { - warnUnimpl("Test test_getImageI not written"); -} - -public void test_getItemCount() { - warnUnimpl("Test test_getItemCount not written"); -} - -public void test_getItems() { - warnUnimpl("Test test_getItems not written"); -} - -public void test_getParent() { - warnUnimpl("Test test_getParent not written"); -} - -public void test_getParentItem() { - warnUnimpl("Test test_getParentItem not written"); -} - -public void test_getText() { - warnUnimpl("Test test_getText not written"); -} - -public void test_getTextI() { - warnUnimpl("Test test_getTextI not written"); -} - -public void test_indexOfLorg_eclipse_swt_custom_TableTreeItem() { - warnUnimpl("Test test_indexOfLorg_eclipse_swt_custom_TableTreeItem not written"); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setCheckedZ() { - warnUnimpl("Test test_setCheckedZ not written"); -} - -public void test_setExpandedZ() { - warnUnimpl("Test test_setExpandedZ not written"); -} - -public void test_setForegroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setForegroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setGrayedZ() { - warnUnimpl("Test test_setGrayedZ not written"); -} - -public void test_setImageILorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageILorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setTextILjava_lang_String() { - warnUnimpl("Test test_setTextILjava_lang_String not written"); -} - -public void test_setTextLjava_lang_String() { - warnUnimpl("Test test_setTextLjava_lang_String not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_TableTreeItem((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_TableTreeI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_TableTreeII"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_TableTreeItemI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_TableTreeItemII"); - methodNames.addElement("test_getBackground"); - methodNames.addElement("test_getBoundsI"); - methodNames.addElement("test_getChecked"); - methodNames.addElement("test_getExpanded"); - methodNames.addElement("test_getForeground"); - methodNames.addElement("test_getGrayed"); - methodNames.addElement("test_getImage"); - methodNames.addElement("test_getImageI"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getParentItem"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_getTextI"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_custom_TableTreeItem"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setCheckedZ"); - methodNames.addElement("test_setExpandedZ"); - methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setGrayedZ"); - methodNames.addElement("test_setImageILorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setTextILjava_lang_String"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_TableTreeI")) test_ConstructorLorg_eclipse_swt_custom_TableTreeI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_TableTreeII")) test_ConstructorLorg_eclipse_swt_custom_TableTreeII(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_TableTreeItemI")) test_ConstructorLorg_eclipse_swt_custom_TableTreeItemI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_TableTreeItemII")) test_ConstructorLorg_eclipse_swt_custom_TableTreeItemII(); - else if (getName().equals("test_getBackground")) test_getBackground(); - else if (getName().equals("test_getBoundsI")) test_getBoundsI(); - else if (getName().equals("test_getChecked")) test_getChecked(); - else if (getName().equals("test_getExpanded")) test_getExpanded(); - else if (getName().equals("test_getForeground")) test_getForeground(); - else if (getName().equals("test_getGrayed")) test_getGrayed(); - else if (getName().equals("test_getImage")) test_getImage(); - else if (getName().equals("test_getImageI")) test_getImageI(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getParentItem")) test_getParentItem(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_getTextI")) test_getTextI(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_custom_TableTreeItem")) test_indexOfLorg_eclipse_swt_custom_TableTreeItem(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setCheckedZ")) test_setCheckedZ(); - else if (getName().equals("test_setExpandedZ")) test_setExpandedZ(); - else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setGrayedZ")) test_setGrayedZ(); - else if (getName().equals("test_setImageILorg_eclipse_swt_graphics_Image")) test_setImageILorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setTextILjava_lang_String")) test_setTextILjava_lang_String(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangeListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangeListener.java deleted file mode 100644 index a0b8bce9f6..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangeListener.java +++ /dev/null @@ -1,566 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.TextChangeListener - * - * @see org.eclipse.swt.custom.TextChangeListener - */ -public class Test_org_eclipse_swt_custom_TextChangeListener extends SwtTestCase { - Shell shell; - StyledText styledText; - int verify = -1; - -public Test_org_eclipse_swt_custom_TextChangeListener(String name) { - super(name); -} -public static void main(String[] args) { - TestRunner.run(suite()); -} -protected void setUp() { - shell = new Shell(); - styledText = new StyledText(shell, SWT.NULL); -} -protected void tearDown() { -} - -public void test_textChangedLorg_eclipse_swt_custom_TextChangedEvent() { - StyledTextContent content = styledText.getContent(); - TextChangeListener listener = new TextChangeListener() { - public void textChanged(TextChangedEvent event) { - switch (verify) { - case 1 : { - assertTrue(":1:", styledText.getText().equals("\ntesting")); - break; - } - case 2 : { - assertTrue(":2:", styledText.getText().equals("a")); - break; - } - case 3 : { - assertTrue(":3:", styledText.getText().equals("\n\n")); - break; - } - case 4: { - assertTrue(":4:", false); - break; - } - case 5 : { - assertTrue(":5:", styledText.getText().equals("\rLine 1\r\nLine 2")); - break; - } - case 6 : { - assertTrue(":6:", styledText.getText().equals("This\nis a test\nline 3")); - break; - } - case 7 : { - assertTrue(":7:", styledText.getText().equals("This\n\r")); - break; - } - case 8 : { - assertTrue(":8:", styledText.getText().equals("\nL1\r\nL2")); - break; - } - case 9 : { - assertTrue(":9:", styledText.getText().equals("L1test")); - break; - } - case 10:{ - assertTrue(":10:", false); - break; - } - case 11: { - assertTrue(":11:", false); - break; - } - case 12: { - assertTrue(":12:", styledText.getText().equals("L1\r\n")); - break; - } - case 13: { - assertTrue(":13:", styledText.getText().equals("L1\r\n")); - break; - } - case 14: { - assertTrue(":14:", false); - break; - } - case 15: { - assertTrue(":15:", styledText.getText().equals("L1test\n\n")); - break; - } - case 16:{ - assertTrue(":16:", false); - break; - } - case 17: { - assertTrue(":17:", false); - break; - } - case 18: { - assertTrue(":18:", styledText.getText().equals("L1\r\ntest\r\n")); - break; - } - case 19: { - assertTrue(":19:", styledText.getText().equals("L1test\r\r\r\n")); - break; - } - case 20: { - assertTrue(":20:", false); - break; - } - } - } - public void textChanging(TextChangingEvent event) { - } - public void textSet(TextChangedEvent event) { - } - }; - content.addTextChangeListener(listener); - - boolean exceptionHandled = false; - verify = 0; - styledText.setText("testing"); - verify = 1; - styledText.replaceTextRange(0, 0, "\n"); - - verify = 0; - styledText.setText("\n\n"); - verify = 2; - styledText.replaceTextRange(0, 2, "a"); - - verify = 0; - styledText.setText("a"); - verify = 3; - styledText.replaceTextRange(0, 1, "\n\n"); - - verify = 0; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - verify = 4; - try {styledText.replaceTextRange(3, 1, "test\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":4: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("Line 1\r\nLine 2"); - verify = 5; - styledText.replaceTextRange(0, 0, "\r"); - - verify = 0; - styledText.setText("This\nis a test\nline 3\nline 4"); - verify = 6; - styledText.replaceTextRange(21, 7, ""); - - verify = 0; - styledText.setText("This\nis a test\r"); - verify = 7; - styledText.replaceTextRange(5, 9, ""); - - verify = 0; - styledText.setText("\nL1\r\nL2\r\n"); - verify = 8; - styledText.replaceTextRange(7, 2, ""); - - verify = 0; - styledText.setText("L1\r\n"); - verify = 9; - styledText.replaceTextRange(2, 2, "test"); - - verify = 0; - styledText.setText("L1\r\n"); - verify = 10; - try {styledText.replaceTextRange(3, 1, "");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":10: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - verify = 11; - try {styledText.replaceTextRange(1, 2, "");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":11: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r"); - verify = 12; - styledText.replaceTextRange(3, 0, "\n"); - - verify = 0; - styledText.setText("L1\n"); - verify = 13; - styledText.replaceTextRange(2, 0, "\r"); - - verify = 0; - styledText.setText("L1\r\n"); - verify = 14; - try {styledText.replaceTextRange(3, 0, "test");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":14: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r\n"); - verify = 15; - styledText.replaceTextRange(2, 2, "test\n\n"); - - verify = 0; - styledText.setText("L1\r\n"); - verify = 16; - try {styledText.replaceTextRange(3, 1, "test\r\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":16: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - verify = 17; - try {styledText.replaceTextRange(1, 2, "test\n\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":17: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 0; - styledText.setText("L1\r"); - verify = 18; - styledText.replaceTextRange(3, 0, "\ntest\r\n"); - - verify = 0; - styledText.setText("L1\n"); - verify = 19; - styledText.replaceTextRange(2, 0, "test\r\r\r"); - - verify = 0; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - verify = 20; - try {styledText.replaceTextRange(3, 1, "test\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":20: exception not thrown", exceptionHandled); - exceptionHandled = false; - content.removeTextChangeListener(listener); -} - -public void test_textChangingLorg_eclipse_swt_custom_TextChangingEvent() { - StyledTextContent content = styledText.getContent(); - TextChangeListener listener = new TextChangeListener() { - public void textChanging(TextChangingEvent event) { - switch(verify) { - case 1 : { - assertTrue(":1a:", event.replaceLineCount == 0); - assertTrue(":1b:", event.newLineCount == 1); - break; - } - case 2 : { - assertTrue(":2a:", event.replaceLineCount == 2); - assertTrue(":2b:", event.newLineCount == 0); - break; - } - case 3 : { - assertTrue(":3a:", event.replaceLineCount == 0); - assertTrue(":3b:", event.newLineCount == 2); - break; - } - case 4: { - assertTrue(":4:", false); - break; - } - case 5 : { - assertTrue(":5a:", event.replaceLineCount == 0); - assertTrue(":5b:", event.newLineCount == 1); - break; - } - case 6 : { - assertTrue(":6a:", event.replaceLineCount == 1); - assertTrue(":6b:", event.newLineCount == 0); - break; - } - case 7 : { - assertTrue(":7a:", event.replaceLineCount == 0); - assertTrue(":7b:", event.newLineCount == 0); - break; - } - case 8 : { - assertTrue(":8a:", event.replaceLineCount == 1); - assertTrue(":8b:", event.newLineCount == 0); - break; - } - case 9 : { - assertTrue(":9a:", event.replaceLineCount == 1); - assertTrue(":9b:", event.newLineCount == 0); - break; - } - case 10:{ - assertTrue(":10:", false); - break; - } - case 11: { - assertTrue(":11:", false); - break; - } - case 12: { - assertTrue(":12a:", event.replaceLineCount == 0); - assertTrue(":12b:", event.newLineCount == 1); - break; - } - case 13: { - assertTrue(":13a:", event.replaceLineCount == 0); - assertTrue(":13b:", event.newLineCount == 1); - break; - } - case 14: { - assertTrue(":14:", false); - break; - } - case 15: { - assertTrue(":15a:", event.replaceLineCount == 1); - assertTrue(":15b:", event.newLineCount == 2); - break; - } - case 16:{ - assertTrue(":16:", false); - break; - } - case 17: { - assertTrue(":17:", false); - break; - } - case 18: { - assertTrue(":18a:", event.replaceLineCount == 0); - assertTrue(":18b:", event.newLineCount == 2); - break; - } - case 19: { - assertTrue(":19a:", event.replaceLineCount == 0); - assertTrue(":19b:", event.newLineCount == 3); - break; - } - case 20: { - assertTrue(":20:", false); - break; - } - } - } - public void textChanged(TextChangedEvent event) { - } - public void textSet(TextChangedEvent event) { - } - }; - content.addTextChangeListener(listener); - - boolean exceptionHandled = false; - verify = 1; - styledText.setText("testing"); - styledText.replaceTextRange(0, 0, "\n"); - - verify = 2; - styledText.setText("\n\n"); - styledText.replaceTextRange(0, 2, "a"); - - verify = 3; - styledText.setText("a"); - styledText.replaceTextRange(0, 1, "\n\n"); - - verify = 4; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - try {styledText.replaceTextRange(3, 1, "test\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":4: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 5; - styledText.setText("Line 1\r\nLine 2"); - styledText.replaceTextRange(0, 0, "\r"); - - verify = 6; - styledText.setText("This\nis a test\nline 3\nline 4"); - styledText.replaceTextRange(21, 7, ""); - - verify = 7; - styledText.setText("This\nis a test\r"); - styledText.replaceTextRange(5, 9, ""); - - verify = 8; - styledText.setText("\nL1\r\nL2\r\n"); - styledText.replaceTextRange(7, 2, ""); - - verify = 9; - styledText.setText("L1\r\n"); - styledText.replaceTextRange(2, 2, "test"); - - verify = 10; - styledText.setText("L1\r\n"); - try {styledText.replaceTextRange(3, 1, "");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":10: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 11; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - try {styledText.replaceTextRange(1, 2, "");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":11: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 12; - styledText.setText("L1\r"); - styledText.replaceTextRange(3, 0, "\n"); - - verify = 13; - styledText.setText("L1\n"); - styledText.replaceTextRange(2, 0, "\r"); - - verify = 14; - styledText.setText("L1\r\n"); - try {styledText.replaceTextRange(3, 0, "test");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":14: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 15; - styledText.setText("L1\r\n"); - styledText.replaceTextRange(2, 2, "test\n\n"); - - verify = 16; - styledText.setText("L1\r\n"); - try {styledText.replaceTextRange(3, 1, "test\r\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":16: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 17; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - try {styledText.replaceTextRange(1, 2, "test\n\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":17: exception not thrown", exceptionHandled); - exceptionHandled = false; - - verify = 18; - styledText.setText("L1\r"); - styledText.replaceTextRange(3, 0, "\ntest\r\n"); - - verify = 19; - styledText.setText("L1\n"); - styledText.replaceTextRange(2, 0, "test\r\r\r"); - verify = 20; - styledText.setText("L1\r\nL2\r\nL3\r\nL4\r\n"); - try {styledText.replaceTextRange(3, 1, "test\n");} - catch (IllegalArgumentException ex) { - exceptionHandled = true; - } - assertTrue(":20: exception not thrown", exceptionHandled); - exceptionHandled = false; - content.removeTextChangeListener(listener); -} - -public void test_textSetLorg_eclipse_swt_custom_TextChangedEvent() { - StyledTextContent content = styledText.getContent(); - TextChangeListener listener = new TextChangeListener() { - public void textChanging(TextChangingEvent event) { - } - public void textChanged(TextChangedEvent event) { - } - public void textSet(TextChangedEvent event) { - switch (verify) { - case 1 : { - assertTrue(":1:", styledText.getText().equals("testing")); - break; - } - case 2 : { - assertTrue(":2:", styledText.getText().equals("\n\n")); - break; - } - case 3 : { - assertTrue(":3:", styledText.getText().equals("a")); - break; - } - case 4 : { - assertTrue(":4:", styledText.getText().equals("")); - break; - } - } - } - }; - content.addTextChangeListener(listener); - - verify = 1; - styledText.setText("testing"); - - verify = 2; - styledText.setText("\n\n"); - - verify = 3; - styledText.setText("a"); - - verify = 4; - try {styledText.setText(null);} - catch (IllegalArgumentException ex) {assertTrue(":4:", true);} - content.removeTextChangeListener(listener); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_TextChangeListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_textChangedLorg_eclipse_swt_custom_TextChangedEvent"); - methodNames.addElement("test_textChangingLorg_eclipse_swt_custom_TextChangingEvent"); - methodNames.addElement("test_textSetLorg_eclipse_swt_custom_TextChangedEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_textChangedLorg_eclipse_swt_custom_TextChangedEvent")) test_textChangedLorg_eclipse_swt_custom_TextChangedEvent(); - else if (getName().equals("test_textChangingLorg_eclipse_swt_custom_TextChangingEvent")) test_textChangingLorg_eclipse_swt_custom_TextChangingEvent(); - else if (getName().equals("test_textSetLorg_eclipse_swt_custom_TextChangedEvent")) test_textSetLorg_eclipse_swt_custom_TextChangedEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangedEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangedEvent.java deleted file mode 100644 index 152d7a7943..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangedEvent.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.TextChangedEvent - * - * @see org.eclipse.swt.custom.TextChangedEvent - */ -public class Test_org_eclipse_swt_custom_TextChangedEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_custom_TextChangedEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_custom_StyledTextContent() { - // this method tested by other test classes -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_TextChangedEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_StyledTextContent"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_StyledTextContent")) test_ConstructorLorg_eclipse_swt_custom_StyledTextContent(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangingEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangingEvent.java deleted file mode 100644 index 62ef5ab93c..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TextChangingEvent.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.TextChangingEvent - * - * @see org.eclipse.swt.custom.TextChangingEvent - */ -public class Test_org_eclipse_swt_custom_TextChangingEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_custom_TextChangingEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_custom_StyledTextContent() { - // this method tested by other test classes -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_TextChangingEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_custom_StyledTextContent"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_custom_StyledTextContent")) test_ConstructorLorg_eclipse_swt_custom_StyledTextContent(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TreeEditor.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TreeEditor.java deleted file mode 100644 index 6d5ec9f853..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_TreeEditor.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.TreeEditor - * - * @see org.eclipse.swt.custom.TreeEditor - */ -public class Test_org_eclipse_swt_custom_TreeEditor extends Test_org_eclipse_swt_custom_ControlEditor { - -public Test_org_eclipse_swt_custom_TreeEditor(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Tree() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Tree not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_getItem() { - warnUnimpl("Test test_getItem not written"); -} - -public void test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TreeItem() { - warnUnimpl("Test test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TreeItem not written"); -} - -public void test_setItemLorg_eclipse_swt_widgets_TreeItem() { - warnUnimpl("Test test_setItemLorg_eclipse_swt_widgets_TreeItem not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_TreeEditor((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Tree"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getItem"); - methodNames.addElement("test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TreeItem"); - methodNames.addElement("test_setItemLorg_eclipse_swt_widgets_TreeItem"); - methodNames.addAll(Test_org_eclipse_swt_custom_ControlEditor.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Tree")) test_ConstructorLorg_eclipse_swt_widgets_Tree(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getItem")) test_getItem(); - else if (getName().equals("test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TreeItem")) test_setEditorLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_TreeItem(); - else if (getName().equals("test_setItemLorg_eclipse_swt_widgets_TreeItem")) test_setItemLorg_eclipse_swt_widgets_TreeItem(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_VerifyKeyListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_VerifyKeyListener.java deleted file mode 100644 index 8d2e57c980..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_VerifyKeyListener.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.custom.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.VerifyKeyListener - * - * @see org.eclipse.swt.custom.VerifyKeyListener - */ -public class Test_org_eclipse_swt_custom_VerifyKeyListener extends SwtTestCase { - Shell shell; - StyledText styledText; - int verify = -1; - -public Test_org_eclipse_swt_custom_VerifyKeyListener(String name) { - super(name); -} -public static void main(String[] args) { - TestRunner.run(suite()); -} -protected void setUp() { - shell = new Shell(); - styledText = new StyledText(shell, SWT.NULL); - shell.open(); -} - -protected void tearDown() { -} - -public void test_verifyKeyLorg_eclipse_swt_events_VerifyEvent() { - VerifyKeyListener listener = new VerifyKeyListener() { - public void verifyKey(VerifyEvent event) { - if (verify != 1) {event.doit = false;} - } - }; - styledText.addVerifyKeyListener(listener); - verify = 1; - Event e = new Event(); - e.character = 'a'; - styledText.notifyListeners(SWT.KeyDown, e); - assertTrue(":1:", styledText.getText().equals("a")); - - verify = 2; - styledText.setText(""); - e = new Event(); - e.character = 'a'; - styledText.notifyListeners(SWT.KeyDown, e); - assertTrue(":2:", styledText.getText().equals("")); - styledText.removeVerifyKeyListener(listener); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_VerifyKeyListener((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_verifyKeyLorg_eclipse_swt_events_VerifyEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_verifyKeyLorg_eclipse_swt_events_VerifyEvent")) test_verifyKeyLorg_eclipse_swt_events_VerifyEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ViewForm.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ViewForm.java deleted file mode 100644 index d79df2778d..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_custom_ViewForm.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.custom.ViewForm - * - * @see org.eclipse.swt.custom.ViewForm - */ -public class Test_org_eclipse_swt_custom_ViewForm extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_custom_ViewForm(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_getClientArea() { - warnUnimpl("Test test_getClientArea not written"); -} - -public void test_getContent() { - warnUnimpl("Test test_getContent not written"); -} - -public void test_getTopCenter() { - warnUnimpl("Test test_getTopCenter not written"); -} - -public void test_getTopLeft() { - warnUnimpl("Test test_getTopLeft not written"); -} - -public void test_getTopRight() { - warnUnimpl("Test test_getTopRight not written"); -} - -public void test_layoutZ() { - warnUnimpl("Test test_layoutZ not written"); -} - -public void test_setBorderVisibleZ() { - warnUnimpl("Test test_setBorderVisibleZ not written"); -} - -public void test_setContentLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setContentLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written"); -} - -public void test_setLayoutLorg_eclipse_swt_widgets_Layout() { - warnUnimpl("Test test_setLayoutLorg_eclipse_swt_widgets_Layout not written"); -} - -public void test_setTopCenterLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setTopCenterLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_setTopCenterSeparateZ() { - warnUnimpl("Test test_setTopCenterSeparateZ not written"); -} - -public void test_setTopLeftLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setTopLeftLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_setTopRightLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setTopRightLorg_eclipse_swt_widgets_Control not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_custom_ViewForm((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_getContent"); - methodNames.addElement("test_getTopCenter"); - methodNames.addElement("test_getTopLeft"); - methodNames.addElement("test_getTopRight"); - methodNames.addElement("test_layoutZ"); - methodNames.addElement("test_setBorderVisibleZ"); - methodNames.addElement("test_setContentLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setLayoutLorg_eclipse_swt_widgets_Layout"); - methodNames.addElement("test_setTopCenterLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setTopCenterSeparateZ"); - methodNames.addElement("test_setTopLeftLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setTopRightLorg_eclipse_swt_widgets_Control"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_getContent")) test_getContent(); - else if (getName().equals("test_getTopCenter")) test_getTopCenter(); - else if (getName().equals("test_getTopLeft")) test_getTopLeft(); - else if (getName().equals("test_getTopRight")) test_getTopRight(); - else if (getName().equals("test_layoutZ")) test_layoutZ(); - else if (getName().equals("test_setBorderVisibleZ")) test_setBorderVisibleZ(); - else if (getName().equals("test_setContentLorg_eclipse_swt_widgets_Control")) test_setContentLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setLayoutLorg_eclipse_swt_widgets_Layout")) test_setLayoutLorg_eclipse_swt_widgets_Layout(); - else if (getName().equals("test_setTopCenterLorg_eclipse_swt_widgets_Control")) test_setTopCenterLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setTopCenterSeparateZ")) test_setTopCenterSeparateZ(); - else if (getName().equals("test_setTopLeftLorg_eclipse_swt_widgets_Control")) test_setTopLeftLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setTopRightLorg_eclipse_swt_widgets_Control")) test_setTopRightLorg_eclipse_swt_widgets_Control(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_ByteArrayTransfer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_ByteArrayTransfer.java deleted file mode 100644 index dabdfc1453..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_ByteArrayTransfer.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.ByteArrayTransfer - * - * @see org.eclipse.swt.dnd.ByteArrayTransfer - */ -public class Test_org_eclipse_swt_dnd_ByteArrayTransfer extends Test_org_eclipse_swt_dnd_Transfer { - -public Test_org_eclipse_swt_dnd_ByteArrayTransfer(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_getSupportedTypes() { - warnUnimpl("Test test_getSupportedTypes not written"); -} - -public void test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_ByteArrayTransfer((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_getSupportedTypes"); - methodNames.addElement("test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData"); - methodNames.addAll(Test_org_eclipse_swt_dnd_Transfer.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_getSupportedTypes")) test_getSupportedTypes(); - else if (getName().equals("test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData")) test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Clipboard.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Clipboard.java deleted file mode 100644 index c8b6730719..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Clipboard.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.Clipboard - * - * @see org.eclipse.swt.dnd.Clipboard - */ -public class Test_org_eclipse_swt_dnd_Clipboard extends SwtTestCase { - -public Test_org_eclipse_swt_dnd_Clipboard(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Display() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Display not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_getAvailableTypeNames() { - warnUnimpl("Test test_getAvailableTypeNames not written"); -} - -public void test_getAvailableTypes() { - warnUnimpl("Test test_getAvailableTypes not written"); -} - -public void test_getContentsLorg_eclipse_swt_dnd_Transfer() { - warnUnimpl("Test test_getContentsLorg_eclipse_swt_dnd_Transfer not written"); -} - -public void test_isDisposed() { - warnUnimpl("Test test_isDisposed not written"); -} - -public void test_setContents$Ljava_lang_Object$Lorg_eclipse_swt_dnd_Transfer() { - warnUnimpl("Test test_setContents$Ljava_lang_Object$Lorg_eclipse_swt_dnd_Transfer not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_Clipboard((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Display"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getAvailableTypeNames"); - methodNames.addElement("test_getAvailableTypes"); - methodNames.addElement("test_getContentsLorg_eclipse_swt_dnd_Transfer"); - methodNames.addElement("test_isDisposed"); - methodNames.addElement("test_setContents$Ljava_lang_Object$Lorg_eclipse_swt_dnd_Transfer"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Display")) test_ConstructorLorg_eclipse_swt_widgets_Display(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getAvailableTypeNames")) test_getAvailableTypeNames(); - else if (getName().equals("test_getAvailableTypes")) test_getAvailableTypes(); - else if (getName().equals("test_getContentsLorg_eclipse_swt_dnd_Transfer")) test_getContentsLorg_eclipse_swt_dnd_Transfer(); - else if (getName().equals("test_isDisposed")) test_isDisposed(); - else if (getName().equals("test_setContents$Ljava_lang_Object$Lorg_eclipse_swt_dnd_Transfer")) test_setContents$Ljava_lang_Object$Lorg_eclipse_swt_dnd_Transfer(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DND.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DND.java deleted file mode 100644 index 1db7f93dfb..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DND.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.DND - * - * @see org.eclipse.swt.dnd.DND - */ -public class Test_org_eclipse_swt_dnd_DND extends SwtTestCase { - -public Test_org_eclipse_swt_dnd_DND(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_errorI() { - warnUnimpl("Test test_errorI not written"); -} - -public void test_errorII() { - warnUnimpl("Test test_errorII not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_DND((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_errorI"); - methodNames.addElement("test_errorII"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_errorI")) test_errorI(); - else if (getName().equals("test_errorII")) test_errorII(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSource.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSource.java deleted file mode 100644 index 0f2e0859e8..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSource.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.DragSource - * - * @see org.eclipse.swt.dnd.DragSource - */ -public class Test_org_eclipse_swt_dnd_DragSource extends Test_org_eclipse_swt_widgets_Widget { - -public Test_org_eclipse_swt_dnd_DragSource(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ControlI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ControlI not written"); -} - -public void test_addDragListenerLorg_eclipse_swt_dnd_DragSourceListener() { - warnUnimpl("Test test_addDragListenerLorg_eclipse_swt_dnd_DragSourceListener not written"); -} - -public void test_getControl() { - warnUnimpl("Test test_getControl not written"); -} - -public void test_getTransfer() { - warnUnimpl("Test test_getTransfer not written"); -} - -public void test_removeDragListenerLorg_eclipse_swt_dnd_DragSourceListener() { - warnUnimpl("Test test_removeDragListenerLorg_eclipse_swt_dnd_DragSourceListener not written"); -} - -public void test_setTransfer$Lorg_eclipse_swt_dnd_Transfer() { - warnUnimpl("Test test_setTransfer$Lorg_eclipse_swt_dnd_Transfer not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_DragSource((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ControlI"); - methodNames.addElement("test_addDragListenerLorg_eclipse_swt_dnd_DragSourceListener"); - methodNames.addElement("test_getControl"); - methodNames.addElement("test_getTransfer"); - methodNames.addElement("test_removeDragListenerLorg_eclipse_swt_dnd_DragSourceListener"); - methodNames.addElement("test_setTransfer$Lorg_eclipse_swt_dnd_Transfer"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ControlI")) test_ConstructorLorg_eclipse_swt_widgets_ControlI(); - else if (getName().equals("test_addDragListenerLorg_eclipse_swt_dnd_DragSourceListener")) test_addDragListenerLorg_eclipse_swt_dnd_DragSourceListener(); - else if (getName().equals("test_getControl")) test_getControl(); - else if (getName().equals("test_getTransfer")) test_getTransfer(); - else if (getName().equals("test_removeDragListenerLorg_eclipse_swt_dnd_DragSourceListener")) test_removeDragListenerLorg_eclipse_swt_dnd_DragSourceListener(); - else if (getName().equals("test_setTransfer$Lorg_eclipse_swt_dnd_Transfer")) test_setTransfer$Lorg_eclipse_swt_dnd_Transfer(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceAdapter.java deleted file mode 100644 index ff1b769c89..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceAdapter.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.DragSourceAdapter - * - * @see org.eclipse.swt.dnd.DragSourceAdapter - */ -public class Test_org_eclipse_swt_dnd_DragSourceAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_dnd_DragSourceAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent() { - warnUnimpl("Test test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent not written"); -} - -public void test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent() { - warnUnimpl("Test test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent not written"); -} - -public void test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent() { - warnUnimpl("Test test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_DragSourceAdapter((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent"); - methodNames.addElement("test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent"); - methodNames.addElement("test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent")) test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent(); - else if (getName().equals("test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent")) test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent(); - else if (getName().equals("test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent")) test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceEvent.java deleted file mode 100644 index baf951c08d..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceEvent.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.DragSourceEvent - * - * @see org.eclipse.swt.dnd.DragSourceEvent - */ -public class Test_org_eclipse_swt_dnd_DragSourceEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_dnd_DragSourceEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_dnd_DNDEvent() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_dnd_DNDEvent not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_DragSourceEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_dnd_DNDEvent"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_dnd_DNDEvent")) test_ConstructorLorg_eclipse_swt_dnd_DNDEvent(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceListener.java deleted file mode 100644 index 1e1d194d40..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DragSourceListener.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.DragSourceListener - * - * @see org.eclipse.swt.dnd.DragSourceListener - */ -public class Test_org_eclipse_swt_dnd_DragSourceListener extends SwtTestCase { - -public Test_org_eclipse_swt_dnd_DragSourceListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent() { - warnUnimpl("Test test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent not written"); -} - -public void test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent() { - warnUnimpl("Test test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent not written"); -} - -public void test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent() { - warnUnimpl("Test test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_DragSourceListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent"); - methodNames.addElement("test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent"); - methodNames.addElement("test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent")) test_dragFinishedLorg_eclipse_swt_dnd_DragSourceEvent(); - else if (getName().equals("test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent")) test_dragSetDataLorg_eclipse_swt_dnd_DragSourceEvent(); - else if (getName().equals("test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent")) test_dragStartLorg_eclipse_swt_dnd_DragSourceEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTarget.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTarget.java deleted file mode 100644 index b0fdaab8c3..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTarget.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.DropTarget - * - * @see org.eclipse.swt.dnd.DropTarget - */ -public class Test_org_eclipse_swt_dnd_DropTarget extends Test_org_eclipse_swt_widgets_Widget { - -public Test_org_eclipse_swt_dnd_DropTarget(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ControlI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ControlI not written"); -} - -public void test_addDropListenerLorg_eclipse_swt_dnd_DropTargetListener() { - warnUnimpl("Test test_addDropListenerLorg_eclipse_swt_dnd_DropTargetListener not written"); -} - -public void test_getControl() { - warnUnimpl("Test test_getControl not written"); -} - -public void test_getTransfer() { - warnUnimpl("Test test_getTransfer not written"); -} - -public void test_notifyListenersILorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_notifyListenersILorg_eclipse_swt_widgets_Event not written"); -} - -public void test_removeDropListenerLorg_eclipse_swt_dnd_DropTargetListener() { - warnUnimpl("Test test_removeDropListenerLorg_eclipse_swt_dnd_DropTargetListener not written"); -} - -public void test_setTransfer$Lorg_eclipse_swt_dnd_Transfer() { - warnUnimpl("Test test_setTransfer$Lorg_eclipse_swt_dnd_Transfer not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_DropTarget((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ControlI"); - methodNames.addElement("test_addDropListenerLorg_eclipse_swt_dnd_DropTargetListener"); - methodNames.addElement("test_getControl"); - methodNames.addElement("test_getTransfer"); - methodNames.addElement("test_notifyListenersILorg_eclipse_swt_widgets_Event"); - methodNames.addElement("test_removeDropListenerLorg_eclipse_swt_dnd_DropTargetListener"); - methodNames.addElement("test_setTransfer$Lorg_eclipse_swt_dnd_Transfer"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ControlI")) test_ConstructorLorg_eclipse_swt_widgets_ControlI(); - else if (getName().equals("test_addDropListenerLorg_eclipse_swt_dnd_DropTargetListener")) test_addDropListenerLorg_eclipse_swt_dnd_DropTargetListener(); - else if (getName().equals("test_getControl")) test_getControl(); - else if (getName().equals("test_getTransfer")) test_getTransfer(); - else if (getName().equals("test_notifyListenersILorg_eclipse_swt_widgets_Event")) test_notifyListenersILorg_eclipse_swt_widgets_Event(); - else if (getName().equals("test_removeDropListenerLorg_eclipse_swt_dnd_DropTargetListener")) test_removeDropListenerLorg_eclipse_swt_dnd_DropTargetListener(); - else if (getName().equals("test_setTransfer$Lorg_eclipse_swt_dnd_Transfer")) test_setTransfer$Lorg_eclipse_swt_dnd_Transfer(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetAdapter.java deleted file mode 100644 index 1ba26db34a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetAdapter.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.DropTargetAdapter - * - * @see org.eclipse.swt.dnd.DropTargetAdapter - */ -public class Test_org_eclipse_swt_dnd_DropTargetAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_dnd_DropTargetAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dropLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dropLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_DropTargetAdapter((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dropLorg_eclipse_swt_dnd_DropTargetEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent")) test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dropLorg_eclipse_swt_dnd_DropTargetEvent")) test_dropLorg_eclipse_swt_dnd_DropTargetEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetEvent.java deleted file mode 100644 index 8b89720368..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetEvent.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.DropTargetEvent - * - * @see org.eclipse.swt.dnd.DropTargetEvent - */ -public class Test_org_eclipse_swt_dnd_DropTargetEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_dnd_DropTargetEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_dnd_DNDEvent() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_dnd_DNDEvent not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_DropTargetEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_dnd_DNDEvent"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_dnd_DNDEvent")) test_ConstructorLorg_eclipse_swt_dnd_DNDEvent(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetListener.java deleted file mode 100644 index 72c09ae51a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_DropTargetListener.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.DropTargetListener - * - * @see org.eclipse.swt.dnd.DropTargetListener - */ -public class Test_org_eclipse_swt_dnd_DropTargetListener extends SwtTestCase { - -public Test_org_eclipse_swt_dnd_DropTargetListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - -public void test_dropLorg_eclipse_swt_dnd_DropTargetEvent() { - warnUnimpl("Test test_dropLorg_eclipse_swt_dnd_DropTargetEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_DropTargetListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent"); - methodNames.addElement("test_dropLorg_eclipse_swt_dnd_DropTargetEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragEnterLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragLeaveLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragOperationChangedLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent")) test_dragOverLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent")) test_dropAcceptLorg_eclipse_swt_dnd_DropTargetEvent(); - else if (getName().equals("test_dropLorg_eclipse_swt_dnd_DropTargetEvent")) test_dropLorg_eclipse_swt_dnd_DropTargetEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_FileTransfer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_FileTransfer.java deleted file mode 100644 index 477cd2c9f6..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_FileTransfer.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.FileTransfer - * - * @see org.eclipse.swt.dnd.FileTransfer - */ -public class Test_org_eclipse_swt_dnd_FileTransfer extends Test_org_eclipse_swt_dnd_ByteArrayTransfer { - -public Test_org_eclipse_swt_dnd_FileTransfer(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_getInstance() { - warnUnimpl("Test test_getInstance not written"); -} - -public void test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData not written"); -} - -public void test_nativeToJavaLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_nativeToJavaLorg_eclipse_swt_dnd_TransferData not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_FileTransfer((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_getInstance"); - methodNames.addElement("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData"); - methodNames.addElement("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData"); - methodNames.addAll(Test_org_eclipse_swt_dnd_ByteArrayTransfer.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_getInstance")) test_getInstance(); - else if (getName().equals("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData")) test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData(); - else if (getName().equals("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData")) test_nativeToJavaLorg_eclipse_swt_dnd_TransferData(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_RTFTransfer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_RTFTransfer.java deleted file mode 100644 index 5a0f850a9d..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_RTFTransfer.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.RTFTransfer - * - * @see org.eclipse.swt.dnd.RTFTransfer - */ -public class Test_org_eclipse_swt_dnd_RTFTransfer extends Test_org_eclipse_swt_dnd_ByteArrayTransfer { - -public Test_org_eclipse_swt_dnd_RTFTransfer(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_getInstance() { - warnUnimpl("Test test_getInstance not written"); -} - -public void test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData not written"); -} - -public void test_nativeToJavaLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_nativeToJavaLorg_eclipse_swt_dnd_TransferData not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_RTFTransfer((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_getInstance"); - methodNames.addElement("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData"); - methodNames.addElement("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData"); - methodNames.addAll(Test_org_eclipse_swt_dnd_ByteArrayTransfer.methodNames()); // add superclass method names - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_getInstance")) test_getInstance(); - else if (getName().equals("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData")) test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData(); - else if (getName().equals("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData")) test_nativeToJavaLorg_eclipse_swt_dnd_TransferData(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TextTransfer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TextTransfer.java deleted file mode 100644 index 057b99a767..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TextTransfer.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.TextTransfer - * - * @see org.eclipse.swt.dnd.TextTransfer - */ -public class Test_org_eclipse_swt_dnd_TextTransfer extends Test_org_eclipse_swt_dnd_ByteArrayTransfer { - -public Test_org_eclipse_swt_dnd_TextTransfer(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_getInstance() { - warnUnimpl("Test test_getInstance not written"); -} - -public void test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData not written"); -} - -public void test_nativeToJavaLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_nativeToJavaLorg_eclipse_swt_dnd_TransferData not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_TextTransfer((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_getInstance"); - methodNames.addElement("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData"); - methodNames.addElement("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData"); - methodNames.addAll(Test_org_eclipse_swt_dnd_ByteArrayTransfer.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_getInstance")) test_getInstance(); - else if (getName().equals("test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData")) test_javaToNativeLjava_lang_ObjectLorg_eclipse_swt_dnd_TransferData(); - else if (getName().equals("test_nativeToJavaLorg_eclipse_swt_dnd_TransferData")) test_nativeToJavaLorg_eclipse_swt_dnd_TransferData(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Transfer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Transfer.java deleted file mode 100644 index 898ed6ac50..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_Transfer.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.Transfer - * - * @see org.eclipse.swt.dnd.Transfer - */ -public class Test_org_eclipse_swt_dnd_Transfer extends SwtTestCase { - -public Test_org_eclipse_swt_dnd_Transfer(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_getSupportedTypes() { - warnUnimpl("Test test_getSupportedTypes not written"); -} - -public void test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData() { - warnUnimpl("Test test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData not written"); -} - -public void test_registerTypeLjava_lang_String() { - warnUnimpl("Test test_registerTypeLjava_lang_String not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_Transfer((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_getSupportedTypes"); - methodNames.addElement("test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData"); - methodNames.addElement("test_registerTypeLjava_lang_String"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_getSupportedTypes")) test_getSupportedTypes(); - else if (getName().equals("test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData")) test_isSupportedTypeLorg_eclipse_swt_dnd_TransferData(); - else if (getName().equals("test_registerTypeLjava_lang_String")) test_registerTypeLjava_lang_String(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TransferData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TransferData.java deleted file mode 100644 index 21319ad182..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_dnd_TransferData.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.dnd.TransferData - * - * @see org.eclipse.swt.dnd.TransferData - */ -public class Test_org_eclipse_swt_dnd_TransferData extends SwtTestCase { - -public Test_org_eclipse_swt_dnd_TransferData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_dnd_TransferData((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmEvent.java deleted file mode 100644 index d099f4788e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ArmEvent - * - * @see org.eclipse.swt.events.ArmEvent - */ -public class Test_org_eclipse_swt_events_ArmEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_ArmEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_ArmEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} - -/* custom */ -protected TypedEvent newTypedEvent(Event event) { - return new ArmEvent(event); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmListener.java deleted file mode 100644 index 5c75654422..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ArmListener.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ArmListener - * - * @see org.eclipse.swt.events.ArmListener - */ -public class Test_org_eclipse_swt_events_ArmListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_ArmListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_widgetArmedLorg_eclipse_swt_events_ArmEvent() { - warnUnimpl("Test test_widgetArmedLorg_eclipse_swt_events_ArmEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_ArmListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_widgetArmedLorg_eclipse_swt_events_ArmEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_widgetArmedLorg_eclipse_swt_events_ArmEvent")) test_widgetArmedLorg_eclipse_swt_events_ArmEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlAdapter.java deleted file mode 100644 index 3f21f2682d..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlAdapter.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ControlAdapter - * - * @see org.eclipse.swt.events.ControlAdapter - */ -public class Test_org_eclipse_swt_events_ControlAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_events_ControlAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_controlMovedLorg_eclipse_swt_events_ControlEvent() { - warnUnimpl("Test test_controlMovedLorg_eclipse_swt_events_ControlEvent not written"); -} - -public void test_controlResizedLorg_eclipse_swt_events_ControlEvent() { - warnUnimpl("Test test_controlResizedLorg_eclipse_swt_events_ControlEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_ControlAdapter((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_controlMovedLorg_eclipse_swt_events_ControlEvent"); - methodNames.addElement("test_controlResizedLorg_eclipse_swt_events_ControlEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_controlMovedLorg_eclipse_swt_events_ControlEvent")) test_controlMovedLorg_eclipse_swt_events_ControlEvent(); - else if (getName().equals("test_controlResizedLorg_eclipse_swt_events_ControlEvent")) test_controlResizedLorg_eclipse_swt_events_ControlEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlEvent.java deleted file mode 100644 index a3fbc7e852..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ControlEvent - * - * @see org.eclipse.swt.events.ControlEvent - */ -public class Test_org_eclipse_swt_events_ControlEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_ControlEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_ControlEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} - -/* custom */ -protected TypedEvent newTypedEvent(Event event) { - return new ControlEvent(event); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlListener.java deleted file mode 100644 index 18ab5b68ee..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ControlListener.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ControlListener - * - * @see org.eclipse.swt.events.ControlListener - */ -public class Test_org_eclipse_swt_events_ControlListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_ControlListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_controlMovedLorg_eclipse_swt_events_ControlEvent() { - warnUnimpl("Test test_controlMovedLorg_eclipse_swt_events_ControlEvent not written"); -} - -public void test_controlResizedLorg_eclipse_swt_events_ControlEvent() { - warnUnimpl("Test test_controlResizedLorg_eclipse_swt_events_ControlEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_ControlListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_controlMovedLorg_eclipse_swt_events_ControlEvent"); - methodNames.addElement("test_controlResizedLorg_eclipse_swt_events_ControlEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_controlMovedLorg_eclipse_swt_events_ControlEvent")) test_controlMovedLorg_eclipse_swt_events_ControlEvent(); - else if (getName().equals("test_controlResizedLorg_eclipse_swt_events_ControlEvent")) test_controlResizedLorg_eclipse_swt_events_ControlEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeEvent.java deleted file mode 100644 index 39331d8020..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.DisposeEvent - * - * @see org.eclipse.swt.events.DisposeEvent - */ -public class Test_org_eclipse_swt_events_DisposeEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_DisposeEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_DisposeEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} - -/* custom */ -protected TypedEvent newTypedEvent(Event event) { - return new DisposeEvent(event); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeListener.java deleted file mode 100644 index d27829e12a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_DisposeListener.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.DisposeListener - * - * @see org.eclipse.swt.events.DisposeListener - */ -public class Test_org_eclipse_swt_events_DisposeListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_DisposeListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_widgetDisposedLorg_eclipse_swt_events_DisposeEvent() { - warnUnimpl("Test test_widgetDisposedLorg_eclipse_swt_events_DisposeEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_DisposeListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_widgetDisposedLorg_eclipse_swt_events_DisposeEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_widgetDisposedLorg_eclipse_swt_events_DisposeEvent")) test_widgetDisposedLorg_eclipse_swt_events_DisposeEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusAdapter.java deleted file mode 100644 index 14824a23ec..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusAdapter.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.FocusAdapter - * - * @see org.eclipse.swt.events.FocusAdapter - */ -public class Test_org_eclipse_swt_events_FocusAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_events_FocusAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_focusGainedLorg_eclipse_swt_events_FocusEvent() { - warnUnimpl("Test test_focusGainedLorg_eclipse_swt_events_FocusEvent not written"); -} - -public void test_focusLostLorg_eclipse_swt_events_FocusEvent() { - warnUnimpl("Test test_focusLostLorg_eclipse_swt_events_FocusEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_FocusAdapter((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_focusGainedLorg_eclipse_swt_events_FocusEvent"); - methodNames.addElement("test_focusLostLorg_eclipse_swt_events_FocusEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_focusGainedLorg_eclipse_swt_events_FocusEvent")) test_focusGainedLorg_eclipse_swt_events_FocusEvent(); - else if (getName().equals("test_focusLostLorg_eclipse_swt_events_FocusEvent")) test_focusLostLorg_eclipse_swt_events_FocusEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusEvent.java deleted file mode 100644 index 7339fa31b0..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.FocusEvent - * - * @see org.eclipse.swt.events.FocusEvent - */ -public class Test_org_eclipse_swt_events_FocusEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_FocusEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_FocusEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} - -/* custom */ -protected TypedEvent newTypedEvent(Event event) { - return new FocusEvent(event); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusListener.java deleted file mode 100644 index 23709de146..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_FocusListener.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.FocusListener - * - * @see org.eclipse.swt.events.FocusListener - */ -public class Test_org_eclipse_swt_events_FocusListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_FocusListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_focusGainedLorg_eclipse_swt_events_FocusEvent() { - warnUnimpl("Test test_focusGainedLorg_eclipse_swt_events_FocusEvent not written"); -} - -public void test_focusLostLorg_eclipse_swt_events_FocusEvent() { - warnUnimpl("Test test_focusLostLorg_eclipse_swt_events_FocusEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_FocusListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_focusGainedLorg_eclipse_swt_events_FocusEvent"); - methodNames.addElement("test_focusLostLorg_eclipse_swt_events_FocusEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_focusGainedLorg_eclipse_swt_events_FocusEvent")) test_focusGainedLorg_eclipse_swt_events_FocusEvent(); - else if (getName().equals("test_focusLostLorg_eclipse_swt_events_FocusEvent")) test_focusLostLorg_eclipse_swt_events_FocusEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpEvent.java deleted file mode 100644 index 80053fdbc5..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.HelpEvent - * - * @see org.eclipse.swt.events.HelpEvent - */ -public class Test_org_eclipse_swt_events_HelpEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_HelpEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_HelpEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} - -/* custom */ -protected TypedEvent newTypedEvent(Event event) { - return new HelpEvent(event); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpListener.java deleted file mode 100644 index 9443c3f419..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_HelpListener.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.HelpListener - * - * @see org.eclipse.swt.events.HelpListener - */ -public class Test_org_eclipse_swt_events_HelpListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_HelpListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_helpRequestedLorg_eclipse_swt_events_HelpEvent() { - warnUnimpl("Test test_helpRequestedLorg_eclipse_swt_events_HelpEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_HelpListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_helpRequestedLorg_eclipse_swt_events_HelpEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_helpRequestedLorg_eclipse_swt_events_HelpEvent")) test_helpRequestedLorg_eclipse_swt_events_HelpEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyAdapter.java deleted file mode 100644 index 804638555f..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyAdapter.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.KeyAdapter - * - * @see org.eclipse.swt.events.KeyAdapter - */ -public class Test_org_eclipse_swt_events_KeyAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_events_KeyAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_keyPressedLorg_eclipse_swt_events_KeyEvent() { - warnUnimpl("Test test_keyPressedLorg_eclipse_swt_events_KeyEvent not written"); -} - -public void test_keyReleasedLorg_eclipse_swt_events_KeyEvent() { - warnUnimpl("Test test_keyReleasedLorg_eclipse_swt_events_KeyEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_KeyAdapter((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_keyPressedLorg_eclipse_swt_events_KeyEvent"); - methodNames.addElement("test_keyReleasedLorg_eclipse_swt_events_KeyEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_keyPressedLorg_eclipse_swt_events_KeyEvent")) test_keyPressedLorg_eclipse_swt_events_KeyEvent(); - else if (getName().equals("test_keyReleasedLorg_eclipse_swt_events_KeyEvent")) test_keyReleasedLorg_eclipse_swt_events_KeyEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyEvent.java deleted file mode 100644 index 78651384da..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.KeyEvent - * - * @see org.eclipse.swt.events.KeyEvent - */ -public class Test_org_eclipse_swt_events_KeyEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_KeyEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_KeyEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} - -/* custom */ -protected TypedEvent newTypedEvent(Event event) { - return new KeyEvent(event); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyListener.java deleted file mode 100644 index 38dc542c70..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_KeyListener.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.KeyListener - * - * @see org.eclipse.swt.events.KeyListener - */ -public class Test_org_eclipse_swt_events_KeyListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_KeyListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_keyPressedLorg_eclipse_swt_events_KeyEvent() { - warnUnimpl("Test test_keyPressedLorg_eclipse_swt_events_KeyEvent not written"); -} - -public void test_keyReleasedLorg_eclipse_swt_events_KeyEvent() { - warnUnimpl("Test test_keyReleasedLorg_eclipse_swt_events_KeyEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_KeyListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_keyPressedLorg_eclipse_swt_events_KeyEvent"); - methodNames.addElement("test_keyReleasedLorg_eclipse_swt_events_KeyEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_keyPressedLorg_eclipse_swt_events_KeyEvent")) test_keyPressedLorg_eclipse_swt_events_KeyEvent(); - else if (getName().equals("test_keyReleasedLorg_eclipse_swt_events_KeyEvent")) test_keyReleasedLorg_eclipse_swt_events_KeyEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuAdapter.java deleted file mode 100644 index 25aecd4755..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuAdapter.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.MenuAdapter - * - * @see org.eclipse.swt.events.MenuAdapter - */ -public class Test_org_eclipse_swt_events_MenuAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_events_MenuAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_menuHiddenLorg_eclipse_swt_events_MenuEvent() { - warnUnimpl("Test test_menuHiddenLorg_eclipse_swt_events_MenuEvent not written"); -} - -public void test_menuShownLorg_eclipse_swt_events_MenuEvent() { - warnUnimpl("Test test_menuShownLorg_eclipse_swt_events_MenuEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_MenuAdapter((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_menuHiddenLorg_eclipse_swt_events_MenuEvent"); - methodNames.addElement("test_menuShownLorg_eclipse_swt_events_MenuEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_menuHiddenLorg_eclipse_swt_events_MenuEvent")) test_menuHiddenLorg_eclipse_swt_events_MenuEvent(); - else if (getName().equals("test_menuShownLorg_eclipse_swt_events_MenuEvent")) test_menuShownLorg_eclipse_swt_events_MenuEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuEvent.java deleted file mode 100644 index 2e54ab6aec..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.MenuEvent - * - * @see org.eclipse.swt.events.MenuEvent - */ -public class Test_org_eclipse_swt_events_MenuEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_MenuEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_MenuEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} - -/* custom */ -protected TypedEvent newTypedEvent(Event event) { - return new MenuEvent(event); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuListener.java deleted file mode 100644 index 083b7495af..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MenuListener.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.MenuListener - * - * @see org.eclipse.swt.events.MenuListener - */ -public class Test_org_eclipse_swt_events_MenuListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_MenuListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_menuHiddenLorg_eclipse_swt_events_MenuEvent() { - warnUnimpl("Test test_menuHiddenLorg_eclipse_swt_events_MenuEvent not written"); -} - -public void test_menuShownLorg_eclipse_swt_events_MenuEvent() { - warnUnimpl("Test test_menuShownLorg_eclipse_swt_events_MenuEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_MenuListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_menuHiddenLorg_eclipse_swt_events_MenuEvent"); - methodNames.addElement("test_menuShownLorg_eclipse_swt_events_MenuEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_menuHiddenLorg_eclipse_swt_events_MenuEvent")) test_menuHiddenLorg_eclipse_swt_events_MenuEvent(); - else if (getName().equals("test_menuShownLorg_eclipse_swt_events_MenuEvent")) test_menuShownLorg_eclipse_swt_events_MenuEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyEvent.java deleted file mode 100644 index 04d2038574..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ModifyEvent - * - * @see org.eclipse.swt.events.ModifyEvent - */ -public class Test_org_eclipse_swt_events_ModifyEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_ModifyEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_ModifyEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} - -/* custom */ -protected TypedEvent newTypedEvent(Event event) { - return new ModifyEvent(event); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyListener.java deleted file mode 100644 index ea45d564f7..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ModifyListener.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ModifyListener - * - * @see org.eclipse.swt.events.ModifyListener - */ -public class Test_org_eclipse_swt_events_ModifyListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_ModifyListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_modifyTextLorg_eclipse_swt_events_ModifyEvent() { - warnUnimpl("Test test_modifyTextLorg_eclipse_swt_events_ModifyEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_ModifyListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_modifyTextLorg_eclipse_swt_events_ModifyEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_modifyTextLorg_eclipse_swt_events_ModifyEvent")) test_modifyTextLorg_eclipse_swt_events_ModifyEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseAdapter.java deleted file mode 100644 index 0d85fb5487..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseAdapter.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.MouseAdapter - * - * @see org.eclipse.swt.events.MouseAdapter - */ -public class Test_org_eclipse_swt_events_MouseAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_events_MouseAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent not written"); -} - -public void test_mouseDownLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseDownLorg_eclipse_swt_events_MouseEvent not written"); -} - -public void test_mouseUpLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseUpLorg_eclipse_swt_events_MouseEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_MouseAdapter((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent"); - methodNames.addElement("test_mouseDownLorg_eclipse_swt_events_MouseEvent"); - methodNames.addElement("test_mouseUpLorg_eclipse_swt_events_MouseEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent")) test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent(); - else if (getName().equals("test_mouseDownLorg_eclipse_swt_events_MouseEvent")) test_mouseDownLorg_eclipse_swt_events_MouseEvent(); - else if (getName().equals("test_mouseUpLorg_eclipse_swt_events_MouseEvent")) test_mouseUpLorg_eclipse_swt_events_MouseEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseEvent.java deleted file mode 100644 index dd794c6c62..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.MouseEvent - * - * @see org.eclipse.swt.events.MouseEvent - */ -public class Test_org_eclipse_swt_events_MouseEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_MouseEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_MouseEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} - -/* custom */ -protected TypedEvent newTypedEvent(Event event) { - return new MouseEvent(event); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseListener.java deleted file mode 100644 index 6b64e5d631..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseListener.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.MouseListener - * - * @see org.eclipse.swt.events.MouseListener - */ -public class Test_org_eclipse_swt_events_MouseListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_MouseListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent not written"); -} - -public void test_mouseDownLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseDownLorg_eclipse_swt_events_MouseEvent not written"); -} - -public void test_mouseUpLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseUpLorg_eclipse_swt_events_MouseEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_MouseListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent"); - methodNames.addElement("test_mouseDownLorg_eclipse_swt_events_MouseEvent"); - methodNames.addElement("test_mouseUpLorg_eclipse_swt_events_MouseEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent")) test_mouseDoubleClickLorg_eclipse_swt_events_MouseEvent(); - else if (getName().equals("test_mouseDownLorg_eclipse_swt_events_MouseEvent")) test_mouseDownLorg_eclipse_swt_events_MouseEvent(); - else if (getName().equals("test_mouseUpLorg_eclipse_swt_events_MouseEvent")) test_mouseUpLorg_eclipse_swt_events_MouseEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseMoveListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseMoveListener.java deleted file mode 100644 index 19d134b0c6..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseMoveListener.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.MouseMoveListener - * - * @see org.eclipse.swt.events.MouseMoveListener - */ -public class Test_org_eclipse_swt_events_MouseMoveListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_MouseMoveListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_mouseMoveLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseMoveLorg_eclipse_swt_events_MouseEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_MouseMoveListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_mouseMoveLorg_eclipse_swt_events_MouseEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_mouseMoveLorg_eclipse_swt_events_MouseEvent")) test_mouseMoveLorg_eclipse_swt_events_MouseEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackAdapter.java deleted file mode 100644 index 976dd5dc23..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackAdapter.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.MouseTrackAdapter - * - * @see org.eclipse.swt.events.MouseTrackAdapter - */ -public class Test_org_eclipse_swt_events_MouseTrackAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_events_MouseTrackAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_mouseEnterLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseEnterLorg_eclipse_swt_events_MouseEvent not written"); -} - -public void test_mouseExitLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseExitLorg_eclipse_swt_events_MouseEvent not written"); -} - -public void test_mouseHoverLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseHoverLorg_eclipse_swt_events_MouseEvent not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_MouseTrackAdapter((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_mouseEnterLorg_eclipse_swt_events_MouseEvent"); - methodNames.addElement("test_mouseExitLorg_eclipse_swt_events_MouseEvent"); - methodNames.addElement("test_mouseHoverLorg_eclipse_swt_events_MouseEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_mouseEnterLorg_eclipse_swt_events_MouseEvent")) test_mouseEnterLorg_eclipse_swt_events_MouseEvent(); - else if (getName().equals("test_mouseExitLorg_eclipse_swt_events_MouseEvent")) test_mouseExitLorg_eclipse_swt_events_MouseEvent(); - else if (getName().equals("test_mouseHoverLorg_eclipse_swt_events_MouseEvent")) test_mouseHoverLorg_eclipse_swt_events_MouseEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackListener.java deleted file mode 100644 index 3c227950ff..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_MouseTrackListener.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.MouseTrackListener - * - * @see org.eclipse.swt.events.MouseTrackListener - */ -public class Test_org_eclipse_swt_events_MouseTrackListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_MouseTrackListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_mouseEnterLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseEnterLorg_eclipse_swt_events_MouseEvent not written"); -} - -public void test_mouseExitLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseExitLorg_eclipse_swt_events_MouseEvent not written"); -} - -public void test_mouseHoverLorg_eclipse_swt_events_MouseEvent() { - warnUnimpl("Test test_mouseHoverLorg_eclipse_swt_events_MouseEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_MouseTrackListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_mouseEnterLorg_eclipse_swt_events_MouseEvent"); - methodNames.addElement("test_mouseExitLorg_eclipse_swt_events_MouseEvent"); - methodNames.addElement("test_mouseHoverLorg_eclipse_swt_events_MouseEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_mouseEnterLorg_eclipse_swt_events_MouseEvent")) test_mouseEnterLorg_eclipse_swt_events_MouseEvent(); - else if (getName().equals("test_mouseExitLorg_eclipse_swt_events_MouseEvent")) test_mouseExitLorg_eclipse_swt_events_MouseEvent(); - else if (getName().equals("test_mouseHoverLorg_eclipse_swt_events_MouseEvent")) test_mouseHoverLorg_eclipse_swt_events_MouseEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintEvent.java deleted file mode 100644 index 0af24d6489..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.PaintEvent - * - * @see org.eclipse.swt.events.PaintEvent - */ -public class Test_org_eclipse_swt_events_PaintEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_PaintEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_PaintEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} - -/* custom */ -protected TypedEvent newTypedEvent(Event event) { - return new PaintEvent(event); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintListener.java deleted file mode 100644 index 1f6d17536d..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_PaintListener.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.PaintListener - * - * @see org.eclipse.swt.events.PaintListener - */ -public class Test_org_eclipse_swt_events_PaintListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_PaintListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_paintControlLorg_eclipse_swt_events_PaintEvent() { - warnUnimpl("Test test_paintControlLorg_eclipse_swt_events_PaintEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_PaintListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_paintControlLorg_eclipse_swt_events_PaintEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_paintControlLorg_eclipse_swt_events_PaintEvent")) test_paintControlLorg_eclipse_swt_events_PaintEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionAdapter.java deleted file mode 100644 index b60a7db43f..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionAdapter.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.SelectionAdapter - * - * @see org.eclipse.swt.events.SelectionAdapter - */ -public class Test_org_eclipse_swt_events_SelectionAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_events_SelectionAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent() { - warnUnimpl("Test test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent not written"); -} - -public void test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent() { - warnUnimpl("Test test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_SelectionAdapter((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent"); - methodNames.addElement("test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent")) test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent(); - else if (getName().equals("test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent")) test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionEvent.java deleted file mode 100644 index 4aaf2a1194..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.SelectionEvent - * - * @see org.eclipse.swt.events.SelectionEvent - */ -public class Test_org_eclipse_swt_events_SelectionEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_SelectionEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_SelectionEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} - -/* custom */ -protected TypedEvent newTypedEvent(Event event) { - return new SelectionEvent(event); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionListener.java deleted file mode 100644 index faf57e7c9d..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_SelectionListener.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.SelectionListener - * - * @see org.eclipse.swt.events.SelectionListener - */ -public class Test_org_eclipse_swt_events_SelectionListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_SelectionListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent() { - warnUnimpl("Test test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent not written"); -} - -public void test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent() { - warnUnimpl("Test test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_SelectionListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent"); - methodNames.addElement("test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent")) test_widgetDefaultSelectedLorg_eclipse_swt_events_SelectionEvent(); - else if (getName().equals("test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent")) test_widgetSelectedLorg_eclipse_swt_events_SelectionEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellAdapter.java deleted file mode 100644 index 99f646d975..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellAdapter.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ShellAdapter - * - * @see org.eclipse.swt.events.ShellAdapter - */ -public class Test_org_eclipse_swt_events_ShellAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_events_ShellAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_shellActivatedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellActivatedLorg_eclipse_swt_events_ShellEvent not written"); -} - -public void test_shellClosedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellClosedLorg_eclipse_swt_events_ShellEvent not written"); -} - -public void test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent not written"); -} - -public void test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent not written"); -} - -public void test_shellIconifiedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellIconifiedLorg_eclipse_swt_events_ShellEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_ShellAdapter((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_shellActivatedLorg_eclipse_swt_events_ShellEvent"); - methodNames.addElement("test_shellClosedLorg_eclipse_swt_events_ShellEvent"); - methodNames.addElement("test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent"); - methodNames.addElement("test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent"); - methodNames.addElement("test_shellIconifiedLorg_eclipse_swt_events_ShellEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_shellActivatedLorg_eclipse_swt_events_ShellEvent")) test_shellActivatedLorg_eclipse_swt_events_ShellEvent(); - else if (getName().equals("test_shellClosedLorg_eclipse_swt_events_ShellEvent")) test_shellClosedLorg_eclipse_swt_events_ShellEvent(); - else if (getName().equals("test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent")) test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent(); - else if (getName().equals("test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent")) test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent(); - else if (getName().equals("test_shellIconifiedLorg_eclipse_swt_events_ShellEvent")) test_shellIconifiedLorg_eclipse_swt_events_ShellEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellEvent.java deleted file mode 100644 index 2e7d93a3a2..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ShellEvent - * - * @see org.eclipse.swt.events.ShellEvent - */ -public class Test_org_eclipse_swt_events_ShellEvent extends Test_org_eclipse_swt_events_TypedEvent { - -public Test_org_eclipse_swt_events_ShellEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_ShellEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_TypedEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} - -/* custom */ -protected TypedEvent newTypedEvent(Event event) { - return new ShellEvent(event); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellListener.java deleted file mode 100644 index 8708ccbfab..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_ShellListener.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.ShellListener - * - * @see org.eclipse.swt.events.ShellListener - */ -public class Test_org_eclipse_swt_events_ShellListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_ShellListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_shellActivatedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellActivatedLorg_eclipse_swt_events_ShellEvent not written"); -} - -public void test_shellClosedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellClosedLorg_eclipse_swt_events_ShellEvent not written"); -} - -public void test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent not written"); -} - -public void test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent not written"); -} - -public void test_shellIconifiedLorg_eclipse_swt_events_ShellEvent() { - warnUnimpl("Test test_shellIconifiedLorg_eclipse_swt_events_ShellEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_ShellListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_shellActivatedLorg_eclipse_swt_events_ShellEvent"); - methodNames.addElement("test_shellClosedLorg_eclipse_swt_events_ShellEvent"); - methodNames.addElement("test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent"); - methodNames.addElement("test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent"); - methodNames.addElement("test_shellIconifiedLorg_eclipse_swt_events_ShellEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_shellActivatedLorg_eclipse_swt_events_ShellEvent")) test_shellActivatedLorg_eclipse_swt_events_ShellEvent(); - else if (getName().equals("test_shellClosedLorg_eclipse_swt_events_ShellEvent")) test_shellClosedLorg_eclipse_swt_events_ShellEvent(); - else if (getName().equals("test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent")) test_shellDeactivatedLorg_eclipse_swt_events_ShellEvent(); - else if (getName().equals("test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent")) test_shellDeiconifiedLorg_eclipse_swt_events_ShellEvent(); - else if (getName().equals("test_shellIconifiedLorg_eclipse_swt_events_ShellEvent")) test_shellIconifiedLorg_eclipse_swt_events_ShellEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseEvent.java deleted file mode 100644 index 6fb0e3e976..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.TraverseEvent - * - * @see org.eclipse.swt.events.TraverseEvent - */ -public class Test_org_eclipse_swt_events_TraverseEvent extends Test_org_eclipse_swt_events_KeyEvent { - -public Test_org_eclipse_swt_events_TraverseEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_TraverseEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_KeyEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} - -/* custom */ -protected TypedEvent newTypedEvent(Event event) { - return new TraverseEvent(event); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseListener.java deleted file mode 100644 index 369d89c64a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TraverseListener.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.TraverseListener - * - * @see org.eclipse.swt.events.TraverseListener - */ -public class Test_org_eclipse_swt_events_TraverseListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_TraverseListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_keyTraversedLorg_eclipse_swt_events_TraverseEvent() { - warnUnimpl("Test test_keyTraversedLorg_eclipse_swt_events_TraverseEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_TraverseListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_keyTraversedLorg_eclipse_swt_events_TraverseEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_keyTraversedLorg_eclipse_swt_events_TraverseEvent")) test_keyTraversedLorg_eclipse_swt_events_TraverseEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeAdapter.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeAdapter.java deleted file mode 100644 index ac6fdf2ab3..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeAdapter.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.TreeAdapter - * - * @see org.eclipse.swt.events.TreeAdapter - */ -public class Test_org_eclipse_swt_events_TreeAdapter extends SwtTestCase { - -public Test_org_eclipse_swt_events_TreeAdapter(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_treeCollapsedLorg_eclipse_swt_events_TreeEvent() { - warnUnimpl("Test test_treeCollapsedLorg_eclipse_swt_events_TreeEvent not written"); -} - -public void test_treeExpandedLorg_eclipse_swt_events_TreeEvent() { - warnUnimpl("Test test_treeExpandedLorg_eclipse_swt_events_TreeEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_TreeAdapter((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_treeCollapsedLorg_eclipse_swt_events_TreeEvent"); - methodNames.addElement("test_treeExpandedLorg_eclipse_swt_events_TreeEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_treeCollapsedLorg_eclipse_swt_events_TreeEvent")) test_treeCollapsedLorg_eclipse_swt_events_TreeEvent(); - else if (getName().equals("test_treeExpandedLorg_eclipse_swt_events_TreeEvent")) test_treeExpandedLorg_eclipse_swt_events_TreeEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeEvent.java deleted file mode 100644 index 14863cc796..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.TreeEvent - * - * @see org.eclipse.swt.events.TreeEvent - */ -public class Test_org_eclipse_swt_events_TreeEvent extends Test_org_eclipse_swt_events_SelectionEvent { - -public Test_org_eclipse_swt_events_TreeEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_TreeEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_SelectionEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} - -/* custom */ -protected TypedEvent newTypedEvent(Event event) { - return new TreeEvent(event); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeListener.java deleted file mode 100644 index 78eda5d61b..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TreeListener.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.TreeListener - * - * @see org.eclipse.swt.events.TreeListener - */ -public class Test_org_eclipse_swt_events_TreeListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_TreeListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_treeCollapsedLorg_eclipse_swt_events_TreeEvent() { - warnUnimpl("Test test_treeCollapsedLorg_eclipse_swt_events_TreeEvent not written"); -} - -public void test_treeExpandedLorg_eclipse_swt_events_TreeEvent() { - warnUnimpl("Test test_treeExpandedLorg_eclipse_swt_events_TreeEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_TreeListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_treeCollapsedLorg_eclipse_swt_events_TreeEvent"); - methodNames.addElement("test_treeExpandedLorg_eclipse_swt_events_TreeEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_treeCollapsedLorg_eclipse_swt_events_TreeEvent")) test_treeCollapsedLorg_eclipse_swt_events_TreeEvent(); - else if (getName().equals("test_treeExpandedLorg_eclipse_swt_events_TreeEvent")) test_treeExpandedLorg_eclipse_swt_events_TreeEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TypedEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TypedEvent.java deleted file mode 100644 index 655ad25a4e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_TypedEvent.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.TypedEvent - * - * @see org.eclipse.swt.events.TypedEvent - */ -public class Test_org_eclipse_swt_events_TypedEvent extends SwtTestCase { - -public Test_org_eclipse_swt_events_TypedEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - shell = new Shell(); -} - -protected void tearDown() { - shell.dispose(); -} - -public void test_ConstructorLjava_lang_Object() { - warnUnimpl("Test test_ConstructorLjava_lang_Object not written"); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - Event event = new Event(); - event.widget = shell; - TypedEvent typedEvent = newTypedEvent(event); - assertNotNull(typedEvent); -} - -public void test_toString() { - Event event = new Event(); - event.widget = shell; - TypedEvent typedEvent = newTypedEvent(event); - assertNotNull(typedEvent.toString()); - assertTrue(typedEvent.toString().length() > 0); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_TypedEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLjava_lang_Object"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addElement("test_toString"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLjava_lang_Object")) test_ConstructorLjava_lang_Object(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else if (getName().equals("test_toString")) test_toString(); -} - -/* custom */ -public Shell shell; - -protected TypedEvent newTypedEvent(Event event) { - return new TypedEvent(event); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyEvent.java deleted file mode 100644 index 8fb31a87d7..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyEvent.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.VerifyEvent - * - * @see org.eclipse.swt.events.VerifyEvent - */ -public class Test_org_eclipse_swt_events_VerifyEvent extends Test_org_eclipse_swt_events_KeyEvent { - -public Test_org_eclipse_swt_events_VerifyEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_VerifyEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Event"); - methodNames.addAll(Test_org_eclipse_swt_events_KeyEvent.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Event")) test_ConstructorLorg_eclipse_swt_widgets_Event(); - else super.runTest(); -} - -/* custom */ -protected TypedEvent newTypedEvent(Event event) { - return new VerifyEvent(event); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyListener.java deleted file mode 100644 index 0b9c676949..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_events_VerifyListener.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.events.VerifyListener - * - * @see org.eclipse.swt.events.VerifyListener - */ -public class Test_org_eclipse_swt_events_VerifyListener extends SwtTestCase { - -public Test_org_eclipse_swt_events_VerifyListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_verifyTextLorg_eclipse_swt_events_VerifyEvent() { - warnUnimpl("Test test_verifyTextLorg_eclipse_swt_events_VerifyEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_events_VerifyListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_verifyTextLorg_eclipse_swt_events_VerifyEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_verifyTextLorg_eclipse_swt_events_VerifyEvent")) test_verifyTextLorg_eclipse_swt_events_VerifyEvent(); -} -} 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 deleted file mode 100644 index c8ae9b5b79..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Color.java +++ /dev/null @@ -1,288 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.Color - * - * @see org.eclipse.swt.graphics.Color - */ -public class Test_org_eclipse_swt_graphics_Color extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_Color(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - display = Display.getDefault(); -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceIII() { - // Test new Color(Device device, int red, int green, int blue) - // IllegalArgumentException if the red, green or blue argument is not between 0 and 255 - - // valid color (black) - Color color = new Color(display, 0, 0, 0); - color.dispose(); - - // valid color (white) - color = new Color(display, 255, 255, 255); - color.dispose(); - - // valid color (random grey) - color = new Color(display, 20, 20, 20); - color.dispose(); - - // valid color (random) - color = new Color(display, 102, 255, 0); - color.dispose(); - - // device == null (valid) - color = new Color(null, 0, 0, 0); - color.dispose(); - - // illegal argument, rgb < 0 - try { - color = new Color(display, -10, -10, -10); - color.dispose(); - fail("No exception thrown for rgb < 0"); - } catch (IllegalArgumentException e) { - } - - // illegal argument, rgb > 255 - try { - color = new Color(display, 1000, 2000, 3000); - color.dispose(); - fail("No exception thrown for rgb > 255"); - } catch (IllegalArgumentException e) { - } - // illegal argument, blue > 255 - try { - color = new Color(display, 10, 10, 256); - color.dispose(); - fail("No exception thrown for blue > 255"); - } catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_RGB() { - // Test new Color(Device device, RGB rgb) - // IllegalArgumentException if the red, green or blue argument is not between 0 and 255; or rgb is null - - // valid color (black) - Color color = new Color(display, new RGB(0, 0, 0)); - color.dispose(); - - // valid color (white) - color = new Color(display, new RGB(255, 255, 255)); - color.dispose(); - - // valid color (random grey) - color = new Color(display, new RGB(10, 10, 10)); - color.dispose(); - - // valid color (random) - color = new Color(display, new RGB(102, 255, 0)); - color.dispose(); - - // device == null (valid) - color = new Color(null, new RGB(0, 0, 0)); - color.dispose(); - - // illegal argument, rgb < 0 - try { - color = new Color(display, new RGB(-10, -10, -10)); - color.dispose(); - fail("No exception thrown for rgb < 0"); - } - catch (IllegalArgumentException e) { - } - // illegal argument, rgb > 255 - try { - color = new Color(display, new RGB(1000, 2000, 3000)); - color.dispose(); - fail("No exception thrown for rgb > 255"); - } - catch (IllegalArgumentException e) { - } - // illegal argument, blue > 255 - try { - color = new Color(display, new RGB(10, 10, 256)); - color.dispose(); - fail("No exception thrown for blue > 255"); - } - catch (IllegalArgumentException e) { - } - - // illegal argument, rgb == null - try { - color = new Color(display, null); - color.dispose(); - fail("No exception thrown for rgb == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_dispose() { - // tested in test_isDisposed -} - -public void test_equalsLjava_lang_Object() { - Color color = new Color(display, 1, 2, 3); - Color sameColor = new Color(display, 1, 2, 3); - Color sameColor2 = new Color(display, new RGB(1, 2, 3)); - Color otherColor = new Color(display, 5, 6, 7); - try { - // Test Color.equals(Object) - assertTrue("!color.equals((Object)null)", !color.equals((Object)null)); - - // Test Color.equals(Color) - assertTrue("!color.equals((Color)null)", !color.equals((Color)null)); - assertTrue("color.equals(color)", color.equals(color)); - assertTrue("color.equals(sameColor)", color.equals(sameColor)); - assertTrue("color.equals(sameColor2)", color.equals(sameColor2)); - assertTrue("!color.equals(otherColor)", !color.equals(otherColor)); - } finally { - color.dispose(); - sameColor.dispose(); - sameColor2.dispose(); - otherColor.dispose(); - } -} - -public void test_getBlue() { - // Test Color.getBlue() - Color color = new Color(display, 0, 0, 255); - try { - assertEquals("color.getBlue()", color.getBlue(), 255); - } finally { - color.dispose(); - } - -} - -public void test_getGreen() { - // Test Color.getGreen() - Color color = new Color(display, 0, 255, 0); - try { - assertEquals("color.getGreen()", color.getGreen(), 255); - } finally { - color.dispose(); - } -} - -public void test_getRGB() { - Color color = new Color(display, 255, 255, 255); - assertNotNull(color.getRGB()); - assertEquals(new RGB(255, 255, 255), color.getRGB()); -} - -public void test_getRed() { - // Test Color.getRed() - Color color = new Color(display, 255, 0, 0); - try { - assertEquals("color.getRed()", color.getRed(), 255); - } finally { - color.dispose(); - } -} - -public void test_hashCode() { - Color color = new Color(display, 12, 34, 56); - Color otherColor = new Color(display, 12, 34, 56); - if (color.equals(otherColor)) { - assertEquals("Hash codes of equal objects should be equal", color.hashCode(), otherColor.hashCode()); - } -} - -public void test_isDisposed() { - // Test Color.isDisposed() false - Color color = new Color(display, 34, 67, 98); - try { - assertTrue("Color should not be disposed", !color.isDisposed()); - } finally { - // Test Color.isDisposed() true - color.dispose(); - assertTrue("Color should be disposed", color.isDisposed()); - } -} - -public void test_toString() { - Color color = new Color(display, 0, 0, 255); - try { - assertNotNull(color.toString()); - assertTrue(color.toString().length() > 0); - assertEquals("Color {0, 0, 255}", color.toString()); - } finally { - color.dispose(); - } -} - -public void test_win32_newLorg_eclipse_swt_graphics_DeviceI() { - // do not test - Windows platform only -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_Color((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceIII"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_RGB"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_getBlue"); - methodNames.addElement("test_getGreen"); - methodNames.addElement("test_getRGB"); - methodNames.addElement("test_getRed"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_isDisposed"); - methodNames.addElement("test_toString"); - methodNames.addElement("test_win32_newLorg_eclipse_swt_graphics_DeviceI"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceIII")) test_ConstructorLorg_eclipse_swt_graphics_DeviceIII(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_RGB")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_RGB(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_getBlue")) test_getBlue(); - else if (getName().equals("test_getGreen")) test_getGreen(); - else if (getName().equals("test_getRGB")) test_getRGB(); - else if (getName().equals("test_getRed")) test_getRed(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_isDisposed")) test_isDisposed(); - else if (getName().equals("test_toString")) test_toString(); - else if (getName().equals("test_win32_newLorg_eclipse_swt_graphics_DeviceI")) test_win32_newLorg_eclipse_swt_graphics_DeviceI(); -} - -/* custom */ -Display display; -} 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 deleted file mode 100644 index fcb975e5cd..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Cursor.java +++ /dev/null @@ -1,248 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import java.io.*; - -import junit.framework.*; -import junit.textui.TestRunner; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.Display; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.Cursor - * - * @see org.eclipse.swt.graphics.Cursor - */ -public class Test_org_eclipse_swt_graphics_Cursor extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_Cursor(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - display = Display.getDefault(); -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceI() { - // Test new Cursor(Device device, int style) - // IllegalArgumentException when an unknown style is specified - - Cursor cursor = new Cursor(display, SWT.CURSOR_ARROW); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_WAIT); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_CROSS); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_APPSTARTING); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_HELP); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_SIZEALL); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_SIZENESW); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_SIZENS); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_SIZENWSE); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_SIZEWE); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_SIZEN); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_SIZES); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_SIZEE); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_SIZEW); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_SIZENE); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_SIZESE); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_SIZESW); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_SIZENW); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_UPARROW); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_IBEAM); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_NO); - cursor.dispose(); - - cursor = new Cursor(display, SWT.CURSOR_HAND); - cursor.dispose(); - - // device == null (valid) - cursor = new Cursor(null, SWT.CURSOR_ARROW); - cursor.dispose(); - - // illegal argument, style > SWT.CURSOR_HAND (21) - try { - cursor = new Cursor(display, 100); - cursor.dispose(); - fail("No exception thrown for style > SWT.CURSOR_HAND (21)"); - } catch (IllegalArgumentException e) { - } - - // illegal argument, style < 0 - try { - cursor = new Cursor(display, -100); - cursor.dispose(); - fail("No exception thrown for style < 0"); - } catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataII() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataII not written"); -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageDataII() { - // Test new Cursor(Device device, ImageData source, ImageData mask, int hotspotX, int hotspotY) - int numFormats = SwtTestCase.imageFormats.length; - String fileName = SwtTestCase.imageFilenames[0]; - for (int i=0; i<numFormats; i++) { - String format = SwtTestCase.imageFormats[i]; - ImageLoader loader = new ImageLoader(); - InputStream stream = SwtTestCase.class.getResourceAsStream(fileName + "." + format); - ImageData source = loader.load(stream)[0]; - ImageData mask = source.getTransparencyMask(); - if (mask != null && (source.depth == 1)) { - Cursor cursor = new Cursor(display, source, mask, 0, 0); - cursor.dispose(); - } - try { - stream.close(); - } catch (IOException e) { - // continue; - } - } -} -public void test_dispose() { - // tested in test_isDisposed -} - -public void test_equalsLjava_lang_Object() { - /* Note: Two cursors are only considered equal if their handles are equal. - * So since Windows reuses cursor handles, and other platforms do not, - * it does not make sense to test whether cursor.equals(sameCursor). - */ - Cursor cursor = new Cursor(display, SWT.CURSOR_WAIT); - Cursor otherCursor = new Cursor(display, SWT.CURSOR_CROSS); - try { - // Test Cursor.equals(Object) - assertTrue("!cursor.equals((Object)null)", !cursor.equals((Object)null)); - - // Test Cursor.equals(Cursor) - assertTrue("!cursor.equals((Cursor)null)", !cursor.equals((Cursor)null)); - assertTrue("cursor.equals(cursor)", cursor.equals(cursor)); - assertTrue("!cursor.equals(otherCursor)", !cursor.equals(otherCursor)); - } finally { - cursor.dispose(); - otherCursor.dispose(); - } -} - -public void test_hashCode() { - warnUnimpl("Test test_hashCode not written"); -} - -public void test_isDisposed() { - // Test Cursor.isDisposed() false - Cursor cursor = new Cursor(display, SWT.CURSOR_WAIT); - try { - assertTrue("Cursor should not be disposed", !cursor.isDisposed()); - } finally { - // Test Cursor.isDisposed() true - cursor.dispose(); - assertTrue("Cursor should be disposed", cursor.isDisposed()); - } -} - -public void test_toString() { - Cursor cursor = new Cursor(display, SWT.CURSOR_WAIT); - assertNotNull(cursor.toString()); - assertTrue(cursor.toString().length() > 0); -} - -public void test_win32_newLorg_eclipse_swt_graphics_DeviceI() { - // do not test - Windows only -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_Cursor((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataII"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageDataII"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_isDisposed"); - methodNames.addElement("test_toString"); - methodNames.addElement("test_win32_newLorg_eclipse_swt_graphics_DeviceI"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceI")) test_ConstructorLorg_eclipse_swt_graphics_DeviceI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataII")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataII(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageDataII")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageDataII(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_isDisposed")) test_isDisposed(); - else if (getName().equals("test_toString")) test_toString(); - else if (getName().equals("test_win32_newLorg_eclipse_swt_graphics_DeviceI")) test_win32_newLorg_eclipse_swt_graphics_DeviceI(); -} - -/* custom */ -Display display; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Device.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Device.java deleted file mode 100644 index 4a202d3faf..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Device.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.Device - * - * @see org.eclipse.swt.graphics.Device - */ -public class Test_org_eclipse_swt_graphics_Device extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_Device(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceData() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceData not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_getBounds() { - warnUnimpl("Test test_getBounds not written"); -} - -public void test_getClientArea() { - warnUnimpl("Test test_getClientArea not written"); -} - -public void test_getDPI() { - warnUnimpl("Test test_getDPI not written"); -} - -public void test_getDepth() { - warnUnimpl("Test test_getDepth not written"); -} - -public void test_getDeviceData() { - warnUnimpl("Test test_getDeviceData not written"); -} - -public void test_getFontListLjava_lang_StringZ() { - warnUnimpl("Test test_getFontListLjava_lang_StringZ not written"); -} - -public void test_getSystemColorI() { - warnUnimpl("Test test_getSystemColorI not written"); -} - -public void test_getSystemFont() { - warnUnimpl("Test test_getSystemFont not written"); -} - -public void test_getWarnings() { - warnUnimpl("Test test_getWarnings not written"); -} - -public void test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData() { - warnUnimpl("Test test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData not written"); -} - -public void test_internal_new_GCLorg_eclipse_swt_graphics_GCData() { - warnUnimpl("Test test_internal_new_GCLorg_eclipse_swt_graphics_GCData not written"); -} - - -public void test_isDisposed() { - warnUnimpl("Test test_isDisposed not written"); -} - -public void test_setWarningsZ() { - warnUnimpl("Test test_setWarningsZ not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_Device((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceData"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_getDPI"); - methodNames.addElement("test_getDepth"); - methodNames.addElement("test_getDeviceData"); - methodNames.addElement("test_getFontListLjava_lang_StringZ"); - methodNames.addElement("test_getSystemColorI"); - methodNames.addElement("test_getSystemFont"); - methodNames.addElement("test_getWarnings"); - methodNames.addElement("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_internal_new_GCLorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_isDisposed"); - methodNames.addElement("test_setWarningsZ"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceData")) test_ConstructorLorg_eclipse_swt_graphics_DeviceData(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_getDPI")) test_getDPI(); - else if (getName().equals("test_getDepth")) test_getDepth(); - else if (getName().equals("test_getDeviceData")) test_getDeviceData(); - else if (getName().equals("test_getFontListLjava_lang_StringZ")) test_getFontListLjava_lang_StringZ(); - else if (getName().equals("test_getSystemColorI")) test_getSystemColorI(); - else if (getName().equals("test_getSystemFont")) test_getSystemFont(); - else if (getName().equals("test_getWarnings")) test_getWarnings(); - else if (getName().equals("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData")) test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_internal_new_GCLorg_eclipse_swt_graphics_GCData")) test_internal_new_GCLorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_isDisposed")) test_isDisposed(); - else if (getName().equals("test_setWarningsZ")) test_setWarningsZ(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_DeviceData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_DeviceData.java deleted file mode 100644 index c761475518..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_DeviceData.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.graphics.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.DeviceData - * - * @see org.eclipse.swt.graphics.DeviceData - */ -public class Test_org_eclipse_swt_graphics_DeviceData extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_DeviceData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - DeviceData data = new DeviceData(); - data.debug = true; - data.tracking = true; -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_DeviceData((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Drawable.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Drawable.java deleted file mode 100644 index 042c71f2a8..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Drawable.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.Drawable - * - * @see org.eclipse.swt.graphics.Drawable - */ -public class Test_org_eclipse_swt_graphics_Drawable extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_Drawable(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData() { - warnUnimpl("Test test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData not written"); -} - -public void test_internal_new_GCLorg_eclipse_swt_graphics_GCData() { - warnUnimpl("Test test_internal_new_GCLorg_eclipse_swt_graphics_GCData not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_Drawable((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_internal_new_GCLorg_eclipse_swt_graphics_GCData"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData")) test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_internal_new_GCLorg_eclipse_swt_graphics_GCData")) test_internal_new_GCLorg_eclipse_swt_graphics_GCData(); -} -} 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 deleted file mode 100644 index fd7b626b39..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Font.java +++ /dev/null @@ -1,313 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.Font - * - * @see org.eclipse.swt.graphics.Font - */ -public class Test_org_eclipse_swt_graphics_Font extends SwtTestCase { - -Display display; - -public Test_org_eclipse_swt_graphics_Font(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - display = Display.getDefault(); -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_graphics_Device$Lorg_eclipse_swt_graphics_FontData() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_Device$Lorg_eclipse_swt_graphics_FontData not written"); -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_FontData() { - // Test new Font(Device device, FontData fd) - // IllegalArgumentException if the fd argument is null - // SWTError: ERROR_NO_HANDLES, if a font could not be created from the given font data - - // valid font with no name (strange, but apparently valid) - Font font = new Font(display, new FontData("", 10, SWT.NORMAL)); - font.dispose(); - - // valid font with unknown name (strange, but apparently valid) - font = new Font(display, new FontData("bad-font", 10, SWT.NORMAL)); - font.dispose(); - - // valid font with 0 height (strange, but apparently valid) - font = new Font(display, new FontData(SwtJunit.testFontName, 0, SWT.NORMAL)); - font.dispose(); - - // valid normal 100-point font - font = new Font(display, new FontData(SwtJunit.testFontName, 100, SWT.NORMAL)); - font.dispose(); - - // valid normal 10-point font - font = new Font(display, new FontData(SwtJunit.testFontName, 10, SWT.NORMAL)); - font.dispose(); - - // valid bold 10-point font - font = new Font(display, new FontData(SwtJunit.testFontName, 10, SWT.BOLD)); - font.dispose(); - - // valid italic 10-point font - font = new Font(display, new FontData(SwtJunit.testFontName, 10, SWT.ITALIC)); - font.dispose(); - - // valid bold italic 10-point font - font = new Font(display, new FontData(SwtJunit.testFontName, 10, SWT.BOLD | SWT.ITALIC)); - font.dispose(); - - // illegal argument, fontData == null - try { - font = new Font(display, (FontData)null); - font.dispose(); - fail("No exception thrown for fontData == null"); - } catch (IllegalArgumentException e) { - } - - // illegal argument, name == null - try { - font = new Font(display, new FontData(null, 10, SWT.NORMAL)); - font.dispose(); - fail("No exception thrown for name == null"); - } catch (IllegalArgumentException e) { - } - - // illegal argument, height < 0 - try { - font = new Font(display, new FontData(SwtJunit.testFontName, -10, SWT.NORMAL)); - font.dispose(); - fail("No exception thrown for height < 0"); - } catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_StringII() { - // Test new Font(Device device, String name, int height, int style) - // IllegalArgumentException if the name argument is null or the height is negative - // SWTError: ERROR_NO_HANDLES, if a font could not be created from the given arguments - - // valid font with no name (strange, but apparently valid) - Font font = new Font(display, "", 10, SWT.NORMAL); - font.dispose(); - - // valid font with unknown name (strange, but apparently valid) - font = new Font(display, "bad-font", 10, SWT.NORMAL); - font.dispose(); - - // valid font with 0 height (strange, but apparently valid) - font = new Font(display, SwtJunit.testFontName, 0, SWT.NORMAL); - font.dispose(); - - // valid normal 100-point font - font = new Font(display, SwtJunit.testFontName, 100, SWT.NORMAL); - font.dispose(); - - // valid normal 10-point font - font = new Font(display, SwtJunit.testFontName, 10, SWT.NORMAL); - font.dispose(); - - // valid bold 10-point font - font = new Font(display, SwtJunit.testFontName, 10, SWT.BOLD); - font.dispose(); - - // valid italic 10-point font - font = new Font(display, SwtJunit.testFontName, 10, SWT.ITALIC); - font.dispose(); - - // valid bold italic 10-point font - font = new Font(display, SwtJunit.testFontName, 10, SWT.BOLD | SWT.ITALIC); - font.dispose(); - - // device == null (valid) - font = new Font(null, SwtJunit.testFontName, 10, SWT.NORMAL); - font.dispose(); - - // illegal argument, name == null - try { - font = new Font(display, null, 10, SWT.NORMAL); - font.dispose(); - fail("No exception thrown for name == null"); - } catch (IllegalArgumentException e) { - } - - // illegal argument, height < 0 - try { - font = new Font(display, SwtJunit.testFontName, -10, SWT.NORMAL); - font.dispose(); - fail("No exception thrown for height < 0"); - } catch (IllegalArgumentException e) { - } -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_equalsLjava_lang_Object() { - // Fonts are only equal if their handles are the same (?!) - Font font = new Font(display, SwtJunit.testFontName, 10, SWT.NORMAL); - Font otherFont = new Font(display, SwtJunit.testFontName, 20, SWT.NORMAL); - try { - // Test Font.equals(Object) - assertTrue("!font.equals((Object)null)", !font.equals((Object)null)); - - // Test Font.equals(Font) - assertTrue("!font.equals((Font)null)", !font.equals((Font)null)); - assertTrue("font.equals(font)", font.equals(font)); - assertTrue("!font.equals(otherFont)", !font.equals(otherFont)); - } finally { - font.dispose(); - otherFont.dispose(); - } -} - -public void test_getFontData() { - // Test Font.getFontData() - // valid normal 10-point font - Font font = new Font(display, SwtJunit.testFontName, 10, SWT.NORMAL); - try { - FontData fontData[] = font.getFontData(); - assertTrue("No font data", fontData != null && fontData.length > 0); - assertEquals("Wrong font name", SwtJunit.testFontName, fontData[0].getName()); - assertEquals("Wrong font height", 10, fontData[0].getHeight()); - assertEquals("Wrong font style", SWT.NORMAL, fontData[0].getStyle()); - } finally { - font.dispose(); - } - - // valid bold 20-point font - font = new Font(display, SwtJunit.testFontName, 20, SWT.BOLD); - try { - FontData fontData[] = font.getFontData(); - assertTrue("No font data", fontData != null && fontData.length > 0); - assertEquals("Wrong font name", SwtJunit.testFontName, fontData[0].getName()); - assertEquals("Wrong font height", 20, fontData[0].getHeight()); - assertEquals("Wrong font style", SWT.BOLD, fontData[0].getStyle()); - } finally { - font.dispose(); - } - - // valid italic 30-point font - font = new Font(display, SwtJunit.testFontName, 30, SWT.ITALIC); - try { - FontData fontData[] = font.getFontData(); - assertTrue("No font data", fontData != null && fontData.length > 0); -// assertEquals("Wrong font name", SwtJunit.testFontName, fontData[0].getName()); - assertEquals("Wrong font height", 30, fontData[0].getHeight()); - assertEquals("Wrong font style", SWT.ITALIC, fontData[0].getStyle()); - } finally { - font.dispose(); - } - - // valid bold italic 40-point font - font = new Font(display, SwtJunit.testFontName, 40, SWT.BOLD | SWT.ITALIC); - try { - FontData fontData[] = font.getFontData(); - font.dispose(); - assertTrue("No font data", fontData != null && fontData.length > 0); -// assertEquals("Wrong font name", SwtJunit.testFontName, fontData[0].getName()); - assertEquals("Wrong font height", 40, fontData[0].getHeight()); - assertEquals("Wrong font style", SWT.BOLD | SWT.ITALIC, fontData[0].getStyle()); - } finally { - font.dispose(); - } - - // valid 10-point font with unknown name - font = new Font(display, "bad-font", 10, SWT.NORMAL); - try { - FontData fontData[] = font.getFontData(); - assertTrue("No font data", fontData != null && fontData.length > 0); -// assertEquals("Wrong font name", "bad-font", fontData[0].getName()); - assertEquals("Wrong font height", 10, fontData[0].getHeight()); - assertEquals("Wrong font style", SWT.NORMAL, fontData[0].getStyle()); - } finally { - font.dispose(); - } -} - -public void test_hashCode() { - warnUnimpl("Test test_hashCode not written"); -} - -public void test_isDisposed() { - // Test Font.isDisposed() false - Font font = new Font(display, SwtJunit.testFontName, 10, SWT.NORMAL); - try { - assertTrue("Font should not be disposed", !font.isDisposed()); - } finally { - // Test Font.isDisposed() true - font.dispose(); - assertTrue("Font should be disposed", font.isDisposed()); - } -} - -public void test_toString() { - warnUnimpl("Test test_toString not written"); -} - -public void test_win32_newLorg_eclipse_swt_graphics_DeviceI() { - // do not test - Windows only -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_Font((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_Device$Lorg_eclipse_swt_graphics_FontData"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_FontData"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_StringII"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_getFontData"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_isDisposed"); - methodNames.addElement("test_toString"); - methodNames.addElement("test_win32_newLorg_eclipse_swt_graphics_DeviceI"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_Device$Lorg_eclipse_swt_graphics_FontData")) test_ConstructorLorg_eclipse_swt_graphics_Device$Lorg_eclipse_swt_graphics_FontData(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_FontData")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_FontData(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_StringII")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_StringII(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_getFontData")) test_getFontData(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_isDisposed")) test_isDisposed(); - else if (getName().equals("test_toString")) test_toString(); - else if (getName().equals("test_win32_newLorg_eclipse_swt_graphics_DeviceI")) test_win32_newLorg_eclipse_swt_graphics_DeviceI(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontData.java deleted file mode 100644 index 450cd2b6e3..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontData.java +++ /dev/null @@ -1,259 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.FontData - * - * @see org.eclipse.swt.graphics.FontData - */ -public class Test_org_eclipse_swt_graphics_FontData extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_FontData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - // Test new FontData() - FontData fd = new FontData(); -} - -public void test_ConstructorLjava_lang_String() { - // Test new FontData(String string) - FontData fd = new FontData(SwtJunit.testFontName, 10, SWT.NORMAL); - FontData reconstructedFontData = new FontData(fd.toString()); - assertEquals(fd, reconstructedFontData); -} - -public void test_ConstructorLjava_lang_StringII() { - // Test new FontData(String name, int height, int style) - // valid font data with no name (strange, but apparently valid) - FontData fd = new FontData("", 10, SWT.NORMAL); - - // valid font data with unknown name (strange, but apparently valid) - fd = new FontData("bad-font", 10, SWT.NORMAL); - - // valid font data with 0 height (strange, but apparently valid) - fd = new FontData(SwtJunit.testFontName, 0, SWT.NORMAL); - - // valid font data with 1000 height (pretty big, but apparently valid) - fd = new FontData(SwtJunit.testFontName, 1000, SWT.NORMAL); - - // valid normal 10-point font data - fd = new FontData(SwtJunit.testFontName, 10, SWT.NORMAL); - - // valid bold 10-point font data - fd = new FontData(SwtJunit.testFontName, 10, SWT.BOLD); - - // valid italic 10-point font data - fd = new FontData(SwtJunit.testFontName, 10, SWT.ITALIC); - - // valid bold italic 10-point font data - fd = new FontData(SwtJunit.testFontName, 10, SWT.BOLD | SWT.ITALIC); - - // illegal argument, name == null - try { - fd = new FontData(null, 10, SWT.NORMAL); - fail("No exception thrown for name == null"); - } catch (IllegalArgumentException e) { - } - - // illegal argument, height < 0 - try { - fd = new FontData(SwtJunit.testFontName, -10, SWT.NORMAL); - fail("No exception thrown for height < 0"); - } catch (IllegalArgumentException e) { - } -} - -public void test_equalsLjava_lang_Object() { - warnUnimpl("Test test_equalsLjava_lang_Object not written"); -} - -public void test_getHeight() { - // Font.getHeight() tested in test_setHeightI -} - -public void test_getLocale() { - warnUnimpl("Test test_getLocale not written"); -} - -public void test_getName() { - // Font.getName() tested in test_setNameLjava_lang_String -} - -public void test_getStyle() { - // Font.getStyle() tested in test_setStyleI -} - -public void test_hashCode() { - warnUnimpl("Test test_hashCode not written"); -} - -public void test_setHeightI() { - // Test Font.setHeight(int height) - // valid normal font data for various heights - FontData fontData = new FontData(SwtJunit.testFontName, 10, SWT.NORMAL); - for (int height = 0; height < 1000; height++) { - fontData.setHeight(height); - assertEquals("Wrong height", fontData.getHeight(), height); - } - - // valid bold font data for various heights - fontData = new FontData(SwtJunit.testFontName, 10, SWT.BOLD); - for (int height = 0; height < 1000; height++) { - fontData.setHeight(height); - assertEquals("Wrong height", fontData.getHeight(), height); - } - - // valid italic font data for various heights - fontData = new FontData(SwtJunit.testFontName, 10, SWT.ITALIC); - for (int height = 0; height < 1000; height++) { - fontData.setHeight(height); - assertEquals("Wrong height", fontData.getHeight(), height); - } - - // valid bold italic font data for various heights - fontData = new FontData(SwtJunit.testFontName, 10, SWT.BOLD | SWT.ITALIC); - for (int height = 0; height < 1000; height++) { - fontData.setHeight(height); - assertEquals("Wrong height", fontData.getHeight(), height); - } -} - -public void test_setLocaleLjava_lang_String() { - warnUnimpl("Test test_setLocaleLjava_lang_String not written"); -} - -public void test_setNameLjava_lang_String() { - // Test Font.setName(String name) - // valid name - FontData fontData = new FontData(SwtJunit.testFontName, 10, SWT.NORMAL); - assertEquals("Wrong name", fontData.getName(), SwtJunit.testFontName); - - // valid name (unknown name, but valid) - fontData.setName("bad-font"); - assertEquals("Wrong name", fontData.getName(), "bad-font"); - - // valid name (empty string, but valid) - // only on windows since motif supports separate font foundries - if (SwtJunit.isWindows) { - fontData.setName(""); - assertEquals("Wrong name", fontData.getName(), ""); - } - - // valid name - fontData.setName(SwtJunit.testFontName); - assertEquals("Wrong name", fontData.getName(), SwtJunit.testFontName); - // illegal argument, name == null - try { - fontData.setName(null); - fail("No exception thrown for name == null"); - } catch (IllegalArgumentException e) { - } -} - -public void test_setStyleI() { - // Test Font.setStyle(int style) - for (int height = 0; height < 1000; height++) { - // valid normal font data - FontData fontData = new FontData(SwtJunit.testFontName, height, SWT.NORMAL); - assertEquals("Wrong style", fontData.getStyle(), SWT.NORMAL); - - // valid bold font data - fontData.setStyle(SWT.BOLD); - assertEquals("Wrong style", fontData.getStyle(), SWT.BOLD); - - // valid italic font data - fontData.setStyle(SWT.ITALIC); - assertEquals("Wrong style", fontData.getStyle(), SWT.ITALIC); - - // valid bold italic font data - fontData.setStyle(SWT.ITALIC | SWT.BOLD); - assertEquals("Wrong style", fontData.getStyle(), SWT.BOLD | SWT.ITALIC); - - // valid normal font data - fontData.setStyle(SWT.NORMAL); - assertEquals("Wrong style", fontData.getStyle(), SWT.NORMAL); - } -} - -public void test_toString() { - FontData data = new FontData(); - assertNotNull(data.toString()); - assertTrue(data.toString().length() > 0); -} - -public void test_win32_newLorg_eclipse_swt_internal_win32_LOGFONTI() { - // do not test - Windows only -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_FontData((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorLjava_lang_String"); - methodNames.addElement("test_ConstructorLjava_lang_StringII"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_getHeight"); - methodNames.addElement("test_getLocale"); - methodNames.addElement("test_getName"); - methodNames.addElement("test_getStyle"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_setHeightI"); - methodNames.addElement("test_setLocaleLjava_lang_String"); - methodNames.addElement("test_setNameLjava_lang_String"); - methodNames.addElement("test_setStyleI"); - methodNames.addElement("test_toString"); - methodNames.addElement("test_win32_newLorg_eclipse_swt_internal_win32_LOGFONTI"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorLjava_lang_String")) test_ConstructorLjava_lang_String(); - else if (getName().equals("test_ConstructorLjava_lang_StringII")) test_ConstructorLjava_lang_StringII(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_getHeight")) test_getHeight(); - else if (getName().equals("test_getLocale")) test_getLocale(); - else if (getName().equals("test_getName")) test_getName(); - else if (getName().equals("test_getStyle")) test_getStyle(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_setHeightI")) test_setHeightI(); - else if (getName().equals("test_setLocaleLjava_lang_String")) test_setLocaleLjava_lang_String(); - else if (getName().equals("test_setNameLjava_lang_String")) test_setNameLjava_lang_String(); - else if (getName().equals("test_setStyleI")) test_setStyleI(); - else if (getName().equals("test_toString")) test_toString(); - else if (getName().equals("test_win32_newLorg_eclipse_swt_internal_win32_LOGFONTI")) test_win32_newLorg_eclipse_swt_internal_win32_LOGFONTI(); -} -} 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 deleted file mode 100644 index 5d04d83a5c..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_FontMetrics.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.FontMetrics - * - * @see org.eclipse.swt.graphics.FontMetrics - */ -public class Test_org_eclipse_swt_graphics_FontMetrics extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_FontMetrics(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - display = Display.getDefault(); - shell = new Shell(display); - gc = new GC(shell); -} - -protected void tearDown() { - gc.dispose(); - shell.dispose(); -} - -public void test_equalsLjava_lang_Object() { - FontMetrics fm1 = gc.getFontMetrics(); - FontMetrics fm2 = gc.getFontMetrics(); - assertTrue(fm1.equals(fm2)); -} - -public void test_getAscent() { - FontMetrics fm = gc.getFontMetrics(); - fm.getAscent(); -} - -public void test_getAverageCharWidth() { - FontMetrics fm = gc.getFontMetrics(); - fm.getAverageCharWidth(); -} - -public void test_getDescent() { - FontMetrics fm = gc.getFontMetrics(); - fm.getDescent(); -} - -public void test_getHeight() { - FontMetrics fm = gc.getFontMetrics(); - fm.getHeight(); -} - -public void test_getLeading() { - FontMetrics fm = gc.getFontMetrics(); - fm.getLeading(); -} - -public void test_hashCode() { - FontMetrics fm1 = gc.getFontMetrics(); - FontMetrics fm2 = gc.getFontMetrics(); - if (fm1.equals(fm2)) { - assertEquals(fm1.hashCode(), fm2.hashCode()); - } -} - -public void test_win32_newLorg_eclipse_swt_internal_win32_TEXTMETRIC() { - // do not test - Windows only -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_FontMetrics((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_getAscent"); - methodNames.addElement("test_getAverageCharWidth"); - methodNames.addElement("test_getDescent"); - methodNames.addElement("test_getHeight"); - methodNames.addElement("test_getLeading"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_win32_newLorg_eclipse_swt_internal_win32_TEXTMETRIC"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_getAscent")) test_getAscent(); - else if (getName().equals("test_getAverageCharWidth")) test_getAverageCharWidth(); - else if (getName().equals("test_getDescent")) test_getDescent(); - else if (getName().equals("test_getHeight")) test_getHeight(); - else if (getName().equals("test_getLeading")) test_getLeading(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_win32_newLorg_eclipse_swt_internal_win32_TEXTMETRIC")) test_win32_newLorg_eclipse_swt_internal_win32_TEXTMETRIC(); -} - -/* custom */ - Display display; - Shell shell; - GC gc; -} 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 deleted file mode 100644 index 33c375827a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GC.java +++ /dev/null @@ -1,629 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.GC - * - * @see org.eclipse.swt.graphics.GC - */ -public class Test_org_eclipse_swt_graphics_GC extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_GC(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - display = Display.getDefault(); - shell = new Shell(display); - shell.setBounds(0,30,240,290); - shell.open(); - gc = new GC(shell); -} - -protected void tearDown() { - gc.dispose(); - shell.dispose(); -} -public void test_ConstructorLorg_eclipse_swt_graphics_Drawable() { - // tested in setup -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DrawableI() { - Canvas canvas = new Canvas(shell, SWT.NULL); - GC testGC = new GC(canvas, SWT.RIGHT_TO_LEFT); - testGC.dispose(); - testGC = new GC(canvas, SWT.RIGHT_TO_LEFT); - testGC.dispose(); -} - -public void test_copyAreaIIIIII() { - warnUnimpl("Test test_copyAreaIIIIII not written"); -} - -public void test_copyAreaLorg_eclipse_swt_graphics_ImageII() { - warnUnimpl("Test test_copyAreaLorg_eclipse_swt_graphics_ImageII not written"); -} - -public void test_dispose() { - gc.dispose(); -} - -public void test_drawArcIIIIII() { - gc.drawArc(10, 20, 50, 25, 90, 90); -} - -public void test_drawFocusIIII() { - gc.drawFocus(1, 1, 50, 25); -} - -public void test_drawImageLorg_eclipse_swt_graphics_ImageII() { - Color c1 = new Color(display, 255, 0, 0); - Color c2 = new Color(display, 0, 0, 0); - Color c3 = new Color(display, 255, 255, 0); - - PaletteData paletteData = new PaletteData(new RGB[] {c1.getRGB(), c2.getRGB(), c3.getRGB()}); - ImageData data = new ImageData(30,30, 8, paletteData); - for (int y = 0; y < data.height; y++) { - for (int x = 0; x < data.width; x++) { - if (x > y) data.setPixel(x, y, paletteData.getPixel(c1.getRGB())); - else if (x < y) data.setPixel(x, y, paletteData.getPixel(c2.getRGB())); - else data.setPixel(x, y, paletteData.getPixel(c3.getRGB())); - } - } - Image image = new Image(display, data); - data = image.getImageData(); - data.transparentPixel = paletteData.getPixel(c1.getRGB()); - Image imageTransparent = new Image(display, data); - data.transparentPixel = -1; - for (int y = 0; y < data.height; y++) { - for (int x = 0; x < data.width; x++) { - data.setAlpha(x, y, 127); - } - } - Image imageAlpha = new Image(display, data); - - gc.drawImage(image, 100, 100); - gc.drawImage(imageTransparent, 130, 100); - gc.drawImage(imageAlpha, 160, 100); - try { - gc.drawImage(null, 100, 100); - fail("No exception thrown"); - } - catch (IllegalArgumentException e) { - } - image.dispose(); - imageTransparent.dispose(); - imageAlpha.dispose(); -} - -public void test_drawImageLorg_eclipse_swt_graphics_ImageIIIIIIII() { - Color c1 = new Color(display, 255, 0, 0); - Color c2 = new Color(display, 0, 0, 0); - Color c3 = new Color(display, 255, 255, 0); - - PaletteData paletteData = new PaletteData(new RGB[] {c1.getRGB(), c2.getRGB(), c3.getRGB()}); - ImageData data = new ImageData(30,30, 8, paletteData); - for (int y = 0; y < data.height; y++) { - for (int x = 0; x < data.width; x++) { - if (x > y) data.setPixel(x, y, paletteData.getPixel(c1.getRGB())); - else if (x < y) data.setPixel(x, y, paletteData.getPixel(c2.getRGB())); - else data.setPixel(x, y, paletteData.getPixel(c3.getRGB())); - } - } - Image image = new Image(display, data); - data = image.getImageData(); - data.transparentPixel = paletteData.getPixel(c1.getRGB()); - Image imageTransparent = new Image(display, data); - data.transparentPixel = -1; - for (int y = 0; y < data.height; y++) { - for (int x = 0; x < data.width; x++) { - data.setAlpha(x, y, 127); - } - } - Image imageAlpha = new Image(display, data); - - gc.drawImage(image, 10, 5, 20, 15, 100, 120, 50, 60); - gc.drawImage(imageTransparent, 10, 5, 20, 15, 100, 120, 10, 10); - gc.drawImage(imageAlpha, 10, 5, 20, 15, 100, 120, 20, 15); - try { - gc.drawImage(null, 10, 5, 20, 15, 100, 120, 50, 60); - fail("No exception thrown"); //should never get here - } - catch (IllegalArgumentException e) { - } - image.dispose(); - imageAlpha.dispose(); - imageTransparent.dispose(); -} - -public void test_drawLineIIII() { - gc.drawLine(0,0,0,20); -} - -public void test_drawOvalIIII() { - gc.drawOval(10, 0, 20, 30); -} - -public void test_drawPointII() { - gc.drawPoint(10, 10); -} - -public void test_drawPolygon$I() { - gc.drawPolygon(new int[] {0,0, 5,10, 0,20}); - gc.drawPolygon(new int[] {0,0}); -} - -public void test_drawPolyline$I() { - gc.drawPolyline(new int[] {0,0, 5,10, 0,20}); - gc.drawPolyline(new int[] {0,0}); -} - -public void test_drawRectangleIIII() { - gc.drawRectangle(10, 0, 20, 30); - gc.drawRectangle(0, 0, 0, 0); -} - -public void test_drawRectangleLorg_eclipse_swt_graphics_Rectangle() { - gc.drawRectangle(new Rectangle(10, 0, 20, 30)); - gc.drawRectangle(new Rectangle(0, 0, 0, 0)); -} - -public void test_drawRoundRectangleIIIIII() { - gc.drawRoundRectangle(10, 0, 20, 30, 3, 3); - gc.drawRoundRectangle(0, 0, 0, 0, 0, 0); -} - -public void test_drawStringLjava_lang_StringII() { - gc.drawString("test", 5, 5); -} - -public void test_drawStringLjava_lang_StringIIZ() { - gc.drawString("test", 5, 5, true); - gc.drawString("test", 5, 5, false); -} - -public void test_drawTextLjava_lang_StringII() { - gc.drawText("test", 5, 5); - gc.drawText("", 0, 0); -} - -public void test_drawTextLjava_lang_StringIII() { - gc.drawText("abc", 5, 5, true); - gc.drawText("abc", 5, 5, false); - gc.drawText("", 0, 0, true); - gc.drawText("", 0, 0, false); -} - -public void test_drawTextLjava_lang_StringIIZ() { - gc.drawText("abc", 5, 5, 0); -} - -public void test_equalsLjava_lang_Object() { - assertTrue(gc.equals(gc)); - Canvas canvas = new Canvas(shell, SWT.NULL); - GC testGC = new GC(canvas); - assertFalse(testGC.equals(gc)); - testGC.dispose(); -} - -public void test_fillArcIIIIII() { - gc.fillArc(10, 20, 50, 25, 90, 90); - gc.fillArc(10, 20, 50, 25, -10, -10); -} - -public void test_fillGradientRectangleIIIIZ() { - gc.fillGradientRectangle(10, 0, 20, 30, true); - gc.fillGradientRectangle(0, 0, 0, 0, true); - gc.fillGradientRectangle(10, 0, 20, 30, false); - gc.fillGradientRectangle(0, 0, 0, 0, false); -} - -public void test_fillOvalIIII() { - gc.fillOval(10, 0, 20, 30); - gc.fillOval(-1, -1, -1, -1); -} - -public void test_fillPolygon$I() { - gc.fillPolygon(new int[] {0,0, 5,10, 0,20}); - gc.fillPolygon(new int[] {0,0}); - gc.fillPolygon(new int[] {-1, -1}); -} - -public void test_fillRectangleIIII() { - gc.fillRectangle(new Rectangle(10, 0, 20, 30)); - gc.fillRectangle(new Rectangle(0, 0, 0, 0)); - gc.fillRectangle(new Rectangle(-1, -1, -1, -1)); -} - -public void test_fillRectangleLorg_eclipse_swt_graphics_Rectangle() { - gc.fillRectangle(10, 0, 20, 30); - gc.fillRectangle(0, 0, 0, 0); -} - -public void test_fillRoundRectangleIIIIII() { - gc.fillRoundRectangle(10, 0, 20, 30, 3, 3); - gc.fillRoundRectangle(0, 0, 0, 0, 0, 0); - gc.fillRoundRectangle(10, 0, 20, 30, -10, -10); -} - -public void test_getAdvanceWidthC() { - int w = gc.getAdvanceWidth('a'); - assertTrue(w > 0); -} - -public void test_getBackground() { - // tested in setBackground method -} - -public void test_getCharWidthC() { - int w = gc.getCharWidth('a'); - assertTrue(w > 0); -} - -public void test_getClipping() { - // tested in setClipping methods -} - -public void test_getClippingLorg_eclipse_swt_graphics_Region() { - warnUnimpl("Test test_getClippingLorg_eclipse_swt_graphics_Region not written"); -} - -public void test_getFont() { - // tested in setFont method -} - -public void test_getFontMetrics() { - FontMetrics fm = gc.getFontMetrics(); - assertTrue(fm.getHeight() > 0); -} - -public void test_getForeground() { - // tested in setForeground method -} - -public void test_getLineStyle() { - // tested in setLineStyle method -} - -public void test_getLineWidth() { - // tested in setLineWidth method -} - -public void test_getStyle() { - Canvas canvas = new Canvas(shell, SWT.NULL); - GC testGC = new GC(canvas, SWT.LEFT_TO_RIGHT); - int style = testGC.getStyle(); - assertTrue((style & SWT.LEFT_TO_RIGHT) != 0); - testGC.dispose(); - testGC = new GC(canvas); - style = testGC.getStyle(); - assertTrue((style & SWT.LEFT_TO_RIGHT) != 0); - testGC.dispose(); - testGC = new GC(canvas, SWT.RIGHT_TO_LEFT); - style = testGC.getStyle(); - assertTrue((style & SWT.RIGHT_TO_LEFT) != 0); - testGC.dispose(); -} - -public void test_getXORMode() { - // tested in setXORMode method -} - -public void test_hashCode() { - warnUnimpl("Test test_hashCode not written"); -} - -public void test_isClipped() { - assertFalse(gc.isClipped()); - gc.setClipping(5,10,15,20); - assertTrue(gc.isClipped()); -} - -public void test_isDisposed() { - assertFalse(gc.isDisposed()); - gc.dispose(); - assertTrue(gc.isDisposed()); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(shell.getDisplay(), 255, 0, 0); - gc.setBackground(color); - assertEquals(color, gc.getBackground()); - try { - gc.setBackground(null); - fail("No exception thrown for null color"); - } catch (IllegalArgumentException e) { - } - assertEquals(gc.getBackground(),gc.getBackground()); - color.dispose(); - try { - gc.setBackground(color); - fail("No exception thrown for color disposed"); - } catch (IllegalArgumentException e) { - } -} - -public void test_setClippingIIII() { - // intermittently fails on XP for reasons unknown, comment out the test case - // until the problem is figured out -// Canvas canvas = new Canvas(shell, SWT.BORDER); -// shell.setSize(110,110); -// canvas.setSize(100,100); -// shell.open(); -// GC testGc = new GC(canvas); -// testGc.setClipping(0,5,10,20); -// Rectangle rect = testGc.getClipping(); -// assertTrue(rect.x == 0); -// assertTrue(rect.y == 5); -// assertTrue(rect.width == 10); -// assertTrue(rect.height == 20); -// testGc.dispose(); -// canvas.dispose(); -} - -public void test_setClippingLorg_eclipse_swt_graphics_Rectangle() { - // intermittently fails on XP for reasons unknown, comment out the test case - // until the problem is figured out -// Canvas canvas = new Canvas(shell, SWT.BORDER); -// shell.setSize(110,110); -// canvas.setSize(100,100); -// shell.open(); -// GC testGc = new GC(canvas); -// testGc.setClipping(new Rectangle(0,5,10,20)); -// Rectangle rect = testGc.getClipping(); -// assertTrue(rect.x == 0); -// assertTrue(rect.y == 5); -// assertTrue(rect.width == 10); -// assertTrue(rect.height == 20); -// testGc.dispose(); -// canvas.dispose(); -} - -public void test_setClippingLorg_eclipse_swt_graphics_Region() { - warnUnimpl("Test test_setClippingLorg_eclipse_swt_graphics_Region not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - gc.setFont(shell.getDisplay().getSystemFont()); - Font font = gc.getFont(); - assertTrue(font.equals(shell.getDisplay().getSystemFont())); -} - -public void test_setForegroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(shell.getDisplay(), 255, 0, 0); - gc.setForeground(color); - assertEquals(color, gc.getForeground()); - try { - gc.setForeground(null); - fail("No exception thrown for null color"); - } catch (IllegalArgumentException e) { - } - assertEquals(gc.getForeground(),gc.getForeground()); - color.dispose(); - try { - gc.setForeground(color); - fail("No exception thrown for color disposed"); - } catch (IllegalArgumentException e) { - } -} - -public void test_setLineStyleI() { - gc.setLineStyle(SWT.LINE_SOLID); - assertTrue(gc.getLineStyle() == SWT.LINE_SOLID); - gc.setLineStyle(SWT.LINE_DASH); - assertTrue(gc.getLineStyle() == SWT.LINE_DASH); - gc.setLineStyle(SWT.LINE_DOT); - assertTrue(gc.getLineStyle() == SWT.LINE_DOT); - gc.setLineStyle(SWT.LINE_DASHDOT); - assertTrue(gc.getLineStyle() == SWT.LINE_DASHDOT); - gc.setLineStyle(SWT.LINE_DASHDOTDOT); - assertTrue(gc.getLineStyle() == SWT.LINE_DASHDOTDOT); -} - -public void test_setLineWidthI() { - gc.setLineWidth(10); - assertTrue(gc.getLineWidth() == 10); - gc.setLineWidth(0); - assertTrue(gc.getLineWidth() == 0); -} - -public void test_setXORModeZ() { - gc.setXORMode(true); - assertTrue(gc.getXORMode()); - gc.setXORMode(false); - assertFalse(gc.getXORMode()); -} - -public void test_stringExtentLjava_lang_String() { - Point pt = gc.stringExtent("abc"); - assertTrue(pt.x > 0); - assertTrue(pt.y > 0); -} - -public void test_textExtentLjava_lang_String() { - Point pt = gc.textExtent("abc"); - assertTrue(pt.x > 0); - assertTrue(pt.y > 0); -} - -public void test_textExtentLjava_lang_StringI() { - Point pt = gc.textExtent("abc", 0); - assertTrue(pt.x > 0); - assertTrue(pt.y > 0); -} - -public void test_toString() { - String s = gc.toString(); - assertNotNull(s); - assertTrue(s.length() > 0); -} - -public void test_win32_newILorg_eclipse_swt_graphics_GCData() { - // do not test - Windows only -} - -public void test_win32_newLorg_eclipse_swt_graphics_DrawableLorg_eclipse_swt_graphics_GCData() { - // do not test - Windows only -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_GC((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_Drawable"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DrawableI"); - methodNames.addElement("test_copyAreaIIIIII"); - methodNames.addElement("test_copyAreaLorg_eclipse_swt_graphics_ImageII"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_drawArcIIIIII"); - methodNames.addElement("test_drawFocusIIII"); - methodNames.addElement("test_drawImageLorg_eclipse_swt_graphics_ImageII"); - methodNames.addElement("test_drawImageLorg_eclipse_swt_graphics_ImageIIIIIIII"); - methodNames.addElement("test_drawLineIIII"); - methodNames.addElement("test_drawOvalIIII"); - methodNames.addElement("test_drawPointII"); - methodNames.addElement("test_drawPolygon$I"); - methodNames.addElement("test_drawPolyline$I"); - methodNames.addElement("test_drawRectangleIIII"); - methodNames.addElement("test_drawRectangleLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_drawRoundRectangleIIIIII"); - methodNames.addElement("test_drawStringLjava_lang_StringII"); - methodNames.addElement("test_drawStringLjava_lang_StringIIZ"); - methodNames.addElement("test_drawTextLjava_lang_StringII"); - methodNames.addElement("test_drawTextLjava_lang_StringIII"); - methodNames.addElement("test_drawTextLjava_lang_StringIIZ"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_fillArcIIIIII"); - methodNames.addElement("test_fillGradientRectangleIIIIZ"); - methodNames.addElement("test_fillOvalIIII"); - methodNames.addElement("test_fillPolygon$I"); - methodNames.addElement("test_fillRectangleIIII"); - methodNames.addElement("test_fillRectangleLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_fillRoundRectangleIIIIII"); - methodNames.addElement("test_getAdvanceWidthC"); - methodNames.addElement("test_getBackground"); - methodNames.addElement("test_getCharWidthC"); - methodNames.addElement("test_getClipping"); - methodNames.addElement("test_getClippingLorg_eclipse_swt_graphics_Region"); - methodNames.addElement("test_getFont"); - methodNames.addElement("test_getFontMetrics"); - methodNames.addElement("test_getForeground"); - methodNames.addElement("test_getLineStyle"); - methodNames.addElement("test_getLineWidth"); - methodNames.addElement("test_getStyle"); - methodNames.addElement("test_getXORMode"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_isClipped"); - methodNames.addElement("test_isDisposed"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setClippingIIII"); - methodNames.addElement("test_setClippingLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_setClippingLorg_eclipse_swt_graphics_Region"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setLineStyleI"); - methodNames.addElement("test_setLineWidthI"); - methodNames.addElement("test_setXORModeZ"); - methodNames.addElement("test_stringExtentLjava_lang_String"); - methodNames.addElement("test_textExtentLjava_lang_String"); - methodNames.addElement("test_textExtentLjava_lang_StringI"); - methodNames.addElement("test_toString"); - methodNames.addElement("test_win32_newILorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_win32_newLorg_eclipse_swt_graphics_DrawableLorg_eclipse_swt_graphics_GCData"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_Drawable")) test_ConstructorLorg_eclipse_swt_graphics_Drawable(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DrawableI")) test_ConstructorLorg_eclipse_swt_graphics_DrawableI(); - else if (getName().equals("test_copyAreaIIIIII")) test_copyAreaIIIIII(); - else if (getName().equals("test_copyAreaLorg_eclipse_swt_graphics_ImageII")) test_copyAreaLorg_eclipse_swt_graphics_ImageII(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_drawArcIIIIII")) test_drawArcIIIIII(); - else if (getName().equals("test_drawFocusIIII")) test_drawFocusIIII(); - else if (getName().equals("test_drawImageLorg_eclipse_swt_graphics_ImageII")) test_drawImageLorg_eclipse_swt_graphics_ImageII(); - else if (getName().equals("test_drawImageLorg_eclipse_swt_graphics_ImageIIIIIIII")) test_drawImageLorg_eclipse_swt_graphics_ImageIIIIIIII(); - else if (getName().equals("test_drawLineIIII")) test_drawLineIIII(); - else if (getName().equals("test_drawOvalIIII")) test_drawOvalIIII(); - else if (getName().equals("test_drawPointII")) test_drawPointII(); - else if (getName().equals("test_drawPolygon$I")) test_drawPolygon$I(); - else if (getName().equals("test_drawPolyline$I")) test_drawPolyline$I(); - else if (getName().equals("test_drawRectangleIIII")) test_drawRectangleIIII(); - else if (getName().equals("test_drawRectangleLorg_eclipse_swt_graphics_Rectangle")) test_drawRectangleLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_drawRoundRectangleIIIIII")) test_drawRoundRectangleIIIIII(); - else if (getName().equals("test_drawStringLjava_lang_StringII")) test_drawStringLjava_lang_StringII(); - else if (getName().equals("test_drawStringLjava_lang_StringIIZ")) test_drawStringLjava_lang_StringIIZ(); - else if (getName().equals("test_drawTextLjava_lang_StringII")) test_drawTextLjava_lang_StringII(); - else if (getName().equals("test_drawTextLjava_lang_StringIII")) test_drawTextLjava_lang_StringIII(); - else if (getName().equals("test_drawTextLjava_lang_StringIIZ")) test_drawTextLjava_lang_StringIIZ(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_fillArcIIIIII")) test_fillArcIIIIII(); - else if (getName().equals("test_fillGradientRectangleIIIIZ")) test_fillGradientRectangleIIIIZ(); - else if (getName().equals("test_fillOvalIIII")) test_fillOvalIIII(); - else if (getName().equals("test_fillPolygon$I")) test_fillPolygon$I(); - else if (getName().equals("test_fillRectangleIIII")) test_fillRectangleIIII(); - else if (getName().equals("test_fillRectangleLorg_eclipse_swt_graphics_Rectangle")) test_fillRectangleLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_fillRoundRectangleIIIIII")) test_fillRoundRectangleIIIIII(); - else if (getName().equals("test_getAdvanceWidthC")) test_getAdvanceWidthC(); - else if (getName().equals("test_getBackground")) test_getBackground(); - else if (getName().equals("test_getCharWidthC")) test_getCharWidthC(); - else if (getName().equals("test_getClipping")) test_getClipping(); - else if (getName().equals("test_getClippingLorg_eclipse_swt_graphics_Region")) test_getClippingLorg_eclipse_swt_graphics_Region(); - else if (getName().equals("test_getFont")) test_getFont(); - else if (getName().equals("test_getFontMetrics")) test_getFontMetrics(); - else if (getName().equals("test_getForeground")) test_getForeground(); - else if (getName().equals("test_getLineStyle")) test_getLineStyle(); - else if (getName().equals("test_getLineWidth")) test_getLineWidth(); - else if (getName().equals("test_getStyle")) test_getStyle(); - else if (getName().equals("test_getXORMode")) test_getXORMode(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_isClipped")) test_isClipped(); - else if (getName().equals("test_isDisposed")) test_isDisposed(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setClippingIIII")) test_setClippingIIII(); - else if (getName().equals("test_setClippingLorg_eclipse_swt_graphics_Rectangle")) test_setClippingLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_setClippingLorg_eclipse_swt_graphics_Region")) test_setClippingLorg_eclipse_swt_graphics_Region(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setLineStyleI")) test_setLineStyleI(); - else if (getName().equals("test_setLineWidthI")) test_setLineWidthI(); - else if (getName().equals("test_setXORModeZ")) test_setXORModeZ(); - else if (getName().equals("test_stringExtentLjava_lang_String")) test_stringExtentLjava_lang_String(); - else if (getName().equals("test_textExtentLjava_lang_String")) test_textExtentLjava_lang_String(); - else if (getName().equals("test_textExtentLjava_lang_StringI")) test_textExtentLjava_lang_StringI(); - else if (getName().equals("test_toString")) test_toString(); - else if (getName().equals("test_win32_newILorg_eclipse_swt_graphics_GCData")) test_win32_newILorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_win32_newLorg_eclipse_swt_graphics_DrawableLorg_eclipse_swt_graphics_GCData")) test_win32_newLorg_eclipse_swt_graphics_DrawableLorg_eclipse_swt_graphics_GCData(); -} - -/* custom */ -Display display; -Shell shell; -GC gc; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GCData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GCData.java deleted file mode 100644 index 9a40846ab0..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_GCData.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.GCData - * - * @see org.eclipse.swt.graphics.GCData - */ -public class Test_org_eclipse_swt_graphics_GCData extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_GCData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_GCData((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); -} -} 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 deleted file mode 100644 index b8038eef35..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java +++ /dev/null @@ -1,530 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import java.io.*; - -import junit.framework.*; -import junit.textui.*; - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.Image - * - * @see org.eclipse.swt.graphics.Image - */ -public class Test_org_eclipse_swt_graphics_Image extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_Image(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - display = Display.getDefault(); -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceII() { - Image image; - try { - image = new Image(display, -1, 10); - image.dispose(); - fail("No exception thrown for width <= 0"); - } catch (IllegalArgumentException e) { - } - - try { - image = new Image(display, 10, 0); - image.dispose(); - fail("No exception thrown for height <= 0"); - } catch (IllegalArgumentException e) { - } - - image = new Image(null, 10, 10); - image.dispose(); - - image = new Image(display, 10, 10); - image.dispose(); - -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageI not written"); -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_Rectangle() { - Image image; - Rectangle bounds = null; - - try { - image = new Image(display, bounds); - image.dispose(); - fail("No exception thrown for rectangle == null"); - } catch (IllegalArgumentException e) { - } - - bounds = new Rectangle(0, 0, -1, 10); - try { - image = new Image(display, bounds); - image.dispose(); - fail("No exception thrown for width <= 0"); - } catch (IllegalArgumentException e) { - } - - bounds = new Rectangle(0, 0, 10, -1); - try { - image = new Image(display, bounds); - image.dispose(); - fail("No exception thrown for height <= 0"); - } catch (IllegalArgumentException e) { - } - - // valid images - bounds = new Rectangle(0, 0, 10, 10); - image = new Image(null, bounds); - image.dispose(); - - image = new Image(display, bounds); - image.dispose(); -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageData() { - ImageData data = null; - Image image = null; - - try { - image = new Image(display, data); - image.dispose(); - fail("No exception thrown for ImageData == null"); - } catch (IllegalArgumentException e) { - } - - data = new ImageData(10, 10, 1, new PaletteData(0xff0000, 0x00ff00, 0x0000ff)); - try { - image = new Image(display, data); - image.dispose(); - fail("Unsupported color depth"); - } catch (SWTException e) { - } - - data = new ImageData(10, 10, 1, new PaletteData(new RGB[] {new RGB(0, 0, 0)})); - image = new Image(null, data); - image.dispose(); - - data = new ImageData(10, 10, 1, new PaletteData(new RGB[] {new RGB(0, 0, 0)})); - image = new Image(display, data); - image.dispose(); -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageData() { - ImageData data = null; - ImageData data1 = new ImageData(10, 10, 1, new PaletteData(new RGB[] {new RGB(0, 0, 0)})); - Image image = null; - - try { - image = new Image(display, data, data1); - image.dispose(); - fail("No exception thrown for ImageData source == null"); - } catch (IllegalArgumentException e) { - } - - data = new ImageData(10, 10, 1, new PaletteData(new RGB[] {new RGB(0, 0, 0)})); - data1 = null; - try { - image = new Image(display, data, data1); - image.dispose(); - fail("No exception thrown for ImageData mask == null"); - } catch (IllegalArgumentException e) { - } - - data = new ImageData(10, 10, 1, new PaletteData(new RGB[] {new RGB(0, 0, 0)})); - data1 = new ImageData(1, 10, 1, new PaletteData(new RGB[] {new RGB(0, 0, 0)})); - try { - image = new Image(display, data, data1); - image.dispose(); - fail("No exception thrown for ImageData source width != ImageData mask width"); - } catch (IllegalArgumentException e) { - } - - data = new ImageData(10, 1, 1, new PaletteData(new RGB[] {new RGB(0, 0, 0)})); - data1 = new ImageData(10, 10, 1, new PaletteData(new RGB[] {new RGB(0, 0, 0)})); - try { - image = new Image(display, data, data1); - image.dispose(); - fail("No exception thrown for ImageData source height != ImageData mask height"); - } catch (IllegalArgumentException e) { - } - - data = new ImageData(10, 10, 8, new PaletteData(new RGB[] {new RGB(0, 0, 0)})); - data1 = new ImageData(10, 10, 8, new PaletteData(new RGB[] {new RGB(0, 0, 0)})); - try { - image = new Image(display, data, data1); - image.dispose(); - fail("No exception thrown for ImageData mask color depth != 1"); - } catch (IllegalArgumentException e) { - } - - // This test isn't finished yet, don't remove until it is! Should test mask support. - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageData not written"); -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_io_InputStream() { - InputStream stream = null; - Image image = null; - try { - try { - image = new Image(display, stream); - image.dispose(); - fail("No exception thrown for InputStream == null"); - } catch (IllegalArgumentException e) { - } - - stream = SwtTestCase.class.getResourceAsStream("empty.txt"); - try { - image = new Image(display, stream); - image.dispose(); - try { - stream.close(); - } catch (IOException e) {} - fail("No exception thrown for invalid InputStream"); - } catch (SWTException e) { - } - - // create valid images - int numFormats = SwtTestCase.imageFormats.length; - String fileName = SwtTestCase.imageFilenames[0]; - Display[] displays = {display, null}; - for (int j = 0; j < displays.length; j++) { - Display tempDisplay = displays[j]; - for (int i=0; i<numFormats; i++) { - String format = SwtTestCase.imageFormats[i]; - stream = SwtTestCase.class.getResourceAsStream(fileName + "." + format); - image = new Image(tempDisplay, stream); - image.dispose(); - try { - stream.close(); - } catch (IOException e) {} - } - } - } finally { - try { - stream.close(); - } catch (Exception e) { - } - } -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_String() { - String filename = null; - try { - Image image = new Image(display, filename); - image.dispose(); - fail("No exception thrown for filename == null"); - } catch (IllegalArgumentException e) { - } - // j2se and j2me(cdc) can load from a filename but, j2me(cldc) throws an exception -} - -public void test_dispose() { - // tested in isDisposed() method -} - -public void test_equalsLjava_lang_Object() { - Image image = null; - Image image1 = null;; - - try { - image = new Image(display, 10, 10); - image1 = image; - - assertFalse(":a:", image.equals(null)); - - assertTrue(":b:", image.equals(image1)); - - ImageData imageData = new ImageData(10, 10, 1, new PaletteData(new RGB[] {new RGB(0, 0, 0)})); - image.dispose(); - image = new Image(display, imageData); - image1 = new Image(display, imageData); - assertFalse(":c:", image.equals(image1)); - } finally { - image.dispose(); - image1.dispose(); - } -} - -public void test_getBackground() { - Image image = new Image(display, 10, 10); - image.dispose(); - try { - image.getBackground(); - fail("No exception thrown for disposed image"); - } catch (SWTException e) { - } - // remainder tested in setBackground method -} - -public void test_getBounds() { - Rectangle bounds = new Rectangle(0, 0, 10, 20); - Image image = new Image(display, bounds.width, bounds.height); - image.dispose(); - try { - image.getBounds(); - fail("No exception thrown for disposed image"); - } catch (SWTException e) { - image.dispose(); - } - - // creates bitmap image - image = new Image(display, bounds.width, bounds.height); - Rectangle bounds1 = image.getBounds(); - image.dispose(); - assertEquals(":a:", bounds, bounds1); - - // create icon image - ImageData imageData = new ImageData(bounds.width, bounds.height, 1, new PaletteData(new RGB[] {new RGB(0, 0, 0)})); - image = new Image(display, imageData); - bounds1 = image.getBounds(); - image.dispose(); - assertEquals(":b:", bounds, bounds1); -} - -public void test_getImageData() { - getImageData1(); - getImageData2(24, new PaletteData(0xff0000, 0xff00, 0xff)); - getImageData2(32, new PaletteData(0xff0000, 0xff00, 0xff)); -} - -public void test_hashCode() { - Image image = null; - Image image1 = null;; - - try { - image = new Image(display, 10, 10); - image1 = image; - - assertEquals(":a:", image1.hashCode(), image.hashCode()); - - ImageData imageData = new ImageData(10, 10, 1, new PaletteData(new RGB[] {new RGB(0, 0, 0)})); - image.dispose(); - image = new Image(display, imageData); - image1 = new Image(display, imageData); - boolean equals = (image1.hashCode() == image.hashCode()); - assertFalse(":b:", equals); - } finally { - image.dispose(); - image1.dispose(); - } -} - -public void test_internal_new_GCLorg_eclipse_swt_graphics_GCData() { - // javadoc states: - // <b>IMPORTANT:</b> This method is <em>not</em> part of the public - // API for <code>Image</code> -} - -public void test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData() { - // javadoc states: - // <b>IMPORTANT:</b> This method is <em>not</em> part of the public - // API for <code>Image</code> -} - -public void test_isDisposed() { - Image image = new Image(display, 10, 10); - assertFalse(":a:", image.isDisposed()); - image.dispose(); - assertTrue(":b:", image.isDisposed()); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - Image image = new Image(display, 10, 10); - Color color = new Color(display, 255, 255, 255); - - try { - image.setBackground(null); - image.dispose(); - color.dispose(); - fail("No exception thrown for color == null"); - } catch (IllegalArgumentException e) { - image.dispose(); - color.dispose(); - } - - image = new Image(display, 10, 10); - color = new Color(display, 255, 255, 255); - color.dispose(); - try { - image.setBackground(color); - image.dispose(); - fail("No exception thrown for disposed color"); - } catch (IllegalArgumentException e) { - } - - try { - image.dispose(); - color = new Color(display, 255, 255, 255); - image.setBackground(color); - color.dispose(); - fail("No exception thrown for disposed image"); - } catch (SWTException e) { - } - - // this image does not have a transparent pixel by default so setBackground has not effect - image = new Image(display, 10, 10); - image.setBackground(display.getSystemColor(SWT.COLOR_GREEN)); - color = image.getBackground(); - image.dispose(); - assertNull(":a:", color); - - // simulate a transparent pixel - ImageData imageData = new ImageData(10, 10, 2, new PaletteData(new RGB[] {new RGB(0, 0, 0), new RGB(255, 255, 255), new RGB(50, 100, 150)})); - imageData.transparentPixel = 0; - image = new Image(display, imageData); - image.setBackground(display.getSystemColor(SWT.COLOR_GREEN)); - color = image.getBackground(); - image.dispose(); - assertEquals(":b:", display.getSystemColor(SWT.COLOR_GREEN), color); -} - -public void test_toString() { - Image image = new Image(display, 10, 10); - try { - assertNotNull(image.toString()); - assertTrue(image.toString().length() > 0); - } finally { - image.dispose(); - } -} - -public void test_win32_newLorg_eclipse_swt_graphics_DeviceII() { - // do not test - Windows only -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_Image((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceII"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_io_InputStream"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_String"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageData"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageData"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_getBackground"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getImageData"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_internal_new_GCLorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_isDisposed"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_toString"); - methodNames.addElement("test_win32_newLorg_eclipse_swt_graphics_DeviceII"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceII")) test_ConstructorLorg_eclipse_swt_graphics_DeviceII(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_io_InputStream")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_io_InputStream(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_String")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLjava_lang_String(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageData")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageData(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageData")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageDataLorg_eclipse_swt_graphics_ImageData(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageI")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_ImageI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_Rectangle")) test_ConstructorLorg_eclipse_swt_graphics_DeviceLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_getBackground")) test_getBackground(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getImageData")) test_getImageData(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData")) test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_internal_new_GCLorg_eclipse_swt_graphics_GCData")) test_internal_new_GCLorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_isDisposed")) test_isDisposed(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_toString")) test_toString(); - else if (getName().equals("test_win32_newLorg_eclipse_swt_graphics_DeviceII")) test_win32_newLorg_eclipse_swt_graphics_DeviceII(); -} -/* custom */ -Display display; - -/** Test implementation **/ - -void getImageData1() { - int numFormats = SwtTestCase.imageFormats.length; - String fileName = SwtTestCase.imageFilenames[0]; - for (int i=0; i<numFormats; i++) { - String format = SwtTestCase.imageFormats[i]; - ImageLoader loader = new ImageLoader(); - InputStream stream = SwtTestCase.class.getResourceAsStream(fileName + "." + format); - ImageData data1 = loader.load(stream)[0]; - Image image = new Image(display, data1); - ImageData data2 = image.getImageData(); - image.dispose(); - assertEquals("Image width should be the same", data1.width, data2.width); - assertEquals("Image height should be the same", data1.height, data2.height); - try { - stream.close(); - } catch (IOException e) { - // continue; - } - } -} - -/* - * Verify Image.getImageData returns pixels with the same RGB value as the - * source image. This test only makes sense with depth of 24 and 32 bits. - */ -void getImageData2(int depth, PaletteData palette) { - int width = 10; - int height = 10; - Color color = new Color(display, 0, 0xff, 0); - RGB colorRGB = color.getRGB(); - - ImageData imageData = new ImageData(width, height, depth, palette); - Image image = new Image(display, imageData); - - GC gc = new GC(image); - gc.setBackground(color); - gc.setForeground(color); - gc.fillRectangle(0, 0, 10, 10); - - ImageData newData = image.getImageData(); - PaletteData newPalette = newData.palette; - for (int i = 0; i < width; i++) { - for (int j = 0; j < height; j++) { - int pixel = newData.getPixel(i, j); - RGB rgb = newPalette.getRGB(pixel); - assertTrue("rgb.equals(colorRGB)", rgb.equals(colorRGB)); - } - } - color.dispose(); - gc.dispose(); - image.dispose(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageData.java deleted file mode 100644 index 72a3fec757..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageData.java +++ /dev/null @@ -1,343 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import java.io.*; - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.ImageData - * - * @see org.eclipse.swt.graphics.ImageData - */ -public class Test_org_eclipse_swt_graphics_ImageData extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_ImageData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorIIILorg_eclipse_swt_graphics_PaletteData() { - try { - new ImageData(-1, 1, 1, new PaletteData(new RGB[] {new RGB(0, 0, 0)})); - fail("No exception thrown for width < 0"); - } catch (IllegalArgumentException e) { - } - - try { - new ImageData(1, -1, 1, new PaletteData(new RGB[] {new RGB(0, 0, 0)})); - fail("No exception thrown for height < 0"); - } catch (IllegalArgumentException e) { - } - - try { - new ImageData(1, 1, 1, null, 0, new byte[] {}); - fail("No exception thrown for paletteData == null"); - } catch (IllegalArgumentException e) { - } - - try { - new ImageData(1, 1, 3, new PaletteData(new RGB[] {new RGB(0, 0, 0)})); - fail("No exception thrown for unsupported depth"); - } catch (IllegalArgumentException e) { - } - - int[] validDepths = {1, 2, 4, 8, 16, 24, 32}; - for (int i = 0; i < validDepths.length; i++) { - new ImageData(1, 1, validDepths[i], new PaletteData(new RGB[] {new RGB(0, 0, 0)})); - }; -} - -public void test_ConstructorIIILorg_eclipse_swt_graphics_PaletteDataI$B() { - try { - new ImageData(-1, 1, 1, new PaletteData(new RGB[] {new RGB(0, 0, 0)}), 1, new byte[] {}); - fail("No exception thrown for width < 0"); - } catch (IllegalArgumentException e) { - } - - try { - new ImageData(1, -1, 1, new PaletteData(new RGB[] {new RGB(0, 0, 0)}), 1, new byte[] {}); - fail("No exception thrown for height < 0"); - } catch (IllegalArgumentException e) { - } - - try { - new ImageData(1, 1, 1, null, 0, new byte[] {}); - fail("No exception thrown for paletteData == null"); - } catch (IllegalArgumentException e) { - } - - try { - new ImageData(1, 1, 1, new PaletteData(new RGB[] {new RGB(0, 0, 0)}), 1, null); - fail("No exception thrown for data == null"); - } catch (IllegalArgumentException e) { - } - - try { - new ImageData(1, 1, 3, new PaletteData(new RGB[] {new RGB(0, 0, 0)}), 1, new byte[] {}); - fail("No exception thrown for unsupported depth"); - } catch (IllegalArgumentException e) { - } - - int[] validDepths = {1, 2, 4, 8, 16, 24, 32}; - for (int i = 0; i < validDepths.length; i++) { - new ImageData(1, 1, validDepths[i], new PaletteData(new RGB[] {new RGB(0, 0, 0)}), 1, new byte[] {}); - }; - - // illegal argument, data is null - try { - new ImageData(1, 1, 8, new PaletteData(new RGB[] {new RGB(0, 0, 0)}), 4, null); - fail("No exception thrown for null data"); - } catch (IllegalArgumentException e) { - } - - // divide by zero exception if scanlinePad == 0 - try { - new ImageData(1, 1, 8, new PaletteData(new RGB[] {new RGB(0, 0, 0)}), 0, new byte[] {}); - fail("No exception thrown for scanlinePad == 0"); - } catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLjava_io_InputStream() { - InputStream stream = null; - try { - try { - new ImageData(stream); - fail("No exception thrown for InputStream == null"); - } catch (IllegalArgumentException e) { - } - - stream = SwtTestCase.class.getResourceAsStream("empty.txt"); - try { - new ImageData(stream); - fail("No exception thrown for invalid InputStream"); - } catch (SWTException e) { - } - - int numFormats = SwtTestCase.imageFormats.length; - String fileName = SwtTestCase.imageFilenames[0]; - for (int i=0; i<numFormats; i++) { - String format = SwtTestCase.imageFormats[i]; - stream = SwtTestCase.class.getResourceAsStream(fileName + "." + format); - new ImageData(stream); - } - } finally { - try { - stream.close(); - } catch (Exception e) { - } - } -} - -public void test_ConstructorLjava_lang_String() { - String filename = null; - try { - new ImageData(filename); - fail("No exception thrown for filename == null"); - } catch (IllegalArgumentException e) { - } - // j2se and j2me(cdc) can load from a filename but, j2me(cldc) throws an exception -} - -public void test_clone() { - InputStream stream = null; - try { - stream = SwtTestCase.class.getResourceAsStream(SwtTestCase.imageFilenames[0] + "." + SwtTestCase.imageFormats[0]); - ImageLoader loader = new ImageLoader(); - ImageData data1 = loader.load(stream)[0]; - ImageData data2 = (ImageData) data1.clone(); - // imageData does not implement an equals(Object) method - assertEquals(":a:", data1.alpha, data2.alpha); - assertEquals(":b:", data1.alphaData, data2.alphaData); - assertEquals(":c:", data1.bytesPerLine, data2.bytesPerLine); - assertEquals(":d:", data1.data, data2.data); - assertEquals(":e:", data1.delayTime, data2.delayTime); - assertEquals(":f:", data1.depth, data2.depth); - assertEquals(":g:", data1.disposalMethod, data2.disposalMethod); - assertEquals(":h:", data1.height, data2.height); - assertEquals(":i:", data1.maskData, data2.maskData); - assertEquals(":j:", data1.maskPad, data2.maskPad); - assertEquals(":k:", data1.palette, data2.palette); - assertEquals(":l:", data1.scanlinePad, data2.scanlinePad); - assertEquals(":m:", data1.transparentPixel, data2.transparentPixel); - assertEquals(":n:", data1.type, data2.type); - assertEquals(":o:", data1.width, data2.width); - assertEquals(":p:", data1.x, data2.x); - assertEquals(":q:", data1.y, data2.y); - } finally { - try { - stream.close(); - } catch (Exception e) { - } - } -} - -public void test_getAlphaII() { - warnUnimpl("Test test_getAlphaII not written"); -} - -public void test_getAlphasIII$BI() { - warnUnimpl("Test test_getAlphasIII$BI not written"); -} - -public void test_getPixelII() { - warnUnimpl("Test test_getPixelII not written"); -} - -public void test_getPixelsIII$BI() { - warnUnimpl("Test test_getPixelsIII$BI not written"); -} - -public void test_getPixelsIII$II() { - warnUnimpl("Test test_getPixelsIII$II not written"); -} - -public void test_getRGBs() { - warnUnimpl("Test test_getRGBs not written"); -} - -public void test_getTransparencyMask() { - warnUnimpl("Test test_getTransparencyMask not written"); -} - -public void test_getTransparencyType() { - warnUnimpl("Test test_getTransparencyType not written"); -} - -public void test_internal_newIIILorg_eclipse_swt_graphics_PaletteDataI$BI$B$BIIIIIII() { - // javadoc states: - // <b>IMPORTANT:</b> This method is <em>not</em> part of the public - // API for <code>ImageData</code>. It is marked public only so that it - // can be shared within the packages provided by SWT. It is subject - // to change without notice, and should never be called from - // application code. -} - -public void test_scaledToII() { - warnUnimpl("Test test_scaledToII not written"); -} - -public void test_setAlphaIII() { - warnUnimpl("Test test_setAlphaIII not written"); -} - -public void test_setAlphasIII$BI() { - warnUnimpl("Test test_setAlphasIII$BI not written"); -} - -public void test_setPixelIII() { - warnUnimpl("Test test_setPixelIII not written"); -} - -public void test_setPixelsIII$BI() { - warnUnimpl("Test test_setPixelsIII$BI not written"); -} - -public void test_setPixelsIII$II() { - warnUnimpl("Test test_setPixelsIII$II not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_ImageData((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorIIILorg_eclipse_swt_graphics_PaletteData"); - methodNames.addElement("test_ConstructorIIILorg_eclipse_swt_graphics_PaletteDataI$B"); - methodNames.addElement("test_ConstructorLjava_io_InputStream"); - methodNames.addElement("test_ConstructorLjava_lang_String"); - methodNames.addElement("test_clone"); - methodNames.addElement("test_getAlphaII"); - methodNames.addElement("test_getAlphasIII$BI"); - methodNames.addElement("test_getPixelII"); - methodNames.addElement("test_getPixelsIII$BI"); - methodNames.addElement("test_getPixelsIII$II"); - methodNames.addElement("test_getRGBs"); - methodNames.addElement("test_getTransparencyMask"); - methodNames.addElement("test_getTransparencyType"); - methodNames.addElement("test_internal_newIIILorg_eclipse_swt_graphics_PaletteDataI$BI$B$BIIIIIII"); - methodNames.addElement("test_scaledToII"); - methodNames.addElement("test_setAlphaIII"); - methodNames.addElement("test_setAlphasIII$BI"); - methodNames.addElement("test_setPixelIII"); - methodNames.addElement("test_setPixelsIII$BI"); - methodNames.addElement("test_setPixelsIII$II"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorIIILorg_eclipse_swt_graphics_PaletteData")) test_ConstructorIIILorg_eclipse_swt_graphics_PaletteData(); - else if (getName().equals("test_ConstructorIIILorg_eclipse_swt_graphics_PaletteDataI$B")) test_ConstructorIIILorg_eclipse_swt_graphics_PaletteDataI$B(); - else if (getName().equals("test_ConstructorLjava_io_InputStream")) test_ConstructorLjava_io_InputStream(); - else if (getName().equals("test_ConstructorLjava_lang_String")) test_ConstructorLjava_lang_String(); - else if (getName().equals("test_clone")) test_clone(); - else if (getName().equals("test_getAlphaII")) test_getAlphaII(); - else if (getName().equals("test_getAlphasIII$BI")) test_getAlphasIII$BI(); - else if (getName().equals("test_getPixelII")) test_getPixelII(); - else if (getName().equals("test_getPixelsIII$BI")) test_getPixelsIII$BI(); - else if (getName().equals("test_getPixelsIII$II")) test_getPixelsIII$II(); - else if (getName().equals("test_getRGBs")) test_getRGBs(); - else if (getName().equals("test_getTransparencyMask")) test_getTransparencyMask(); - else if (getName().equals("test_getTransparencyType")) test_getTransparencyType(); - else if (getName().equals("test_internal_newIIILorg_eclipse_swt_graphics_PaletteDataI$BI$B$BIIIIIII")) test_internal_newIIILorg_eclipse_swt_graphics_PaletteDataI$BI$B$BIIIIIII(); - else if (getName().equals("test_scaledToII")) test_scaledToII(); - else if (getName().equals("test_setAlphaIII")) test_setAlphaIII(); - else if (getName().equals("test_setAlphasIII$BI")) test_setAlphasIII$BI(); - else if (getName().equals("test_setPixelIII")) test_setPixelIII(); - else if (getName().equals("test_setPixelsIII$BI")) test_setPixelsIII$BI(); - else if (getName().equals("test_setPixelsIII$II")) test_setPixelsIII$II(); -} -/* custom */ - -void assertEquals(String message, byte expected[], byte actual[]) { - if (expected == null && actual == null) - return; - boolean equal = false; - if (expected != null && actual != null && expected.length == actual.length) { - if (expected.length == 0) - return; - equal = true; - for (int i = 0; i < expected.length; i++) { - if (expected[i] != actual[i]) { - equal = false; - } - } - } - if (!equal) { - String formatted= ""; - if (message != null) - formatted= message+" "; - fail(formatted+"expected:<"+expected+"> but was:<"+actual+">"); - } -} - -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoader.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoader.java deleted file mode 100644 index ce542453c1..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoader.java +++ /dev/null @@ -1,245 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import java.io.*; - -import junit.framework.*; -import junit.textui.*; - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.ImageLoader - * - * @see org.eclipse.swt.graphics.ImageLoader - */ -public class Test_org_eclipse_swt_graphics_ImageLoader extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_ImageLoader(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - ImageLoader loader = new ImageLoader(); -} - -public void test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener() { - ImageLoader loader = new ImageLoader(); - ImageLoaderListener loaderListener = new ImageLoaderListener() { - public void imageDataLoaded(ImageLoaderEvent e) { - loaderListenerCalled = true; - }; - }; - - try { - loader.addImageLoaderListener(null); - fail("No exception thrown for addImageLoaderListener with null argument"); - } catch (IllegalArgumentException e) { - } - - assertFalse(":a:", loader.hasListeners()); - loader.addImageLoaderListener(loaderListener); - assertTrue(":b:", loader.hasListeners()); - - loaderListenerCalled = false; - InputStream stream = SwtTestCase.class.getResourceAsStream("interlaced_target.png"); - loader.load(stream); - try { - stream.close(); - } catch (IOException e) {} - assertTrue(":c:", loaderListenerCalled); - - loaderListenerCalled = false; - stream = SwtTestCase.class.getResourceAsStream("target.png"); - loader.load(stream); - try { - stream.close(); - } catch (IOException e) {} - assertFalse(":d:", loaderListenerCalled); - - loaderListenerCalled = false; - loader.notifyListeners(new ImageLoaderEvent(loader, loader.data[0], 0, true)); - assertTrue(":e:", loaderListenerCalled); - - loader.removeImageLoaderListener(loaderListener); - assertFalse(":f:", loader.hasListeners()); -} - -public void test_hasListeners() { - // tested in addImageLoaderListener method -} - -public void test_loadLjava_io_InputStream() { - ImageLoader loader = new ImageLoader(); - InputStream stream = null; - try { - try { - loader.load(stream); - fail("No exception thrown for load inputStream == null"); - } catch (IllegalArgumentException e) { - } - - stream = SwtTestCase.class.getResourceAsStream("empty.txt"); - try { - loader.load(stream); - try { - stream.close(); - } catch (IOException e) {} - fail("No exception thrown for load from invalid inputStream"); - } catch (SWTException e) { - } - - int numFormats = SwtTestCase.imageFormats.length; - String fileName = SwtTestCase.imageFilenames[0]; - for (int i=0; i<numFormats; i++) { - String format = SwtTestCase.imageFormats[i]; - stream = SwtTestCase.class.getResourceAsStream(fileName + "." + format); - loader.load(stream); - try { - stream.close(); - } catch (IOException e) {} - } - } finally { - try { - stream.close(); - } catch (Exception e) { - } - } -} - -public void test_loadLjava_lang_String() { - ImageLoader loader = new ImageLoader(); - String filename = null; - try { - loader.load(filename); - fail("No exception thrown for load filename == null"); - } catch (IllegalArgumentException e) { - } - // j2se and j2me(cdc) can load from a filename but, j2me(cldc) throws an exception -} - -public void test_notifyListenersLorg_eclipse_swt_graphics_ImageLoaderEvent() { - // tested in addImageLoaderListener method -} - -public void test_removeImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener() { - // tested in addImageLoaderListener method -} - -public void test_saveLjava_io_OutputStreamI() { - ImageLoader loader = new ImageLoader(); - ByteArrayOutputStream outStream = null; - InputStream inStream = null; - try { - try { - loader.save(outStream, 0); - fail("No exception thrown for save outputStream == null"); - } catch (IllegalArgumentException e) { - } - - outStream = new ByteArrayOutputStream(); - try { - loader.save(outStream, -1); - fail("No exception thrown for save to invalid outputStream format"); - } catch (IllegalArgumentException e) { - } - boolean jpgSupported = false; - for (int i=0; i<imageFormats.length; i++) { - if (imageFormats[i].equals("jpg")) { - jpgSupported = true; - break; - } - } - if (jpgSupported) { - String filename = SwtTestCase.imageFilenames[0]; - // must use jpg since save is not implemented yet in png format - String filetype = "jpg"; - inStream = SwtTestCase.class.getResourceAsStream(filename + "." + filetype); - loader.load(inStream); - try { - inStream.close(); - } catch (IOException e) {} - for (int i = 0; i < imageFormats.length; i++) { - if (imageFormats[i].equals(filetype)) { - // save using the appropriate format - loader.save(outStream, i); - break; - } - } - } - } finally { - try { - outStream.close(); - } catch (Exception e) { - } - } -} - -public void test_saveLjava_lang_StringI() { - ImageLoader loader = new ImageLoader(); - String filename = null; - try { - loader.save(filename, 0); - fail("No exception thrown for save filename == null"); - } catch (IllegalArgumentException e) { - } - // j2se and j2me(cdc) can load from a filename but, j2me(cldc) throws an exception -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_ImageLoader((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener"); - methodNames.addElement("test_hasListeners"); - methodNames.addElement("test_loadLjava_io_InputStream"); - methodNames.addElement("test_loadLjava_lang_String"); - methodNames.addElement("test_notifyListenersLorg_eclipse_swt_graphics_ImageLoaderEvent"); - methodNames.addElement("test_removeImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener"); - methodNames.addElement("test_saveLjava_io_OutputStreamI"); - methodNames.addElement("test_saveLjava_lang_StringI"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener")) test_addImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener(); - else if (getName().equals("test_hasListeners")) test_hasListeners(); - else if (getName().equals("test_loadLjava_io_InputStream")) test_loadLjava_io_InputStream(); - else if (getName().equals("test_loadLjava_lang_String")) test_loadLjava_lang_String(); - else if (getName().equals("test_notifyListenersLorg_eclipse_swt_graphics_ImageLoaderEvent")) test_notifyListenersLorg_eclipse_swt_graphics_ImageLoaderEvent(); - else if (getName().equals("test_removeImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener")) test_removeImageLoaderListenerLorg_eclipse_swt_graphics_ImageLoaderListener(); - else if (getName().equals("test_saveLjava_io_OutputStreamI")) test_saveLjava_io_OutputStreamI(); - else if (getName().equals("test_saveLjava_lang_StringI")) test_saveLjava_lang_StringI(); -} -/* custom */ -boolean loaderListenerCalled; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderEvent.java deleted file mode 100644 index cf8f43f28f..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderEvent.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -import org.eclipse.swt.graphics.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.ImageLoaderEvent - * - * @see org.eclipse.swt.graphics.ImageLoaderEvent - */ -public class Test_org_eclipse_swt_graphics_ImageLoaderEvent extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_ImageLoaderEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_graphics_ImageLoaderLorg_eclipse_swt_graphics_ImageDataIZ() { - try { - new ImageLoaderEvent(null, null, 0, true); - fail("No exception thrown for ImageLoader source == null"); - } catch (IllegalArgumentException e) { - } - - new ImageLoaderEvent(new ImageLoader(), null, 0, true); -} - -public void test_toString() { - ImageLoaderEvent event = new ImageLoaderEvent(new ImageLoader(), null, 0, true); - assertNotNull(event.toString()); - assertTrue(event.toString().length() > 0); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_ImageLoaderEvent((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_ImageLoaderLorg_eclipse_swt_graphics_ImageDataIZ"); - methodNames.addElement("test_toString"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_ImageLoaderLorg_eclipse_swt_graphics_ImageDataIZ")) test_ConstructorLorg_eclipse_swt_graphics_ImageLoaderLorg_eclipse_swt_graphics_ImageDataIZ(); - else if (getName().equals("test_toString")) test_toString(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderListener.java deleted file mode 100644 index 4eea178055..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_ImageLoaderListener.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.ImageLoaderListener - * - * @see org.eclipse.swt.graphics.ImageLoaderListener - */ -public class Test_org_eclipse_swt_graphics_ImageLoaderListener extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_ImageLoaderListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_imageDataLoadedLorg_eclipse_swt_graphics_ImageLoaderEvent() { - warnUnimpl("Test test_imageDataLoadedLorg_eclipse_swt_graphics_ImageLoaderEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_ImageLoaderListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_imageDataLoadedLorg_eclipse_swt_graphics_ImageLoaderEvent"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_imageDataLoadedLorg_eclipse_swt_graphics_ImageLoaderEvent")) test_imageDataLoadedLorg_eclipse_swt_graphics_ImageLoaderEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_PaletteData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_PaletteData.java deleted file mode 100644 index 35c6dc3fb7..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_PaletteData.java +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import org.eclipse.swt.graphics.*; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.PaletteData - * - * @see org.eclipse.swt.graphics.PaletteData - */ -public class Test_org_eclipse_swt_graphics_PaletteData extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_PaletteData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor$Lorg_eclipse_swt_graphics_RGB() { - try { - new PaletteData(null); - fail("No exception thrown for rgb == null"); - } - catch (IllegalArgumentException e) { - } - - PaletteData data = new PaletteData(new RGB[] {}); - assertFalse(":a:", data.isDirect); - - new PaletteData(new RGB[] {null, null}); - assertFalse(":b:", data.isDirect); - - new PaletteData(new RGB[] {new RGB(0, 0, 0), new RGB(255, 255, 255)}); - assertFalse(":c:", data.isDirect); -} - -public void test_ConstructorIII() { - PaletteData data = new PaletteData(0, 0, 0); - assertTrue(":a:", data.isDirect); - - data = new PaletteData(-1, -1, -1); - assertTrue(":b:", data.isDirect); - - data = new PaletteData(0xff0000, 0x00ff00, 0x0000ff); - assertTrue(":c:", data.isDirect); -} - -public void test_getPixelLorg_eclipse_swt_graphics_RGB() { - // indexed palette tests - RGB[] rgbs = {new RGB(0, 0, 0), new RGB(255, 255, 255), new RGB(50, 100, 150)}; - PaletteData data = new PaletteData(rgbs); - - try { - data.getPixel(null); - fail("No exception thrown for indexed palette with rgb == null"); - } - catch (IllegalArgumentException e) { - } - - try { - data.getPixel(new RGB(0, 0, 1)); - fail("No exception thrown for rgb not found"); - } - catch (IllegalArgumentException e) { - } - - assertEquals(":a:", rgbs.length-1, data.getPixel(rgbs[rgbs.length-1])); - - // direct palette tests - RGB rgb =new RGB(0x32, 0x64, 0x96); - data = new PaletteData(0xff0000, 0x00ff00, 0x0000ff); - - try { - data.getPixel(null); - fail("No exception thrown for direct palette with rgb == null"); - } - catch (IllegalArgumentException e) { - } - - assertEquals(":b:", 0x326496, data.getPixel(rgb)); -} - -public void test_getRGBI() { - // indexed palette tests - RGB[] rgbs = {new RGB(0, 0, 0), new RGB(255, 255, 255), new RGB(50, 100, 150)}; - PaletteData data = new PaletteData(rgbs); - - try { - data.getRGB(rgbs.length); - fail("No exception thrown for nonexistent pixel"); - } - catch (IllegalArgumentException e) { - } - - assertEquals(":a:", rgbs[rgbs.length-1], data.getRGB(rgbs.length-1)); - - // direct palette tests - RGB rgb =new RGB(0x32, 0x64, 0x96); - data = new PaletteData(0xff0000, 0x00ff00, 0x0000ff); - - assertEquals(":b:", rgb, data.getRGB(0x326496)); -} - -public void test_getRGBs() { - // indexed palette tests - RGB[] rgbs = {new RGB(0, 0, 0), new RGB(255, 255, 255)}; - PaletteData data = new PaletteData(rgbs); - - assertEquals(":a:", rgbs, data.getRGBs()); - - // direct palette tests - data = new PaletteData(0xff0000, 0x00ff00, 0x0000ff); - - assertNull(":b:", data.getRGBs()); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_PaletteData((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor$Lorg_eclipse_swt_graphics_RGB"); - methodNames.addElement("test_ConstructorIII"); - methodNames.addElement("test_getPixelLorg_eclipse_swt_graphics_RGB"); - methodNames.addElement("test_getRGBI"); - methodNames.addElement("test_getRGBs"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor$Lorg_eclipse_swt_graphics_RGB")) test_Constructor$Lorg_eclipse_swt_graphics_RGB(); - else if (getName().equals("test_ConstructorIII")) test_ConstructorIII(); - else if (getName().equals("test_getPixelLorg_eclipse_swt_graphics_RGB")) test_getPixelLorg_eclipse_swt_graphics_RGB(); - else if (getName().equals("test_getRGBI")) test_getRGBI(); - else if (getName().equals("test_getRGBs")) test_getRGBs(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Point.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Point.java deleted file mode 100644 index 3dfdc8d299..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Point.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.Point - * - * @see org.eclipse.swt.graphics.Point - */ -public class Test_org_eclipse_swt_graphics_Point extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_Point(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorII() { - // Test new Point (int x, int y) - Point p = new Point(3, 4); - assertEquals(3, p.x); - assertEquals(4, p.y); - - p = new Point(-4, -3); - assertEquals(-4, p.x); - assertEquals(-3, p.y); - - p = new Point(500000, 700000); - assertEquals(500000, p.x); - assertEquals(700000, p.y); -} - -public void test_equalsLjava_lang_Object() { - Point p1 = new Point(5, 5); - Point p2 = new Point(5, 5); - assertTrue("Points should be equal", p1.equals(p2)); - - p1 = new Point(-5, -5); - p2 = new Point(-5, -5); - assertTrue("Points should be equal", p1.equals(p2)); - - p2 = new Point(3, 4); - assertTrue("Points should not be equal", !p1.equals(p2)); -} - -public void test_hashCode() { - Point p1 = new Point(5, 5); - Point p2 = new Point(5, 5); - assertTrue("Points should have the same hashCode", p1.hashCode() == p2.hashCode()); -} - -public void test_toString() { - Point p = new Point(3, 4); - assertNotNull(p.toString()); - assertTrue(p.toString().length() > 0); - assertEquals("Point {3, 4}", p.toString()); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_Point((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorII"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_toString"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorII")) test_ConstructorII(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_toString")) test_toString(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_RGB.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_RGB.java deleted file mode 100644 index 29db52109d..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_RGB.java +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.graphics.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.RGB - * - * @see org.eclipse.swt.graphics.RGB - */ -public class Test_org_eclipse_swt_graphics_RGB extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_RGB(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorIII() { - // Test RGB(int red, int green, int blue) - RGB rgb = new RGB(20,100,200); - - rgb = new RGB(0,0,0); - - rgb = new RGB(255,255,255); - - try { - rgb = new RGB(-1, 20, 50); - fail("No exception thrown for red < 0"); - } - catch (IllegalArgumentException e) { - } - - try { - rgb = new RGB(256, 20, 50); - fail("No exception thrown for red > 255"); - } - catch (IllegalArgumentException e) { - } - - try { - rgb = new RGB(20, -1, 50); - fail("No exception thrown for green < 0"); - } - catch (IllegalArgumentException e) { - } - - try { - rgb = new RGB(20, 256, 50); - fail("No exception thrown for green > 255"); - } - catch (IllegalArgumentException e) { - } - - try { - rgb = new RGB(20, 50, -1); - fail("No exception thrown for blue < 0"); - } - catch (IllegalArgumentException e) { - } - - try { - rgb = new RGB(20, 50, 256); - fail("No exception thrown for blue > 255"); - } - catch (IllegalArgumentException e) { - } - -} - -public void test_equalsLjava_lang_Object() { - int r = 0, g = 127, b = 254; - RGB rgb1 = new RGB(r, g, b); - RGB rgb2; - - rgb2 = rgb1; - if (!rgb1.equals(rgb2)) { - fail("Two references to the same RGB instance not found equal"); - } - - rgb2 = new RGB(r, g, b); - if (!rgb1.equals(rgb2)) { - fail("References to two different RGB instances with same R G B parameters not found equal"); - } - - if (rgb1.equals(new RGB(r+1, g, b)) || - rgb1.equals(new RGB(r, g+1, b)) || - rgb1.equals(new RGB(r, g, b+1)) || - rgb1.equals(new RGB(r+1, g+1, b+1))) { - fail("Comparing two RGB instances with different combination of R G B parameters found equal"); - } -} - -public void test_hashCode() { - int r = 255, g = 100, b = 0; - RGB rgb1 = new RGB(r, g, b); - RGB rgb2 = new RGB(r, g, b); - - int hash1 = rgb1.hashCode(); - int hash2 = rgb2.hashCode(); - - if (hash1 != hash2) { - fail("Two RGB instances with same R G B parameters returned different hash codes"); - } - - if (rgb1.hashCode() == new RGB(g, b, r).hashCode() || - rgb1.hashCode() == new RGB(b, r, g).hashCode()) { - fail("Two RGB instances with different R G B parameters returned the same hash code"); - } -} - -public void test_toString() { - RGB rgb = new RGB(0, 100, 200); - - String s = rgb.toString(); - - if (s == null || s.length() == 0) { - fail("RGB.toString returns a null or empty String"); - } -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_RGB((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorIII"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_toString"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorIII")) test_ConstructorIII(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_toString")) test_toString(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Rectangle.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Rectangle.java deleted file mode 100644 index 966e66a257..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Rectangle.java +++ /dev/null @@ -1,302 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.graphics.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.Rectangle - * - * @see org.eclipse.swt.graphics.Rectangle - */ -public class Test_org_eclipse_swt_graphics_Rectangle extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_Rectangle(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorIIII() { - // Test new Rectangle (int x, int y, int width, int height) - Rectangle r = new Rectangle(3, 4, 5, 6); - assertEquals(3, r.x); - assertEquals(4, r.y); - assertEquals(5, r.width); - assertEquals(6, r.height); - - r = new Rectangle(-4, -3, -2, -1); - assertEquals(-4, r.x); - assertEquals(-3, r.y); - assertEquals(-2, r.width); - assertEquals(-1, r.height); - - r = new Rectangle(500000, 700000, 200000, 100000); - assertEquals(500000, r.x); - assertEquals(700000, r.y); - assertEquals(200000, r.width); - assertEquals(100000, r.height); -} - -/** - * Destructively replaces the x, y, width and height values - * in the receiver with ones which represent the union of the - * rectangles specified by the receiver and the given rectangle. - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the argument is null</li> - * </ul> - */ -public void test_addLorg_eclipse_swt_graphics_Rectangle() { - Rectangle r1 = new Rectangle(1, 2, 3, 4); - Rectangle r2 = new Rectangle(3, 3, 2, 2); - r1.add(r2); - assertEquals("Rectangle add incorrect", new Rectangle(1, 2, 4, 4), r1); - - r1.add(r2); - assertEquals("Rectangle add incorrect", new Rectangle(1, 2, 4, 4), r1); - - r1 = new Rectangle(1, 2, 3, 4); - r2 = new Rectangle(3, 3, 0, 0); - r1.add(r2); - assertEquals("Rectangle add incorrect", new Rectangle(1, 2, 3, 4), r1); - - r1 = new Rectangle(1, 2, 3, 4); - r2 = new Rectangle(6, 6, 0, 0); - r1.add(r2); - assertEquals("Rectangle add incorrect", new Rectangle(1, 2, 5, 4), r1); - - try { - r1.add(null); - fail("No exception thrown for rectangle == null"); - } catch (IllegalArgumentException e) { - } -} - -/** - * Returns <code>true</code> if the point specified by the - * arguments is inside the area specified by the receiver. - */ -public void test_containsII() { - Rectangle r = new Rectangle(1, 2, 3, 4); - assertTrue("Rectangle should contain point (1, 2)", r.contains(1, 2)); - - assertTrue("Rectangle should contain point (3, 4)", r.contains(3, 4)); - - assertTrue("Rectangle should contain point (3, 5)", r.contains(3, 5)); - -// assertTrue("Rectangle should contain point (3, 6)", r.contains(3, 6)); -// -// assertTrue("Rectangle should contain point (4, 5)", r.contains(4, 5)); -// -// assertTrue("Rectangle should contain point (4, 6)", r.contains(4, 6)); - - assertTrue("Rectangle should not contain point (9, 10)", !r.contains(9, 10)); - - assertTrue("Rectangle should not contain point (-1, -1)", !r.contains(-1, -1)); -} - -/** - * Returns <code>true</code> if the given point is inside the - * area specified by the receiver. - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the argument is null</li> - * </ul> - */ -public void test_containsLorg_eclipse_swt_graphics_Point() { - Rectangle r = new Rectangle(1, 2, 3, 4); - assertTrue("Rectangle should contain Point(1, 2)", r.contains(new Point(1, 2))); - - assertTrue("Rectangle should contain Point(3, 4)", r.contains(new Point(3, 4))); - - assertTrue("Rectangle should contain point (3, 5)", r.contains(new Point(3, 5))); - -// assertTrue("Rectangle should contain point (3, 6)", r.contains(new Point(3, 6))); -// -// assertTrue("Rectangle should contain point (4, 5)", r.contains(new Point(4, 5))); -// -// assertTrue("Rectangle should contain Point(4, 6)", r.contains(new Point(4, 6))); - - assertTrue("Rectangle should not contain Point(9, 10)", !r.contains(new Point(9, 10))); - - assertTrue("Rectangle should not contain point (-1, -1)", !r.contains(new Point(-1, -1))); - - try { - r.contains(null); - fail("No exception thrown for rectangle == null"); - } catch (IllegalArgumentException e) { - } -} - -public void test_equalsLjava_lang_Object() { - Rectangle r1 = new Rectangle(5, 4, 3, 2); - Rectangle r2 = new Rectangle(5, 4, 3, 2); - assertTrue("Rectangles should be equal", r1.equals(r2)); - - r2 = new Rectangle(3, 4, 5, 6); - assertTrue("Rectangles should not be equal", !r1.equals(r2)); - - r2 = new Rectangle(2, 3, 4, 5); - assertTrue("Rectangles should not be equal", !r1.equals(r2)); - - r2 = new Rectangle(5, 4, 2, 3); - assertTrue("Rectangles should not be equal", !r1.equals(r2)); - - r2 = new Rectangle(4, 5, 3, 2); - assertTrue("Rectangles should not be equal", !r1.equals(r2)); -} - -public void test_hashCode() { - Rectangle r1 = new Rectangle(5, 4, 3, 2); - Rectangle r2 = new Rectangle(5, 4, 3, 2); - assertTrue("Rectangles should have the same hashCode", r1.hashCode() == r2.hashCode()); -} - -public void test_intersectLorg_eclipse_swt_graphics_Rectangle() { - warnUnimpl("Test test_intersectLorg_eclipse_swt_graphics_Rectangle not written"); -} - -public void test_intersectionLorg_eclipse_swt_graphics_Rectangle() { - Rectangle r1 = new Rectangle(1, 2, 3, 4); - Rectangle r2 = new Rectangle(3, 3, 2, 2); - assertEquals("Rectangle intersection incorrect", new Rectangle(3, 3, 1, 2), r1.intersection(r2)); - - r2 = new Rectangle(3, 3, 0, 0); - assertEquals("Rectangle intersection incorrect", new Rectangle(3, 3, 0, 0), r1.intersection(r2)); - - r2 = new Rectangle(3, 3, -1, -1); - assertEquals("Rectangle intersection incorrect", new Rectangle(0, 0, 0, 0), r1.intersection(r2)); - - try { - r1.intersection(null); - fail("No exception thrown for rectangle == null"); - } catch (IllegalArgumentException e) { - } -} - -public void test_intersectsIIII() { - warnUnimpl("Test test_intersectsIIII not written"); -} - -public void test_intersectsLorg_eclipse_swt_graphics_Rectangle() { - Rectangle r1 = new Rectangle(1, 2, 3, 4); - Rectangle r2 = new Rectangle(2, 3, 7, 8); - assertTrue("Rectangle(1, 2, 3, 4) should intersect Rectangle(2, 3, 7, 8)", r1.intersects(r2)); - assertTrue("Rectangle(2, 3, 7, 8) should intersect Rectangle(1, 2, 3, 4)", r2.intersects(r1)); - - r2 = new Rectangle(200, 300, 400, 500); - assertTrue("Rectangle(1, 2, 3, 4) should not intersect Rectangle(200, 300, 400, 500)", !r1.intersects(r2)); - assertTrue("Rectangle(200, 300, 400, 500) should not intersect Rectangle(1, 2, 3, 4)", !r2.intersects(r1)); - - r2 = new Rectangle(3, 3, 0, 0); - assertTrue("Rectangle(1, 2, 3, 4) should intersect Rectangle(3, 3, 0, 0)", r1.intersects(r2)); - assertTrue("Rectangle(3, 3, 0, 0) should intersect Rectangle(1, 2, 3, 4)", r2.intersects(r1)); - - r2 = new Rectangle(3, 3, -1, -1); - assertTrue("Rectangle(1, 2, 3, 4) should not intersect Rectangle(3, 3, -1, -1)", !r1.intersects(r2)); - assertTrue("Rectangle(3, 3, -1, -1) should not intersect Rectangle(1, 2, 3, 4)", !r2.intersects(r1)); - - try { - r1.intersects(null); - fail("No exception thrown for rectangle == null"); - } catch (IllegalArgumentException e) { - } -} - -public void test_isEmpty() { - Rectangle r = new Rectangle(1, 2, 0, 0); - assertTrue("Rectangle is empty", r.isEmpty()); - - r = new Rectangle(1, 2, -3, -4); - assertTrue("Rectangle is empty", r.isEmpty()); - - r = new Rectangle(1, 2, 3, 4); - assertTrue("Rectangle is not empty", !r.isEmpty()); -} - -public void test_toString() { - Rectangle r = new Rectangle(3, 4, 5, 6); - assertNotNull(r.toString()); - assertTrue(r.toString().length() > 0); - assertEquals("Rectangle {3, 4, 5, 6}", r.toString()); -} - -public void test_unionLorg_eclipse_swt_graphics_Rectangle() { - Rectangle r1 = new Rectangle(1, 2, 3, 4); - Rectangle r2 = new Rectangle(3, 3, 2, 2); - assertEquals("Rectangle union incorrect", new Rectangle(1, 2, 4, 4), r1.union(r2)); - - r2 = new Rectangle(3, 3, 0, 0); - assertEquals("Rectangle union incorrect", new Rectangle(1, 2, 3, 4), r1.union(r2)); - - r2 = new Rectangle(3, 3, -1, -1); - assertEquals("Rectangle union incorrect", new Rectangle(1, 2, 3, 4), r1.union(r2)); - - try { - r1.union(null); - fail("No exception thrown for rectangle == null"); - } catch (IllegalArgumentException e) { - } -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_Rectangle((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorIIII"); - methodNames.addElement("test_addLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_containsII"); - methodNames.addElement("test_containsLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_intersectLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_intersectionLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_intersectsIIII"); - methodNames.addElement("test_intersectsLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_isEmpty"); - methodNames.addElement("test_toString"); - methodNames.addElement("test_unionLorg_eclipse_swt_graphics_Rectangle"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorIIII")) test_ConstructorIIII(); - else if (getName().equals("test_addLorg_eclipse_swt_graphics_Rectangle")) test_addLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_containsII")) test_containsII(); - else if (getName().equals("test_containsLorg_eclipse_swt_graphics_Point")) test_containsLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_intersectLorg_eclipse_swt_graphics_Rectangle")) test_intersectLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_intersectionLorg_eclipse_swt_graphics_Rectangle")) test_intersectionLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_intersectsIIII")) test_intersectsIIII(); - else if (getName().equals("test_intersectsLorg_eclipse_swt_graphics_Rectangle")) test_intersectsLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_isEmpty")) test_isEmpty(); - else if (getName().equals("test_toString")) test_toString(); - else if (getName().equals("test_unionLorg_eclipse_swt_graphics_Rectangle")) test_unionLorg_eclipse_swt_graphics_Rectangle(); -} -} 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 deleted file mode 100644 index 90f6ac93b1..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Region.java +++ /dev/null @@ -1,953 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.graphics.Region - * - * @see org.eclipse.swt.graphics.Region - */ -public class Test_org_eclipse_swt_graphics_Region extends SwtTestCase { - -public Test_org_eclipse_swt_graphics_Region(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - display = Display.getDefault(); -} - -protected void tearDown() { -} - -public void test_Constructor() { - // test Region() - Region reg = new Region(); - if (reg.isDisposed()) { - fail("Constructor for Region didn't initialize"); - } - reg.dispose(); -} - -public void test_ConstructorLorg_eclipse_swt_graphics_Device() { - Region reg = new Region(display); - if (reg.isDisposed()) { - fail("Constructor for Region didn't initialize"); - } - reg.dispose(); -} - -public void test_add$I() { - Region reg = new Region(display); - try { - reg.add((int[])null); - fail("no exception thrown for adding a null rectangle"); - } - catch (IllegalArgumentException e) { - } - reg.dispose(); - try { - reg.add(new int[]{}); - fail("no exception thrown on disposed region"); - } - catch (SWTException e) { - } - reg = new Region(display); - reg.add(new int[] { - 0,0, 50,0, 0,25, 50,25, - 10,10, 20,10, 10,20, 20,20} - ); - Rectangle box = reg.getBounds(); - if (!box.equals(new Rectangle (0,0,50,25))) { - reg.dispose(); - fail("add 1 failed"); - } - reg.dispose(); - - reg = new Region(display); - reg.add(new int[] {0,0, 50,0, 0,25, 50,25}); - reg.add(new int[] {0,25, 50,25, 0,40, 50,40}); - box = reg.getBounds(); - if (!box.equals(new Rectangle (0,0,50,40))) { - reg.dispose(); - fail("add 2 failed"); - } - reg.dispose(); - - reg = new Region(display); - reg.add(new int[] {0,0, 5,0, 10,10, 0,10}); - box = reg.getBounds(); - if (!box.equals(new Rectangle (0,0,10,10))) { - reg.dispose(); - fail("add 3 failed"); - } - reg.dispose(); -} - -public void test_addLorg_eclipse_swt_graphics_Rectangle() { - Region reg = new Region(display); - // add a rectangle - reg.add(new Rectangle(0, 0, 100, 50)); - // add a second rectangle - reg.add(new Rectangle(200, 200, 10,10)); - - try { - reg.add((Rectangle)null); - fail("no exception thrown for adding a null rectangle"); - } - catch (IllegalArgumentException e) { - } - - reg.dispose(); - - try { - reg.add(new Rectangle(20,30,10,5)); - fail("no exception thrown for adding a rectangle after Region got disposed"); - } - catch (SWTException e) { - } -} - -public void test_addLorg_eclipse_swt_graphics_Region() { - Region reg1 = new Region(display); - // make a second region and add it to the first one - Region reg2 = new Region(display); - reg2.add(new Rectangle(40, 50, 10, 20)); - reg1.add(reg2); - - try { - reg1.add((Region)null); - fail("no exception thrown for adding a null region"); - } - catch (IllegalArgumentException e) { - } - - try { - reg2 = new Region(display); - reg2.add(new Rectangle(1,1,100,200)); - reg2.dispose(); - reg1.add(reg2); - fail("no exception thrown for adding to a Region a Region which got disposed"); - } - catch (IllegalArgumentException e) { - } - - reg1.dispose(); - - try { - reg2 = new Region(display); - reg2.add(new Rectangle(1,1,100,200)); - reg1.add(reg2); - fail("no exception thrown for adding a Region to a Region which got disposed"); - } - catch (SWTException e) { - } -} - -public void test_containsII() { - Rectangle rect1 = new Rectangle(10,10,200,100); - Point pointInRect1 = new Point(10,10); - Rectangle rect2 = new Rectangle(50,50,1000,1000); - Point pointInRect2 = new Point(1049,1009); - Point pointNotInRect12 = new Point(49,110); - - Region reg = new Region(display); - reg.dispose(); - try { - boolean res = reg.contains(pointInRect1.x, pointInRect1.y); - fail("no exception thrown on disposed region"); - } - catch (Exception e) { - } - - reg = new Region(display); - if (reg.contains(pointInRect1.x, pointInRect1.y)) { - reg.dispose(); - fail("Empty region should not contain point"); - } - reg.add(rect1); - if (!reg.contains(pointInRect1.x, pointInRect1.y)) { - reg.dispose(); - fail("Region should contain point"); - } - reg.add(rect2); - if (!reg.contains(pointInRect1.x, pointInRect1.y) || - !reg.contains(pointInRect2.x, pointInRect2.y)) { - reg.dispose(); - fail("Region should contain point"); - } - if (reg.contains(pointNotInRect12.x, pointNotInRect12.y)) { - reg.dispose(); - fail("Region should not contain point"); - } - reg.dispose(); -} - -public void test_containsLorg_eclipse_swt_graphics_Point() { - Rectangle rect1 = new Rectangle(10,10,200,100); - Point pointInRect1 = new Point(10,10); - Rectangle rect2 = new Rectangle(50,50,1000,1000); - Point pointInRect2 = new Point(1049,1009); - Point pointNotInRect12 = new Point(49,110); - - Region reg = new Region(display); - reg.dispose(); - try { - boolean res = reg.contains(pointInRect1); - fail("no exception thrown on disposed region"); - } - catch (Exception e) { - } - - reg = new Region(display); - if (reg.contains(pointInRect1)) { - reg.dispose(); - fail("Empty region should not contain point"); - } - reg.add(rect1); - if (!reg.contains(pointInRect1)) { - reg.dispose(); - fail("Region should contain point"); - } - reg.add(rect2); - if (!reg.contains(pointInRect1) || - !reg.contains(pointInRect2)) { - reg.dispose(); - fail("Region should contain point"); - } - if (reg.contains(pointNotInRect12)) { - reg.dispose(); - fail("Region should not contain point"); - } - reg.dispose(); -} - -public void test_dispose() { - Region reg = new Region(display); - reg.add(new Rectangle(1,1,50,100)); - if (reg.isDisposed()) { - fail("Region should not be in the disposed state"); - } - - // dispose twice as this is allowed - for (int i = 0; i < 2; i++) { - reg.dispose(); - if (!reg.isDisposed()) { - fail("Region should be in the disposed state"); - } - } -} - -public void test_equalsLjava_lang_Object() { - Rectangle rect1 = new Rectangle(25, 100, 200, 780); - Rectangle rect2 = new Rectangle(30, 105, 205, 785); - - Region reg1 = new Region(display); - reg1.add(rect1); - - Region reg2 = reg1; - - if (!reg1.equals(reg2)) { - reg1.dispose(); - reg2.dispose(); - fail("references to the same instance of Region should be considered equal"); - } - - reg2 = new Region(display); - reg2.add(rect1); - -// 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. -// if (!reg1.equals(reg2)) { -// reg1.dispose(); -// reg2.dispose(); -// fail("two instances of Region representing the same area should be considered equal"); -// } - - reg2.dispose(); - reg2 = new Region(display); - if (reg1.equals(reg2)) { - reg1.dispose(); - reg2.dispose(); - fail("Non empty region considered equal to empty one"); - } - - reg2.add(rect2); - if (reg1.equals(reg2)) { - reg1.dispose(); - reg2.dispose(); - fail("two different regions considered equal"); - } - - reg1.dispose(); - reg2.dispose(); -} - -public void test_getBounds() { - Region reg = new Region(display); - reg.dispose(); - - try { - Rectangle rect = reg.getBounds(); - fail("Region disposed should throw Exception"); - } - catch (Exception e) { - } - - Rectangle rect1 = new Rectangle(10,10,50,30); - Rectangle rect2 = new Rectangle(100,100,10,10); - // the rectangle enclosing the two preceding rectangles - Rectangle rect12Bounds = new Rectangle(10,10,100,100); - - reg = new Region(display); - reg.add(rect1); - Rectangle rect1Bis = reg.getBounds(); - if (rect1Bis.x != rect1.x || rect1Bis.y != rect1.y || - rect1Bis.height != rect1.height || rect1Bis.width != rect1.width) { - reg.dispose(); - fail("getBounds doesn't return the borders of the rectangle area which was set up"); - } - - reg.add(rect2); - Rectangle rect12 = reg.getBounds(); - if (rect12.x != rect12Bounds.x || rect12.y != rect12Bounds.y || - rect12.height != rect12Bounds.height || rect12.width != rect12Bounds.width) { - reg.dispose(); - fail("getBounds doesn't return the borders of the resulting rectangle area which was set up"); - } - - reg.dispose(); -} - -public void test_hashCode() { - Region reg1 = new Region(display); - Region reg2 = new Region(display); - - Rectangle rect1 = new Rectangle(25, 100, 200, 780); - Rectangle rect2 = new Rectangle(30, 105, 205, 785); - - reg1.add(rect1); - reg2.add(rect2); - - if (reg1.hashCode() == reg2.hashCode()) { - reg1.dispose(); - reg2.dispose(); - fail("two different regions should have different hashCode"); - } - reg2.dispose(); - - reg2 = new Region(display); - reg2.add(rect1); - - -// BUG: this should pass -// if (reg1.hashCode() != reg2.hashCode()) { -// reg1.dispose(); -// reg2.dispose(); -// fail("two regions representing same area should have same hashCode"); -// } - - reg1.dispose(); - reg2.dispose(); -} - -public void test_intersectLorg_eclipse_swt_graphics_Rectangle() { - Rectangle rect1 = new Rectangle(0,0,50,25); - Rectangle rect2 = new Rectangle(0,0,50,25); - Rectangle rect3 = new Rectangle(10,10,10,10); - Rectangle rect4 = new Rectangle(50,25,10,10); - Rectangle rect5 = new Rectangle(25,20,25,10); - - Region reg = new Region(display); - reg.dispose(); - try { - reg.intersect(rect1); - fail("no exception thrown on disposed region"); - } - catch (SWTException e) { - } - - reg = new Region(display); - reg.intersect(rect1); - if (!reg.isEmpty()) { - reg.dispose(); - fail("intersect failed for empty region"); - } - reg.add(rect1); - reg.intersect(rect2); - Rectangle box = reg.getBounds(); - if (!box.equals(rect1)) { - reg.dispose(); - fail("intersect failed 1"); - } - reg.intersect(rect3); - box = reg.getBounds(); - if (!box.equals(rect3)) { - reg.dispose(); - fail("intersect failed 2"); - } - reg.intersect(rect4); - if (!reg.isEmpty()) { - reg.dispose(); - fail("intersect failed 3"); - } - reg.add(rect1.union(rect4)); - reg.intersect(rect5); - box = reg.getBounds(); - if (!box.equals(rect5)) { - reg.dispose(); - fail("intersect failed 4"); - } - reg.dispose(); - - reg = new Region(display); - reg.add(rect1); - reg.add(rect4); - reg.intersect(rect5); - box = reg.getBounds(); - if (!box.equals(new Rectangle(25,20,25,5))) { - reg.dispose(); - fail("intersect failed 5"); - } - reg.dispose(); -} - -public void test_intersectLorg_eclipse_swt_graphics_Region() { - Region reg = new Region(display); - Region reg1 = new Region(display); - reg1.add(new Rectangle(0,0,50,25)); - - reg.dispose(); - try { - reg.intersect(reg1); - reg1.dispose(); - fail("no exception thrown on disposed region"); - } - catch (SWTException e) { - } - - reg = new Region(display); - reg.intersect(reg1); - if (!reg.isEmpty()) { - reg.dispose(); - reg1.dispose(); - fail("intersect failed for empty region"); - } - - Region reg2 = new Region(display); - reg2.add(new Rectangle(0,0,50,25)); - - reg.add(reg1); - reg.intersect(reg2); - Rectangle box = reg.getBounds(); - if (!box.equals(reg1.getBounds())) { - reg.dispose(); - reg1.dispose(); - reg2.dispose(); - fail("intersect failed 1"); - } - reg2.dispose(); - - Region reg3 = new Region(display); - reg3.add(new Rectangle(10,10,10,10)); - - reg.intersect(reg3); - box = reg.getBounds(); - if (!box.equals(reg3.getBounds())) { - reg.dispose(); - reg1.dispose(); - reg3.dispose(); - fail("intersect failed 2"); - } - reg3.dispose(); - - Region reg4 = new Region(display); - reg4.add(new Rectangle(50,25,10,10)); - - reg.intersect(reg4); - if (!reg.isEmpty()) { - reg.dispose(); - reg1.dispose(); - reg4.dispose(); - fail("intersect failed 3"); - } - - Region reg5 = new Region(display); - reg5.add(new Rectangle(25,20,25,10)); - - reg.add(reg1.getBounds().union(reg4.getBounds())); - reg.intersect(reg5); - box = reg.getBounds(); - if (!box.equals(reg5.getBounds())) { - reg.dispose(); - reg1.dispose(); - reg4.dispose(); - fail("intersect failed 4"); - } - reg.dispose(); - - reg = new Region(display); - reg.add(reg1); - reg.add(reg4); - reg.intersect(reg5); - box = reg.getBounds(); - if (!box.equals(new Rectangle(25,20,25,5))) { - reg.dispose(); - reg1.dispose(); - reg4.dispose(); - fail("intersect failed 5"); - } - reg.dispose(); - reg1.dispose(); - reg4.dispose(); -} - -public void test_intersectsIIII() { - Rectangle rect1 = new Rectangle(10,20,50,30); - Rectangle rectInter1 = new Rectangle(59,49,10,20); - Rectangle rectNotInter1 = new Rectangle(0,5,10,15); - - Rectangle rect2 = new Rectangle(30,40,10,100); - Rectangle rectInter2 = new Rectangle(39,139,1,5); - Rectangle rectNotInter12 = new Rectangle(40,50,5,15); - - - Region reg = new Region(display); - reg.dispose(); - try { - boolean res = reg.intersects(rectInter1.x, rectInter1.y, rectInter1.width, rectInter1.height); - fail("no exception thrown on disposed region"); - } - catch (Exception e) { - } - - reg = new Region(display); - if (reg.intersects(rect1.x, rect1.y, rect1.width, rect1.height)) { - reg.dispose(); - fail("intersects can't return true on empty region"); - } - reg.add(rect1); - if (!reg.intersects(rect1.x, rect1.y, rect1.width, rect1.height)) { - reg.dispose(); - fail("intersects didn't return true"); - } - if (!reg.intersects(rectInter1.x, rectInter1.y, rectInter1.width, rectInter1.height)) { - reg.dispose(); - fail("intersects didn't return true "); - } - if (reg.intersects(rectNotInter1.x, rectNotInter1.y, rectNotInter1.width, rectNotInter1.height)) { - reg.dispose(); - fail("intersects return true on rectangle not intersecting with region"); - } - - reg.add(rect2); - if (!reg.intersects(rect2.x, rect2.y, rect2.width, rect2.height)) { - reg.dispose(); - fail("intersects didn't return true"); - } - if (!reg.intersects(rectInter2.x, rectInter2.y, rectInter2.width, rectInter2.height)) { - reg.dispose(); - fail("intersects didn't return true "); - } - if (reg.intersects(rectNotInter12.x, rectNotInter12.y, rectNotInter12.width, rectNotInter12.height)) { - reg.dispose(); - fail("intersects return true on rectangle not intersecting with region"); - } - reg.dispose(); -} - -public void test_intersectsLorg_eclipse_swt_graphics_Rectangle() { - Rectangle rect1 = new Rectangle(10,20,50,30); - Rectangle rectInter1 = new Rectangle(59,49,10,20); - Rectangle rectNotInter1 = new Rectangle(0,5,10,15); - - Rectangle rect2 = new Rectangle(30,40,10,100); - Rectangle rectInter2 = new Rectangle(39,139,1,5); - Rectangle rectNotInter12 = new Rectangle(40,50,5,15); - - - Region reg = new Region(display); - reg.dispose(); - try { - boolean res = reg.intersects(rectInter1); - fail("no exception thrown on disposed region"); - } - catch (Exception e) { - } - - reg = new Region(display); - if (reg.intersects(rect1)) { - reg.dispose(); - fail("intersects can't return true on empty region"); - } - reg.add(rect1); - if (!reg.intersects(rect1)) { - reg.dispose(); - fail("intersects didn't return true"); - } - if (!reg.intersects(rectInter1)) { - reg.dispose(); - fail("intersects didn't return true "); - } - if (reg.intersects(rectNotInter1)) { - reg.dispose(); - fail("intersects return true on rectangle not intersecting with region"); - } - - reg.add(rect2); - if (!reg.intersects(rect2)) { - reg.dispose(); - fail("intersects didn't return true"); - } - if (!reg.intersects(rectInter2)) { - reg.dispose(); - fail("intersects didn't return true "); - } - if (reg.intersects(rectNotInter12)) { - reg.dispose(); - fail("intersects return true on rectangle not intersecting with region"); - } - reg.dispose(); -} - -public void test_isDisposed() { - // test in dispose() -} - -public void test_isEmpty() { - Region reg = new Region(display); - Rectangle emptyRect1 = new Rectangle(10,20,0,200); - Rectangle emptyRect2 = new Rectangle(10,20,10,0); - Rectangle rect = new Rectangle(10,20,50,100); - - if (!reg.isEmpty()) { - reg.dispose(); - fail("isEmpty didn't return true on empty region"); - } - - reg.add(emptyRect1); - if (!reg.isEmpty()) { - reg.dispose(); - fail("isEmpty didn't return true on empty region"); - } - - reg.add(emptyRect2); - if (!reg.isEmpty()) { - reg.dispose(); - fail("isEmpty didn't return true on empty region"); - } - - reg.add(rect); - if (reg.isEmpty()) { - reg.dispose(); - fail("isEmpty returned true on non empty region"); - } - - reg.dispose(); -} - -public void test_subtract$I() { - Region reg = new Region(display); - try { - reg.subtract((int[])null); - fail("no exception thrown for subtract a null array"); - } - catch (IllegalArgumentException e) { - } - reg.dispose(); - try { - reg.subtract(new int[]{}); - fail("no exception thrown on disposed region"); - } - catch (SWTException e) { - } - reg = new Region(display); - reg.add(new int[] {0,0, 50,0, 50,25, 0,25}); - reg.subtract(new int[] {0,0, 50,0, 50,20, 0,20}); - Rectangle box = reg.getBounds(); - if (!box.equals(new Rectangle (0,20,50,5))) { - reg.dispose(); - fail("subtract 1 failed"); - } - reg.dispose(); - - reg = new Region(display); - reg.add(new int[] {0,0, 50,0, 0,25, 50,25}); - reg.add(new int[] {0,25, 50,25, 0,40, 50,40}); - reg.subtract(new int[] {0,25, 50,25, 0,40, 50,40}); - box = reg.getBounds(); - if (!box.equals(new Rectangle (0,0,50,25))) { - reg.dispose(); - fail("subtract 2 failed"); - } - reg.dispose(); -} - -public void test_subtractLorg_eclipse_swt_graphics_Rectangle() { - Rectangle rect1 = new Rectangle(0,0,50,25); - Rectangle rect2 = new Rectangle(0,0,50,25); - Rectangle rect3 = new Rectangle(10,10,10,10); - Rectangle rect4 = new Rectangle(50,25,10,10); - Rectangle rect5 = new Rectangle(0,0,60,20); - - Region reg = new Region(display); - reg.dispose(); - try { - reg.subtract(rect1); - fail("no exception thrown on disposed region"); - } - catch (SWTException e) { - } - - reg = new Region(display); - reg.subtract(rect1); - if (!reg.isEmpty()) { - reg.dispose(); - fail("subtract failed for empty region"); - } - reg.add(rect1); - reg.subtract(rect2); - if (!reg.isEmpty()) { - reg.dispose(); - fail("subtract failed 1"); - } - reg.add(rect1); - reg.subtract(rect3); - Rectangle box = reg.getBounds(); - if (!box.equals(rect1)) { - reg.dispose(); - fail("subtract failed 2"); - } - reg.subtract(rect4); - box = reg.getBounds(); - if (!box.equals(rect1)) { - reg.dispose(); - fail("subtract failed 3"); - } - reg.add(rect1.union(rect4)); - reg.subtract(rect5); - box = reg.getBounds(); - if (!box.equals(new Rectangle(0,20,60,15))) { - reg.dispose(); - fail("subtract failed 4"); - } - reg.dispose(); - - reg = new Region(display); - reg.add(rect1); - reg.add(rect4); - reg.subtract(rect5); - box = reg.getBounds(); - if (!box.equals(new Rectangle(0,20,60,15))) { - reg.dispose(); - fail("subtract failed 5"); - } - reg.dispose(); -} - -public void test_subtractLorg_eclipse_swt_graphics_Region() { - Region reg1 = new Region(display); - reg1.add(new Rectangle(0,0,50,25)); - - Region reg = new Region(display); - reg.dispose(); - try { - reg.subtract(reg1); - reg1.dispose(); - fail("no exception thrown on disposed region"); - } - catch (SWTException e) { - } - - reg = new Region(display); - reg.subtract(reg1); - if (!reg.isEmpty()) { - reg.dispose(); - reg1.dispose(); - fail("subtract failed for empty region"); - } - - Region reg2 = new Region(display); - reg2.add(new Rectangle(0,0,50,25)); - - reg.add(reg1); - reg.subtract(reg2); - if (!reg.isEmpty()) { - reg.dispose(); - reg1.dispose(); - reg2.dispose(); - fail("subtract failed 1"); - } - reg2.dispose(); - - Region reg3 = new Region(display); - reg3.add(new Rectangle(10,10,10,10)); - - reg.add(reg1); - reg.subtract(reg3); - Rectangle box = reg.getBounds(); - if (!box.equals(reg1.getBounds())) { - reg.dispose(); - reg1.dispose(); - reg3.dispose(); - fail("subtract failed 2"); - } - reg3.dispose(); - - Region reg4 = new Region(display); - reg4.add(new Rectangle(50,25,10,10)); - - reg.subtract(reg4); - box = reg.getBounds(); - if (!box.equals(reg1.getBounds())) { - reg.dispose(); - reg1.dispose(); - reg4.dispose(); - fail("subtract failed 3"); - } - - Region reg5 = new Region(display); - reg5.add(new Rectangle(0,0,60,20)); - - reg.add(reg1.getBounds().union(reg4.getBounds())); - reg.subtract(reg5); - box = reg.getBounds(); - if (!box.equals(new Rectangle(0,20,60,15))) { - reg.dispose(); - reg1.dispose(); - reg4.dispose(); - reg5.dispose(); - fail("subtract failed 4"); - } - reg.dispose(); - - reg = new Region(display); - reg.add(reg1); - reg.add(reg4); - reg.subtract(reg5); - box = reg.getBounds(); - if (!box.equals(new Rectangle(0,20,60,15))) { - reg.dispose(); - reg1.dispose(); - reg4.dispose(); - reg5.dispose(); - fail("subtract failed 5"); - } - reg.dispose(); - reg1.dispose(); - reg4.dispose(); - reg5.dispose(); -} - -public void test_toString() { - Region reg = new Region(display); - - String s = reg.toString(); - - if (s == null || s.length() == 0) { - fail("toString returns null or empty string"); - } - - reg.add(new Rectangle(1,1,10,20)); - s = reg.toString(); - - if (s == null || s.length() == 0) { - fail("toString returns null or empty string"); - } - - reg.dispose(); - s = reg.toString(); - - if (s == null || s.length() == 0) { - fail("toString returns null or empty string"); - } -} - -public void test_win32_newLorg_eclipse_swt_graphics_DeviceI() { - if (SWT.getPlatform().equals("win32")) { - warnUnimpl("Test test_win32_newLorg_eclipse_swt_graphics_DeviceI not written"); - } -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_graphics_Region((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_Device"); - methodNames.addElement("test_add$I"); - methodNames.addElement("test_addLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_addLorg_eclipse_swt_graphics_Region"); - methodNames.addElement("test_containsII"); - methodNames.addElement("test_containsLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_intersectLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_intersectLorg_eclipse_swt_graphics_Region"); - methodNames.addElement("test_intersectsIIII"); - methodNames.addElement("test_intersectsLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_isDisposed"); - methodNames.addElement("test_isEmpty"); - methodNames.addElement("test_subtract$I"); - methodNames.addElement("test_subtractLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_subtractLorg_eclipse_swt_graphics_Region"); - methodNames.addElement("test_toString"); - methodNames.addElement("test_win32_newLorg_eclipse_swt_graphics_DeviceI"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_Device")) test_ConstructorLorg_eclipse_swt_graphics_Device(); - else if (getName().equals("test_add$I")) test_add$I(); - else if (getName().equals("test_addLorg_eclipse_swt_graphics_Rectangle")) test_addLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_addLorg_eclipse_swt_graphics_Region")) test_addLorg_eclipse_swt_graphics_Region(); - else if (getName().equals("test_containsII")) test_containsII(); - else if (getName().equals("test_containsLorg_eclipse_swt_graphics_Point")) test_containsLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_intersectLorg_eclipse_swt_graphics_Rectangle")) test_intersectLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_intersectLorg_eclipse_swt_graphics_Region")) test_intersectLorg_eclipse_swt_graphics_Region(); - else if (getName().equals("test_intersectsIIII")) test_intersectsIIII(); - else if (getName().equals("test_intersectsLorg_eclipse_swt_graphics_Rectangle")) test_intersectsLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_isDisposed")) test_isDisposed(); - else if (getName().equals("test_isEmpty")) test_isEmpty(); - 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_toString")) test_toString(); - else if (getName().equals("test_win32_newLorg_eclipse_swt_graphics_DeviceI")) test_win32_newLorg_eclipse_swt_graphics_DeviceI(); -} - -/* custom */ - Display display; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FillLayout.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FillLayout.java deleted file mode 100644 index 7ce0f706d4..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FillLayout.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.layout.FillLayout - * - * @see org.eclipse.swt.layout.FillLayout - */ -public class Test_org_eclipse_swt_layout_FillLayout extends Test_org_eclipse_swt_widgets_Layout { - -public Test_org_eclipse_swt_layout_FillLayout(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_ConstructorI() { - warnUnimpl("Test test_ConstructorI not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_layout_FillLayout((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorI"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Layout.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorI")) test_ConstructorI(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FormAttachment.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FormAttachment.java deleted file mode 100644 index cae4d699e7..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FormAttachment.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; - -/** - * Automated Test Suite for class org.eclipse.swt.layout.FormAttachment - * - * @see org.eclipse.swt.layout.FormAttachment - */ -public class Test_org_eclipse_swt_layout_FormAttachment extends SwtTestCase { - -public Test_org_eclipse_swt_layout_FormAttachment(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - shell = new Shell(); -} - -protected void tearDown() { - shell.dispose(); -} - -public void test_ConstructorI() { - FormAttachment attachment = new FormAttachment(50); - assertNotNull(attachment); -} - -public void test_ConstructorII() { - FormAttachment attachment = new FormAttachment(50, 10); - assertNotNull(attachment); -} - -public void test_ConstructorIII() { - FormAttachment attachment = new FormAttachment(50, 100, 10); - assertNotNull(attachment); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Control() { - FormAttachment attachment = new FormAttachment(shell); - assertNotNull(attachment); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ControlI() { - FormAttachment attachment = new FormAttachment(shell, 10); - assertNotNull(attachment); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ControlII() { - FormAttachment attachment = new FormAttachment(shell, 10, SWT.LEFT); - assertNotNull(attachment); -} - -public void test_toString() { - FormAttachment attachment = new FormAttachment(50); - assertNotNull(attachment.toString()); - assertTrue(attachment.toString().length() > 0); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_layout_FormAttachment((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorI"); - methodNames.addElement("test_ConstructorII"); - methodNames.addElement("test_ConstructorIII"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ControlI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ControlII"); - methodNames.addElement("test_toString"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorI")) test_ConstructorI(); - else if (getName().equals("test_ConstructorII")) test_ConstructorII(); - else if (getName().equals("test_ConstructorIII")) test_ConstructorIII(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Control")) test_ConstructorLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ControlI")) test_ConstructorLorg_eclipse_swt_widgets_ControlI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ControlII")) test_ConstructorLorg_eclipse_swt_widgets_ControlII(); - else if (getName().equals("test_toString")) test_toString(); -} - -/* custom */ -public Shell shell; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FormData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FormData.java deleted file mode 100644 index a7a74925e9..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FormData.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.layout.FormData - * - * @see org.eclipse.swt.layout.FormData - */ -public class Test_org_eclipse_swt_layout_FormData extends SwtTestCase { - -public Test_org_eclipse_swt_layout_FormData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_ConstructorII() { - warnUnimpl("Test test_ConstructorII not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_layout_FormData((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorII"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorII")) test_ConstructorII(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FormLayout.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FormLayout.java deleted file mode 100644 index 53e0364830..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_FormLayout.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.layout.FormLayout - * - * @see org.eclipse.swt.layout.FormLayout - */ -public class Test_org_eclipse_swt_layout_FormLayout extends Test_org_eclipse_swt_widgets_Layout { - -public Test_org_eclipse_swt_layout_FormLayout(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_layout_FormLayout((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Layout.methodNames()); // add superclass method names - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridData.java deleted file mode 100644 index 0d7e4430be..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridData.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.layout.*; - -/** - * Automated Test Suite for class org.eclipse.swt.layout.GridData - * - * @see org.eclipse.swt.layout.GridData - */ -public class Test_org_eclipse_swt_layout_GridData extends SwtTestCase { - -public Test_org_eclipse_swt_layout_GridData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - GridData data = new GridData(); - assertNotNull(data); - assertTrue(data.verticalAlignment == GridData.CENTER); - assertTrue(data.horizontalAlignment == GridData.BEGINNING); - assertTrue(data.widthHint == SWT.DEFAULT); - assertTrue(data.heightHint == SWT.DEFAULT); - assertTrue(data.horizontalIndent == 0); - assertTrue(data.horizontalSpan == 1); - assertTrue(data.verticalSpan == 1); - assertTrue(data.grabExcessHorizontalSpace == false); - assertTrue(data.grabExcessVerticalSpace == false); -} - -public void test_ConstructorI() { - GridData data = new GridData(GridData.FILL_BOTH); - assertNotNull(data); - assertTrue(data.verticalAlignment == GridData.FILL); - assertTrue(data.horizontalAlignment == GridData.FILL); - assertTrue(data.grabExcessHorizontalSpace == true); - assertTrue(data.grabExcessVerticalSpace == true); -} - -public void test_ConstructorII() { - GridData data = new GridData(100, 100); - assertNotNull(data); - assertTrue(data.widthHint == 100); - assertTrue(data.heightHint == 100); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_layout_GridData((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorI"); - methodNames.addElement("test_ConstructorII"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorI")) test_ConstructorI(); - else if (getName().equals("test_ConstructorII")) test_ConstructorII(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridLayout.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridLayout.java deleted file mode 100644 index bc799f93a1..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_GridLayout.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.layout.GridLayout - * - * @see org.eclipse.swt.layout.GridLayout - */ -public class Test_org_eclipse_swt_layout_GridLayout extends Test_org_eclipse_swt_widgets_Layout { - -public Test_org_eclipse_swt_layout_GridLayout(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_ConstructorIZ() { - warnUnimpl("Test test_ConstructorIZ not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_layout_GridLayout((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorIZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Layout.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorIZ")) test_ConstructorIZ(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowData.java deleted file mode 100644 index a5c3e0c8e1..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowData.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.layout.RowData - * - * @see org.eclipse.swt.layout.RowData - */ -public class Test_org_eclipse_swt_layout_RowData extends SwtTestCase { - -public Test_org_eclipse_swt_layout_RowData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_ConstructorII() { - warnUnimpl("Test test_ConstructorII not written"); -} - -public void test_ConstructorLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_Point not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_layout_RowData((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorII"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_Point"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorII")) test_ConstructorII(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_Point")) test_ConstructorLorg_eclipse_swt_graphics_Point(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowLayout.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowLayout.java deleted file mode 100644 index 965d11285a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_layout_RowLayout.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.layout.RowLayout - * - * @see org.eclipse.swt.layout.RowLayout - */ -public class Test_org_eclipse_swt_layout_RowLayout extends Test_org_eclipse_swt_widgets_Layout { - -public Test_org_eclipse_swt_layout_RowLayout(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_ConstructorI() { - warnUnimpl("Test test_ConstructorI not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_layout_RowLayout((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorI"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Layout.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorI")) test_ConstructorI(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OLE.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OLE.java deleted file mode 100644 index 4b172da642..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OLE.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.ole.win32.OLE - * - * @see org.eclipse.swt.ole.win32.OLE - */ -public class Test_org_eclipse_swt_ole_win32_OLE extends Test_org_eclipse_swt_SWT { - -public Test_org_eclipse_swt_ole_win32_OLE(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_errorI() { - warnUnimpl("Test test_errorI not written"); -} - -public void test_errorII() { - warnUnimpl("Test test_errorII not written"); -} - -public void test_findProgramIDLjava_lang_String() { - warnUnimpl("Test test_findProgramIDLjava_lang_String not written"); -} - -public void test_isOleFileLjava_io_File() { - warnUnimpl("Test test_isOleFileLjava_io_File not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_ole_win32_OLE((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_errorI"); - methodNames.addElement("test_errorII"); - methodNames.addElement("test_findProgramIDLjava_lang_String"); - methodNames.addElement("test_isOleFileLjava_io_File"); - methodNames.addAll(Test_org_eclipse_swt_SWT.methodNames()); // add superclass method names - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_errorI")) test_errorI(); - else if (getName().equals("test_errorII")) test_errorII(); - else if (getName().equals("test_findProgramIDLjava_lang_String")) test_findProgramIDLjava_lang_String(); - else if (getName().equals("test_isOleFileLjava_io_File")) test_isOleFileLjava_io_File(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleAutomation.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleAutomation.java deleted file mode 100644 index ded9ed39ef..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleAutomation.java +++ /dev/null @@ -1,187 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.ole.win32.OleAutomation - * - * @see org.eclipse.swt.ole.win32.OleAutomation - */ -public class Test_org_eclipse_swt_ole_win32_OleAutomation extends SwtTestCase { - -public Test_org_eclipse_swt_ole_win32_OleAutomation(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_ole_win32_OleClientSite() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_ole_win32_OleClientSite not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_getDocumentationI() { - warnUnimpl("Test test_getDocumentationI not written"); -} - -public void test_getFunctionDescriptionI() { - warnUnimpl("Test test_getFunctionDescriptionI not written"); -} - -public void test_getHelpFileI() { - warnUnimpl("Test test_getHelpFileI not written"); -} - -public void test_getIDsOfNames$Ljava_lang_String() { - warnUnimpl("Test test_getIDsOfNames$Ljava_lang_String not written"); -} - -public void test_getLastError() { - warnUnimpl("Test test_getLastError not written"); -} - -public void test_getNameI() { - warnUnimpl("Test test_getNameI not written"); -} - -public void test_getNamesII() { - warnUnimpl("Test test_getNamesII not written"); -} - -public void test_getPropertyDescriptionI() { - warnUnimpl("Test test_getPropertyDescriptionI not written"); -} - -public void test_getPropertyI() { - warnUnimpl("Test test_getPropertyI not written"); -} - -public void test_getPropertyI$Lorg_eclipse_swt_ole_win32_Variant() { - warnUnimpl("Test test_getPropertyI$Lorg_eclipse_swt_ole_win32_Variant not written"); -} - -public void test_getPropertyI$Lorg_eclipse_swt_ole_win32_Variant$I() { - warnUnimpl("Test test_getPropertyI$Lorg_eclipse_swt_ole_win32_Variant$I not written"); -} - -public void test_getTypeInfoAttributes() { - warnUnimpl("Test test_getTypeInfoAttributes not written"); -} - -public void test_invokeI() { - warnUnimpl("Test test_invokeI not written"); -} - -public void test_invokeI$Lorg_eclipse_swt_ole_win32_Variant() { - warnUnimpl("Test test_invokeI$Lorg_eclipse_swt_ole_win32_Variant not written"); -} - -public void test_invokeI$Lorg_eclipse_swt_ole_win32_Variant$I() { - warnUnimpl("Test test_invokeI$Lorg_eclipse_swt_ole_win32_Variant$I not written"); -} - -public void test_invokeNoReplyI() { - warnUnimpl("Test test_invokeNoReplyI not written"); -} - -public void test_invokeNoReplyI$Lorg_eclipse_swt_ole_win32_Variant() { - warnUnimpl("Test test_invokeNoReplyI$Lorg_eclipse_swt_ole_win32_Variant not written"); -} - -public void test_invokeNoReplyI$Lorg_eclipse_swt_ole_win32_Variant$I() { - warnUnimpl("Test test_invokeNoReplyI$Lorg_eclipse_swt_ole_win32_Variant$I not written"); -} - -public void test_setPropertyI$Lorg_eclipse_swt_ole_win32_Variant() { - warnUnimpl("Test test_setPropertyI$Lorg_eclipse_swt_ole_win32_Variant not written"); -} - -public void test_setPropertyILorg_eclipse_swt_ole_win32_Variant() { - warnUnimpl("Test test_setPropertyILorg_eclipse_swt_ole_win32_Variant not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_ole_win32_OleAutomation((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_ole_win32_OleClientSite"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getDocumentationI"); - methodNames.addElement("test_getFunctionDescriptionI"); - methodNames.addElement("test_getHelpFileI"); - methodNames.addElement("test_getIDsOfNames$Ljava_lang_String"); - methodNames.addElement("test_getLastError"); - methodNames.addElement("test_getNameI"); - methodNames.addElement("test_getNamesII"); - methodNames.addElement("test_getPropertyDescriptionI"); - methodNames.addElement("test_getPropertyI"); - methodNames.addElement("test_getPropertyI$Lorg_eclipse_swt_ole_win32_Variant"); - methodNames.addElement("test_getPropertyI$Lorg_eclipse_swt_ole_win32_Variant$I"); - methodNames.addElement("test_getTypeInfoAttributes"); - methodNames.addElement("test_invokeI"); - methodNames.addElement("test_invokeI$Lorg_eclipse_swt_ole_win32_Variant"); - methodNames.addElement("test_invokeI$Lorg_eclipse_swt_ole_win32_Variant$I"); - methodNames.addElement("test_invokeNoReplyI"); - methodNames.addElement("test_invokeNoReplyI$Lorg_eclipse_swt_ole_win32_Variant"); - methodNames.addElement("test_invokeNoReplyI$Lorg_eclipse_swt_ole_win32_Variant$I"); - methodNames.addElement("test_setPropertyI$Lorg_eclipse_swt_ole_win32_Variant"); - methodNames.addElement("test_setPropertyILorg_eclipse_swt_ole_win32_Variant"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_ole_win32_OleClientSite")) test_ConstructorLorg_eclipse_swt_ole_win32_OleClientSite(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getDocumentationI")) test_getDocumentationI(); - else if (getName().equals("test_getFunctionDescriptionI")) test_getFunctionDescriptionI(); - else if (getName().equals("test_getHelpFileI")) test_getHelpFileI(); - else if (getName().equals("test_getIDsOfNames$Ljava_lang_String")) test_getIDsOfNames$Ljava_lang_String(); - else if (getName().equals("test_getLastError")) test_getLastError(); - else if (getName().equals("test_getNameI")) test_getNameI(); - else if (getName().equals("test_getNamesII")) test_getNamesII(); - else if (getName().equals("test_getPropertyDescriptionI")) test_getPropertyDescriptionI(); - else if (getName().equals("test_getPropertyI")) test_getPropertyI(); - else if (getName().equals("test_getPropertyI$Lorg_eclipse_swt_ole_win32_Variant")) test_getPropertyI$Lorg_eclipse_swt_ole_win32_Variant(); - else if (getName().equals("test_getPropertyI$Lorg_eclipse_swt_ole_win32_Variant$I")) test_getPropertyI$Lorg_eclipse_swt_ole_win32_Variant$I(); - else if (getName().equals("test_getTypeInfoAttributes")) test_getTypeInfoAttributes(); - else if (getName().equals("test_invokeI")) test_invokeI(); - else if (getName().equals("test_invokeI$Lorg_eclipse_swt_ole_win32_Variant")) test_invokeI$Lorg_eclipse_swt_ole_win32_Variant(); - else if (getName().equals("test_invokeI$Lorg_eclipse_swt_ole_win32_Variant$I")) test_invokeI$Lorg_eclipse_swt_ole_win32_Variant$I(); - else if (getName().equals("test_invokeNoReplyI")) test_invokeNoReplyI(); - else if (getName().equals("test_invokeNoReplyI$Lorg_eclipse_swt_ole_win32_Variant")) test_invokeNoReplyI$Lorg_eclipse_swt_ole_win32_Variant(); - else if (getName().equals("test_invokeNoReplyI$Lorg_eclipse_swt_ole_win32_Variant$I")) test_invokeNoReplyI$Lorg_eclipse_swt_ole_win32_Variant$I(); - else if (getName().equals("test_setPropertyI$Lorg_eclipse_swt_ole_win32_Variant")) test_setPropertyI$Lorg_eclipse_swt_ole_win32_Variant(); - else if (getName().equals("test_setPropertyILorg_eclipse_swt_ole_win32_Variant")) test_setPropertyILorg_eclipse_swt_ole_win32_Variant(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleClientSite.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleClientSite.java deleted file mode 100644 index e5b2c59465..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleClientSite.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.ole.win32.OleClientSite - * - * @see org.eclipse.swt.ole.win32.OleClientSite - */ -public class Test_org_eclipse_swt_ole_win32_OleClientSite extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_ole_win32_OleClientSite(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_io_File() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_io_File not written"); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_lang_String() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_lang_String not written"); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_lang_StringLjava_io_File() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_lang_StringLjava_io_File not written"); -} - -public void test_deactivateInPlaceClient() { - warnUnimpl("Test test_deactivateInPlaceClient not written"); -} - -public void test_doVerbI() { - warnUnimpl("Test test_doVerbI not written"); -} - -public void test_execIILorg_eclipse_swt_ole_win32_VariantLorg_eclipse_swt_ole_win32_Variant() { - warnUnimpl("Test test_execIILorg_eclipse_swt_ole_win32_VariantLorg_eclipse_swt_ole_win32_Variant not written"); -} - -public void test_getIndent() { - warnUnimpl("Test test_getIndent not written"); -} - -public void test_getProgramID() { - warnUnimpl("Test test_getProgramID not written"); -} - -public void test_isDirty() { - warnUnimpl("Test test_isDirty not written"); -} - -public void test_isFocusControl() { - warnUnimpl("Test test_isFocusControl not written"); -} - -public void test_queryStatusI() { - warnUnimpl("Test test_queryStatusI not written"); -} - -public void test_saveLjava_io_FileZ() { - warnUnimpl("Test test_saveLjava_io_FileZ not written"); -} - -public void test_setIndentLorg_eclipse_swt_graphics_Rectangle() { - warnUnimpl("Test test_setIndentLorg_eclipse_swt_graphics_Rectangle not written"); -} - -public void test_showPropertiesLjava_lang_String() { - warnUnimpl("Test test_showPropertiesLjava_lang_String not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_ole_win32_OleClientSite((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_io_File"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_lang_String"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_lang_StringLjava_io_File"); - methodNames.addElement("test_deactivateInPlaceClient"); - methodNames.addElement("test_doVerbI"); - methodNames.addElement("test_execIILorg_eclipse_swt_ole_win32_VariantLorg_eclipse_swt_ole_win32_Variant"); - methodNames.addElement("test_getIndent"); - methodNames.addElement("test_getProgramID"); - methodNames.addElement("test_isDirty"); - methodNames.addElement("test_isFocusControl"); - methodNames.addElement("test_queryStatusI"); - methodNames.addElement("test_saveLjava_io_FileZ"); - methodNames.addElement("test_setIndentLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_showPropertiesLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_io_File")) test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_io_File(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_lang_String")) test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_lang_String(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_lang_StringLjava_io_File")) test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_lang_StringLjava_io_File(); - else if (getName().equals("test_deactivateInPlaceClient")) test_deactivateInPlaceClient(); - else if (getName().equals("test_doVerbI")) test_doVerbI(); - else if (getName().equals("test_execIILorg_eclipse_swt_ole_win32_VariantLorg_eclipse_swt_ole_win32_Variant")) test_execIILorg_eclipse_swt_ole_win32_VariantLorg_eclipse_swt_ole_win32_Variant(); - else if (getName().equals("test_getIndent")) test_getIndent(); - else if (getName().equals("test_getProgramID")) test_getProgramID(); - else if (getName().equals("test_isDirty")) test_isDirty(); - else if (getName().equals("test_isFocusControl")) test_isFocusControl(); - else if (getName().equals("test_queryStatusI")) test_queryStatusI(); - else if (getName().equals("test_saveLjava_io_FileZ")) test_saveLjava_io_FileZ(); - else if (getName().equals("test_setIndentLorg_eclipse_swt_graphics_Rectangle")) test_setIndentLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_showPropertiesLjava_lang_String")) test_showPropertiesLjava_lang_String(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleControlSite.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleControlSite.java deleted file mode 100644 index bb3e732f2e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleControlSite.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.ole.win32.OleControlSite - * - * @see org.eclipse.swt.ole.win32.OleControlSite - */ -public class Test_org_eclipse_swt_ole_win32_OleControlSite extends Test_org_eclipse_swt_ole_win32_OleClientSite { - -public Test_org_eclipse_swt_ole_win32_OleControlSite(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_lang_String() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_lang_String not written"); -} - -public void test_addEventListenerILorg_eclipse_swt_ole_win32_OleListener() { - warnUnimpl("Test test_addEventListenerILorg_eclipse_swt_ole_win32_OleListener not written"); -} - -public void test_addEventListenerLorg_eclipse_swt_ole_win32_OleAutomationILorg_eclipse_swt_ole_win32_OleListener() { - warnUnimpl("Test test_addEventListenerLorg_eclipse_swt_ole_win32_OleAutomationILorg_eclipse_swt_ole_win32_OleListener not written"); -} - -public void test_addPropertyListenerILorg_eclipse_swt_ole_win32_OleListener() { - warnUnimpl("Test test_addPropertyListenerILorg_eclipse_swt_ole_win32_OleListener not written"); -} - -public void test_getBackground() { - warnUnimpl("Test test_getBackground not written"); -} - -public void test_getFont() { - warnUnimpl("Test test_getFont not written"); -} - -public void test_getForeground() { - warnUnimpl("Test test_getForeground not written"); -} - -public void test_getSitePropertyI() { - warnUnimpl("Test test_getSitePropertyI not written"); -} - -public void test_removeEventListenerILorg_eclipse_swt_ole_win32_OleListener() { - warnUnimpl("Test test_removeEventListenerILorg_eclipse_swt_ole_win32_OleListener not written"); -} - -public void test_removeEventListenerLorg_eclipse_swt_ole_win32_OleAutomationILorg_eclipse_swt_ole_win32_OleListener() { - warnUnimpl("Test test_removeEventListenerLorg_eclipse_swt_ole_win32_OleAutomationILorg_eclipse_swt_ole_win32_OleListener not written"); -} - -public void test_removeEventListenerLorg_eclipse_swt_ole_win32_OleAutomationLorg_eclipse_swt_internal_ole_win32_GUIDILorg_eclipse_swt_ole_win32_OleListener() { - warnUnimpl("Test test_removeEventListenerLorg_eclipse_swt_ole_win32_OleAutomationLorg_eclipse_swt_internal_ole_win32_GUIDILorg_eclipse_swt_ole_win32_OleListener not written"); -} - -public void test_removePropertyListenerILorg_eclipse_swt_ole_win32_OleListener() { - warnUnimpl("Test test_removePropertyListenerILorg_eclipse_swt_ole_win32_OleListener not written"); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setBackgroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written"); -} - -public void test_setForegroundLorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setForegroundLorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setSitePropertyILorg_eclipse_swt_ole_win32_Variant() { - warnUnimpl("Test test_setSitePropertyILorg_eclipse_swt_ole_win32_Variant not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_ole_win32_OleControlSite((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_lang_String"); - methodNames.addElement("test_addEventListenerILorg_eclipse_swt_ole_win32_OleListener"); - methodNames.addElement("test_addEventListenerLorg_eclipse_swt_ole_win32_OleAutomationILorg_eclipse_swt_ole_win32_OleListener"); - methodNames.addElement("test_addPropertyListenerILorg_eclipse_swt_ole_win32_OleListener"); - methodNames.addElement("test_getBackground"); - methodNames.addElement("test_getFont"); - methodNames.addElement("test_getForeground"); - methodNames.addElement("test_getSitePropertyI"); - methodNames.addElement("test_removeEventListenerILorg_eclipse_swt_ole_win32_OleListener"); - methodNames.addElement("test_removeEventListenerLorg_eclipse_swt_ole_win32_OleAutomationILorg_eclipse_swt_ole_win32_OleListener"); - methodNames.addElement("test_removeEventListenerLorg_eclipse_swt_ole_win32_OleAutomationLorg_eclipse_swt_internal_ole_win32_GUIDILorg_eclipse_swt_ole_win32_OleListener"); - methodNames.addElement("test_removePropertyListenerILorg_eclipse_swt_ole_win32_OleListener"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setSitePropertyILorg_eclipse_swt_ole_win32_Variant"); - methodNames.addAll(Test_org_eclipse_swt_ole_win32_OleClientSite.methodNames()); // add superclass method names - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_lang_String")) test_ConstructorLorg_eclipse_swt_widgets_CompositeILjava_lang_String(); - else if (getName().equals("test_addEventListenerILorg_eclipse_swt_ole_win32_OleListener")) test_addEventListenerILorg_eclipse_swt_ole_win32_OleListener(); - else if (getName().equals("test_addEventListenerLorg_eclipse_swt_ole_win32_OleAutomationILorg_eclipse_swt_ole_win32_OleListener")) test_addEventListenerLorg_eclipse_swt_ole_win32_OleAutomationILorg_eclipse_swt_ole_win32_OleListener(); - else if (getName().equals("test_addPropertyListenerILorg_eclipse_swt_ole_win32_OleListener")) test_addPropertyListenerILorg_eclipse_swt_ole_win32_OleListener(); - else if (getName().equals("test_getBackground")) test_getBackground(); - else if (getName().equals("test_getFont")) test_getFont(); - else if (getName().equals("test_getForeground")) test_getForeground(); - else if (getName().equals("test_getSitePropertyI")) test_getSitePropertyI(); - else if (getName().equals("test_removeEventListenerILorg_eclipse_swt_ole_win32_OleListener")) test_removeEventListenerILorg_eclipse_swt_ole_win32_OleListener(); - else if (getName().equals("test_removeEventListenerLorg_eclipse_swt_ole_win32_OleAutomationILorg_eclipse_swt_ole_win32_OleListener")) test_removeEventListenerLorg_eclipse_swt_ole_win32_OleAutomationILorg_eclipse_swt_ole_win32_OleListener(); - else if (getName().equals("test_removeEventListenerLorg_eclipse_swt_ole_win32_OleAutomationLorg_eclipse_swt_internal_ole_win32_GUIDILorg_eclipse_swt_ole_win32_OleListener")) test_removeEventListenerLorg_eclipse_swt_ole_win32_OleAutomationLorg_eclipse_swt_internal_ole_win32_GUIDILorg_eclipse_swt_ole_win32_OleListener(); - else if (getName().equals("test_removePropertyListenerILorg_eclipse_swt_ole_win32_OleListener")) test_removePropertyListenerILorg_eclipse_swt_ole_win32_OleListener(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setSitePropertyILorg_eclipse_swt_ole_win32_Variant")) test_setSitePropertyILorg_eclipse_swt_ole_win32_Variant(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleEvent.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleEvent.java deleted file mode 100644 index 8ce7d71899..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleEvent.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.ole.win32.OleEvent - * - * @see org.eclipse.swt.ole.win32.OleEvent - */ -public class Test_org_eclipse_swt_ole_win32_OleEvent extends SwtTestCase { - -public Test_org_eclipse_swt_ole_win32_OleEvent(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_ole_win32_OleEvent((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleFrame.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleFrame.java deleted file mode 100644 index aa60372d45..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleFrame.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.ole.win32.OleFrame - * - * @see org.eclipse.swt.ole.win32.OleFrame - */ -public class Test_org_eclipse_swt_ole_win32_OleFrame extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_ole_win32_OleFrame(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_getContainerMenus() { - warnUnimpl("Test test_getContainerMenus not written"); -} - -public void test_getFileMenus() { - warnUnimpl("Test test_getFileMenus not written"); -} - -public void test_getWindowMenus() { - warnUnimpl("Test test_getWindowMenus not written"); -} - -public void test_setContainerMenus$Lorg_eclipse_swt_widgets_MenuItem() { - warnUnimpl("Test test_setContainerMenus$Lorg_eclipse_swt_widgets_MenuItem not written"); -} - -public void test_setFileMenus$Lorg_eclipse_swt_widgets_MenuItem() { - warnUnimpl("Test test_setFileMenus$Lorg_eclipse_swt_widgets_MenuItem not written"); -} - -public void test_setWindowMenus$Lorg_eclipse_swt_widgets_MenuItem() { - warnUnimpl("Test test_setWindowMenus$Lorg_eclipse_swt_widgets_MenuItem not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_ole_win32_OleFrame((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_getContainerMenus"); - methodNames.addElement("test_getFileMenus"); - methodNames.addElement("test_getWindowMenus"); - methodNames.addElement("test_setContainerMenus$Lorg_eclipse_swt_widgets_MenuItem"); - methodNames.addElement("test_setFileMenus$Lorg_eclipse_swt_widgets_MenuItem"); - methodNames.addElement("test_setWindowMenus$Lorg_eclipse_swt_widgets_MenuItem"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_getContainerMenus")) test_getContainerMenus(); - else if (getName().equals("test_getFileMenus")) test_getFileMenus(); - else if (getName().equals("test_getWindowMenus")) test_getWindowMenus(); - else if (getName().equals("test_setContainerMenus$Lorg_eclipse_swt_widgets_MenuItem")) test_setContainerMenus$Lorg_eclipse_swt_widgets_MenuItem(); - else if (getName().equals("test_setFileMenus$Lorg_eclipse_swt_widgets_MenuItem")) test_setFileMenus$Lorg_eclipse_swt_widgets_MenuItem(); - else if (getName().equals("test_setWindowMenus$Lorg_eclipse_swt_widgets_MenuItem")) test_setWindowMenus$Lorg_eclipse_swt_widgets_MenuItem(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleFunctionDescription.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleFunctionDescription.java deleted file mode 100644 index 88a7cc84c1..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleFunctionDescription.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.ole.win32.OleFunctionDescription - * - * @see org.eclipse.swt.ole.win32.OleFunctionDescription - */ -public class Test_org_eclipse_swt_ole_win32_OleFunctionDescription extends SwtTestCase { - -public Test_org_eclipse_swt_ole_win32_OleFunctionDescription(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_ole_win32_OleFunctionDescription((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleListener.java deleted file mode 100644 index 0631da45f6..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleListener.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.ole.win32.OleListener - * - * @see org.eclipse.swt.ole.win32.OleListener - */ -public class Test_org_eclipse_swt_ole_win32_OleListener extends SwtTestCase { - -public Test_org_eclipse_swt_ole_win32_OleListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_handleEventLorg_eclipse_swt_ole_win32_OleEvent() { - warnUnimpl("Test test_handleEventLorg_eclipse_swt_ole_win32_OleEvent not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_ole_win32_OleListener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_handleEventLorg_eclipse_swt_ole_win32_OleEvent"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_handleEventLorg_eclipse_swt_ole_win32_OleEvent")) test_handleEventLorg_eclipse_swt_ole_win32_OleEvent(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleParameterDescription.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleParameterDescription.java deleted file mode 100644 index 55cfecea52..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OleParameterDescription.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.ole.win32.OleParameterDescription - * - * @see org.eclipse.swt.ole.win32.OleParameterDescription - */ -public class Test_org_eclipse_swt_ole_win32_OleParameterDescription extends SwtTestCase { - -public Test_org_eclipse_swt_ole_win32_OleParameterDescription(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_ole_win32_OleParameterDescription((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OlePropertyDescription.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OlePropertyDescription.java deleted file mode 100644 index 630e6d2987..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_OlePropertyDescription.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.ole.win32.OlePropertyDescription - * - * @see org.eclipse.swt.ole.win32.OlePropertyDescription - */ -public class Test_org_eclipse_swt_ole_win32_OlePropertyDescription extends SwtTestCase { - -public Test_org_eclipse_swt_ole_win32_OlePropertyDescription(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_ole_win32_OlePropertyDescription((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_Variant.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_Variant.java deleted file mode 100644 index 98970c255b..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_ole_win32_Variant.java +++ /dev/null @@ -1,205 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.ole.win32.Variant - * - * @see org.eclipse.swt.ole.win32.Variant - */ -public class Test_org_eclipse_swt_ole_win32_Variant extends SwtTestCase { - -public Test_org_eclipse_swt_ole_win32_Variant(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_ConstructorF() { - warnUnimpl("Test test_ConstructorF not written"); -} - -public void test_ConstructorI() { - warnUnimpl("Test test_ConstructorI not written"); -} - -public void test_ConstructorIS() { - warnUnimpl("Test test_ConstructorIS not written"); -} - -public void test_ConstructorLjava_lang_String() { - warnUnimpl("Test test_ConstructorLjava_lang_String not written"); -} - -public void test_ConstructorLorg_eclipse_swt_internal_ole_win32_IDispatch() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_internal_ole_win32_IDispatch not written"); -} - -public void test_ConstructorLorg_eclipse_swt_internal_ole_win32_IUnknown() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_internal_ole_win32_IUnknown not written"); -} - -public void test_ConstructorLorg_eclipse_swt_ole_win32_OleAutomation() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_ole_win32_OleAutomation not written"); -} - -public void test_ConstructorS() { - warnUnimpl("Test test_ConstructorS not written"); -} - -public void test_ConstructorZ() { - warnUnimpl("Test test_ConstructorZ not written"); -} - -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_getAutomation() { - warnUnimpl("Test test_getAutomation not written"); -} - -public void test_getBoolean() { - warnUnimpl("Test test_getBoolean not written"); -} - -public void test_getByRef() { - warnUnimpl("Test test_getByRef not written"); -} - -public void test_getDispatch() { - warnUnimpl("Test test_getDispatch not written"); -} - -public void test_getFloat() { - warnUnimpl("Test test_getFloat not written"); -} - -public void test_getInt() { - warnUnimpl("Test test_getInt not written"); -} - -public void test_getShort() { - warnUnimpl("Test test_getShort not written"); -} - -public void test_getString() { - warnUnimpl("Test test_getString not written"); -} - -public void test_getType() { - warnUnimpl("Test test_getType not written"); -} - -public void test_getUnknown() { - warnUnimpl("Test test_getUnknown not written"); -} - -public void test_setByRefF() { - warnUnimpl("Test test_setByRefF not written"); -} - -public void test_setByRefI() { - warnUnimpl("Test test_setByRefI not written"); -} - -public void test_setByRefS() { - warnUnimpl("Test test_setByRefS not written"); -} - -public void test_setByRefZ() { - warnUnimpl("Test test_setByRefZ not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_ole_win32_Variant((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorF"); - methodNames.addElement("test_ConstructorI"); - methodNames.addElement("test_ConstructorIS"); - methodNames.addElement("test_ConstructorLjava_lang_String"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_internal_ole_win32_IDispatch"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_internal_ole_win32_IUnknown"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_ole_win32_OleAutomation"); - methodNames.addElement("test_ConstructorS"); - methodNames.addElement("test_ConstructorZ"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getAutomation"); - methodNames.addElement("test_getBoolean"); - methodNames.addElement("test_getByRef"); - methodNames.addElement("test_getDispatch"); - methodNames.addElement("test_getFloat"); - methodNames.addElement("test_getInt"); - methodNames.addElement("test_getShort"); - methodNames.addElement("test_getString"); - methodNames.addElement("test_getType"); - methodNames.addElement("test_getUnknown"); - methodNames.addElement("test_setByRefF"); - methodNames.addElement("test_setByRefI"); - methodNames.addElement("test_setByRefS"); - methodNames.addElement("test_setByRefZ"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorF")) test_ConstructorF(); - else if (getName().equals("test_ConstructorI")) test_ConstructorI(); - else if (getName().equals("test_ConstructorIS")) test_ConstructorIS(); - else if (getName().equals("test_ConstructorLjava_lang_String")) test_ConstructorLjava_lang_String(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_internal_ole_win32_IDispatch")) test_ConstructorLorg_eclipse_swt_internal_ole_win32_IDispatch(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_internal_ole_win32_IUnknown")) test_ConstructorLorg_eclipse_swt_internal_ole_win32_IUnknown(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_ole_win32_OleAutomation")) test_ConstructorLorg_eclipse_swt_ole_win32_OleAutomation(); - else if (getName().equals("test_ConstructorS")) test_ConstructorS(); - else if (getName().equals("test_ConstructorZ")) test_ConstructorZ(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getAutomation")) test_getAutomation(); - else if (getName().equals("test_getBoolean")) test_getBoolean(); - else if (getName().equals("test_getByRef")) test_getByRef(); - else if (getName().equals("test_getDispatch")) test_getDispatch(); - else if (getName().equals("test_getFloat")) test_getFloat(); - else if (getName().equals("test_getInt")) test_getInt(); - else if (getName().equals("test_getShort")) test_getShort(); - else if (getName().equals("test_getString")) test_getString(); - else if (getName().equals("test_getType")) test_getType(); - else if (getName().equals("test_getUnknown")) test_getUnknown(); - else if (getName().equals("test_setByRefF")) test_setByRefF(); - else if (getName().equals("test_setByRefI")) test_setByRefI(); - else if (getName().equals("test_setByRefS")) test_setByRefS(); - else if (getName().equals("test_setByRefZ")) test_setByRefZ(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrintDialog.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrintDialog.java deleted file mode 100644 index 847425e43b..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrintDialog.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.printing.*; - -/** - * Automated Test Suite for class org.eclipse.swt.printing.PrintDialog - * - * @see org.eclipse.swt.printing.PrintDialog - */ -public class Test_org_eclipse_swt_printing_PrintDialog extends Test_org_eclipse_swt_widgets_Dialog { - -public Test_org_eclipse_swt_printing_PrintDialog(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - printDialog = new PrintDialog(shell, SWT.NONE); - setDialog(printDialog); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Shell() { - new PrintDialog(shell); - - try { - new PrintDialog(null); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() { - new PrintDialog(shell, SWT.NONE); - - try { - new PrintDialog(null, SWT.NONE); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_getEndPage() { - warnUnimpl("Test test_getEndPage not written"); -} - -public void test_getPrintToFile() { - warnUnimpl("Test test_getPrintToFile not written"); -} - -public void test_getScope() { - warnUnimpl("Test test_getScope not written"); -} - -public void test_getStartPage() { - warnUnimpl("Test test_getStartPage not written"); -} - -public void test_open() { - warnUnimpl("Test test_open not written"); -} - -public void test_setEndPageI() { - warnUnimpl("Test test_setEndPageI not written"); -} - -public void test_setPrintToFileZ() { - warnUnimpl("Test test_setPrintToFileZ not written"); -} - -public void test_setScopeI() { - warnUnimpl("Test test_setScopeI not written"); -} - -public void test_setStartPageI() { - warnUnimpl("Test test_setStartPageI not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_printing_PrintDialog((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI"); - methodNames.addElement("test_getEndPage"); - methodNames.addElement("test_getPrintToFile"); - methodNames.addElement("test_getScope"); - methodNames.addElement("test_getStartPage"); - methodNames.addElement("test_open"); - methodNames.addElement("test_setEndPageI"); - methodNames.addElement("test_setPrintToFileZ"); - methodNames.addElement("test_setScopeI"); - methodNames.addElement("test_setStartPageI"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI(); - else if (getName().equals("test_getEndPage")) test_getEndPage(); - else if (getName().equals("test_getPrintToFile")) test_getPrintToFile(); - else if (getName().equals("test_getScope")) test_getScope(); - else if (getName().equals("test_getStartPage")) test_getStartPage(); - else if (getName().equals("test_open")) test_open(); - else if (getName().equals("test_setEndPageI")) test_setEndPageI(); - else if (getName().equals("test_setPrintToFileZ")) test_setPrintToFileZ(); - else if (getName().equals("test_setScopeI")) test_setScopeI(); - else if (getName().equals("test_setStartPageI")) test_setStartPageI(); - else super.runTest(); -} - -/* custom */ - PrintDialog printDialog; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_Printer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_Printer.java deleted file mode 100644 index d8dfc0de5f..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_Printer.java +++ /dev/null @@ -1,252 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.printing.*; - -/** - * Automated Test Suite for class org.eclipse.swt.printing.Printer - * - * @see org.eclipse.swt.printing.Printer - */ -public class Test_org_eclipse_swt_printing_Printer extends Test_org_eclipse_swt_graphics_Device { - -public Test_org_eclipse_swt_printing_Printer(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_Constructor() { - boolean exceptionThrown = false; - String detail = ""; - if (Printer.getDefaultPrinterData() == null) { - /* There aren't any printers, so verify that the - * constructor throws an ERROR_NO_HANDLES SWTError. - */ - try { - Printer printer = new Printer(); - printer.dispose(); - } catch (SWTError ex) { - if (ex.code == SWT.ERROR_NO_HANDLES) exceptionThrown = true; - } - assertTrue("ERROR_NO_HANDLES not thrown", exceptionThrown); - } else { - /* There is at least a default printer, so verify that - * the constructor does not throw any exceptions. - */ - try { - Printer printer = new Printer(); - printer.dispose(); - } catch (Throwable ex) { - exceptionThrown = true; - detail = ex.getMessage(); - } - assertFalse("Exception thrown: " + detail, exceptionThrown); - } -} - -public void test_ConstructorLorg_eclipse_swt_printing_PrinterData() { - boolean exceptionThrown = false; - String detail = ""; - PrinterData data = Printer.getDefaultPrinterData(); - if (data == null) { - /* There aren't any printers, so verify that the - * constructor throws an ERROR_NO_HANDLES SWTError. - */ - try { - Printer printer = new Printer(data); - printer.dispose(); - } catch (SWTError ex) { - if (ex.code == SWT.ERROR_NO_HANDLES) exceptionThrown = true; - } - assertTrue("ERROR_NO_HANDLES not thrown", exceptionThrown); - } else { - /* There is at least a default printer, so verify that - * the constructor does not throw any exceptions. - */ - try { - Printer printer = new Printer(data); - printer.dispose(); - } catch (Throwable ex) { - exceptionThrown = true; - detail = ex.getMessage(); - } - assertFalse("Exception thrown: " + detail, exceptionThrown); - } -} - -public void test_cancelJob() { - warnUnimpl("Test test_cancelJob not written"); -} - -public void test_computeTrimIIII() { - PrinterData data = Printer.getDefaultPrinterData(); - // if there aren't any printers, don't do this test - if (data == null) return; - Printer printer = new Printer(data); - Rectangle trim = printer.computeTrim(0, 0, 10, 10); - assertTrue("trim width or height is incorrect", trim.width >= 10 && trim.height >= 10); - printer.dispose(); -} - -public void test_endJob() { - warnUnimpl("Test test_endJob not written"); -} - -public void test_endPage() { - warnUnimpl("Test test_endPage not written"); -} - -public void test_getBounds() { - PrinterData data = Printer.getDefaultPrinterData(); - // if there aren't any printers, don't do this test - if (data == null) return; - Printer printer = new Printer(data); - Rectangle bounds = printer.getBounds(); - assertTrue("bounds width or height is zero", bounds.width > 0 && bounds.height > 0); - printer.dispose(); -} - -public void test_getClientArea() { - PrinterData data = Printer.getDefaultPrinterData(); - // if there aren't any printers, don't do this test - if (data == null) return; - Printer printer = new Printer(data); - Rectangle clientArea = printer.getClientArea(); - assertTrue("clientArea width or height is zero", clientArea.width > 0 && clientArea.height > 0); - printer.dispose(); -} - -public void test_getDPI() { - PrinterData data = Printer.getDefaultPrinterData(); - // if there aren't any printers, don't do this test - if (data == null) return; - Printer printer = new Printer(data); - Point dpi = printer.getDPI(); - assertTrue("dpi x or y is zero", dpi.x > 0 && dpi.y > 0); - printer.dispose(); -} - -public void test_getDefaultPrinterData() { - // Tested in test_getPrinterData. -} - -public void test_getPrinterData() { - PrinterData data = Printer.getDefaultPrinterData(); - // if there aren't any printers, don't do this test - if (data == null) return; - Printer printer = new Printer(data); - assertTrue("getPrinterData != data used in constructor", - data == printer.getPrinterData()); - printer.dispose(); -} - -public void test_getPrinterList() { - PrinterData data = Printer.getDefaultPrinterData(); - if (data == null) { - /* If there aren't any printers, verify that the - * printer list is empty. - */ - PrinterData list[] = Printer.getPrinterList(); - assertTrue("printer list contains items even though there are no printers", - list.length == 0); - } else { - /* If there is at least a default printer, verify - * that the printer list is not empty. - */ - PrinterData list[] = Printer.getPrinterList(); - assertTrue("printer list is empty", list.length > 0); - } -} - -public void test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData() { - warnUnimpl("Test test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData not written"); -} - -public void test_internal_new_GCLorg_eclipse_swt_graphics_GCData() { - warnUnimpl("Test test_internal_new_GCLorg_eclipse_swt_graphics_GCData not written"); -} - -public void test_startJobLjava_lang_String() { - warnUnimpl("Test test_startJobLjava_lang_String not written"); -} - -public void test_startPage() { - warnUnimpl("Test test_startPage not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_printing_Printer((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_printing_PrinterData"); - methodNames.addElement("test_cancelJob"); - methodNames.addElement("test_computeTrimIIII"); - methodNames.addElement("test_endJob"); - methodNames.addElement("test_endPage"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_getDPI"); - methodNames.addElement("test_getDefaultPrinterData"); - methodNames.addElement("test_getPrinterData"); - methodNames.addElement("test_getPrinterList"); - methodNames.addElement("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_internal_new_GCLorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_startJobLjava_lang_String"); - methodNames.addElement("test_startPage"); - methodNames.addAll(Test_org_eclipse_swt_graphics_Device.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_printing_PrinterData")) test_ConstructorLorg_eclipse_swt_printing_PrinterData(); - else if (getName().equals("test_cancelJob")) test_cancelJob(); - else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII(); - else if (getName().equals("test_endJob")) test_endJob(); - else if (getName().equals("test_endPage")) test_endPage(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_getDPI")) test_getDPI(); - else if (getName().equals("test_getDefaultPrinterData")) test_getDefaultPrinterData(); - else if (getName().equals("test_getPrinterData")) test_getPrinterData(); - else if (getName().equals("test_getPrinterList")) test_getPrinterList(); - else if (getName().equals("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData")) test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_internal_new_GCLorg_eclipse_swt_graphics_GCData")) test_internal_new_GCLorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_startJobLjava_lang_String")) test_startJobLjava_lang_String(); - else if (getName().equals("test_startPage")) test_startPage(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrinterData.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrinterData.java deleted file mode 100644 index db6eef3eb7..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_printing_PrinterData.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.printing.*; - -/** - * Automated Test Suite for class org.eclipse.swt.printing.PrinterData - * - * @see org.eclipse.swt.printing.PrinterData - */ -public class Test_org_eclipse_swt_printing_PrinterData extends Test_org_eclipse_swt_graphics_DeviceData { - -public Test_org_eclipse_swt_printing_PrinterData(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_Constructor() { - PrinterData data = new PrinterData(); -} - -public void test_ConstructorLjava_lang_StringLjava_lang_String() { - PrinterData data = new PrinterData("hello", "there"); -} - -public void test_toString() { - PrinterData data = new PrinterData(); - assertNotNull(data.toString()); - assertTrue(data.toString().length() > 0); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_printing_PrinterData((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorLjava_lang_StringLjava_lang_String"); - methodNames.addElement("test_toString"); - methodNames.addAll(Test_org_eclipse_swt_graphics_DeviceData.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorLjava_lang_StringLjava_lang_String")) test_ConstructorLjava_lang_StringLjava_lang_String(); - else if (getName().equals("test_toString")) test_toString(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_program_Program.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_program_Program.java deleted file mode 100644 index b57ef0aa60..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_program_Program.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.program.Program - * - * @see org.eclipse.swt.program.Program - */ -public class Test_org_eclipse_swt_program_Program extends SwtTestCase { - -public Test_org_eclipse_swt_program_Program(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_equalsLjava_lang_Object() { - warnUnimpl("Test test_equalsLjava_lang_Object not written"); -} - -public void test_executeLjava_lang_String() { - warnUnimpl("Test test_executeLjava_lang_String not written"); -} - -public void test_findProgramLjava_lang_String() { - warnUnimpl("Test test_findProgramLjava_lang_String not written"); -} - -public void test_getExtensions() { - warnUnimpl("Test test_getExtensions not written"); -} - -public void test_getImageData() { - warnUnimpl("Test test_getImageData not written"); -} - -public void test_getName() { - warnUnimpl("Test test_getName not written"); -} - -public void test_getPrograms() { - warnUnimpl("Test test_getPrograms not written"); -} - -public void test_hashCode() { - warnUnimpl("Test test_hashCode not written"); -} - -public void test_launchLjava_lang_String() { - warnUnimpl("Test test_launchLjava_lang_String not written"); -} - -public void test_toString() { - warnUnimpl("Test test_toString not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_program_Program((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_executeLjava_lang_String"); - methodNames.addElement("test_findProgramLjava_lang_String"); - methodNames.addElement("test_getExtensions"); - methodNames.addElement("test_getImageData"); - methodNames.addElement("test_getName"); - methodNames.addElement("test_getPrograms"); - methodNames.addElement("test_hashCode"); - methodNames.addElement("test_launchLjava_lang_String"); - methodNames.addElement("test_toString"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_executeLjava_lang_String")) test_executeLjava_lang_String(); - else if (getName().equals("test_findProgramLjava_lang_String")) test_findProgramLjava_lang_String(); - else if (getName().equals("test_getExtensions")) test_getExtensions(); - else if (getName().equals("test_getImageData")) test_getImageData(); - else if (getName().equals("test_getName")) test_getName(); - else if (getName().equals("test_getPrograms")) test_getPrograms(); - else if (getName().equals("test_hashCode")) test_hashCode(); - else if (getName().equals("test_launchLjava_lang_String")) test_launchLjava_lang_String(); - else if (getName().equals("test_toString")) test_toString(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java deleted file mode 100644 index 450630ab34..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Button.java +++ /dev/null @@ -1,305 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Button - * - * @see org.eclipse.swt.widgets.Button - */ -public class Test_org_eclipse_swt_widgets_Button extends Test_org_eclipse_swt_widgets_Control { - -Button button; - -public Test_org_eclipse_swt_widgets_Button(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - button = new Button(shell, SWT.PUSH); - setWidget(button); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - // Test Button(Composite parent, int style) - Button button = new Button(shell, SWT.NULL); - - button = new Button(shell, SWT.PUSH); - - button = new Button(shell, SWT.CHECK); - - button = new Button(shell, SWT.TOGGLE); - - button = new Button(shell, SWT.ARROW); - - button = new Button(shell, SWT.PUSH | SWT.CHECK); - - try { - button = new Button(null, 0); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - listenerCalled = false; - SelectionListener listener = new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - listenerCalled = true; - }; - public void widgetDefaultSelected(SelectionEvent e) { - }; - }; - - try { - button.addSelectionListener(null); - fail("No exception thrown for addSelectionListener with null argument"); - } catch (IllegalArgumentException e) { - } - - button.addSelectionListener(listener); - button.notifyListeners(SWT.Selection, new Event()); - assertTrue(listenerCalled); - - try { - button.removeSelectionListener(null); - fail("No exception thrown for removeSelectionListener with null argument"); - } catch (IllegalArgumentException e) { - } - listenerCalled = false; - button.removeSelectionListener(listener); - button.notifyListeners(SWT.Selection, new Event()); - assertFalse(listenerCalled); -} - -public void test_computeSizeIIZ() { - button.computeSize(0, 0); - - button.computeSize(0, 0, false); - - button.computeSize(-10, -10); - - button.computeSize(-10, -10, false); - - button.computeSize(10, 10); - - button.computeSize(10, 10, false); - - button.computeSize(10000, 10000); - - button.computeSize(10000, 10000, false); -} - -public void test_getAlignment() { - // tested in test_setAlignmentI() -} - -public void test_getImage() { - // tested in test_setImageLorg_eclipse_swt_graphics_Image -} - -public void test_getSelection() { - // tested in test_setSelectionZ -} - -public void test_getText() { - // tested in test_setTextLjava_lang_String() -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - // tested in test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() -} - -public void test_setAlignmentI() { - button.setAlignment(SWT.LEFT); - assertEquals(SWT.LEFT, button.getAlignment()); - - button.setAlignment(SWT.RIGHT); - assertEquals(SWT.RIGHT, button.getAlignment()); - - button.setAlignment(SWT.CENTER); - assertEquals(SWT.CENTER, button.getAlignment()); - - button.setAlignment(SWT.UP); // bad value for push button - assertTrue(SWT.UP != button.getAlignment()); - - Button arrowButton = new Button(shell, SWT.ARROW); - arrowButton.setAlignment(SWT.LEFT); - assertEquals(SWT.LEFT, arrowButton.getAlignment()); - - arrowButton.setAlignment(SWT.RIGHT); - assertEquals(SWT.RIGHT, arrowButton.getAlignment()); - - arrowButton.setAlignment(SWT.UP); - assertEquals(SWT.UP, arrowButton.getAlignment()); - - arrowButton.setAlignment(SWT.DOWN); - assertEquals(SWT.DOWN, arrowButton.getAlignment()); - - arrowButton.setAlignment(SWT.CENTER); // bad value for arrow button - assertTrue(SWT.CENTER != arrowButton.getAlignment()); - arrowButton.dispose(); - - int alignment = 55; // some bogus number - button.setAlignment(alignment); - assertTrue(alignment != button.getAlignment()); -} - -public void test_setFocus() { - Button btn = new Button(shell, SWT.ARROW); - btn.setFocus(); -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - Image image = button.getImage(); - button.setImage(image); - assertEquals(image, button.getImage()); - - button.setImage(null); - assertNull(button.getImage()); - - image = new Image(shell.getDisplay(), 10, 10); - button.setImage(image); - assertEquals(image, button.getImage()); - - button.setImage(null); - image.dispose(); - try { - button.setImage(image); - button.setImage(null); - fail("No exception thrown for disposed image"); - } catch (IllegalArgumentException e) { - } -} - -public void test_setSelectionZ() { - // test setSelection for check box - button = new Button(shell, SWT.CHECK); - button.setSelection(true); - assertTrue(button.getSelection()); - button.setSelection(false); - assertTrue(!button.getSelection()); - - // test setSelection for arrow button - Button newButton = new Button(shell, SWT.ARROW); - newButton.setSelection(true); - assertTrue(!newButton.getSelection()); - newButton.setSelection(false); - assertTrue(!newButton.getSelection()); - newButton.dispose(); - - // test setSelection for push button - newButton = new Button(shell, SWT.PUSH); - newButton.setSelection(true); - assertTrue(!newButton.getSelection()); - newButton.setSelection(false); - assertTrue(!newButton.getSelection()); - newButton.dispose(); - - // test setSelection for radio button - newButton = new Button(shell, SWT.RADIO); - newButton.setSelection(true); - assertTrue(newButton.getSelection()); - newButton.setSelection(false); - assertTrue(!newButton.getSelection()); - newButton.dispose(); - - // test setSelection for toggle button - newButton = new Button(shell, SWT.TOGGLE); - newButton.setSelection(true); - assertTrue(newButton.getSelection()); - newButton.setSelection(false); - assertTrue(!newButton.getSelection()); - newButton.dispose(); -} - -public void test_setTextLjava_lang_String() { - String[] cases = {"", "some text", "ldkashdoehufweovcnhslvhregojebckreavbkuhxbiufvcyhbifuyewvbiureyd.,cmnesljliewjfchvbwoifivbeworixuieurvbiuvbohflksjeahfcliureafgyciabelitvyrwtlicuyrtliureybcliuyreuceyvbliureybct", "\n \n \b \t ", "\0"}; - int goodCases = 4; - for (int i=0; i<goodCases; i++){ - button.setText(cases[i]); - assertTrue("good case: " + String.valueOf(i), button.getText().equals(cases[i])); - }; - - try { - button.setText(null); - fail("No exception thrown for text == null"); - } - catch (IllegalArgumentException e) { - } - - button.setText(""); - - button.setText("some name "); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Button((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getAlignment"); - methodNames.addElement("test_getImage"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_setAlignmentI"); - methodNames.addElement("test_setFocus"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setSelectionZ"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getAlignment")) test_getAlignment(); - else if (getName().equals("test_getImage")) test_getImage(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_setAlignmentI")) test_setAlignmentI(); - else if (getName().equals("test_setFocus")) test_setFocus(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setSelectionZ")) test_setSelectionZ(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else super.runTest(); -} -} 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 deleted file mode 100644 index 4c8dff2e72..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Canvas.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Canvas - * - * @see org.eclipse.swt.widgets.Canvas - */ -public class Test_org_eclipse_swt_widgets_Canvas extends Test_org_eclipse_swt_widgets_Composite { - -Canvas canvas; - -public Test_org_eclipse_swt_widgets_Canvas(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - canvas = new Canvas(shell, 0); - super.setWidget(canvas); -} - -protected void tearDown() { - super.tearDown(); -} - -protected void setWidget(Widget w) { - if (!canvas.isDisposed()) - canvas.dispose(); - canvas = (Canvas)w; - super.setWidget(w); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - Canvas newCanvas; - try { - newCanvas = new Canvas(null, SWT.NONE); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_getCaret() { - // tested in test_setCaretLorg_eclipse_swt_widgets_Caret -} - -public void test_scrollIIIIIIZ() { - warnUnimpl("Test test_scrollIIIIIIZ not written"); -} - -public void test_setCaretLorg_eclipse_swt_widgets_Caret() { - int number = 5; - Caret[] carets = new Caret[number]; - for (int i = 0; i < number; i++) { - carets[i] = new Caret(canvas, SWT.NONE); - } - for (int i = 0; i < number; i++) { - canvas.setCaret(carets[i]); - assertEquals("Caret # " + i + "not set properly", canvas.getCaret(), carets[i]); - } - - canvas.setCaret(null); - assertNull("Caret should be null" , canvas.getCaret()); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - FontData fontData = canvas.getFont().getFontData()[0]; - 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(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Canvas((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_getCaret"); - methodNames.addElement("test_scrollIIIIIIZ"); - methodNames.addElement("test_setCaretLorg_eclipse_swt_widgets_Caret"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_getCaret")) test_getCaret(); - else if (getName().equals("test_scrollIIIIIIZ")) test_scrollIIIIIIZ(); - else if (getName().equals("test_setCaretLorg_eclipse_swt_widgets_Caret")) test_setCaretLorg_eclipse_swt_widgets_Caret(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else super.runTest(); -} -} 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 deleted file mode 100644 index b7bb9b4d4c..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Caret.java +++ /dev/null @@ -1,251 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Caret - * - * @see org.eclipse.swt.widgets.Caret - */ -public class Test_org_eclipse_swt_widgets_Caret extends Test_org_eclipse_swt_widgets_Widget { - -Canvas canvas; -Caret caret; - -public Test_org_eclipse_swt_widgets_Caret(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - canvas = new Canvas(shell, SWT.NULL); - caret = new Caret(canvas, SWT.NULL); - setWidget(caret); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CanvasI() { - Caret newCaret; - try { - newCaret = new Caret(null, 0); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_getBounds() { - Rectangle rect = new Rectangle(0,0,30,30); - caret.setBounds(rect); - assertTrue(caret.getBounds().equals(rect)); - - rect = new Rectangle(0,0,30,30); - caret.setBounds(rect); - assertTrue(!caret.getBounds().equals(new Rectangle (0,0,60,70))); -} - -public void test_getFont() { - // tested in test_setFontLorg_eclipse_swt_graphics_Font -} - -public void test_getImage() { - // tested in test_setImageLorg_eclipse_swt_graphics_Image -} - -public void test_getLocation() { - warnUnimpl("Test test_getLocation not written"); -} - -public void test_getParent() { - assertEquals(canvas, caret.getParent()); - - assertTrue(caret.getDisplay()==shell.getDisplay()); -} - -public void test_getSize() { - warnUnimpl("Test test_getSize not written"); -} - -public void test_getVisible() { - // tested in test_setVisibleZ -} - -public void test_isVisible() { - caret.setVisible(true); - assertTrue(!caret.isVisible()); //because the shell is not visible - - caret.setVisible(false); - assertTrue(!caret.isVisible()); - - caret.setVisible(true); - canvas.setVisible(true); - shell.setVisible(true); - assertTrue(caret.getVisible() == true); - canvas.setVisible(false); - if (fCheckVisibility) { - assertTrue(!caret.getVisible()); - } - - shell.setVisible(false); - canvas.setVisible(false); - caret.setVisible(false); - assertTrue(!caret.getVisible()); -} - -public void test_setBoundsIIII() { - caret.setBounds(0, 0, 30, 30); -} - -public void test_setBoundsLorg_eclipse_swt_graphics_Rectangle() { - caret.setBounds(new Rectangle(0,0,30,30)); - - try { - caret.setBounds(null); - fail("No exception thrown for bounds == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - Font font = caret.getFont(); - caret.setFont(font); - assertEquals(font, caret.getFont()); - caret.setFont(null); - - font = new Font(caret.getDisplay(), SwtJunit.testFontName, 10, SWT.NORMAL); - caret.setFont(font); - assertEquals(font, caret.getFont()); - - caret.setFont(null); - font.dispose(); - try { - caret.setFont(font); - caret.setFont(null); - fail("No exception thrown for disposed font"); - } catch (IllegalArgumentException e) { - } -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - Image image = caret.getImage(); - caret.setImage(image); - assertEquals(image, caret.getImage()); - - caret.setImage(null); - assertNull(caret.getImage()); - - image = new Image(shell.getDisplay(), 10, 10); - caret.setImage(image); - assertEquals(image, caret.getImage()); - - caret.setImage(null); - image.dispose(); - try { - caret.setImage(image); - caret.setImage(null); - fail("No exception thrown for disposed image"); - } catch (IllegalArgumentException e) { - } -} - -public void test_setLocationII() { - warnUnimpl("Test test_setLocationII not written"); -} - -public void test_setLocationLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_setLocationLorg_eclipse_swt_graphics_Point not written"); -} - -public void test_setSizeII() { - warnUnimpl("Test test_setSizeII not written"); -} - -public void test_setSizeLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_setSizeLorg_eclipse_swt_graphics_Point not written"); -} - -public void test_setVisibleZ() { - caret.setVisible(true); - assertTrue("Caret should be visible", caret.getVisible()==true); - - caret.setVisible(false); - assertTrue("Caret should not be visible", caret.getVisible()==false); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Caret((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CanvasI"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getFont"); - methodNames.addElement("test_getImage"); - methodNames.addElement("test_getLocation"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getSize"); - methodNames.addElement("test_getVisible"); - methodNames.addElement("test_isVisible"); - methodNames.addElement("test_setBoundsIIII"); - methodNames.addElement("test_setBoundsLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setLocationII"); - methodNames.addElement("test_setLocationLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setSizeII"); - methodNames.addElement("test_setSizeLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setVisibleZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CanvasI")) test_ConstructorLorg_eclipse_swt_widgets_CanvasI(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getFont")) test_getFont(); - else if (getName().equals("test_getImage")) test_getImage(); - else if (getName().equals("test_getLocation")) test_getLocation(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getSize")) test_getSize(); - else if (getName().equals("test_getVisible")) test_getVisible(); - else if (getName().equals("test_isVisible")) test_isVisible(); - else if (getName().equals("test_setBoundsIIII")) test_setBoundsIIII(); - else if (getName().equals("test_setBoundsLorg_eclipse_swt_graphics_Rectangle")) test_setBoundsLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setLocationII")) test_setLocationII(); - else if (getName().equals("test_setLocationLorg_eclipse_swt_graphics_Point")) test_setLocationLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setSizeII")) test_setSizeII(); - else if (getName().equals("test_setSizeLorg_eclipse_swt_graphics_Point")) test_setSizeLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setVisibleZ")) test_setVisibleZ(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ColorDialog.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ColorDialog.java deleted file mode 100644 index 5118ef40ae..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ColorDialog.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.ColorDialog - * - * @see org.eclipse.swt.widgets.ColorDialog - */ -public class Test_org_eclipse_swt_widgets_ColorDialog extends Test_org_eclipse_swt_widgets_Dialog { - -ColorDialog colorDialog; - -public Test_org_eclipse_swt_widgets_ColorDialog(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - colorDialog = new ColorDialog(shell, SWT.NULL); - setDialog(colorDialog); -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Shell() { - new ColorDialog(shell); - - try { - new ColorDialog(null); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() { - new ColorDialog(shell, SWT.NULL); - - try { - new ColorDialog(null, SWT.NULL); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_getRGB() { - // tested in test_setRGBLorg_eclipse_swt_graphics_RGB -} - -public void test_open() { - warnUnimpl("Test test_open not written"); -} - -public void test_setRGBLorg_eclipse_swt_graphics_RGB() { - RGB rgb = new RGB(0, 0, 0); - - assertTrue(":a:", colorDialog.getRGB() == null); - - colorDialog.setRGB(rgb); - assertTrue(":b:", colorDialog.getRGB() == rgb); - - colorDialog.setRGB(null); - assertTrue(":c:", colorDialog.getRGB() == null); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_ColorDialog((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI"); - methodNames.addElement("test_getRGB"); - methodNames.addElement("test_open"); - methodNames.addElement("test_setRGBLorg_eclipse_swt_graphics_RGB"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI(); - else if (getName().equals("test_getRGB")) test_getRGB(); - else if (getName().equals("test_open")) test_open(); - else if (getName().equals("test_setRGBLorg_eclipse_swt_graphics_RGB")) test_setRGBLorg_eclipse_swt_graphics_RGB(); - else super.runTest(); -} -} 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 deleted file mode 100644 index 0546ba6155..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Combo.java +++ /dev/null @@ -1,908 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Combo - * - * @see org.eclipse.swt.widgets.Combo - */ -public class Test_org_eclipse_swt_widgets_Combo extends Test_org_eclipse_swt_widgets_Composite { - - Combo combo; - -public Test_org_eclipse_swt_widgets_Combo(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - combo = new Combo(shell, 0); - setWidget(combo); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - try { - combo = new Combo(null, 0); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } - - int[] cases = {SWT.DROP_DOWN, SWT.SIMPLE}; - for (int i = 0; i < cases.length; i++) { - combo = new Combo(shell, cases[i]); - assertTrue(":a:" + String.valueOf(i), (combo.getStyle() & cases[i]) == cases[i]); - } -} - -public void test_addLjava_lang_String() { - try { - combo.add(null); - fail("No exception thrown for item == null"); - } - catch (IllegalArgumentException e) { - } - - combo.add(""); - assertEquals(":a:", new String[]{""}, combo.getItems()); - combo.add(""); - assertEquals(":b:", new String[]{"", ""}, combo.getItems()); - combo.add("fred"); - assertEquals(":c:", new String[]{"", "", "fred"}, combo.getItems()); - -} - -public void test_addLjava_lang_StringI() { - try { - combo.add(null, 0); - fail("No exception thrown for item == null"); - } - catch (IllegalArgumentException e) { - } - - try { - combo.add("string", -1); - fail("No exception thrown for index < 0"); - } - catch (IllegalArgumentException e) { - } - - combo.add("string0", 0); - try { - combo.add("string1", 2); - fail("No exception thrown for index > size"); - } - catch (IllegalArgumentException e) { - } - combo.removeAll(); - - combo.add("fred", 0); - assertEquals("fred", new String[]{"fred"}, combo.getItems()); - combo.add("fred", 0); - assertEquals("fred fred", new String[]{"fred", "fred"}, combo.getItems()); - combo.add("fred"); - assertEquals("fred fred fred", new String[]{"fred", "fred", "fred"}, combo.getItems()); - combo.removeAll(); - - int number = 3; - for (int i = 0; i < number; i++) - combo.add("fred" + i); - combo.add("fred", number); - assertEquals("fred0 fred1 fred2 fred", new String[]{"fred0", "fred1", "fred2", "fred"}, combo.getItems()); - - combo.removeAll(); - number = 3; - for (int i = 0; i < number; i++) - combo.add("fred" + i); - combo.add("fred", 1); - assertEquals("fred0 fred fred1 fred2", new String[]{"fred0", "fred", "fred1", "fred2"}, combo.getItems()); - combo.add("fred", 0); - assertEquals("fred fred0 fred fred1 fred2", new String[]{"fred", "fred0", "fred", "fred1", "fred2"}, combo.getItems()); - combo.add("fred", 4); - assertEquals("fred fred0 fred fred1 fred fred2", new String[]{"fred", "fred0", "fred", "fred1", "fred", "fred2"}, combo.getItems()); -} - -public void test_addModifyListenerLorg_eclipse_swt_events_ModifyListener() { - boolean exceptionThrown = false; - ModifyListener listener = new ModifyListener() { - public void modifyText(ModifyEvent event) { - listenerCalled = true; - } - }; - try { - combo.addModifyListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - // test whether all content modifying API methods send a Modify event - combo.addModifyListener(listener); - listenerCalled = false; - combo.setText("new text"); - assertTrue("setText does not send event", listenerCalled); - - listenerCalled = false; - combo.removeModifyListener(listener); - // cause to call the listener. - combo.setText("line"); - assertTrue("Listener not removed", listenerCalled == false); - try { - combo.removeModifyListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - listenerCalled = false; - boolean exceptionThrown = false; - SelectionListener listener = new SelectionListener() { - public void widgetSelected(SelectionEvent event) { - listenerCalled = true; - } - public void widgetDefaultSelected(SelectionEvent event) { - } - }; - try { - combo.addSelectionListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - combo.addSelectionListener(listener); - combo.select(0); - assertTrue(":a:", listenerCalled == false); - combo.removeSelectionListener(listener); - try { - combo.removeSelectionListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } -} - -public void test_clearSelection() { - int number = 5; - for (int i = 0; i < number; i++) - combo.add("fred" + i); - combo.clearSelection(); - assertTrue(":a:", combo.getSelection().equals(new Point(0, 0))); - combo.setSelection(new Point(0, 5)); - assertTrue(":b:", combo.getSelection().equals(new Point(0, 0))); //nothing is selected - combo.setText("some text"); - combo.setSelection(new Point(0, 5)); - assertTrue(":c:", combo.getSelection().equals(new Point(0, 5))); - combo.clearSelection(); - assertTrue(":d:", combo.getSelection().x==combo.getSelection().y); -} - -public void test_computeSizeIIZ() { - // super class test is sufficient -} - -public void test_copy() { - combo.setText("123456"); - combo.setSelection(new Point(1,3)); - combo.copy(); - combo.setSelection(new Point(0,0)); - combo.paste(); - assertTrue(":a:", combo.getText().equals("23123456")); -} - -public void test_cut() { - combo.setText("123456"); - combo.setSelection(new Point(1,3)); - combo.cut(); - assertTrue(":a:", combo.getText().equals("1456")); -} - -public void test_deselectAll() { - combo.add("123"); - combo.add("456"); - combo.add("789"); - combo.select(0); - combo.select(2); - combo.deselectAll(); - assertTrue(":a:", combo.getSelectionIndex()== -1); -} -public void test_deselectI() { - // indices out of range are ignored - String[] items = {"item0", "item1", "item2"}; - combo.setItems(items); - combo.select(1); - combo.deselect(10); - assertEquals(1, combo.getSelectionIndex()); - combo.removeAll(); - - combo.deselect(2); - - int number = 10; - for (int i = 0; i < number; i++) - combo.add("fred" + i); - for (int i = 0; i < number; i++) { - combo.select(i); - assertTrue(":a:" + i, combo.getSelectionIndex()==i); - combo.deselect(i); - assertTrue(":b:" + i, combo.getSelectionIndex()==-1); - } -} - -public void test_getChildren() { - // Combo cannot have children -} - -public void test_getItemCount() { - int number = 10; - for (int i = 0; i < number; i++) { - assertTrue(":a:" + i, combo.getItemCount() == i); - combo.add("fred" + i); - } - assertTrue(":aa:", combo.getItemCount() == number); - - for (int i = 0; i < number; i++) { - assertTrue(":b:" + i, combo.getItemCount() == number-i); - combo.remove(0); - } - combo.removeAll(); - assertTrue(":c:", combo.getItemCount() == 0); -} - -public void test_getItemHeight() { - combo.getItemHeight(); -} - -public void test_getItemI() { - try { - combo.getItem(0); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } - - int number = 10; - for (int i = 0; i < number; i++) { - combo.add("fred" + i); - } - for (int i = 0; i < number; i++) - assertTrue(combo.getItem(i).equals("fred" + i)); -} - -public void test_getItems() { - combo.removeAll(); - combo.add("1"); - combo.add("2"); - combo.add("3"); - String[] items = combo.getItems(); - assertTrue(":a:", items.length==3); - assertTrue(":a:", items[0].equals("1")); - assertTrue(":a:", items[1].equals("2")); - assertTrue(":a:", items[2].equals("3")); -} - -public void test_getOrientation() { - // tested in setOrientation -} - -public void test_getSelection() { - combo.setText("123456"); - combo.setSelection(new Point(1,3)); - combo.getSelection(); - assertTrue(":a:", combo.getSelection().equals(new Point(1,3))); -} - -public void test_getSelectionIndex() { - int number = 5; - for (int i = 0; i < number; i++) { - combo.add("fred"); - } - assertEquals(-1, combo.getSelectionIndex()); - for (int i = 0; i < number; i++) { - combo.select(i); - assertEquals(i, combo.getSelectionIndex()); - } - - combo.removeAll(); - for (int i = 0; i < number; i++) { - combo.add("fred"); - } - assertEquals(-1, combo.getSelectionIndex()); - for (int i = 0; i < number; i++) { - combo.select(i); - combo.deselect(i); - assertEquals(-1, combo.getSelectionIndex()); - } -} - -public void test_getText() { - String[] cases = {"", "fred", "fredfred"}; - for (int i = 0; i < cases.length; i++) { - combo.setText(cases[i]); - assertTrue(":a:" + String.valueOf(i), cases[i].equals(combo.getText())); - } -} - -public void test_getTextHeight() { - combo.getTextHeight(); -} - -public void test_getTextLimit() { - combo.setTextLimit(3); - assertTrue(":a:", combo.getTextLimit()==3); -} - -public void test_hasFocus() { - // not public api -} - -public void test_indexOfLjava_lang_String() { - combo.add("string0"); - try { - combo.indexOf(null); - fail("No exception thrown for string == null"); - } - catch (IllegalArgumentException e) { - } - combo.removeAll(); - - int number = 5; - for (int i = 0; i < number; i++) - combo.add("fred" + i); - for (int i = 0; i < number; i++) - assertEquals(i, combo.indexOf("fred" + i)); - - for (int i = 0; i < number; i++) - combo.add("fred" + i); - combo.removeAll(); - for (int i = 0; i < number; i++) - assertEquals(-1, combo.indexOf("fred" + i)); - - for (int i = 0; i < number; i++) - combo.add("fred" + i); - combo.remove("fred3"); - for (int i = 0; i < 3; i++) - assertEquals(i, combo.indexOf("fred" + i)); - assertEquals(-1, combo.indexOf("fred3")); - for (int i = 4; i < number; i++) - assertEquals(i - 1, combo.indexOf("fred" + i)); - - combo.removeAll(); - for (int i = 0; i < number; i++) - combo.add("fred" + i); - combo.remove(2); - for (int i = 0; i < 2; i++) - assertEquals(i, combo.indexOf("fred" + i)); - assertEquals(-1, combo.indexOf("fred2")); - for (int i = 3; i < number; i++) - assertEquals(i - 1, combo.indexOf("fred" + i)); -} - -public void test_indexOfLjava_lang_StringI() { - combo.add("string0"); - try { - combo.indexOf(null); - fail("No exception thrown for string == null"); - } - catch (IllegalArgumentException e) { - } - assertEquals(-1, combo.indexOf("string0", -1)); - combo.removeAll(); - - int number = 5; - for (int i = 0; i < number; i++) - combo.add("fred" + i); - for (int i = 0; i < number; i++) - assertTrue(":a:" + i, combo.indexOf("fred" + i, 0) == i); - for (int i = 0; i < number; i++) - assertTrue(":b:" + i, combo.indexOf("fred" + i, i + 1) == -1); - - for (int i = 0; i < number; i++) - combo.add("fred" + i); - for (int i = 0; i < 3; i++) - assertTrue(":a:" + i, combo.indexOf("fred" + i, 0) == i); - for (int i = 3; i < number; i++) - assertTrue(":b:" + i, combo.indexOf("fred" + i, 3) == i); - for (int i = 0; i < number; i++) - assertTrue(":b:" + i, combo.indexOf("fred" + i, i) == i); -} - -public void test_paste() { - combo.setText("123456"); - combo.setSelection(new Point(1,3)); - combo.cut(); - assertTrue(":a:", combo.getText().equals("1456")); - combo.paste(); - assertTrue(":a:", combo.getText().equals("123456")); -} - -public void test_removeAll() { - combo.add("1"); - combo.add("2"); - combo.removeAll(); - assertTrue(":a:", combo.getItems().length==0); -} - -public void test_removeI() { - try { - combo.remove(0); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } - - try { - combo.remove(3); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } - - combo.add("string0"); - try { - combo.remove(-1); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } - combo.removeAll(); - - int number = 5; - for (int i = 0; i < number; i++) { - combo.add("fred" + i); - } - for (int i = 0; i < number; i++) { - assertEquals("Wrong number of items", number - i, combo.getItemCount()); - combo.remove(0); - } - - for (int i = 0; i < number; i++) { - combo.add("fred"); // all items the same - } - for (int i = 0; i < number; i++) { - assertEquals("Wrong number of items", number - i, combo.getItemCount()); - combo.remove(0); - } - - for (int i = 0; i < number; i++) { - combo.add("fred" + i); // different items - } - for (int i = 0; i < number; i++) { - assertEquals("index " + i, number - i, combo.getItemCount()); - combo.select(0); - assertEquals("index " + i, 0, combo.getSelectionIndex()); - combo.remove(0); - if (SwtJunit.isWindows) { - // The behavior on Windows when the selected item is removed - // is to simply say that no items are selected. - assertEquals("index " + i, -1, combo.getSelectionIndex()); - } else { - // The behavior on other platforms when the selected item is removed - // is to select the item that is now at the same index, and send a - // selection event. If there is no item at the selected index, then - // the platform says that no items are selected. - if (i < number - 1) { - assertEquals("index " + i, 0, combo.getSelectionIndex()); - } else { - assertEquals("index " + i, -1, combo.getSelectionIndex()); - } - } - } - - for (int i = 0; i < number; i++) - combo.add("fred" + i); // different items - for (int i = 0; i < number; i++) { - assertEquals("index " + i, number - i, combo.getItemCount()); - combo.remove(number-i-1); - } -} - -public void test_removeII() { - int number = 5; - for (int i = 0; i < number; i++) { - combo.add("fred"); - } - combo.remove(0, 4); - assertEquals(0, combo.getItemCount()); - - combo.removeAll(); - for (int i = 0; i < number; i++) { - combo.add("fred"); - } - combo.remove(0, 2); - assertEquals(2, combo.getItemCount()); - - combo.removeAll(); - for (int i = 0; i < number; i++) { - combo.add("fred"); - } - combo.remove(2, 4); - assertEquals(2, combo.getItemCount()); - - combo.removeAll(); - for (int i = 0; i < number; i++) { - combo.add("fred"); - } - combo.remove(3, 2); - assertEquals(number, combo.getItemCount()); - - combo.removeAll(); - for (int i = 0; i < number; i++) { - combo.add("fred"); - } - - try { - combo.remove(2, 100); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } - - try { - combo.remove(-1, number-1); - fail("No exception thrown for start index < 0"); - } - catch (IllegalArgumentException e) { - } - -} - -public void test_removeLjava_lang_String() { - int number = 5; - for (int i = 0; i < number; i++) - combo.add("fred" + i); - for (int i = 0; i < number; i++) { - assertEquals(number - i, combo.getItemCount()); - combo.remove("fred" + i); - } - - for (int i = 0; i < number; i++) - combo.add("fred"); - for (int i = 0; i < number; i++) { - assertEquals(number - i, combo.getItemCount()); - combo.remove("fred"); - } - - for (int i = 0; i < number; i++) - combo.add("fred"); - try { - combo.remove(null); - fail("No exception thrown for item == null"); - } - catch (IllegalArgumentException e) { - } - - combo.removeAll(); - for (int i = 0; i < number; i++) - combo.add("fred" + i); - try { - combo.remove("fred"); - fail("No exception thrown for item not found"); - } - catch (IllegalArgumentException e) { - } - - assertEquals(number, combo.getItemCount()); -} - -public void test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener() { - // tested in addModifyListener method -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - // tested in addSelectionListener method -} -public void test_selectI() { - combo.add("123"); - combo.add("456"); - combo.add("789"); - combo.select(1); - assertTrue(":a:", combo.getSelectionIndex()== 1); - - // indices out of range are ignored - combo.select(10); - assertEquals(1, combo.getSelectionIndex()); -} - -public void test_setItemILjava_lang_String() { - try { - combo.setItem(0, null); - fail("No exception thrown for item == null"); - } - catch (IllegalArgumentException e) { - } - - try { - combo.setItem(3, null); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } - - try { - combo.setItem(0, "fred"); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } - - combo.add("string0"); - try { - combo.setItem(0, null); - fail("No exception thrown for item == null"); - } - catch (IllegalArgumentException e) { - } - - try { - combo.setItem(-1, "new value"); - fail("No exception thrown for index < 0"); - } - catch (IllegalArgumentException e) { - } - - combo.add("joe"); - combo.setItem(0, "fred"); - assertTrue("fred", combo.getItem(0).equals("fred")); - - try { - combo.setItem(4, "fred"); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } - - combo.removeAll(); - int number = 5; - for (int i = 0; i < number; i++) - combo.add("fred"); - for (int i = 0; i < number; i++) - combo.setItem(i, "fred" + i); - assertEquals(":a:", new String[]{"fred0", "fred1", "fred2", "fred3", "fred4"}, combo.getItems()); -} - -public void test_setItems$Ljava_lang_String() { - try { - combo.setItems(null); - fail("No exception thrown for items == null"); - } - catch (IllegalArgumentException e) { - } - - String[][] items = {{}, {""}, {"", ""}, {"fred"}, {"fred0", "fred0"}, {"fred", "fred"}}; - - for (int i = 0 ; i< items.length; i++){ - combo.setItems(items[i]); - assertEquals(":a:" + i, items[i], combo.getItems());} -} - -public void test_setOrientationI() { - combo.setOrientation(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() { - try { - combo.setSelection(null); - fail("No exception thrown for point == null"); - } - catch (IllegalArgumentException e) { - } - - int number = 5; - for (int i = 0; i < number; i++) - combo.add("fred" + i); - combo.setSelection(new Point(0, 5)); - assertTrue(":a:", combo.getSelection().equals(new Point(0, 0))); - combo.setText("some text"); - combo.setSelection(new Point(0, 5)); - assertTrue(":b:", combo.getSelection().equals(new Point(0, 5))); -} - -public void test_setTextLimitI() { - try { - combo.setTextLimit(0); - fail("No exception thrown for limit == 0"); - } - catch (IllegalArgumentException e) { - } - - combo.setTextLimit(3); - assertTrue(":a:", combo.getTextLimit()==3); -} - -public void test_setTextLjava_lang_String() { - try { - combo.setText(null); - fail("No exception thrown for text == null"); - } - catch (IllegalArgumentException e) { - } - - String[] cases = {"", "fred", "fred0"}; - for (int i = 0; i < cases.length; i++) { - combo.setText(cases[i]); - assertTrue(":a:" + i, combo.getText().equals(cases[i])); - } - for (int i = 0; i < 5; i++) { - combo.add("fred"); - } - for (int i = 0; i < cases.length; i++) { - combo.setText(cases[i]); - assertTrue(":b:" + i, combo.getText().equals(cases[i])); - } - for (int i = 0; i < 5; i++) { - combo.add("fred" + i); - } - for (int i = 0; i < cases.length; i++) { - combo.setText(cases[i]); - assertTrue(":c:" + i, combo.getText().equals(cases[i])); - } -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Combo((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addLjava_lang_String"); - methodNames.addElement("test_addLjava_lang_StringI"); - methodNames.addElement("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_clearSelection"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_copy"); - methodNames.addElement("test_cut"); - methodNames.addElement("test_deselectAll"); - methodNames.addElement("test_deselectI"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItemHeight"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getOrientation"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionIndex"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_getTextHeight"); - methodNames.addElement("test_getTextLimit"); - methodNames.addElement("test_indexOfLjava_lang_String"); - methodNames.addElement("test_indexOfLjava_lang_StringI"); - methodNames.addElement("test_paste"); - methodNames.addElement("test_removeAll"); - methodNames.addElement("test_removeI"); - methodNames.addElement("test_removeII"); - methodNames.addElement("test_removeLjava_lang_String"); - methodNames.addElement("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_selectI"); - methodNames.addElement("test_setItemILjava_lang_String"); - methodNames.addElement("test_setItems$Ljava_lang_String"); - methodNames.addElement("test_setOrientationI"); - methodNames.addElement("test_setSelectionLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setTextLimitI"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addLjava_lang_String")) test_addLjava_lang_String(); - else if (getName().equals("test_addLjava_lang_StringI")) test_addLjava_lang_StringI(); - else if (getName().equals("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_addModifyListenerLorg_eclipse_swt_events_ModifyListener(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_clearSelection")) test_clearSelection(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_copy")) test_copy(); - else if (getName().equals("test_cut")) test_cut(); - else if (getName().equals("test_deselectAll")) test_deselectAll(); - else if (getName().equals("test_deselectI")) test_deselectI(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItemHeight")) test_getItemHeight(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getOrientation")) test_getOrientation(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionIndex")) test_getSelectionIndex(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_getTextHeight")) test_getTextHeight(); - else if (getName().equals("test_getTextLimit")) test_getTextLimit(); - else if (getName().equals("test_indexOfLjava_lang_String")) test_indexOfLjava_lang_String(); - else if (getName().equals("test_indexOfLjava_lang_StringI")) test_indexOfLjava_lang_StringI(); - else if (getName().equals("test_paste")) test_paste(); - else if (getName().equals("test_removeAll")) test_removeAll(); - else if (getName().equals("test_removeI")) test_removeI(); - else if (getName().equals("test_removeII")) test_removeII(); - else if (getName().equals("test_removeLjava_lang_String")) test_removeLjava_lang_String(); - else if (getName().equals("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_selectI")) test_selectI(); - else if (getName().equals("test_setItemILjava_lang_String")) test_setItemILjava_lang_String(); - else if (getName().equals("test_setItems$Ljava_lang_String")) test_setItems$Ljava_lang_String(); - else if (getName().equals("test_setOrientationI")) test_setOrientationI(); - else if (getName().equals("test_setSelectionLorg_eclipse_swt_graphics_Point")) test_setSelectionLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setTextLimitI")) test_setTextLimitI(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else super.runTest(); -} - -/* custom */ -public void test_setBoundsIIII() { - combo.setBounds(10, 20, 30, 40); - // only check x, y, and width - you can't set the height of a combo - assertTrue(combo.getBounds().x == 10); - assertTrue(combo.getBounds().y == 20); - assertTrue(combo.getBounds().width == 30); -} - -public void test_setBoundsLorg_eclipse_swt_graphics_Rectangle() { - combo.setBounds(new Rectangle(10, 20, 30, 40)); - // only check x, y, and width - you can't set the height of a combo - assertTrue(combo.getBounds().x == 10); - assertTrue(combo.getBounds().y == 20); - assertTrue(combo.getBounds().width == 30); -} - -public void test_setSizeII() { - combo.setSize(30, 40); - // only check the width - you can't set the height of a combo - assertTrue(combo.getSize().x == 30); - - combo.setSize(32, 43); - // only check the width - you can't set the height of a combo - assertTrue(combo.getSize().x == 32); -} - -public void test_setSizeLorg_eclipse_swt_graphics_Point() { - combo.setSize(new Point(30, 40)); - // only check the width - you can't set the height of a combo - assertTrue(combo.getSize().x == 30); - - combo.setBounds(32, 43, 33, 44); - // only check the width - you can't set the height of a combo - assertTrue(combo.getSize().x == 33); - - combo.setBounds(32, 43, 30, 40); - combo.setLocation(11, 22); - combo.setSize(new Point(32, 43)); - // only check the width - you can't set the height of a combo - assertTrue(combo.getSize().x == 32); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java deleted file mode 100644 index 558a96f6e6..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Composite.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Composite - * - * @see org.eclipse.swt.widgets.Composite - */ -public class Test_org_eclipse_swt_widgets_Composite extends Test_org_eclipse_swt_widgets_Scrollable { - -Composite composite; - -public Test_org_eclipse_swt_widgets_Composite(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - composite = new Composite(shell, 0); - super.setWidget(composite); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - try { - composite = new Composite(null, 0); - fail("No exception thrown"); - } - catch (IllegalArgumentException e) { - } - - int[] cases = {SWT.H_SCROLL, SWT.V_SCROLL, SWT.H_SCROLL | SWT.V_SCROLL}; - for (int i = 0; i < cases.length; i++) - composite = new Composite(shell, cases[i]); -} - -public void test_getChildren() { - assertEquals(":a:", new Control[]{}, composite.getChildren()); - Composite c1 = new Composite(composite, 0); - assertEquals(":b:", new Control[]{c1}, composite.getChildren()); - - List c2 = new List(composite, 0); - assertEquals(":c:", new Control[]{c1, c2}, composite.getChildren()); - - Button c3 = new Button(composite, 0); - assertEquals(":d:", new Control[]{c1, c2, c3}, composite.getChildren()); - - c2.dispose(); - assertEquals(":e:", new Control[]{c1, c3}, composite.getChildren()); - - Control[] children = composite.getChildren(); - for (int i = 0; i < children.length; i++) - children[i].dispose(); - - assertEquals(":f:", new Control[]{}, composite.getChildren()); -} - -public void test_getLayout() { - // tested in test_setLayoutLorg_eclipse_swt_widgets_Layout -} - -public void test_getTabList() { - // tested in test_setTabList$Lorg_eclipse_swt_widgets_Control -} - -public void test_layout() { - // tested in test_layoutZ -} - -public void test_layoutZ() { - // tested in specific Layout classes -} - -public void test_setLayoutLorg_eclipse_swt_widgets_Layout() { - // tested in specific Layout classes -} - -public void test_setTabList$Lorg_eclipse_swt_widgets_Control() { - Button button1 = new Button(composite, SWT.PUSH); - Button button2 = new Button(composite, SWT.PUSH); - Control[] tablist = new Control[] {button1, button2}; - composite.setTabList(tablist); - assertEquals(tablist, composite.getTabList()); - button1.dispose(); - button2.dispose(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Composite((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_getChildren"); - methodNames.addElement("test_getLayout"); - methodNames.addElement("test_getTabList"); - methodNames.addElement("test_layout"); - methodNames.addElement("test_layoutZ"); - methodNames.addElement("test_setLayoutLorg_eclipse_swt_widgets_Layout"); - methodNames.addElement("test_setTabList$Lorg_eclipse_swt_widgets_Control"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Scrollable.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_getChildren")) test_getChildren(); - else if (getName().equals("test_getLayout")) test_getLayout(); - else if (getName().equals("test_getTabList")) test_getTabList(); - else if (getName().equals("test_layout")) test_layout(); - else if (getName().equals("test_layoutZ")) test_layoutZ(); - else if (getName().equals("test_setLayoutLorg_eclipse_swt_widgets_Layout")) test_setLayoutLorg_eclipse_swt_widgets_Layout(); - else if (getName().equals("test_setTabList$Lorg_eclipse_swt_widgets_Control")) test_setTabList$Lorg_eclipse_swt_widgets_Control(); - else super.runTest(); -} - -/* custom */ -protected void setWidget(Widget w) { - if (composite != null) - composite.dispose(); - composite = (Composite)w; - super.setWidget(w); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java deleted file mode 100644 index 4f5d26eb80..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Control.java +++ /dev/null @@ -1,876 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.Accessible; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Control - * - * @see org.eclipse.swt.widgets.Control - */ -public class Test_org_eclipse_swt_widgets_Control extends Test_org_eclipse_swt_widgets_Widget { - -public Test_org_eclipse_swt_widgets_Control(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - // abstract class -} - -public void test_addControlListenerLorg_eclipse_swt_events_ControlListener() { - ControlListener listener = new ControlListener() { - public void controlMoved(ControlEvent e) { - eventOccurred = true; - }; - public void controlResized(ControlEvent e) { - eventOccurred = true; - }; - }; - control.addControlListener(listener); - eventOccurred = false; - control.notifyListeners(SWT.Move, new Event()); - assertTrue(eventOccurred); - eventOccurred = false; - control.notifyListeners(SWT.Resize, new Event()); - assertTrue(eventOccurred); - control.removeControlListener(listener); -} - -public void test_addFocusListenerLorg_eclipse_swt_events_FocusListener() { - FocusListener listener = new FocusListener() { - public void focusGained(FocusEvent e) { - eventOccurred = true; - }; - public void focusLost(FocusEvent e) { - eventOccurred = true; - }; - }; - control.addFocusListener(listener); - eventOccurred = false; - control.notifyListeners(SWT.FocusIn, new Event()); - assertTrue(eventOccurred); - eventOccurred = false; - control.notifyListeners(SWT.FocusOut, new Event()); - assertTrue(eventOccurred); - control.removeFocusListener(listener); -} - -public void test_addHelpListenerLorg_eclipse_swt_events_HelpListener() { - HelpListener listener = new HelpListener() { - public void helpRequested(HelpEvent e) { - eventOccurred = true; - }; - }; - control.addHelpListener(listener); - eventOccurred = false; - control.notifyListeners(SWT.Help, new Event()); - assertTrue(eventOccurred); - control.removeHelpListener(listener); -} - -public void test_addKeyListenerLorg_eclipse_swt_events_KeyListener() { - KeyListener listener = new KeyListener() { - public void keyPressed(KeyEvent e) { - eventOccurred = true; - }; - public void keyReleased(KeyEvent e) { - eventOccurred = true; - }; - }; - control.addKeyListener(listener); - eventOccurred = false; - control.notifyListeners(SWT.KeyDown, new Event()); - assertTrue(eventOccurred); - eventOccurred = false; - control.notifyListeners(SWT.KeyUp, new Event()); - assertTrue(eventOccurred); - control.removeKeyListener(listener); -} - -public void test_addMouseListenerLorg_eclipse_swt_events_MouseListener() { - MouseListener listener = new MouseListener() { - public void mouseDown(MouseEvent e) { - eventOccurred = true; - }; - public void mouseUp(MouseEvent e) { - eventOccurred = true; - }; - public void mouseDoubleClick(MouseEvent e) { - eventOccurred = true; - }; - }; - control.addMouseListener(listener); - eventOccurred = false; - control.notifyListeners(SWT.MouseDown, new Event()); - assertTrue(eventOccurred); - eventOccurred = false; - control.notifyListeners(SWT.MouseUp, new Event()); - assertTrue(eventOccurred); - eventOccurred = false; - control.notifyListeners(SWT.MouseDoubleClick, new Event()); - assertTrue(eventOccurred); - control.removeMouseListener(listener); -} - -public void test_addMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener() { - MouseMoveListener listener = new MouseMoveListener() { - public void mouseMove(MouseEvent e) { - eventOccurred = true; - }; - }; - control.addMouseMoveListener(listener); - eventOccurred = false; - control.notifyListeners(SWT.MouseMove, new Event()); - assertTrue(eventOccurred); - control.removeMouseMoveListener(listener); -} - -public void test_addMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener() { - MouseTrackListener listener = new MouseTrackListener() { - public void mouseEnter(MouseEvent e) { - eventOccurred = true; - }; - public void mouseExit(MouseEvent e) { - eventOccurred = true; - }; - public void mouseHover(MouseEvent e) { - eventOccurred = true; - }; - }; - control.addMouseTrackListener(listener); - eventOccurred = false; - control.notifyListeners(SWT.MouseEnter, new Event()); - assertTrue(eventOccurred); - eventOccurred = false; - control.notifyListeners(SWT.MouseExit, new Event()); - assertTrue(eventOccurred); - eventOccurred = false; - control.notifyListeners(SWT.MouseHover, new Event()); - assertTrue(eventOccurred); - control.removeMouseTrackListener(listener); -} - -public void test_addPaintListenerLorg_eclipse_swt_events_PaintListener() { - PaintListener listener = new PaintListener() { - public void paintControl(PaintEvent e) { - eventOccurred = true; - }; - }; - control.addPaintListener(listener); - eventOccurred = false; - Event event = new Event(); - GC gc = event.gc = new GC(control); - control.notifyListeners(SWT.Paint, event); - gc.dispose(); - assertTrue(eventOccurred); - control.removePaintListener(listener); -} - -public void test_addTraverseListenerLorg_eclipse_swt_events_TraverseListener() { - TraverseListener listener = new TraverseListener() { - public void keyTraversed(TraverseEvent e) { - eventOccurred = true; - }; - }; - control.addTraverseListener(listener); - eventOccurred = false; - control.notifyListeners(SWT.Traverse, new Event()); - assertTrue(eventOccurred); - control.removeTraverseListener(listener); -} - -public void test_computeSizeII() { - control.computeSize(SWT.DEFAULT, SWT.DEFAULT); - Point size = control.getSize(); - control.computeSize(size.x, size.y); - assertEquals(size.x, control.getSize().x); - assertEquals(size.y, control.getSize().y); -} - -public void test_computeSizeIIZ() { - control.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); - Point size = control.getSize(); - control.computeSize(size.x, size.y, false); - assertEquals(size.x, control.getSize().x); - assertEquals(size.y, control.getSize().y); -} - -public void test_forceFocus() { - // this is difficult to test in Control. - // subclasses that wish to test this should override. -} - -public void test_getAccessible() { - Accessible accessible = control.getAccessible(); - assertTrue(":a:", accessible != null); -} - -public void test_getBackground() { - // tested in test_setBackgroundLorg_eclipse_swt_graphics_Color -} - -public void test_getBorderWidth() { - control.getBorderWidth(); -} - -public void test_getBounds() { - // tested in test_setBoundsIIII and test_setBoundsLorg_eclipse_swt_graphics_Rectangle -} - -public void test_getEnabled() { - // tested in test_setEnabledZ -} - -public void test_getFont() { - // tested in test_setFontLorg_eclipse_swt_graphics_Font -} - -public void test_getForeground() { - // tested in test_setForegroundLorg_eclipse_swt_graphics_Color -} - -public void test_getLayoutData() { - // tested in test_setLayoutDataLjava_lang_Object -} - -public void test_getLocation() { - control.setBounds(32, 43, 30, 40); - assertTrue(control.getLocation().equals(new Point(32, 43))); -} - -public void test_getMenu() { - // tested in test_setMenuLorg_eclipse_swt_widgets_Menu -} - -public void test_getMonitor() { - Monitor monitor = control.getMonitor(); - assertNotNull(monitor); - Display display = control.getDisplay(); - Monitor[] monitors = display.getMonitors(); - int i; - /* monitor must be listed in Display.getMonitors */ - for (i = 0; i < monitors.length; i++) { - if (monitor.equals(monitors[i])) break; - } - if (i == monitors.length) { - fail("Control.getMonitor does not return a monitor listed in Display.getMonitors"); - } -} - -public void test_getParent() { - assertEquals(shell, control.getParent()); -} - -public void test_getShell() { - assertEquals(shell, control.getShell()); -} - -public void test_getSize() { - // tested in test_setSizeII -} - -public void test_getToolTipText() { - // tested in test_setToolTipTextLjava_lang_String -} - -public void test_getVisible() { - // tested in test_setVisibleZ -} - -public void test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData() { - // tested in test_internal_new_GCLorg_eclipse_swt_graphics_GCData -} - -public void test_internal_new_GCLorg_eclipse_swt_graphics_GCData() { - GCData data = new GCData(); - int hDC = control.internal_new_GC(data); - control.internal_dispose_GC(hDC, data); -} - -public void test_isEnabled() { - control.setEnabled(true); - assertTrue(control.isEnabled()); - - control.setEnabled(false); - assertTrue(!control.isEnabled()); -} - -public void test_isFocusControl() { - assertTrue(!control.isFocusControl()); -} - -public void test_isReparentable() { - assertEquals ("isReparentable", control.isReparentable(), isReparentablePlatform()); -} - -public void test_isVisible() { - control.setVisible(true); - assertTrue(!control.isVisible()); //because the shell is not visible - - control.setVisible(false); - assertTrue(!control.isVisible()); - - if (!SwtJunit.isAIX) { - control.setVisible(true); - shell.setVisible(true); - assertTrue("Window should be visible", control.isVisible()); - shell.setVisible(false); - assertTrue("Window should not be visible", !control.isVisible()); - } -} - -public void test_moveAboveLorg_eclipse_swt_widgets_Control() { - control.moveAbove(null); - - control.moveAbove(control); - - Button b = new Button(shell, 0); - control.moveAbove(b); - b.dispose(); -} - -public void test_moveBelowLorg_eclipse_swt_widgets_Control() { - control.moveBelow(null); - - control.moveBelow(control); - - Button b = new Button(shell, 0); - control.moveBelow(b); - b.dispose(); -} - -public void test_pack() { - control.pack(); -} - -public void test_packZ() { - control.pack(true); - control.pack(false); -} - -public void test_redraw() { - control.redraw(); -} - -public void test_redrawIIIIZ() { - control.redraw(0, 0, 0, 0, false); - - control.redraw(0, 0, 0, 0, true); - - control.redraw(-10, -10, -10, -10, true); - - control.redraw(10, 10, 10, 10, true); - - control.redraw(10, 10, 10, 10, false); - - control.redraw(10000, 10000, 10000, 10000, false); -} - -public void test_removeControlListenerLorg_eclipse_swt_events_ControlListener() { - // tested in test_addControlListenerLorg_eclipse_swt_events_ControlListener -} - -public void test_removeFocusListenerLorg_eclipse_swt_events_FocusListener() { - // tested in test_addFocusListenerLorg_eclipse_swt_events_FocusListener -} - -public void test_removeHelpListenerLorg_eclipse_swt_events_HelpListener() { - // tested in test_addHelpListenerLorg_eclipse_swt_events_HelpListener -} - -public void test_removeKeyListenerLorg_eclipse_swt_events_KeyListener() { - // tested in test_addKeyListenerLorg_eclipse_swt_events_KeyListener -} - -public void test_removeMouseListenerLorg_eclipse_swt_events_MouseListener() { - // tested in test_addMouseListenerLorg_eclipse_swt_events_MouseListener -} - -public void test_removeMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener() { - // tested in test_addMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener -} - -public void test_removeMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener() { - // tested in test_addMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener -} - -public void test_removePaintListenerLorg_eclipse_swt_events_PaintListener() { - // tested in test_addPaintListenerLorg_eclipse_swt_events_PaintListener -} - -public void test_removeTraverseListenerLorg_eclipse_swt_events_TraverseListener() { - // tested in test_addTraverseListenerLorg_eclipse_swt_events_TraverseListener -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(control.getDisplay(), 255, 0, 0); - control.setBackground(color); - assertEquals(color, control.getBackground()); - control.setBackground(null); - assertTrue(!control.getBackground().equals(color)); - color.dispose(); -} - -public void test_setBoundsIIII() { - control.setBounds(10, 20, 30, 40); - assertEquals(new Rectangle(10, 20, 30, 40), control.getBounds()); - - control.setBounds(20, 30, 40, 50); - assertEquals(false, control.getBounds().equals(new Rectangle(10, 20, 30, 40))); - - control.setBounds(10, 20, 30, 40); -} - -public void test_setBoundsLorg_eclipse_swt_graphics_Rectangle() { - control.setBounds(new Rectangle(10, 20, 30, 40)); - assertEquals(new Rectangle(10, 20, 30, 40), control.getBounds()); - - control.setBounds(new Rectangle(20, 30, 40, 50)); - assertEquals(false, control.getBounds().equals(new Rectangle(10, 20, 30, 40))); - - try { - control.setBounds(null); - fail("No exception thrown for rectangle == null"); - } - catch (IllegalArgumentException e) { - } - - control.setBounds(new Rectangle(10, 20, 30, 40)); -} - -public void test_setCaptureZ() { - control.setCapture(true); - - control.setCapture(false); -} - -public void test_setCursorLorg_eclipse_swt_graphics_Cursor() { - control.setCursor(null); - - Cursor c = new Cursor(control.getDisplay(), 0); - control.setCursor(c); - c.dispose(); -} - -public void test_setEnabledZ() { - control.setEnabled(true); - assertTrue(control.getEnabled()); - - control.setEnabled(false); - assertTrue(!control.getEnabled()); -} - -public void test_setFocus() { - control.setFocus(); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - Font font = control.getFont(); - control.setFont(font); - assertEquals(font, control.getFont()); - - font = new Font(control.getDisplay(), SwtJunit.testFontName, 10, SWT.NORMAL); - control.setFont(font); - assertEquals(font, control.getFont()); - - control.setFont(null); - font.dispose(); - try { - control.setFont(font); - control.setFont(null); - fail("No exception thrown for disposed font"); - } catch (IllegalArgumentException e) { - } -} - -public void test_setForegroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(control.getDisplay(), 255, 0, 0); - control.setForeground(color); - assertEquals(color, control.getForeground()); - control.setForeground(null); - assertTrue(!control.getForeground().equals(color)); - color.dispose(); -} - -public void test_setLayoutDataLjava_lang_Object() { - control.setLayoutData(this); - assertEquals(this, control.getLayoutData()); - - control.setLayoutData("asldsahdahcaslcshdac"); - assertEquals("asldsahdahcaslcshdac", control.getLayoutData()); - - control.setLayoutData(this.getClass()); - assertEquals(this.getClass(), control.getLayoutData()); - - control.setLayoutData(null); - assertNull(control.getLayoutData()); -} - -public void test_setLocationII() { - control.setBounds(32, 43, 30, 40); - control.setLocation(11, 22); - control.setSize(32, 43); - assertEquals(control.getLocation(), new Point(11, 22)); - - control.setLocation(10, 10); - assertEquals(control.getLocation(), new Point(10, 10)); -} - -public void test_setLocationLorg_eclipse_swt_graphics_Point() { - try { - control.setLocation(null); - fail("No exception thrown for location == null"); - } - catch (IllegalArgumentException e) { - } - - Point loc = new Point(30, 40); - control.setLocation(loc); - assertEquals(control.getLocation(), loc); - - loc = new Point(10, 10); - control.setLocation(loc); - assertEquals(control.getLocation(), loc); - - loc = new Point(10000, 10000); - control.setLocation(loc); - assertEquals(control.getLocation(), loc); - - loc = new Point(-10, -10); - control.setLocation(loc); - assertEquals(control.getLocation(), loc); -} - -public void test_setMenuLorg_eclipse_swt_widgets_Menu () { - /* this is a valid thing to do, you can reset a menu to nothing */ - control.setMenu(null); - - Menu m = new Menu(control); - control.setMenu(m); - assertEquals(m, control.getMenu()); -} - -public void test_setParentLorg_eclipse_swt_widgets_Composite() { - if (control.isReparentable()) { - Shell originalParent = new Shell(); - Shell newParent = new Shell(); - Button b = new Button(originalParent, SWT.PUSH); - b.setParent(newParent); - originalParent.dispose(); - assertTrue(!b.isDisposed()); - newParent.dispose(); - } -} - -public void test_setRedrawZ() { - control.setRedraw(false); - - control.setRedraw(true); -} - -public void test_setSizeII() { - control.setBounds(32, 43, 30, 40); - assertEquals(new Point(30, 40), control.getSize()); - - control.setBounds(32, 43, 30, 40); - control.setLocation(11, 22); - control.setSize(32, 43); - assertEquals(new Point(32, 43), control.getSize()); - - control.setSize(0, 0); - - control.setSize(10, 10); - - control.setSize(10000, 10000); - - control.setSize(-10, -10); -} - -public void test_setSizeLorg_eclipse_swt_graphics_Point() { - control.setSize(new Point(30, 40)); - assertEquals(new Point(30, 40), control.getSize()); - - try { - control.setSize(null); - fail("No exception thrown for size == null"); - } - catch (IllegalArgumentException e) { - } - - control.setSize(new Point(0, 0)); - - control.setSize(new Point(10, 10)); - - control.setSize(new Point(10000, 10000)); - - control.setSize(new Point(-10, -10)); -} - -public void test_setToolTipTextLjava_lang_String() { - control.setToolTipText("This is a tip"); - assertEquals("This is a tip", control.getToolTipText()); - - control.setToolTipText(null); - assertNull(control.getToolTipText()); -} - -public void test_setVisibleZ() { - control.setVisible(true); - assertTrue(control.getVisible()); - - control.setVisible(false); - assertTrue(!control.getVisible()); -} - -public void test_toControlII() { - Point controlCoords = control.toControl(0, 0); - assertEquals(new Point(0, 0), control.toDisplay(controlCoords.x, controlCoords.y)); -} - -public void test_toControlLorg_eclipse_swt_graphics_Point() { - Point controlCoords = control.toControl(new Point(0, 0)); - assertEquals(new Point(0, 0), control.toDisplay(controlCoords)); - try { - control.toControl(null); - fail("No exception thrown for size == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_toDisplayII() { - Point displayCoords = control.toDisplay(0, 0); - assertEquals(new Point(0, 0), control.toControl(displayCoords.x, displayCoords.y)); -} - -public void test_toDisplayLorg_eclipse_swt_graphics_Point() { - Point displayCoords = control.toDisplay(new Point(0, 0)); - assertEquals(new Point(0, 0), control.toControl(displayCoords)); - try { - control.toDisplay(null); - fail("No exception thrown for size == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_traverseI() { - control.traverse(SWT.TRAVERSE_ESCAPE); - control.traverse(SWT.TRAVERSE_RETURN); - control.traverse(SWT.TRAVERSE_TAB_NEXT); - control.traverse(SWT.TRAVERSE_TAB_PREVIOUS); - control.traverse(SWT.TRAVERSE_ARROW_NEXT); - control.traverse(SWT.TRAVERSE_ARROW_PREVIOUS); -} - -public void test_update() { - control.update(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Control((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addControlListenerLorg_eclipse_swt_events_ControlListener"); - methodNames.addElement("test_addFocusListenerLorg_eclipse_swt_events_FocusListener"); - methodNames.addElement("test_addHelpListenerLorg_eclipse_swt_events_HelpListener"); - methodNames.addElement("test_addKeyListenerLorg_eclipse_swt_events_KeyListener"); - methodNames.addElement("test_addMouseListenerLorg_eclipse_swt_events_MouseListener"); - methodNames.addElement("test_addMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener"); - methodNames.addElement("test_addMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener"); - methodNames.addElement("test_addPaintListenerLorg_eclipse_swt_events_PaintListener"); - methodNames.addElement("test_addTraverseListenerLorg_eclipse_swt_events_TraverseListener"); - methodNames.addElement("test_computeSizeII"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_forceFocus"); - methodNames.addElement("test_getAccessible"); - methodNames.addElement("test_getBackground"); - methodNames.addElement("test_getBorderWidth"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getEnabled"); - methodNames.addElement("test_getFont"); - methodNames.addElement("test_getForeground"); - methodNames.addElement("test_getLayoutData"); - methodNames.addElement("test_getLocation"); - methodNames.addElement("test_getMenu"); - methodNames.addElement("test_getMonitor"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getShell"); - methodNames.addElement("test_getSize"); - methodNames.addElement("test_getToolTipText"); - methodNames.addElement("test_getVisible"); - methodNames.addElement("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_internal_new_GCLorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_isEnabled"); - methodNames.addElement("test_isFocusControl"); - methodNames.addElement("test_isReparentable"); - methodNames.addElement("test_isVisible"); - methodNames.addElement("test_moveAboveLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_moveBelowLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_pack"); - methodNames.addElement("test_packZ"); - methodNames.addElement("test_redraw"); - methodNames.addElement("test_redrawIIIIZ"); - methodNames.addElement("test_removeControlListenerLorg_eclipse_swt_events_ControlListener"); - methodNames.addElement("test_removeFocusListenerLorg_eclipse_swt_events_FocusListener"); - methodNames.addElement("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener"); - methodNames.addElement("test_removeKeyListenerLorg_eclipse_swt_events_KeyListener"); - methodNames.addElement("test_removeMouseListenerLorg_eclipse_swt_events_MouseListener"); - methodNames.addElement("test_removeMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener"); - methodNames.addElement("test_removeMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener"); - methodNames.addElement("test_removePaintListenerLorg_eclipse_swt_events_PaintListener"); - methodNames.addElement("test_removeTraverseListenerLorg_eclipse_swt_events_TraverseListener"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setBoundsIIII"); - methodNames.addElement("test_setBoundsLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_setCaptureZ"); - methodNames.addElement("test_setCursorLorg_eclipse_swt_graphics_Cursor"); - methodNames.addElement("test_setEnabledZ"); - methodNames.addElement("test_setFocus"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setLayoutDataLjava_lang_Object"); - methodNames.addElement("test_setLocationII"); - methodNames.addElement("test_setLocationLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setMenuLorg_eclipse_swt_widgets_Menu"); - methodNames.addElement("test_setParentLorg_eclipse_swt_widgets_Composite"); - methodNames.addElement("test_setRedrawZ"); - methodNames.addElement("test_setSizeII"); - methodNames.addElement("test_setSizeLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setToolTipTextLjava_lang_String"); - methodNames.addElement("test_setVisibleZ"); - methodNames.addElement("test_toControlII"); - methodNames.addElement("test_toControlLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_toDisplayII"); - methodNames.addElement("test_toDisplayLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_traverseI"); - methodNames.addElement("test_update"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addControlListenerLorg_eclipse_swt_events_ControlListener")) test_addControlListenerLorg_eclipse_swt_events_ControlListener(); - else if (getName().equals("test_addFocusListenerLorg_eclipse_swt_events_FocusListener")) test_addFocusListenerLorg_eclipse_swt_events_FocusListener(); - else if (getName().equals("test_addHelpListenerLorg_eclipse_swt_events_HelpListener")) test_addHelpListenerLorg_eclipse_swt_events_HelpListener(); - else if (getName().equals("test_addKeyListenerLorg_eclipse_swt_events_KeyListener")) test_addKeyListenerLorg_eclipse_swt_events_KeyListener(); - else if (getName().equals("test_addMouseListenerLorg_eclipse_swt_events_MouseListener")) test_addMouseListenerLorg_eclipse_swt_events_MouseListener(); - else if (getName().equals("test_addMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener")) test_addMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener(); - else if (getName().equals("test_addMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener")) test_addMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener(); - else if (getName().equals("test_addPaintListenerLorg_eclipse_swt_events_PaintListener")) test_addPaintListenerLorg_eclipse_swt_events_PaintListener(); - else if (getName().equals("test_addTraverseListenerLorg_eclipse_swt_events_TraverseListener")) test_addTraverseListenerLorg_eclipse_swt_events_TraverseListener(); - else if (getName().equals("test_computeSizeII")) test_computeSizeII(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_forceFocus")) test_forceFocus(); - else if (getName().equals("test_getAccessible")) test_getAccessible(); - else if (getName().equals("test_getBackground")) test_getBackground(); - else if (getName().equals("test_getBorderWidth")) test_getBorderWidth(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getEnabled")) test_getEnabled(); - else if (getName().equals("test_getFont")) test_getFont(); - else if (getName().equals("test_getForeground")) test_getForeground(); - else if (getName().equals("test_getLayoutData")) test_getLayoutData(); - else if (getName().equals("test_getLocation")) test_getLocation(); - else if (getName().equals("test_getMenu")) test_getMenu(); - else if (getName().equals("test_getMonitor")) test_getMonitor(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getShell")) test_getShell(); - else if (getName().equals("test_getSize")) test_getSize(); - else if (getName().equals("test_getToolTipText")) test_getToolTipText(); - else if (getName().equals("test_getVisible")) test_getVisible(); - else if (getName().equals("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData")) test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_internal_new_GCLorg_eclipse_swt_graphics_GCData")) test_internal_new_GCLorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_isEnabled")) test_isEnabled(); - else if (getName().equals("test_isFocusControl")) test_isFocusControl(); - else if (getName().equals("test_isReparentable")) test_isReparentable(); - else if (getName().equals("test_isVisible")) test_isVisible(); - else if (getName().equals("test_moveAboveLorg_eclipse_swt_widgets_Control")) test_moveAboveLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_moveBelowLorg_eclipse_swt_widgets_Control")) test_moveBelowLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_pack")) test_pack(); - else if (getName().equals("test_packZ")) test_packZ(); - else if (getName().equals("test_redraw")) test_redraw(); - else if (getName().equals("test_redrawIIIIZ")) test_redrawIIIIZ(); - else if (getName().equals("test_removeControlListenerLorg_eclipse_swt_events_ControlListener")) test_removeControlListenerLorg_eclipse_swt_events_ControlListener(); - else if (getName().equals("test_removeFocusListenerLorg_eclipse_swt_events_FocusListener")) test_removeFocusListenerLorg_eclipse_swt_events_FocusListener(); - else if (getName().equals("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener")) test_removeHelpListenerLorg_eclipse_swt_events_HelpListener(); - else if (getName().equals("test_removeKeyListenerLorg_eclipse_swt_events_KeyListener")) test_removeKeyListenerLorg_eclipse_swt_events_KeyListener(); - else if (getName().equals("test_removeMouseListenerLorg_eclipse_swt_events_MouseListener")) test_removeMouseListenerLorg_eclipse_swt_events_MouseListener(); - else if (getName().equals("test_removeMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener")) test_removeMouseMoveListenerLorg_eclipse_swt_events_MouseMoveListener(); - else if (getName().equals("test_removeMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener")) test_removeMouseTrackListenerLorg_eclipse_swt_events_MouseTrackListener(); - else if (getName().equals("test_removePaintListenerLorg_eclipse_swt_events_PaintListener")) test_removePaintListenerLorg_eclipse_swt_events_PaintListener(); - else if (getName().equals("test_removeTraverseListenerLorg_eclipse_swt_events_TraverseListener")) test_removeTraverseListenerLorg_eclipse_swt_events_TraverseListener(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setBoundsIIII")) test_setBoundsIIII(); - else if (getName().equals("test_setBoundsLorg_eclipse_swt_graphics_Rectangle")) test_setBoundsLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_setCaptureZ")) test_setCaptureZ(); - else if (getName().equals("test_setCursorLorg_eclipse_swt_graphics_Cursor")) test_setCursorLorg_eclipse_swt_graphics_Cursor(); - else if (getName().equals("test_setEnabledZ")) test_setEnabledZ(); - else if (getName().equals("test_setFocus")) test_setFocus(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setLayoutDataLjava_lang_Object")) test_setLayoutDataLjava_lang_Object(); - else if (getName().equals("test_setLocationII")) test_setLocationII(); - else if (getName().equals("test_setLocationLorg_eclipse_swt_graphics_Point")) test_setLocationLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setMenuLorg_eclipse_swt_widgets_Menu")) test_setMenuLorg_eclipse_swt_widgets_Menu(); - else if (getName().equals("test_setParentLorg_eclipse_swt_widgets_Composite")) test_setParentLorg_eclipse_swt_widgets_Composite(); - else if (getName().equals("test_setRedrawZ")) test_setRedrawZ(); - else if (getName().equals("test_setSizeII")) test_setSizeII(); - else if (getName().equals("test_setSizeLorg_eclipse_swt_graphics_Point")) test_setSizeLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setToolTipTextLjava_lang_String")) test_setToolTipTextLjava_lang_String(); - else if (getName().equals("test_setVisibleZ")) test_setVisibleZ(); - else if (getName().equals("test_toControlII")) test_toControlII(); - else if (getName().equals("test_toControlLorg_eclipse_swt_graphics_Point")) test_toControlLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_toDisplayII")) test_toDisplayII(); - else if (getName().equals("test_toDisplayLorg_eclipse_swt_graphics_Point")) test_toDisplayLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_traverseI")) test_traverseI(); - else if (getName().equals("test_update")) test_update(); - else super.runTest(); -} - -/* custom */ - Control control; - boolean eventOccurred; - -protected void setWidget(Widget w) { - control = (Control)w; - super.setWidget(w); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolBar.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolBar.java deleted file mode 100644 index 6fee58df19..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolBar.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.CoolBar - * - * @see org.eclipse.swt.widgets.CoolBar - */ -public class Test_org_eclipse_swt_widgets_CoolBar extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_widgets_CoolBar(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - CoolBar coolBar = new CoolBar(shell, 0); - setWidget(coolBar); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl( "Test test_computeSizeIIZ not written"); -} - -public void test_getItemCount() { - warnUnimpl("Test test_getItemCount not written"); -} - -public void test_getItemI() { - warnUnimpl("Test test_getItemI not written"); -} - -public void test_getItemOrder() { - warnUnimpl("Test test_getItemOrder not written"); -} - -public void test_getItemSizes() { - warnUnimpl("Test test_getItemSizes not written"); -} - -public void test_getItems() { - warnUnimpl("Test test_getItems not written"); -} - -public void test_getLocked() { - warnUnimpl("Test test_getLocked not written"); -} - -public void test_getWrapIndices() { - warnUnimpl("Test test_getWrapIndices not written"); -} - -public void test_indexOfLorg_eclipse_swt_widgets_CoolItem() { - warnUnimpl("Test test_indexOfLorg_eclipse_swt_widgets_CoolItem not written"); -} - -public void test_setItemLayout$I$I$Lorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_setItemLayout$I$I$Lorg_eclipse_swt_graphics_Point not written"); -} - -public void test_setLockedZ() { - warnUnimpl("Test test_setLockedZ not written"); -} - -public void test_setWrapIndices$I() { - warnUnimpl("Test test_setWrapIndices$I not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_CoolBar((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItemOrder"); - methodNames.addElement("test_getItemSizes"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getLocked"); - methodNames.addElement("test_getWrapIndices"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_CoolItem"); - methodNames.addElement("test_setItemLayout$I$I$Lorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setLockedZ"); - methodNames.addElement("test_setWrapIndices$I"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItemOrder")) test_getItemOrder(); - else if (getName().equals("test_getItemSizes")) test_getItemSizes(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getLocked")) test_getLocked(); - else if (getName().equals("test_getWrapIndices")) test_getWrapIndices(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_CoolItem")) test_indexOfLorg_eclipse_swt_widgets_CoolItem(); - else if (getName().equals("test_setItemLayout$I$I$Lorg_eclipse_swt_graphics_Point")) test_setItemLayout$I$I$Lorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setLockedZ")) test_setLockedZ(); - else if (getName().equals("test_setWrapIndices$I")) test_setWrapIndices$I(); - else super.runTest(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolItem.java deleted file mode 100644 index 49c4d590cc..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_CoolItem.java +++ /dev/null @@ -1,351 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.CoolItem - * - * @see org.eclipse.swt.widgets.CoolItem - */ -public class Test_org_eclipse_swt_widgets_CoolItem extends Test_org_eclipse_swt_widgets_Item { - -public Test_org_eclipse_swt_widgets_CoolItem(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - setWidget(coolItem); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CoolBarI() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - - try { - coolItem = new CoolItem(null, 0); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CoolBarII() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0, 0); - try { - coolItem = new CoolItem(coolBar, 0, -1); - fail("No exception thrown for index == -1"); - } - catch (IllegalArgumentException e){ - } - try { - coolItem = new CoolItem(coolBar, 0, 2); - fail("No exception thrown for index == 2"); - } - catch (IllegalArgumentException e){ - } - assertEquals(1, coolBar.getItemCount()); - coolItem = new CoolItem(coolBar, 0, 1); - assertEquals(2, coolBar.getItemCount()); - coolItem = new CoolItem(coolBar, 0, 0); - assertEquals(3, coolBar.getItemCount()); - assertEquals(coolItem, coolBar.getItem(0)); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_computeSizeII() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - Button button = new Button(coolBar, SWT.PUSH); - button.setText("foo"); - - Point size = coolItem.computeSize(SWT.DEFAULT, SWT.DEFAULT); - Point size2 = coolItem.computeSize(0, 0); - assertEquals(size, size2); - - coolItem.setControl(button); - size2 = coolItem.computeSize(SWT.DEFAULT, SWT.DEFAULT); - assertTrue(size2.x > size.x); - - size = coolItem.computeSize(50, 25); - size2 = coolItem.computeSize(100, 25); - assertEquals(size.x + 50, size2.x); - assertEquals(size.y, size2.y); - - size = coolItem.computeSize(1,1); - size2 = coolItem.computeSize(26, 26); - assertEquals(25, size2.x - size.x); -} - -public void test_getBounds() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - Button button = new Button(coolBar, SWT.PUSH); - button.setText("foo"); - coolItem.setControl(button); - - Rectangle rect = coolItem.getBounds(); - Point size = coolItem.getSize(); - assertEquals(size.x, rect.width); - assertEquals(size.y, rect.height); - - coolItem.setSize(25, 25); - rect = coolItem.getBounds(); - coolItem.setSize(100, 25); - Rectangle newRect = coolItem.getBounds(); - assertEquals(rect.width + 75, newRect.width); - assertEquals(rect.x, newRect.x); - assertEquals(rect.y, newRect.y); -} - -public void test_getControl() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - assertNull(coolItem.getControl()); - - Button button = new Button(coolBar, SWT.PUSH); - coolItem.setControl(button); - Control control = coolItem.getControl(); - assertEquals(button, control); - - button = new Button(coolBar, SWT.PUSH); - coolItem.setControl(button); - control = coolItem.getControl(); - assertEquals(button, control); -} - -public void test_getMinimumSize() { - warnUnimpl("Test test_getMinimumSize not written"); -} - -public void test_getParent() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - assertEquals(coolBar, coolItem.getParent()); -} - -public void test_getPreferredSize() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - Button button = new Button(coolBar, SWT.PUSH); - button.setText("foobar"); - coolItem.setControl(button); - - Point pref = coolItem.getPreferredSize(); - coolItem.setPreferredSize(pref); - assertEquals(pref, coolItem.getPreferredSize()); -} - -public void test_getSize() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - Button button = new Button(coolBar, SWT.PUSH); - button.setText("foo"); - coolItem.setControl(button); - - Point size = coolItem.getSize(); - Rectangle rect = coolItem.getBounds(); - assertEquals(rect.width, size.x); - assertEquals(rect.height, size.y); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_setControlLorg_eclipse_swt_widgets_Control() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - coolItem.setControl(null); - - Button button = new Button(coolBar, SWT.PUSH); - button.setText("foobar"); - - Point size = coolItem.getSize(); - coolItem.setControl(button); - Point size2 = coolItem.getSize(); - assertTrue(size2.x > size.x); - - if (!MINIMAL_CONFORMANCE) { - size = button.computeSize(SWT.DEFAULT, SWT.DEFAULT); - size2 = coolItem.computeSize(size.x, size.y); - assertEquals(size2, coolItem.getSize()); - } - - button = new Button(coolBar, SWT.PUSH); - button.dispose(); - try { - coolItem.setControl(button); - fail("No exception when control.isDisposed()"); - } - catch (IllegalArgumentException e) { - } - - button = new Button(shell, SWT.PUSH); - try { - coolItem.setControl(button); - fail("No exception thrown when control has wrong parent"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_setMinimumSizeII() { - warnUnimpl("Test test_setMinimumSizeII not written"); -} - -public void test_setMinimumSizeLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_setMinimumSizeLorg_eclipse_swt_graphics_Point not written"); -} - -public void test_setPreferredSizeII() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - Button button = new Button(coolBar, SWT.PUSH); - button.setText("foobar"); - coolItem.setControl(button); - - Point size = coolItem.getSize(); - coolItem.setPreferredSize(size); - assertEquals(size.x, coolItem.getSize().x); - coolItem.setSize(coolItem.getPreferredSize()); - assertEquals(size, coolItem.getSize()); -} - -public void test_setPreferredSizeLorg_eclipse_swt_graphics_Point() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - Button button = new Button(coolBar, SWT.PUSH); - button.setText("foobar"); - coolItem.setControl(button); - - Point size = new Point(50, 30); - coolItem.setPreferredSize(size); - Point size2 = coolItem.getPreferredSize(); - coolItem.setPreferredSize(50, 30); - assertEquals(size2, coolItem.getPreferredSize()); -} - -public void test_setSizeII() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - Button button = new Button(coolBar, SWT.PUSH); - button.setText("foo"); - coolItem.setControl(button); - - coolItem.setSize(50, 50); - assertEquals(new Point(50, 50), coolItem.getSize()); - - coolItem.setSize(0, 0); - Point smallest = coolItem.getSize(); - coolItem.setSize(1, 1); - assertEquals(smallest, coolItem.getSize()); - - Rectangle rect = coolItem.getBounds(); - Point size = coolItem.getSize(); - coolItem.setSize(rect.width, rect.height); - assertEquals(size, coolItem.getSize()); -} - -public void test_setSizeLorg_eclipse_swt_graphics_Point() { - CoolBar coolBar = new CoolBar(shell, 0); - CoolItem coolItem = new CoolItem(coolBar, 0); - Button button = new Button(coolBar, SWT.PUSH); - button.setText("foo"); - coolItem.setControl(button); - - Point size = new Point(50, 50); - coolItem.setSize(size); - Point size2 = coolItem.getSize(); - coolItem.setSize(50, 50); - assertEquals(size2, coolItem.getSize()); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_CoolItem((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CoolBarI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CoolBarII"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_computeSizeII"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getControl"); - methodNames.addElement("test_getMinimumSize"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getPreferredSize"); - methodNames.addElement("test_getSize"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_setControlLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setMinimumSizeII"); - methodNames.addElement("test_setMinimumSizeLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setPreferredSizeII"); - methodNames.addElement("test_setPreferredSizeLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setSizeII"); - methodNames.addElement("test_setSizeLorg_eclipse_swt_graphics_Point"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CoolBarI")) test_ConstructorLorg_eclipse_swt_widgets_CoolBarI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CoolBarII")) test_ConstructorLorg_eclipse_swt_widgets_CoolBarII(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_computeSizeII")) test_computeSizeII(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getControl")) test_getControl(); - else if (getName().equals("test_getMinimumSize")) test_getMinimumSize(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getPreferredSize")) test_getPreferredSize(); - else if (getName().equals("test_getSize")) test_getSize(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_setControlLorg_eclipse_swt_widgets_Control")) test_setControlLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setMinimumSizeII")) test_setMinimumSizeII(); - else if (getName().equals("test_setMinimumSizeLorg_eclipse_swt_graphics_Point")) test_setMinimumSizeLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setPreferredSizeII")) test_setPreferredSizeII(); - else if (getName().equals("test_setPreferredSizeLorg_eclipse_swt_graphics_Point")) test_setPreferredSizeLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setSizeII")) test_setSizeII(); - else if (getName().equals("test_setSizeLorg_eclipse_swt_graphics_Point")) test_setSizeLorg_eclipse_swt_graphics_Point(); - else super.runTest(); -} - -/* custom */ -static final boolean MINIMAL_CONFORMANCE = false; - -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Decorations.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Decorations.java deleted file mode 100644 index 85ada1d8c4..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Decorations.java +++ /dev/null @@ -1,301 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import java.io.*; - -import junit.framework.*; -import junit.textui.TestRunner; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Decorations - * - * @see org.eclipse.swt.widgets.Decorations - */ -public class Test_org_eclipse_swt_widgets_Decorations extends Test_org_eclipse_swt_widgets_Canvas { - -public Test_org_eclipse_swt_widgets_Decorations(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - // do nothing, even though this is not an abstract class, it was never meant to - // be instantiated -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - // do nothing, even though this is not an abstract class, it was never meant to - // be instantiated -} - -public void test_computeTrimIIII() { - decorations.computeTrim(0,0,0,0); - decorations.computeTrim(0,0,10,20); -} -public void test_dispose() { - warnUnimpl("Test test_dispose not written"); -} - -public void test_getBounds() { - warnUnimpl("Test test_getBounds not written"); -} - -public void test_getClientArea() { - Rectangle rect = decorations.getClientArea(); - assertTrue(":a:", rect.height >= 0); - assertTrue(":b:", rect.width >= 0); -} - -public void test_getDefaultButton() { - Button button = new Button(decorations, SWT.PUSH); - decorations.setDefaultButton(button); - assertTrue(":a:", decorations.getDefaultButton() == button); -} - -public void test_getImage() { - Image[] cases = {null, new Image(null, 100, 100)}; - for(int i=0; i<cases.length; i++){ - decorations.setImage(cases[i]); - assertEquals(decorations.getImage(), cases[i]); - if (cases[i]!=null) - cases[i].dispose(); - } -} - -public void test_getImages() { - warnUnimpl("Test test_getImages not written"); -} - -public void test_getLocation() { - decorations.setLocation(10,15); - assertTrue(":a:", decorations.getLocation().x == 10); - assertTrue(":b:", decorations.getLocation().y == 15); -} - -public void test_getMaximized() { - // tested in setMaximized method -} - -public void test_getMenuBar() { - assertTrue(":a:", decorations.getMenuBar() == null); - Menu bar = new Menu (decorations, SWT.BAR); - decorations.setMenuBar (bar); - assertTrue(":b:", decorations.getMenuBar() == bar); -} - -public void test_getMinimized() { - // tested in setMinimized method -} - -public void test_getSize() { - // super class test sufficient -} - -public void test_getText() { - decorations.setText("test"); - assertTrue(":a:", decorations.getText().equals("test")); -} - -public void test_isReparentable() { - /* Decorations are not reparentable, see win32 implementation of isReparentable() */ - assertFalse(decorations.isReparentable()); -} - -public void test_setDefaultButtonLorg_eclipse_swt_widgets_Button() { - assertNull(decorations.getDefaultButton()); - Button button = new Button(decorations, SWT.NULL); - decorations.setDefaultButton(button); - assertTrue("button not default", decorations.getDefaultButton() == button); - if (fCheckBogusTestCases) { - decorations.setDefaultButton(null); - assertNull(decorations.getDefaultButton()); - } -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - assertNull(":a:", decorations.getImage()); - loadImages(); - decorations.setImage(images[0]); - assertTrue(":b:", images[0] == decorations.getImage()); - assertTrue(":c:", images[1] != decorations.getImage()); - decorations.setImage(null); - assertNull(":d:", decorations.getImage()); - freeImages(); -} - -public void test_setImages$Lorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImages$Lorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setMaximizedZ() { - decorations.setMaximized(false); - assertTrue(":1:", decorations.getMaximized() == false); - decorations.setMaximized(true); - assertTrue(":2:", decorations.getMaximized() == true); - assertTrue(":3:", decorations.getMinimized() == false); -} - -public void test_setMenuBarLorg_eclipse_swt_widgets_Menu() { - assertNull(decorations.getMenu()); - Menu testMenu = new Menu(decorations); - decorations.setMenu(testMenu); - assertTrue("Incorrect menu", decorations.getMenu() == testMenu); - decorations.setMenu(null); - assertNull(decorations.getMenu()); -} - -public void test_setMinimizedZ() { - decorations.setMinimized(false); - assertTrue(":1:", decorations.getMinimized() == false); - decorations.setMinimized(true); - assertTrue(":2:", decorations.getMinimized() == true); - assertTrue(":3:", decorations.getMaximized() == false); -} - -public void test_setTextLjava_lang_String() { - try { - decorations.setText(null); - fail("No exception thrown for string == null"); - } - catch (IllegalArgumentException e) { - } - - String testStr = "test string"; - decorations.setText(testStr); - assertTrue("a", decorations.getText().equals(testStr)); - decorations.setText(""); - assertTrue("b", decorations.getText().equals("")); - try { - decorations.setText(null); - fail("No exception thrown for string == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_setVisibleZ() { - // test in subclasses -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Decorations((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_computeTrimIIII"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_getDefaultButton"); - methodNames.addElement("test_getImage"); - methodNames.addElement("test_getImages"); - methodNames.addElement("test_getLocation"); - methodNames.addElement("test_getMaximized"); - methodNames.addElement("test_getMenuBar"); - methodNames.addElement("test_getMinimized"); - methodNames.addElement("test_getSize"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_isReparentable"); - methodNames.addElement("test_setDefaultButtonLorg_eclipse_swt_widgets_Button"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setImages$Lorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setMaximizedZ"); - methodNames.addElement("test_setMenuBarLorg_eclipse_swt_widgets_Menu"); - methodNames.addElement("test_setMinimizedZ"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setVisibleZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Canvas.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_getDefaultButton")) test_getDefaultButton(); - else if (getName().equals("test_getImage")) test_getImage(); - else if (getName().equals("test_getImages")) test_getImages(); - else if (getName().equals("test_getLocation")) test_getLocation(); - else if (getName().equals("test_getMaximized")) test_getMaximized(); - else if (getName().equals("test_getMenuBar")) test_getMenuBar(); - else if (getName().equals("test_getMinimized")) test_getMinimized(); - else if (getName().equals("test_getSize")) test_getSize(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_isReparentable")) test_isReparentable(); - else if (getName().equals("test_setDefaultButtonLorg_eclipse_swt_widgets_Button")) test_setDefaultButtonLorg_eclipse_swt_widgets_Button(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setImages$Lorg_eclipse_swt_graphics_Image")) test_setImages$Lorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setMaximizedZ")) test_setMaximizedZ(); - else if (getName().equals("test_setMenuBarLorg_eclipse_swt_widgets_Menu")) test_setMenuBarLorg_eclipse_swt_widgets_Menu(); - else if (getName().equals("test_setMinimizedZ")) test_setMinimizedZ(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setVisibleZ")) test_setVisibleZ(); - else super.runTest(); -} - -/* custom */ -Decorations decorations; -Image[] images = new Image [SwtTestCase.imageFormats.length*SwtTestCase.imageFilenames.length]; - -protected void setWidget(Widget w) { - if (decorations != null && !decorations.isDisposed()) - decorations.dispose(); - decorations = (Decorations)w; - super.setWidget(w); -} - -// this method must be private or protected so the auto-gen tool keeps it -private void loadImages() { - int numFormats = SwtTestCase.imageFormats.length; - int numFiles = SwtTestCase.imageFilenames.length; - for (int i=0; i<numFormats; i++) { - String format = SwtTestCase.imageFormats[i]; - int index = i*numFiles; - for (int j=0; j<numFiles; j++){ - String fileName = SwtTestCase.imageFilenames[j]; - InputStream resource = this.getClass().getResourceAsStream(fileName + "." + format); - images [index+j] = new Image (shell.getDisplay(), resource); - try { - resource.close(); - } catch (IOException e) { - // continue; - } - } - } -} - -// this method must be private or protected so the auto-gen tool keeps it -private void freeImages() { - for (int i=0; i<images.length; i++) images[i].dispose(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Dialog.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Dialog.java deleted file mode 100644 index 011d765225..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Dialog.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Dialog - * - * @see org.eclipse.swt.widgets.Dialog - */ -public class Test_org_eclipse_swt_widgets_Dialog extends SwtTestCase { - -public Test_org_eclipse_swt_widgets_Dialog(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - shell = new Shell(); -} - -protected void tearDown() { - shell.dispose(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Shell() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Shell not written"); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ShellI not written"); -} - -public void test_getParent() { - assertTrue(":a:", dialog.getParent() == shell); -} - -public void test_getStyle() { - // we use this call in a Constructor test so that we can - // check if the style is the one that was created - dialog.getStyle(); -} - -public void test_getText() { - // tested in test_setTextLjava_lang_String() -} - -public void test_setTextLjava_lang_String() { - assertTrue(":1:", dialog.getText() == ""); - String testStr = "test string"; - dialog.setText(testStr); - assertTrue(":2:", dialog.getText().equals(testStr)); - dialog.setText(""); - assertTrue(":3:", dialog.getText().equals("")); - try { - dialog.setText(null); - fail("No exception thrown for string = null"); - } - catch (IllegalArgumentException e) { - } -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Dialog((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getStyle"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_setTextLjava_lang_String"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getStyle")) test_getStyle(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); -} - -/* custom */ -public Shell shell; -private Dialog dialog; -private int junitStyle; - -protected void setDialog(Dialog newDialog) { - dialog = newDialog; -} -protected void setStyle(int style) { - style = junitStyle; -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DirectoryDialog.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DirectoryDialog.java deleted file mode 100644 index 0893b0c641..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_DirectoryDialog.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.DirectoryDialog - * - * @see org.eclipse.swt.widgets.DirectoryDialog - */ -public class Test_org_eclipse_swt_widgets_DirectoryDialog extends Test_org_eclipse_swt_widgets_Dialog { - -public Test_org_eclipse_swt_widgets_DirectoryDialog(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - dirDialog = new DirectoryDialog(shell, SWT.NULL); - setDialog(dirDialog); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Shell() { - DirectoryDialog dd = new DirectoryDialog(shell); - try { - new DirectoryDialog(null); - fail("No exception thrown for null parent"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ShellI not written"); -} - -public void test_getFilterPath() { - // tested in test_setFilterPathLjava_lang_String -} - -public void test_getMessage() { - // tested in test_setMessageLjava_lang_String -} - -public void test_open() { - if (fTestDialogOpen) - dirDialog.open(); -} - -public void test_setFilterPathLjava_lang_String() { - assertTrue(":1:", dirDialog.getFilterPath() == ""); - String testStr = "./*"; - dirDialog.setFilterPath(testStr); - assertTrue(":2:", dirDialog.getFilterPath().equals(testStr)); - dirDialog.setFilterPath(""); - assertTrue(":3:", dirDialog.getFilterPath().equals("")); - dirDialog.setFilterPath(null); - assertTrue(":4:", dirDialog.getFilterPath() == null); -} - -public void test_setMessageLjava_lang_String() { - assertTrue(":1:", dirDialog.getMessage() == ""); - String testStr = "test string"; - dirDialog.setMessage(testStr); - assertTrue(":2:", dirDialog.getMessage().equals(testStr)); - dirDialog.setMessage(""); - assertTrue(":3:", dirDialog.getMessage().equals("")); - try { - dirDialog.setMessage(null); - fail ("null argument did not throw IllegalArgumentException"); - } catch (IllegalArgumentException e) { - } -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_DirectoryDialog((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI"); - methodNames.addElement("test_getFilterPath"); - methodNames.addElement("test_getMessage"); - methodNames.addElement("test_open"); - methodNames.addElement("test_setFilterPathLjava_lang_String"); - methodNames.addElement("test_setMessageLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI(); - else if (getName().equals("test_getFilterPath")) test_getFilterPath(); - else if (getName().equals("test_getMessage")) test_getMessage(); - else if (getName().equals("test_open")) test_open(); - else if (getName().equals("test_setFilterPathLjava_lang_String")) test_setFilterPathLjava_lang_String(); - else if (getName().equals("test_setMessageLjava_lang_String")) test_setMessageLjava_lang_String(); - else super.runTest(); -} - -/* custom */ -DirectoryDialog dirDialog; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java deleted file mode 100644 index 214e59dedd..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Display.java +++ /dev/null @@ -1,553 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Display - * - * @see org.eclipse.swt.widgets.Display - */ -public class Test_org_eclipse_swt_widgets_Display extends Test_org_eclipse_swt_graphics_Device { - -public Test_org_eclipse_swt_widgets_Display(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - // There can only be one Display object per thread. - // If a second Display is created on the same thread, an - // InvalidThreadAccessException is thrown. - // - // Each test will create its own Display and must dispose of it - // before completing. -} - -protected void tearDown() { -} - -public void test_Constructor() { - Display disp = new Display(); - disp.dispose(); -} - -public void test_ConstructorLorg_eclipse_swt_graphics_DeviceData() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_graphics_DeviceData not written"); -} - -public void test_addFilterILorg_eclipse_swt_widgets_Listener() { - warnUnimpl("Test test_addFilterILorg_eclipse_swt_widgets_Listener not written"); -} - -public void test_addListenerILorg_eclipse_swt_widgets_Listener() { - warnUnimpl("Test test_addListenerILorg_eclipse_swt_widgets_Listener not written"); -} - -public void test_asyncExecLjava_lang_Runnable() { - final Display display = new Display(); - try { - display.asyncExec(new Runnable() { - public void run() { - display.beep(); - } - }); - } finally { - display.dispose(); - } -} - -public void test_beep() { - Display display = new Display(); - try { - display.beep(); - } finally { - display.dispose(); - } -} - -public void test_close() { - warnUnimpl("Test test_close not written"); -} - -public void test_disposeExecLjava_lang_Runnable() { - // Also tests dispose and isDisposed - Display testDisplay = new Display(); - disposeExecRan = false; - testDisplay.disposeExec(new Runnable() { - public void run() { - disposeExecRan = true; - } - }); - assertEquals("Display should not be disposed", false, testDisplay.isDisposed()); - testDisplay.dispose(); - assertTrue("Display should be disposed", testDisplay.isDisposed()); - assertTrue("DisposeExec Runnable did not run", disposeExecRan); -} - -public void test_findDisplayLjava_lang_Thread() { - warnUnimpl("Test test_findDisplayLjava_lang_Thread not written"); -} - -public void test_findWidgetI() { - warnUnimpl("Test test_findWidgetI not written"); -} - -public void test_getActiveShell() { - Display display = new Display(); - try { - Shell shell = new Shell(display); - shell.open(); - assertTrue(display.getActiveShell() == shell); - shell.dispose(); - } finally { - display.dispose(); - } -} - -public void test_getBounds() { - Display display = new Display(); - try { - Rectangle rect = display.getBounds(); - assertNotNull(rect); - } finally { - display.dispose(); - } -} - -public void test_getClientArea() { - Display display = new Display(); - try { - Rectangle rect = display.getClientArea(); - assertNotNull(rect); - } finally { - display.dispose(); - } -} - -public void test_getCurrent() { - Display display = new Display(); - try { - assertTrue(display.getThread() == Thread.currentThread()); - } finally { - display.dispose(); - } -} - -public void test_getCursorControl() { - Display display = new Display(); - try { - display.getCursorControl(); - } finally { - display.dispose(); - } -} - -public void test_getCursorLocation() { - Display display = new Display(); - try { - Point pt = display.getCursorLocation(); - assertNotNull(pt); - assertTrue(pt.x >= 0); - assertTrue(pt.y >= 0); - } finally { - display.dispose(); - } -} - -public void test_getCursorSize() { - warnUnimpl("Test test_getCursorSize not written"); -} - -public void test_getData() { - // tested in setData(Object) method -} - -public void test_getDataLjava_lang_String() { - // tested in setData(String, Object) method -} - -public void test_getDefault() { - Display display = new Display(); - try { - assertNotNull(Display.getDefault()); - } finally { - display.dispose(); - } -} - -public void test_getDismissalAlignment() { - Display display = new Display(); - try { - int alignment = display.getDismissalAlignment(); - assertTrue("getDismissalAlignment should return SWT.LEFT or SWT.RIGHT", - alignment == SWT.LEFT || alignment == SWT.RIGHT); - } finally { - display.dispose(); - } -} - -public void test_getDoubleClickTime() { - Display display = new Display(); - try { - int time = display.getDoubleClickTime(); - assertTrue(time > 0); - } finally { - display.dispose(); - } -} - -public void test_getFocusControl() { - Display display = new Display(); - try { - display.getFocusControl(); - } finally { - display.dispose(); - } -} - -public void test_getIconDepth() { - warnUnimpl("Test test_getIconDepth not written"); -} - -public void test_getMonitors() { - Display display = new Display(); - Monitor[] monitors = display.getMonitors(); - assertNotNull(monitors); - assertTrue("at least one monitor should be returned", monitors.length >= 1); - for (int i = 0; i < monitors.length; i++) - assertTrue("monitor at index "+i+" should not be null", monitors[i] != null); - display.dispose(); -} - -public void test_getPrimaryMonitor() { - Display display = new Display(); - Monitor monitor = display.getPrimaryMonitor(); - assertNotNull(monitor); - display.dispose(); -} - -public void test_getShells() { - Display display = new Display(); - try { - Shell shell1 = new Shell(display); - Shell shell2 = new Shell(display); - assertTrue(display.getShells().length == 2); - shell1.dispose(); - shell2.dispose(); - } finally { - display.dispose(); - } -} - -public void test_getSyncThread() { - warnUnimpl("Test test_getSyncThread not written"); -} - -public void test_getSystemColorI() { - Display display = new Display(); - try { - int [] colorIds = { - SWT.COLOR_WIDGET_DARK_SHADOW, SWT.COLOR_WIDGET_NORMAL_SHADOW, - SWT.COLOR_WIDGET_LIGHT_SHADOW, SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW, - SWT.COLOR_WIDGET_BACKGROUND, SWT.COLOR_WIDGET_BORDER, - SWT.COLOR_WIDGET_FOREGROUND, SWT.COLOR_LIST_FOREGROUND, - SWT.COLOR_LIST_BACKGROUND, SWT.COLOR_LIST_SELECTION, - SWT.COLOR_LIST_SELECTION_TEXT, - }; - for (int i=0; i < colorIds.length; i++) { - assertNotNull(display.getSystemColor(colorIds[i])); - } - } finally { - display.dispose(); - } -} - -public void test_getSystemFont() { - Display display = new Display(); - try { - Font font = display.getSystemFont(); - assertNotNull(font); - } finally { - display.dispose(); - } -} - -public void test_getThread() { - Display display = new Display(); - try { - assertTrue(display.getThread() == Thread.currentThread()); - } finally { - display.dispose(); - } -} - -public void test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData() { - warnUnimpl("Test test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData not written"); -} - -public void test_internal_new_GCLorg_eclipse_swt_graphics_GCData() { - warnUnimpl("Test test_internal_new_GCLorg_eclipse_swt_graphics_GCData not written"); -} - -public void test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlII() { - warnUnimpl("Test test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlII not written"); -} - -public void test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlIIII() { - warnUnimpl("Test test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlIIII not written"); -} - -public void test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_graphics_Point not written"); -} - -public void test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_graphics_Rectangle() { - warnUnimpl("Test test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_graphics_Rectangle not written"); -} - -public void test_readAndDispatch() { - warnUnimpl("Test test_readAndDispatch not written"); -} - -public void test_removeFilterILorg_eclipse_swt_widgets_Listener() { - warnUnimpl("Test test_removeFilterILorg_eclipse_swt_widgets_Listener not written"); -} - -public void test_removeListenerILorg_eclipse_swt_widgets_Listener() { - warnUnimpl("Test test_removeListenerILorg_eclipse_swt_widgets_Listener not written"); -} - -public void test_release() { - // Overriding test_release from Device. -} - -public void test_setAppNameLjava_lang_String() { - warnUnimpl("Test test_setAppNameLjava_lang_String not written"); -} - -public void test_setCursorLocationII() { - Display display = new Display(); - try { - display.setCursorLocation(0,0); - } finally { - display.dispose(); - } -} - -public void test_setCursorLocationLorg_eclipse_swt_graphics_Point() { - Display display = new Display(); - try { - display.setCursorLocation(new Point(0,0)); - try { - display.setCursorLocation(null); - fail("No exception thrown for null argument"); - } - catch (IllegalArgumentException e) { - } - } finally { - display.dispose(); - } -} - -public void test_setDataLjava_lang_Object() { - Display display = new Display(); - try { - display.setData(new Integer(10)); - Integer i = (Integer)display.getData(); - assertNotNull(i); - assertTrue(i.equals(new Integer(10))); - } finally { - display.dispose(); - } -} - -public void test_setDataLjava_lang_StringLjava_lang_Object() { - Display display = new Display(); - try { - display.setData("Integer", new Integer(10)); - display.setData("String", "xyz"); - Integer i = (Integer)display.getData("Integer"); - assertNotNull(i); - assertTrue(i.equals(new Integer(10))); - String s = (String)display.getData("String"); - assertNotNull(s); - assertTrue(s.equals("xyz")); - } finally { - display.dispose(); - } -} - -public void test_setSynchronizerLorg_eclipse_swt_widgets_Synchronizer() { - warnUnimpl("Test test_setSynchronizerLorg_eclipse_swt_widgets_Synchronizer not written"); -} - -public void test_sleep() { - warnUnimpl("Test test_sleep not written"); -} - -public void test_syncExecLjava_lang_Runnable() { - final Display display = new Display(); - try { - display.syncExec(new Runnable() { - public void run() { - display.beep(); - } - }); - } finally { - display.dispose(); - } -} - -public void test_timerExecILjava_lang_Runnable() { - warnUnimpl("Test test_timerExecILjava_lang_Runnable not written"); -} - -public void test_update() { - warnUnimpl("Test test_update not written"); -} - -public void test_wake() { - warnUnimpl("Test test_wake not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Display((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_graphics_DeviceData"); - methodNames.addElement("test_addFilterILorg_eclipse_swt_widgets_Listener"); - methodNames.addElement("test_addListenerILorg_eclipse_swt_widgets_Listener"); - methodNames.addElement("test_asyncExecLjava_lang_Runnable"); - methodNames.addElement("test_beep"); - methodNames.addElement("test_close"); - methodNames.addElement("test_disposeExecLjava_lang_Runnable"); - methodNames.addElement("test_findDisplayLjava_lang_Thread"); - methodNames.addElement("test_findWidgetI"); - methodNames.addElement("test_getActiveShell"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_getCurrent"); - methodNames.addElement("test_getCursorControl"); - methodNames.addElement("test_getCursorLocation"); - methodNames.addElement("test_getCursorSize"); - methodNames.addElement("test_getData"); - methodNames.addElement("test_getDataLjava_lang_String"); - methodNames.addElement("test_getDefault"); - methodNames.addElement("test_getDismissalAlignment"); - methodNames.addElement("test_getDoubleClickTime"); - methodNames.addElement("test_getFocusControl"); - methodNames.addElement("test_getIconDepth"); - methodNames.addElement("test_getMonitors"); - methodNames.addElement("test_getPrimaryMonitor"); - methodNames.addElement("test_getShells"); - methodNames.addElement("test_getSyncThread"); - methodNames.addElement("test_getSystemColorI"); - methodNames.addElement("test_getSystemFont"); - methodNames.addElement("test_getThread"); - methodNames.addElement("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_internal_new_GCLorg_eclipse_swt_graphics_GCData"); - methodNames.addElement("test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlII"); - methodNames.addElement("test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlIIII"); - methodNames.addElement("test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_readAndDispatch"); - methodNames.addElement("test_removeFilterILorg_eclipse_swt_widgets_Listener"); - methodNames.addElement("test_removeListenerILorg_eclipse_swt_widgets_Listener"); - methodNames.addElement("test_setAppNameLjava_lang_String"); - methodNames.addElement("test_setCursorLocationII"); - methodNames.addElement("test_setCursorLocationLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setDataLjava_lang_Object"); - methodNames.addElement("test_setDataLjava_lang_StringLjava_lang_Object"); - methodNames.addElement("test_setSynchronizerLorg_eclipse_swt_widgets_Synchronizer"); - methodNames.addElement("test_sleep"); - methodNames.addElement("test_syncExecLjava_lang_Runnable"); - methodNames.addElement("test_timerExecILjava_lang_Runnable"); - methodNames.addElement("test_update"); - methodNames.addElement("test_wake"); - methodNames.addAll(Test_org_eclipse_swt_graphics_Device.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_graphics_DeviceData")) test_ConstructorLorg_eclipse_swt_graphics_DeviceData(); - else if (getName().equals("test_addFilterILorg_eclipse_swt_widgets_Listener")) test_addFilterILorg_eclipse_swt_widgets_Listener(); - else if (getName().equals("test_addListenerILorg_eclipse_swt_widgets_Listener")) test_addListenerILorg_eclipse_swt_widgets_Listener(); - else if (getName().equals("test_asyncExecLjava_lang_Runnable")) test_asyncExecLjava_lang_Runnable(); - else if (getName().equals("test_beep")) test_beep(); - else if (getName().equals("test_close")) test_close(); - else if (getName().equals("test_disposeExecLjava_lang_Runnable")) test_disposeExecLjava_lang_Runnable(); - else if (getName().equals("test_findDisplayLjava_lang_Thread")) test_findDisplayLjava_lang_Thread(); - else if (getName().equals("test_findWidgetI")) test_findWidgetI(); - else if (getName().equals("test_getActiveShell")) test_getActiveShell(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_getCurrent")) test_getCurrent(); - else if (getName().equals("test_getCursorControl")) test_getCursorControl(); - else if (getName().equals("test_getCursorLocation")) test_getCursorLocation(); - else if (getName().equals("test_getCursorSize")) test_getCursorSize(); - else if (getName().equals("test_getData")) test_getData(); - else if (getName().equals("test_getDataLjava_lang_String")) test_getDataLjava_lang_String(); - else if (getName().equals("test_getDefault")) test_getDefault(); - else if (getName().equals("test_getDismissalAlignment")) test_getDismissalAlignment(); - else if (getName().equals("test_getDoubleClickTime")) test_getDoubleClickTime(); - else if (getName().equals("test_getFocusControl")) test_getFocusControl(); - else if (getName().equals("test_getIconDepth")) test_getIconDepth(); - else if (getName().equals("test_getMonitors")) test_getMonitors(); - else if (getName().equals("test_getPrimaryMonitor")) test_getPrimaryMonitor(); - else if (getName().equals("test_getShells")) test_getShells(); - else if (getName().equals("test_getSyncThread")) test_getSyncThread(); - else if (getName().equals("test_getSystemColorI")) test_getSystemColorI(); - else if (getName().equals("test_getSystemFont")) test_getSystemFont(); - else if (getName().equals("test_getThread")) test_getThread(); - else if (getName().equals("test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData")) test_internal_dispose_GCILorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_internal_new_GCLorg_eclipse_swt_graphics_GCData")) test_internal_new_GCLorg_eclipse_swt_graphics_GCData(); - else if (getName().equals("test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlII")) test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlII(); - else if (getName().equals("test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlIIII")) test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlIIII(); - else if (getName().equals("test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_graphics_Point")) test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_graphics_Rectangle")) test_mapLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_widgets_ControlLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_readAndDispatch")) test_readAndDispatch(); - else if (getName().equals("test_removeFilterILorg_eclipse_swt_widgets_Listener")) test_removeFilterILorg_eclipse_swt_widgets_Listener(); - else if (getName().equals("test_removeListenerILorg_eclipse_swt_widgets_Listener")) test_removeListenerILorg_eclipse_swt_widgets_Listener(); - else if (getName().equals("test_setAppNameLjava_lang_String")) test_setAppNameLjava_lang_String(); - else if (getName().equals("test_setCursorLocationII")) test_setCursorLocationII(); - else if (getName().equals("test_setCursorLocationLorg_eclipse_swt_graphics_Point")) test_setCursorLocationLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setDataLjava_lang_Object")) test_setDataLjava_lang_Object(); - else if (getName().equals("test_setDataLjava_lang_StringLjava_lang_Object")) test_setDataLjava_lang_StringLjava_lang_Object(); - else if (getName().equals("test_setSynchronizerLorg_eclipse_swt_widgets_Synchronizer")) test_setSynchronizerLorg_eclipse_swt_widgets_Synchronizer(); - else if (getName().equals("test_sleep")) test_sleep(); - else if (getName().equals("test_syncExecLjava_lang_Runnable")) test_syncExecLjava_lang_Runnable(); - else if (getName().equals("test_timerExecILjava_lang_Runnable")) test_timerExecILjava_lang_Runnable(); - else if (getName().equals("test_update")) test_update(); - else if (getName().equals("test_wake")) test_wake(); - else super.runTest(); -} - -/* custom */ -boolean disposeExecRan; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Event.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Event.java deleted file mode 100644 index 2f9c7a212e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Event.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Event - * - * @see org.eclipse.swt.widgets.Event - */ -public class Test_org_eclipse_swt_widgets_Event extends SwtTestCase { - -public Test_org_eclipse_swt_widgets_Event(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_Constructor() { - Event event = new Event(); - assertNotNull(event); -} - -public void test_getBounds() { - warnUnimpl("Test test_getBounds not written"); -} - -public void test_setBoundsLorg_eclipse_swt_graphics_Rectangle() { - warnUnimpl("Test test_setBoundsLorg_eclipse_swt_graphics_Rectangle not written"); -} - -public void test_toString() { - Event event = new Event(); - assertNotNull(event.toString()); - assertTrue(event.toString().length() > 0); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Event((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_setBoundsLorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_toString"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_setBoundsLorg_eclipse_swt_graphics_Rectangle")) test_setBoundsLorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_toString")) test_toString(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FileDialog.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FileDialog.java deleted file mode 100644 index fe7564e635..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FileDialog.java +++ /dev/null @@ -1,187 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.FileDialog - * - * @see org.eclipse.swt.widgets.FileDialog - */ -public class Test_org_eclipse_swt_widgets_FileDialog extends Test_org_eclipse_swt_widgets_Dialog { - -public Test_org_eclipse_swt_widgets_FileDialog(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - fileDialog = new FileDialog(shell, SWT.NULL); - setDialog(fileDialog); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Shell() { - // Test FileDialog(Shell) - FileDialog fd = new FileDialog(shell); - try { - new FileDialog(null); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() { - // Test FileDialog(Shell, int) - FileDialog fd; - fd = new FileDialog(shell, SWT.NULL); - assertTrue(fd.getStyle()==SWT.NULL); - fd = new FileDialog(shell, SWT.APPLICATION_MODAL); - assertTrue(fd.getStyle()==SWT.APPLICATION_MODAL); - fd = new FileDialog(shell, SWT.PRIMARY_MODAL); - assertTrue(fd.getStyle()==SWT.PRIMARY_MODAL); - fd = new FileDialog(shell, SWT.SYSTEM_MODAL); - assertTrue(fd.getStyle()==SWT.SYSTEM_MODAL); -} -public void test_getFileName() { - // tested in test_setFileNameLjava_lang_String() -} - -public void test_getFileNames() { - String[] names = fileDialog.getFileNames(); - assertTrue(names.length==0); -} - -public void test_getFilterExtensions() { - // tested in test_setFilterExtensions$Ljava_lang_String() -} - -public void test_getFilterNames() { - // tested in test_setFilterNames$Ljava_lang_String() -} - -public void test_getFilterPath() { - // tested in test_setFilterPathLjava_lang_String -} - -public void test_open() { - if (fTestDialogOpen) - fileDialog.open(); -} - -public void test_setFileNameLjava_lang_String() { - fileDialog.setFileName(""); - String name = fileDialog.getFileName(); - assertTrue(name.equals("")); - fileDialog.setFileName(null); - name = fileDialog.getFileName(); - assertTrue(name==null); - fileDialog.setFileName("somefile.test"); - name = fileDialog.getFileName(); - assertTrue(name.equals("somefile.test")); -} - -public void test_setFilterExtensions$Ljava_lang_String() { - fileDialog.setFilterExtensions(new String[] {"txt","java"}); - String filters[] = fileDialog.getFilterExtensions(); - assertTrue(filters.length == 2); - assertTrue(filters[0].equals("txt")); - assertTrue(filters[1].equals("java")); - fileDialog.setFilterExtensions(new String[] {""}); - filters = fileDialog.getFilterExtensions(); - assertTrue(filters.length == 1); - fileDialog.setFilterExtensions(null); - filters = fileDialog.getFilterExtensions(); - assertTrue(filters==null); -} - -public void test_setFilterNames$Ljava_lang_String() { - fileDialog.setFilterNames(new String[] {"a.txt","b.java"}); - String filters[] = fileDialog.getFilterNames(); - assertTrue(filters.length == 2); - assertTrue(filters[0].equals("a.txt")); - assertTrue(filters[1].equals("b.java")); - fileDialog.setFilterNames(new String[] {""}); - filters = fileDialog.getFilterNames(); - assertTrue(filters.length == 1); - fileDialog.setFilterNames(null); - filters = fileDialog.getFilterNames(); - assertTrue(filters==null); -} - -public void test_setFilterPathLjava_lang_String() { - assertTrue(":1:", fileDialog.getFilterPath() == ""); - String testStr = "./*"; - fileDialog.setFilterPath(testStr); - assertTrue(":2:", fileDialog.getFilterPath().equals(testStr)); - fileDialog.setFilterPath(""); - assertTrue(":3:", fileDialog.getFilterPath().equals("")); - fileDialog.setFilterPath(null); - assertTrue(":4:", fileDialog.getFilterPath() == null); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_FileDialog((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI"); - methodNames.addElement("test_getFileName"); - methodNames.addElement("test_getFileNames"); - methodNames.addElement("test_getFilterExtensions"); - methodNames.addElement("test_getFilterNames"); - methodNames.addElement("test_getFilterPath"); - methodNames.addElement("test_open"); - methodNames.addElement("test_setFileNameLjava_lang_String"); - methodNames.addElement("test_setFilterExtensions$Ljava_lang_String"); - methodNames.addElement("test_setFilterNames$Ljava_lang_String"); - methodNames.addElement("test_setFilterPathLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI(); - else if (getName().equals("test_getFileName")) test_getFileName(); - else if (getName().equals("test_getFileNames")) test_getFileNames(); - else if (getName().equals("test_getFilterExtensions")) test_getFilterExtensions(); - else if (getName().equals("test_getFilterNames")) test_getFilterNames(); - else if (getName().equals("test_getFilterPath")) test_getFilterPath(); - else if (getName().equals("test_open")) test_open(); - else if (getName().equals("test_setFileNameLjava_lang_String")) test_setFileNameLjava_lang_String(); - else if (getName().equals("test_setFilterExtensions$Ljava_lang_String")) test_setFilterExtensions$Ljava_lang_String(); - else if (getName().equals("test_setFilterNames$Ljava_lang_String")) test_setFilterNames$Ljava_lang_String(); - else if (getName().equals("test_setFilterPathLjava_lang_String")) test_setFilterPathLjava_lang_String(); - else super.runTest(); -} - -/* custom */ -FileDialog fileDialog; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FontDialog.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FontDialog.java deleted file mode 100644 index 21f81e9b3e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_FontDialog.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.FontDialog - * - * @see org.eclipse.swt.widgets.FontDialog - */ -public class Test_org_eclipse_swt_widgets_FontDialog extends Test_org_eclipse_swt_widgets_Dialog { - -public Test_org_eclipse_swt_widgets_FontDialog(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - fontDialog = new FontDialog(shell, SWT.NULL); - setDialog(fontDialog); -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Shell() { - FontDialog fd = new FontDialog(shell); - try { - new FontDialog(null); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() { - try { - new FontDialog(null, SWT.NULL); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_getFontData() { - // tested in test_setFontDataLorg_eclipse_swt_graphics_FontData -} - -public void test_getFontList() { - warnUnimpl("Test test_getFontList not written"); -} - -public void test_getRGB() { - // tested in test_setRGBLorg_eclipse_swt_graphics_RGB -} - -public void test_open() { - warnUnimpl("Test test_open not written"); -} - -public void test_setFontDataLorg_eclipse_swt_graphics_FontData() { - FontData [] fontData = new FontData [1]; - fontData [0] = new FontData (); - - assertNull(fontDialog.getFontList()); - - fontDialog.setFontList(fontData); - assertEquals(fontDialog.getFontList(), fontData); - - fontDialog.setFontList(null); - assertNull(fontDialog.getFontList()); -} - -public void test_setFontList$Lorg_eclipse_swt_graphics_FontData() { - warnUnimpl("Test test_setFontList$Lorg_eclipse_swt_graphics_FontData not written"); -} - -public void test_setRGBLorg_eclipse_swt_graphics_RGB() { - RGB rgb = new RGB(255, 0, 0); - fontDialog.setRGB(rgb); - RGB rgb2 = fontDialog.getRGB(); - assertEquals(rgb, rgb2); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_FontDialog((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI"); - methodNames.addElement("test_getFontData"); - methodNames.addElement("test_getFontList"); - methodNames.addElement("test_getRGB"); - methodNames.addElement("test_open"); - methodNames.addElement("test_setFontDataLorg_eclipse_swt_graphics_FontData"); - methodNames.addElement("test_setFontList$Lorg_eclipse_swt_graphics_FontData"); - methodNames.addElement("test_setRGBLorg_eclipse_swt_graphics_RGB"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI(); - else if (getName().equals("test_getFontData")) test_getFontData(); - else if (getName().equals("test_getFontList")) test_getFontList(); - else if (getName().equals("test_getRGB")) test_getRGB(); - else if (getName().equals("test_open")) test_open(); - else if (getName().equals("test_setFontDataLorg_eclipse_swt_graphics_FontData")) test_setFontDataLorg_eclipse_swt_graphics_FontData(); - else if (getName().equals("test_setFontList$Lorg_eclipse_swt_graphics_FontData")) test_setFontList$Lorg_eclipse_swt_graphics_FontData(); - else if (getName().equals("test_setRGBLorg_eclipse_swt_graphics_RGB")) test_setRGBLorg_eclipse_swt_graphics_RGB(); - else super.runTest(); -} - -/* custom */ -FontDialog fontDialog; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Group.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Group.java deleted file mode 100644 index 7a8fa5d24d..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Group.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Group - * - * @see org.eclipse.swt.widgets.Group - */ -public class Test_org_eclipse_swt_widgets_Group extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_widgets_Group(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - group = new Group(shell, 0); - setWidget(group); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - try { - group = new Group(null, 0); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } - - int[] cases = {SWT.SHADOW_IN, SWT.SHADOW_OUT, SWT.SHADOW_ETCHED_IN, SWT.SHADOW_ETCHED_OUT}; - for (int i = 0; i < cases.length; i++) - group = new Group(shell, cases[i]); -} - -public void test_computeTrimIIII() { - warnUnimpl("Test test_computeTrimIIII not written"); -} - -public void test_getClientArea() { - warnUnimpl("Test test_getClientArea not written"); -} - -public void test_getText() { - // tested in test_setTextLjava_lang_String -} - -public void test_setTextLjava_lang_String() { - String[] cases = {"", "some text", "ldkashdoehufweovcnhslvhregojebckreavbkuhxbiufvcyhbifuyewvbiureyd.,cmnesljliewjfchvbwoifivbeworixuieurvbiuvbohflksjeahfcliureafgyciabelitvyrwtlicuyrtliureybcliuyreuceyvbliureybct"}; - for (int i = 0; i < cases.length; i++) { - group.setText(cases[i]); - assertTrue("case: " + String.valueOf(i), group.getText().equals(cases[i])); - }; -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Group((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_computeTrimIIII"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else super.runTest(); -} - -/* custom */ -Group group; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Item.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Item.java deleted file mode 100644 index 30641bba3e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Item.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import java.io.*; - -import junit.framework.*; -import junit.textui.TestRunner; - -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Item - * - * @see org.eclipse.swt.widgets.Item - */ -public class Test_org_eclipse_swt_widgets_Item extends Test_org_eclipse_swt_widgets_Widget { - -public Test_org_eclipse_swt_widgets_Item(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - loadImages(); -} - -protected void tearDown() { - super.tearDown(); - freeImages(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_WidgetI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_WidgetI not written"); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_WidgetII() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_WidgetII not written"); -} - -public void test_getImage() { - // tested in test_setImageLorg_eclipse_swt_graphics_Image -} - -public void test_getText() { - // tested in test_setTextLjava_lang_String -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - assertNull(item.getImage()); - item.setImage(images[0]); - assertEquals(images[0], item.getImage()); - assertTrue(item.getImage() != images[1]); - item.setImage(null); - assertNull(item.getImage()); -} - -public void test_setTextLjava_lang_String() { - String testStr = "test string"; - item.setText(testStr); - assertTrue("a", item.getText().equals(testStr)); - item.setText(""); - assertTrue("b", item.getText().equals("")); - try { - item.setText(null); - fail("No exception thrown for string == null"); - } - catch (IllegalArgumentException e) { - } -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Item((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_WidgetI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_WidgetII"); - methodNames.addElement("test_getImage"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_WidgetI")) test_ConstructorLorg_eclipse_swt_widgets_WidgetI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_WidgetII")) test_ConstructorLorg_eclipse_swt_widgets_WidgetII(); - else if (getName().equals("test_getImage")) test_getImage(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else super.runTest(); -} - -/* custom */ -Item item; -Image[] images = new Image [SwtTestCase.imageFormats.length*SwtTestCase.imageFilenames.length]; - -private void loadImages() { - int numFormats = SwtTestCase.imageFormats.length; - int numFiles = SwtTestCase.imageFilenames.length; - for (int i=0; i<numFormats; i++) { - String format = SwtTestCase.imageFormats[i]; - int index = i*numFiles; - for (int j=0; j<numFiles; j++){ - String fileName = SwtTestCase.imageFilenames[j]; - InputStream resource = this.getClass().getResourceAsStream(fileName + "." + format); - images [index+j] = new Image (shell.getDisplay(), resource); - try { - resource.close(); - } catch (IOException e) { - // continue; - } - } - } -} -protected void setWidget(Widget widget) { - item = (Item) widget; - super.setWidget(widget); -} - -private void freeImages() { - for (int i=0; i<images.length; i++) { - if (images[i] != null) - images[i].dispose(); - } -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Label.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Label.java deleted file mode 100644 index 9d89d82e8e..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Label.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Label - * - * @see org.eclipse.swt.widgets.Label - */ -public class Test_org_eclipse_swt_widgets_Label extends Test_org_eclipse_swt_widgets_Control { - -public Test_org_eclipse_swt_widgets_Label(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - label = new Label(shell, 0); - setWidget(label); -} - -protected void tearDown() { -// super.tearDown(); - - if (label != null) { - assertEquals(shell.isDisposed(), false); - assertEquals(label.isDisposed(), false); - } - - shell.dispose(); - if (label != null) { - assertTrue(shell.isDisposed()); - assertTrue(label.isDisposed()); - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI(){ - try { - label = new Label(null, 0); - fail("No exception thrown"); //should never get here - } - catch (IllegalArgumentException e) { - } - - label = new Label(shell, 0); - - int[] cases = {SWT.LEFT, SWT.RIGHT, SWT.CENTER, SWT.SEPARATOR, SWT.HORIZONTAL, SWT.VERTICAL, SWT.SHADOW_IN, SWT.SHADOW_OUT}; - for (int i = 0; i < cases.length; i++) - label = new Label(shell, cases[i]); -} - -public void test_computeSizeIIZ() { - // super class test is sufficient -} - -public void test_getAlignment(){ - int[] cases = {SWT.LEFT, SWT.RIGHT, SWT.CENTER}; - for (int i=0; i<cases.length; i++) - { - label = new Label(shell, cases[i]); - assertEquals(label.getAlignment(), cases[i]); - } -} - -public void test_getImage(){ - Image[] cases = {null, new Image(null, 100, 100)}; - for(int i=0; i<cases.length; i++){ - label.setImage(cases[i]); - assertEquals(label.getImage(), cases[i]); - if (cases[i]!=null) - cases[i].dispose(); - } -} - -public void test_getText(){ - String[] cases = {"", "some name", "sdasdlkjshcdascecoewcwe"}; - for(int i=0; i<cases.length; i++){ - label.setText(cases[i]); - assertEquals(label.getText(), cases[i]); - } -} - -public void test_setAlignmentI(){ - int[] cases = {SWT.LEFT, SWT.RIGHT, SWT.CENTER}; - for (int i=0; i<cases.length; i++) - { - label.setAlignment(cases[i]); - assertEquals(label.getAlignment(), cases[i]); - } -} - -public void test_setFocus() { - // super class test is sufficient -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - // tested in getImage method -} - -public void test_setTextLjava_lang_String(){ - try { - label.setText(null); - fail("No exception thrown for string == null"); - } - catch (IllegalArgumentException e) { - } -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Label((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getAlignment"); - methodNames.addElement("test_getImage"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_setAlignmentI"); - methodNames.addElement("test_setFocus"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getAlignment")) test_getAlignment(); - else if (getName().equals("test_getImage")) test_getImage(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_setAlignmentI")) test_setAlignmentI(); - else if (getName().equals("test_setFocus")) test_setFocus(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else super.runTest(); -} - -/* custom */ -Label label; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Layout.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Layout.java deleted file mode 100644 index d69a2eb3f3..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Layout.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Layout - * - * @see org.eclipse.swt.widgets.Layout - */ -public class Test_org_eclipse_swt_widgets_Layout extends SwtTestCase { - Shell shell; - Composite composite; - -public Test_org_eclipse_swt_widgets_Layout(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - shell = new Shell(); - composite = new Composite(shell, 0); -} - -protected void tearDown() { - if (composite != null) { - composite.dispose(); - } - if (shell != null) { - shell.dispose(); - } -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Layout((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); -} -} 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 deleted file mode 100644 index 1ef4f0d707..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_List.java +++ /dev/null @@ -1,2471 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.List - * - * @see org.eclipse.swt.widgets.List - */ -public class Test_org_eclipse_swt_widgets_List extends Test_org_eclipse_swt_widgets_Scrollable { - -public Test_org_eclipse_swt_widgets_List(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - list = new List(shell, SWT.MULTI); - - setWidget(list); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - try { - list = new List(null, 0); - fail("No exception thrown"); //should never get here - } catch (IllegalArgumentException e) { - } - - int[] cases = - { - 0, - SWT.SINGLE, - SWT.MULTI, - SWT.MULTI | SWT.V_SCROLL, - SWT.MULTI | SWT.H_SCROLL, - SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL }; - for (int i = 0; i < cases.length; i++) - list = new List(shell, cases[i]); -} - -public void test_addLjava_lang_String() { - try { - list.add(null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - list.add(""); - assertSame(":a:", new String[] {""}, list.getItems()); - list.add("some \n text"); - assertSame(":b:", new String[] {"", "some \n text"}, list.getItems()); - list.add("some text"); - assertSame(":c:", new String[] {"", "some \n text", "some text"}, list.getItems()); - - // test single-selection list - - setSingleList(); - - try { - list.add(null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - list.add(""); - assertSame(":a:", new String[] {""}, list.getItems()); - list.add("some \n text"); - assertSame(":b:", new String[] {"", "some \n text"}, list.getItems()); - list.add("some text"); - assertSame(":c:", new String[] {"", "some \n text", "some text"}, list.getItems()); -} - -public void test_addLjava_lang_StringI() { - try { - list.add("some text", 2); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(0, list.getItemCount()); - - list.add("", 0); - assertSame(":a:", new String[] {""}, list.getItems()); - list.add("some \n text", 1); - assertSame(":b:", new String[] {"", "some \n text"}, list.getItems()); - list.add("some text", 0); - assertSame(":c:", new String[] {"some text", "", "some \n text" }, list.getItems()); - - try { - list.add(null, 0); - fail("No exception thrown string == null"); - } catch (IllegalArgumentException e) { - } - - try { - list.add("string", -1); - fail("No exception thrown index < 0"); - } catch (IllegalArgumentException e) { - } - - // test single-selection list - - setSingleList(); - - try { - list.add("some text", 2); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(0, list.getItemCount()); - - list.add("", 0); - assertSame(":a:", new String[] {""}, list.getItems()); - list.add("some \n text", 1); - assertSame(":b:", new String[] {"", "some \n text"}, list.getItems()); - list.add("some text", 0); - assertSame(":c:", new String[] {"some text", "", "some \n text" }, list.getItems()); - - try { - list.add(null, 0); - fail("No exception thrown string == null"); - } catch (IllegalArgumentException e) { - } - - try { - list.add("string", -1); - fail("No exception thrown index < 0"); - } catch (IllegalArgumentException e) { - } -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - listenerCalled = false; - boolean exceptionThrown = false; - SelectionListener listener = new SelectionListener() { - public void widgetSelected(SelectionEvent event) { - listenerCalled = true; - } - public void widgetDefaultSelected(SelectionEvent event) { - } - }; - try { - list.addSelectionListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown for listener == null", exceptionThrown); - - list.addSelectionListener(listener); - list.select(0); - assertTrue(":a:", listenerCalled == false); - list.removeSelectionListener(listener); - exceptionThrown = false; - try { - list.removeSelectionListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown for listener == null", exceptionThrown); - - // test single-selection list - - setSingleList(); - - listenerCalled = false; - exceptionThrown = false; - try { - list.addSelectionListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown for listener == null", exceptionThrown); - - list.addSelectionListener(listener); - list.select(0); - assertTrue(":a:", listenerCalled == false); - list.removeSelectionListener(listener); - exceptionThrown = false; - try { - list.removeSelectionListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown for listener == null", exceptionThrown); - -} - -public void test_computeSizeIIZ() { - // super class test is sufficient -} - -public void test_deselect$I() { - String[] items = { "item0", "item1", "item2", "item3" }; - String[] empty = { - }; - list.setItems(items); - list.setSelection(items); - assertSame(":a:", list.getSelection(), items); - try { - list.deselect(null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertSame(list.getSelection(), items); - list.deselect(new int[] { - }); - assertSame(list.getSelection(), items); - list.deselect(new int[] { 0 }); - assertEquals(list.isSelected(0), false); - assertTrue(list.isSelected(1)); - list.deselect(new int[] { 2, 0, 0 }); - assertSame(list.getSelectionIndices(), new int[] { 1, 3 }); - /* assert(":d:", !list.isSelected(0)); - assert(":dd:", !list.isSelected(2)); - assert(":ddd:", list.isSelected(1)); - assert(":ddd:", list.isSelected(1));*/ - - - setSingleList(); - list.setItems(items); - list.setSelection(items); - assertEquals(list.getSelection(), new String[] { "item3" }); - try { - list.deselect(null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(list.getSelection(), new String[] { "item3" }); - list.deselect(new int[] { - }); - assertEquals(list.getSelection(), new String[] { "item3" }); - list.deselect(new int[] { 1 }); - assertEquals(list.getSelectionIndices(), new int[] { 3 }); - list.deselect(new int[] { 0 }); - assertEquals(list.getSelectionIndices(), new int[] { 3 }); - list.deselect(new int[] { 3 }); - assertEquals(list.getSelectionIndices(), new int[] {}); - list.deselect(new int[] { 2, 0, 0 }); - assertEquals(list.getSelectionIndices(), new int[] {}); - -} - -public void test_deselectAll() { - String[] items = { "item0", "item1", "item2", "item3" }; - String[] empty = { - }; - list.setItems(items); - list.setSelection(items); - assertSame(items, list.getSelection()); - list.deselectAll(); - assertEquals(empty, list.getSelection()); - - - setSingleList(); - - list.setItems(items); - list.setSelection(items); - assertEquals(new String[] { "item3" }, list.getSelection()); - list.deselectAll(); - assertEquals(empty, list.getSelection()); - -} - -public void test_deselectI() { - int number = 5; - String[] items = new String[number]; - for (int i = 0; i < number; i++) - items[i] = "fred" + i; - list.setItems(items); - - String[] items2 = { "item0", "item1", "item2", "item3" }; - String[] empty = { - }; - list.setItems(items2); - list.setSelection(items2); - assertSame(items2, list.getSelection()); - list.deselect(5); - assertSame(items2, list.getSelection()); - list.deselect(1); - assertEquals(false, list.isSelected(1)); - list.deselect(1); - assertEquals(false, list.isSelected(1)); - - - setSingleList(); - list.setItems(items2); - list.setSelection(items2); - assertEquals(new String[] { "item3" }, list.getSelection()); - list.deselect(5); - assertEquals(new String[] { "item3" }, list.getSelection()); - list.deselect(2); - assertEquals(false, list.isSelected(2)); - list.deselect(1); - assertEquals(false, list.isSelected(1)); - list.deselect(1); - assertEquals(false, list.isSelected(1)); - // assert(":e:", list.getSe); - -} - -public void test_deselectII() { - int number = 5; - String[] items = new String[number]; - for (int i = 0; i < number; i++) - items[i] = "fred" + i; - list.setItems(items); - list.setSelection(items); - - // tests if deselect(i, j) is the same as for (i=0; i<=j; ++i) deselect(i); - int[][] cases = { { 3, 1 }, { - -3, -2 }, { - -2, -1 }, { - -1, -1 }, { - 10, 1 } - }; - - for (int i = 0; i < cases.length; ++i) { - deselectII_helper(items, cases[i][0], cases[i][1], new int[] { 0, 1, 2, 3, 4 }); - } - if (fCheckSWTPolicy) { - deselectII_helper(items, -1, 3, new int[] { 4 }); - deselectII_helper(items, -1, 30, new int[] { - }); - } - deselectII_helper(items, 1, 3, new int[] { 0, 4 }); - deselectII_helper(items, 1, 1, new int[] { 0, 2, 3, 4 }); - // done - - String[] items2 = { "item0", "item1", "item2", "item3" }; - String[] empty = { - }; - list.setItems(items2); - list.setSelection(items2); - assertSame(":a:", items2, list.getSelection()); - list.deselect(0, 0); - assertSame(":b:", list.getSelectionIndices(), new int[] { 1, 2, 3 }); - list.deselect(0, 0); - assertSame(":bbb:", list.getSelectionIndices(), new int[] { 1, 2, 3 }); - list.deselect(2, 3); - assertEquals(":bb:", list.getSelectionIndices(), new int[] { 1 }); - - list.setSelection(items2); - list.deselect(0, 2); - assertEquals(":dddd:", list.getSelectionIndices(), new int[] { 3 }); - - list.setSelection(items2); - list.deselect(2, 0); - assertSame( - ":ddddd:", - list.getSelectionIndices(), new int[] { 0, 1, 2, 3 }); - - - setSingleList(); - deselectII_helper(items, 3, 1, new int[]{4}); - deselectII_helper(items, -1, -1, new int[]{4}); - deselectII_helper(items, 1, 3, new int[]{4}); - deselectII_helper(items, -1, 3, new int[]{4}); - deselectII_helper(items, -1, 30, new int[]{}); - deselectII_helper(items, 1, 1, new int[]{4}); - deselectII_helper(items, 10, 1, new int[]{4}); - - - - list.setItems(items2); - list.deselectAll(); - - list.select(0); - - list.deselect(-3, -2); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - list.deselect(-2, -1); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - list.deselect(-1, -1); - assertEquals(":e:", list.getSelectionIndices(), new int[] { 0 }); - - - list.setSelection(items2); - assertEquals(list.getSelection(), new String[] { "item3" }); - - list.deselect(1, 1); - assertEquals(list.getSelection(), new String[] { "item3" }); - - list.deselect(0, 0); - assertEquals(list.getSelection(), new String[] { "item3" }); - - list.deselect(3, 3); - assertEquals(list.getSelection(), new String[] {}); - - list.setSelection(items2); - list.deselect(1, 2); - assertEquals(list.getSelection(), new String[] { "item3" }); - - list.setSelection(items2); - list.deselect(0, 2); - assertEquals(list.getSelectionIndices(), new int[] { 3 }); - - list.setSelection(items2); - list.deselect(1, 3); - assertEquals(list.getSelectionIndices(), new int[] {}); -} - -public void test_getFocusIndex() { - String[] items = { "item0", "item1", "item2"}; - list.setItems(items); - list.setSelection(0); - assertEquals(0, list.getFocusIndex()); - list.setSelection(2); - assertEquals(2, list.getFocusIndex()); -} - -public void test_getItemCount() { - String[] items = { "item0", "item1", "item2", "item3" }; - - assertEquals(0, list.getItemCount()); - list.setItems(items); - assertEquals(4, list.getItemCount()); - list.remove(2); - assertEquals(3, list.getItemCount()); - list.removeAll(); - assertEquals(0, list.getItemCount()); - - - setSingleList(); - assertEquals(0, list.getItemCount()); - list.setItems(items); - assertEquals(4, list.getItemCount()); - list.remove(2); - assertEquals(3, list.getItemCount()); - list.removeAll(); - assertEquals(0, list.getItemCount()); - -} - -public void test_getItemHeight() { - FontData fontData = list.getFont().getFontData()[0]; - int lineHeight; - Font font; - - font = new Font(list.getDisplay(), fontData.getName(), 8, fontData.getStyle()); - list.setFont(font); - 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(); -} - -public void test_getItemI() { - String[] items = { "item0", "item1", "item2", "item3" }; - String[] empty = { - }; - list.setItems(items); - String item = null; - try { - item = list.getItem(5); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - try { - item = list.getItem(-1); - fail("No exception thrown for index < 0"); - } catch (IllegalArgumentException e) { - } - - assertEquals(list.getItem(3), "item3"); - - - setSingleList(); - list.setItems(items); - try { - item = list.getItem(5); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - try { - item = list.getItem(-1); - fail("No exception thrown for index < 0"); - } catch (IllegalArgumentException e) { - } - - //assert(":a:", list.getItem(5)==null); - assertEquals("item3", list.getItem(3)); - -} - -public void test_getItems() { - String[][] cases = { { - }, { - "" }, { - "", "" }, { - "text1", "text2" } - }; - for (int i = 0; i < cases.length; i++) { - list.setItems(cases[i]); - assertEquals("case: " + i, cases[i], list.getItems()); - } -} - -public void test_getSelection() { - String[][] cases = { { - }, { - "" }, { - "", "" }, { - "text1", "text2" } - }; - for (int i = 0; i < cases.length; i++) { - // System.out.println("loop:" + i); - list.setItems(cases[i]); - list.setSelection(cases[i]); - // System.out.println("list:" + list.getSelection()); - // System.out.println("case:" + i + cases[i]); - assertSame("case: " + i, cases[i], list.getSelection()); - } - - for (int i = 1; i < cases.length; i++) { - list.setItems(cases[i]); - list.setSelection(0); - assertEquals( - "case: " + String.valueOf(i), - list.getSelection(), new String[] { cases[i][0] }); - } - - String[] items = { "text1", "text2", "text3" }; - list.setItems(items); - int[] sel = { 0, 2 }; - list.setSelection(sel); - assertEquals(list.getSelection().length, 2); - String[] selItems = new String[] {items[0], items[2]}; - assertSame(list.getSelection(), selItems); - - list.setSelection(0, 1); - assertEquals(list.getSelection().length, 2); - selItems = new String[] {items[0], items[1]}; - assertSame(list.getSelection(), selItems); - - list.setSelection(1, 1); - assertEquals(list.getSelection().length, 1); - assertEquals(list.getSelection()[0], items[1]); - - list.setSelection(1, 0); - String[] empty = { - }; - assertEquals(empty, list.getSelection()); - - String[] bogus_items = { "bogus_text1", "bogus_text2", "bogus_text3" }; - list.setSelection(bogus_items); - assertEquals(empty, list.getSelection()); - - // test single-selection lists - - setSingleList(); - - list.setItems(items); - sel = new int[] { 0, 2 }; - list.setSelection(sel); - assertEquals(1, list.getSelection().length); - assertEquals(items[0], list.getSelection()[0]); - - list.setSelection(0, 1); - assertEquals(1, list.getSelection().length); - assertEquals(items[1], list.getSelection()[0]); -} - -/** - * Returns the number of selected items contained in the receiver. - * - * @return the number of selected items - * - * @exception SWTException <ul> - * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> - * </ul> - * @exception SWTError <ul> - * <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li> - * </ul> - */ -public void test_getSelectionCount() { - String[] items = { "text1", "text2", "text3" }; - - list.setItems(items); - assertEquals(0, list.getSelectionCount()); - - list.setSelection(items); - assertEquals(3, list.getSelectionCount()); - - list.deselectAll(); - try { - list.setSelection((String[]) null); - fail("No exception thrown for selection == null"); - } catch (IllegalArgumentException e) { - } - assertEquals(list.getSelectionCount(), 0); - - - setSingleList(); - - list.setItems(items); - list.setSelection(items); - assertEquals(1, list.getSelectionCount()); -} - -public void test_getSelectionIndex() { - String[] items = { "text1", "text2", "text3" }; - - setSingleList(); - - list.setItems(items); - list.setSelection(items); - assertEquals(items.length - 1, list.getSelectionIndex()); -} - -public void test_getSelectionIndices() { - String[] items = { "text1", "text2", "text3" }; - - list.setItems(items); - - assertEquals(list.getSelectionIndices(), new int[] {}); - - list.setSelection(items); - int[] sel = { 0, 1, 2 }; - assertSame(sel, list.getSelectionIndices()); - - - setSingleList(); - - list.setItems(items); - list.setSelection(items); - sel = new int[]{ items.length - 1 }; - assertSame(sel, list.getSelectionIndices()); - - - list.setItems(items); - assertEquals(new int[] {}, list.getSelectionIndices()); - -} - -public void test_getTopIndex() { - String[] items = { "text1", "text2", "text3" }; - - list.setItems(items); - assertEquals(0, list.getTopIndex()); - - - setSingleList(); - - list.setItems(items); - assertEquals(0, list.getTopIndex()); - -} - -public void test_indexOfLjava_lang_String() { - String[] items = { "text1", "text2", "text3" }; - - list.setItems(items); - assertEquals(list.indexOf("text3"), 2); - assertEquals(list.indexOf("text4"), -1); - - int ind; - try { - ind = list.indexOf(null); - fail("No exception thrown for item == null"); - } catch (IllegalArgumentException e) { - } - - String[] items2 = { "text1", "text2", "text2" }; //two identical - - list.setItems(items2); - assertEquals(list.indexOf("text2"), 1); - - - setSingleList(); - - list.setItems(items); - assertEquals(-1, list.indexOf("text3", 4)); - - - assertEquals(2, list.indexOf("text3")); - - - assertEquals(-1, list.indexOf("text4")); - - - try { - ind = list.indexOf(null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - - assertEquals(1, list.indexOf("text2")); -} - -public void test_indexOfLjava_lang_StringI() { - String[] items = { "text1", "text2", "text3" }; - - list.setItems(items); - assertEquals(-1, list.indexOf("text3", 4)); - assertEquals(2, list.indexOf("text3", 2)); - assertEquals(1, list.indexOf("text2", 0)); - assertEquals(1, list.indexOf("text2", 1)); - assertEquals(-1, list.indexOf("text2", 2)); - - String[] items2 = { "text1", "text2", "text2" }; //two identical - list.setItems(items2); - assertEquals(list.indexOf("text2", 2), 2); - - try { - list.indexOf(null, 0); - fail("No exception thrown for string == null"); - } catch (IllegalArgumentException e) { - } - - setSingleList(); - - list.setItems(items2); - // assert("list.indexOf(\"text2\", -1)==1", list.indexOf("text2", -1)==1); - assertEquals(1, list.indexOf("text2", 0)); - assertEquals(1, list.indexOf("text2", 1)); - assertEquals(2, list.indexOf("text2", 2)); - - try { - list.indexOf(null, 0); - fail("No exception thrown for string == null"); - } catch (IllegalArgumentException e) { - } -} - -public void test_isSelectedI() { - String[] items = { "text1", "text2", "text2" }; //two identical - - list.setItems(items); - list.setSelection(items); - assertTrue(list.isSelected(0)); - assertTrue(list.isSelected(1)); - assertTrue(list.isSelected(2)); - assertEquals(false, list.isSelected(3)); - - - setSingleList(); - - list.setItems(items); - list.setSelection(items); - if (fCheckSWTPolicy) { - assertEquals(false, list.isSelected(0)); - assertTrue(list.isSelected(1)); - assertEquals(false, list.isSelected(2)); - assertEquals(false, list.isSelected(3)); - } - -} - -public void test_remove$I() { - try { - list.remove((int[]) null); - fail("No exception thrown for indices == null"); - } catch (IllegalArgumentException e) { - } - - String[] items = { "text0", "text1", "text2", "text3" }; - - list.setItems(items); - assertEquals(list.getItemCount(), 4); - - list.setItems(items); - list.remove(new int[] { 1, 0, 1 }); - assertEquals(list.getItemCount(), 2); - - list.setItems(items); - - // index > number of elements in list - try { - list.remove(new int[] { 4, 1}); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(":a:", list.getItems(), items); - - try { - list.remove(new int[] { 3, 1, -1 }); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(":a:", list.getItems(), items); - - list.setItems(items); - assertEquals(list.getItemCount(), 4); - - try { - list.remove(new int[] { -1, -1 }); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(":b:", list.getItems(), items); - - try { - list.remove(new int[] { -2, -1 }); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(":c:", list.getItems(), items); - - list.setItems(items); - assertEquals(list.getItemCount(), 4); - - list.remove(new int[] { 1, 1, 1 }); - assertEquals( - ":d:", - list.getItems(), new String[] { "text0", "text2", "text3" }); - - list.setItems(items); - assertEquals(list.getItemCount(), 4); - - list.remove(new int[] { 1, 3 }); - assertEquals(":e:", list.getItems(), new String[] { "text0", "text2" }); - - - setSingleList(); - - try { - int[] indices = null; - list.remove(indices); - fail("No exception thrown for indices == null"); - } catch (IllegalArgumentException e) { - } - - list.setItems(items); - assertEquals(4, list.getItemCount()); - - list.remove(new int[] { 1, 3 }); - assertEquals(":f:", list.getItems(), new String[] { "text0", "text2" }); - - - list.setItems(items); - assertEquals(4, list.getItemCount()); - - list.remove(new int[] { 3, 1 }); - assertEquals(":g:", list.getItems(), new String[] { "text0", "text2" }); - - - list.setItems(items); - assertEquals(4, list.getItemCount()); - - // index > number of elements in list - try { - list.remove(new int[] { 4, 1}); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(":h:", list.getItems(), items); - - try { - list.remove(new int[] { 3, 1, -1 }); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(":h:", list.getItems(), items); - - - list.setItems(items); - assertEquals(4, list.getItemCount()); - - try { - list.remove(new int[] { -1, -1 }); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(":i:", items, list.getItems()); - - - assertEquals(4, list.getItemCount()); - - list.remove(new int[] { 1, 1, 1 }); - assertEquals(":j:", - new String[] { "text0", "text2", "text3" }, list.getItems()); - -} - -public void test_removeAll() { - String[] items = { "text1", "text2", "text3", "test2" }; - - list.setItems(items); - assertEquals(list.getItemCount(), 4); - - list.removeAll(); - assertEquals(list.getItemCount(), 0); - list.removeAll(); - assertEquals(list.getItemCount(), 0); - - - setSingleList(); - list.setItems(items); - assertEquals(4, list.getItemCount()); - - list.removeAll(); - assertEquals(0, list.getItemCount()); - - - setSingleList(); - assertEquals(0, list.getItemCount()); - list.removeAll(); - assertEquals(0, list.getItemCount()); - -} - -public void test_removeI() { - String[] items = { "text1", "text2", "text3" }; - - list.setItems(items); - assertEquals(list.getItemCount(), 3); - - try { - list.remove(3); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(list.getItemCount(), 3); - - try { - list.remove(-1); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(list.getItemCount(), 3); - - list.remove(1); - assertEquals(list.getItemCount(), 2); - assertEquals(list.getItem(1), "text3"); - - list.setItems(items); - assertEquals(list.getItemCount(), 3); - - try { - list.remove(3, 4); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(list.getItemCount(), 3); - - try { - list.remove(3, 3); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(list.getItemCount(), 3); - - list.remove(0); - assertEquals(list.getItemCount(), 2); - list.remove(0); - assertEquals(list.getItemCount(), 1); - assertEquals(list.getItem(0), "text3"); - list.remove(0); - assertEquals(list.getItemCount(), 0); - - list.setItems(items); - list.remove(1, 2); - assertEquals(list.getItemCount(), 1); - assertEquals(list.getItem(0), "text1"); - - - setSingleList(); - list.setItems(items); - assertEquals(3, list.getItemCount()); - try { - list.remove(3); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(3, list.getItemCount()); - ///////////////////////////////////////////////// - try { - list.remove(-1); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(3, list.getItemCount()); - //////////////////////////////////////////////// - list.remove(1); - assertEquals(2, list.getItemCount()); - ////////////////////////////////////////////////////// - assertTrue(list.getItem(1).equals("text3")); - - list.setItems(items); - assertEquals(list.getItemCount(), 3); - - list.remove(0); - assertEquals(list.getItemCount(), 2); - list.remove(0); - assertEquals(list.getItemCount(), 1); - assertEquals(list.getItem(0), "text3"); - list.remove(0); - assertEquals(list.getItemCount(), 0); - -} - -public void test_removeII() { - String[] items = { "text1", "text2", "text3" }; - - list.setItems(items); - assertEquals(3, list.getItemCount()); - - try { - list.remove(3, 4); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(3, list.getItemCount()); - - try { - list.remove(3, 3); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(3, list.getItemCount()); - - list.remove(0, 0); - assertEquals(2, list.getItemCount()); - assertEquals("text3", list.getItem(1)); - - list.setItems(items); - assertEquals(3, list.getItemCount()); - - try { - list.remove(-1, 1); - fail("No exception thrown for start index < 0"); - } catch (IllegalArgumentException e) { - } - assertEquals(3, list.getItemCount()); - - try { - list.remove(3, 4); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(3, list.getItemCount()); - - list.remove(0, 2); - assertEquals(0, list.getItemCount()); - - list.setItems(items); - assertEquals(3, list.getItemCount()); - - try { - list.remove(3, 3); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(3, list.getItemCount()); - - list.remove(2, 0); - assertEquals(3, list.getItemCount()); - - - setSingleList(); - - list.setItems(items); - assertEquals(3, list.getItemCount()); - ////////////////////////////////////////////////////////////// - try { - list.remove(3, 4); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(3, list.getItemCount()); - ///////////////////////////////////////////////////////// - try { - list.remove(3, 3); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(3, list.getItemCount()); - ////////////////////////////////////////////////////////////// - - try { - list.remove(-1, 1); - fail("No exception thrown for start index < 0"); - } catch (IllegalArgumentException e) { - } - assertEquals(3, list.getItemCount()); - - list.remove(1, 2); - assertEquals(1, list.getItemCount()); - assertEquals("text1", list.getItem(0)); - - - list.setItems(items); - assertEquals(3, list.getItemCount()); - - try { - list.remove(2, 10); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(3, list.getItemCount()); - assertEquals("text2", list.getItem(1)); - - list.remove(2, 0); - assertEquals(3, list.getItemCount()); -} - -public void test_removeLjava_lang_String() { - String[] items = { "text1", "text2", "text3", "test2" }; - - list.setItems(items); - assertEquals(list.getItemCount(), 4); - - try { - list.remove((String) null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(list.getItemCount(), 4); - - try { - list.remove("items989"); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(list.getItemCount(), 4); - - list.setItems(items); - assertEquals(list.getItemCount(), 4); - - list.remove("text3"); - assertEquals(list.getItemCount(), 3); - - list.remove("text2"); - assertEquals(list.getItemCount(), 2); - - - setSingleList(); - list.setItems(items); - assertEquals(4, list.getItemCount()); - - try { - list.remove((String) null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(4, list.getItemCount()); - //////////////////////////////////////// - try { - list.remove("items989"); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(4, list.getItemCount()); - - - assertEquals(4, list.getItemCount()); - - list.remove("text3"); - assertEquals(3, list.getItemCount()); - - list.remove("text2"); - assertEquals(2, list.getItemCount()); - -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - // tested in addSelectionListener method -} - -public void test_select$I() { - try { - list.select((int[]) null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - String[] items = { "item0", "item1", "item2", "item3" }; - list.setItems(items); - - list.select(new int[] { 0, 2 }); - assertSame(list.getSelectionIndices(), new int[] { 0, 2 }); - - list.select(new int[] { 1, 3 }); - assertSame(list.getSelectionIndices(), new int[] { 0, 1, 2, 3 }); - - list.select(new int[] { 1, 3 }); - assertSame(list.getSelectionIndices(), new int[] { 0, 1, 2, 3 }); - - list.select(new int[] { 1 }); - assertSame(list.getSelectionIndices(), new int[] { 0, 1, 2, 3 }); - - list.add("item4"); - - int[] ind = { -1, 0, 1, 2, 3 }; - list.select(ind); - assertSame(list.getSelectionIndices(), new int[] { 0, 1, 2, 3 }); - - ind = new int[32]; - for (int i = 0; i < ind.length; i++) - ind[i] = i; - - list.select(ind); - assertSame(list.getSelectionIndices(), new int[] { 0, 1, 2, 3, 4 }); - - list.setSelection(new int[] { - }); - list.select(new int[] { 1 }); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - list.setSelection(new int[] { - }); - list.select(new int[] { -1 }); - assertEquals(list.getSelectionIndices(), new int[] {}); - - list.deselectAll(); - items = list.getItems(); - - select$I_helper(items, 0, 3, new int[] { 0, 1, 2, 3 }); - select$I_helper(items, -1, 3, new int[] { 0, 1, 2, 3 }); - select$I_helper(items, -1, 30, new int[] { 0, 1, 2, 3, 4 }); - - - setSingleList(); - list.setItems(items); - - ind = new int[]{ -1, 0, 1, 2, 3 }; - list.select(ind); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - - ind = new int[32]; - for (int i = 0; i < ind.length; i++) - ind[i] = i; - - list.select(ind); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - - ind = new int[]{ 1 }; - list.select(ind); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - list.deselectAll(); - - - ind = new int[]{ -1 }; - list.select(ind); - assertEquals(list.getSelectionIndices(), new int[] {}); - - - setSingleList(); - list.setItems(items); - - list.select(new int[] { 0, 2 }); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - list.select(new int[] { 1, 3 }); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - list.select(new int[] { 1, 3 }); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - list.select(new int[] { 2, 3 }); - assertEquals(list.getSelectionIndices(), new int[] { 2 }); - list.select(new int[] { 1, 3 }); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - - try { - list.select((int[]) null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - - int[] selection = { 0, 1, 2, 3 }; - list.select(selection); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - - selection = new int[]{ -1, 0, 1, 2, 3 }; - list.select(selection); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - - selection = new int[32]; - for (int i = -1; i <= 30; i++) - selection[i + 1] = i; - - list.select(selection); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - - selection = new int[]{1}; - list.select(selection); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); -} - -public void test_selectAll() { - String[] items = { "text1", "text2", "text3", "test2" }; - - list.setItems(items); - assertEquals(list.getSelectionCount(), 0); - list.selectAll(); - assertEquals(list.getSelectionCount(), 4); - - - setSingleList(); - - list.setItems(items); - assertEquals(0, list.getSelectionCount()); - list.selectAll(); - assertEquals(0, list.getSelectionCount()); - -} - -public void test_selectI() { - String[] items = { "item0", "item1", "item2", "item3" }; - list.setItems(items); - - list.select(2); - assertEquals("select(2):", list.getSelectionIndices(), new int[] { 2 }); - - list.select(1); - assertSame("select(1):", list.getSelectionIndices(), new int[] { 1, 2 }); - - list.select(3); - assertSame( - "select(3):", - list.getSelectionIndices(), new int[] { 1, 2, 3 }); - - list.select(5); - assertSame( - "select(5):", - list.getSelectionIndices(), new int[] { 1, 2, 3 }); - - - setSingleList(); - list.setItems(items); - - list.select(2); - assertEquals(list.getSelectionIndices(), new int[] { 2 }); - - list.select(1); - assertEquals(list.getSelectionIndices(), new int[] { 1 }); - - list.select(3); - assertEquals(list.getSelectionIndices(), new int[] { 3 }); - - list.select(5); - assertEquals(list.getSelectionIndices(), new int[] { 3 }); - -} - -public void test_selectII() { - int number = 5; - - String[] items = new String[number]; - int[] empty = { - }; - - for (int i = 0; i < number; i++) - items[i] = "item" + i; - - selectII_helper(items, 10, 1, empty); - selectII_helper(items, 3, 1, empty); - selectII_helper(items, -1, -1, empty); - selectII_helper(items, 2, 4, new int[] { 2, 3, 4 }); - selectII_helper(items, 0, 3, new int[] { 0, 1, 2, 3 }); - selectII_helper(items, 1, 1, new int[] { 1 }); - - if (fCheckSWTPolicy == true) { - selectII_helper(items, -1, 30, new int[] { 0, 1, 2, 3, 4 }); - selectII_helper(items, -1, 3, new int[] { 0, 1, 2, 3 }); - } - - list.select(0); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - list.select(-10, -9); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - list.deselectAll(); - - list.select(1000, 2000); - assertEquals(list.getSelectionCount(), 0); - - list.deselectAll(); - list.select(1, 2); - assertSame(list.getSelectionIndices(), new int[] { 1, 2 }); - - list.select(1, 3); - assertSame(list.getSelectionIndices(), new int[] { 1, 2, 3 }); - - list.select(2, 2); - assertSame(list.getSelectionIndices(), new int[] { 1, 2, 3 }); - - list.select(3, 5); - assertSame(list.getSelectionIndices(), new int[] { 1, 2, 3, 4 }); - - - setSingleList(); - list.setItems(items); - list.select(0); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - list.select(-10, -9); - assertEquals(list.getSelectionIndices(), new int[] { 0 }); - - - list.deselectAll(); - assertEquals(0, list.getSelectionCount()); - - list.select(1000, 2000); - assertEquals(0, list.getSelectionCount()); - - list.deselectAll(); - assertEquals(0, list.getSelectionCount()); - - list.select(1, 2); - assertEquals(list.getSelectionIndices(), new int[] { 2 }); - - list.select(1, 3); - assertEquals(list.getSelectionIndices(), new int[] { 3 }); - - list.select(2, 2); - assertEquals(list.getSelectionIndices(), new int[] { 2 }); - - list.select(3, 5); - assertEquals(list.getSelectionIndices(), new int[] { 4 }); - - selectII_helper(items, 1, 1, new int[]{1}); - selectII_helper(items, -1, 30, new int[]{4}); - selectII_helper(items, 10, 1, new int[]{}); - selectII_helper(items, 3, 1, new int[]{}); - selectII_helper(items, -1, -1, new int[]{}); - selectII_helper(items, 2, 4, new int[]{4}); - selectII_helper(items, 0, 3, new int[]{3}); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - FontData fontData = list.getFont().getFontData()[0]; - int lineHeight; - Font font; - - font = new Font(list.getDisplay(), fontData.getName(), 8, fontData.getStyle()); - list.setFont(font); - 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(); -} - -public void test_setItemILjava_lang_String() { - String[] items = { "item0", "item1", "item2", "item3" }; - - assertEquals(list.getItemCount(), 0); - int[] cases = { -10, 0, 10 }; - for (int i = 0; i < cases.length; i++) { - try { - list.setItem(cases[i], null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - } - assertEquals(list.getItemCount(), 0); - - for (int i = 0; i < cases.length; i++) { - try { - list.setItem(cases[i], ""); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - } - assertEquals(list.getItemCount(), 0); - - int cases2[] = { 10, 15, 0 }; - for (int i = 0; i < cases2.length; i++) { - try { - list.setItem(cases2[i], "fred"); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - assertEquals(list.getItemCount(), 0); - } - - list.setItems(items); - list.setItem(1, "new1"); - assertEquals(new String[] { "item0", "new1", "item2", "item3" }, list.getItems()); - - setSingleList(); - assertEquals(0, list.getItemCount()); - for (int i = 0; i < cases.length; i++) { - try { - list.setItem(cases[i], null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - } - - - setSingleList(); - for (int i = 0; i < cases.length; i++) { - try { - list.setItem(cases[i], ""); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - } - - assertEquals(0, list.getItemCount()); - - - setSingleList(); - for (int i = 0; i < cases2.length; i++) { - try { - list.setItem(cases2[i], "fred"); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - assertEquals(0, list.getItemCount()); - } - - list.setItems(items); - list.setItem(1, "new1"); - assertEquals(new String[] { "item0", "new1", "item2", "item3" }, list.getItems()); - -} - -public void test_setItems$Ljava_lang_String() { - try { - list.setItems(null); - fail("No exception thrown for items == null"); - } catch (IllegalArgumentException e) { - } - - // TODO An SWTError should never happen and should not - // be part of the test case. List should throw an - // SWTException. -// String[][] cases = { { null }, { -// "dsada", null, "dsdasdasd" } -// }; -// for (int i = 0; i < cases.length; i++) { -// try { -// list.setItems(cases[i]); -// fail("No exception thrown for items not found"); -// } catch (SWTError e) { -// } -// } - - String[][] itemArr = { { - }, { - "" }, { - "sdasd" }, { - "sdasd", "323434" } - }; - for (int i = 0; i < itemArr.length; i++) { - list.setItems(itemArr[i]); - assertEquals(itemArr[i], list.getItems()); - } - - try { - list.setItems(null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - - setSingleList(); - for (int i = 0; i < itemArr.length; i++) { - list.setItems(itemArr[i]); - assertEquals("case:" + i, itemArr[i], list.getItems()); - } - - - try { - list.setItems(null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } -} - -public void test_setSelection$I() { - int number = 8; - for (int i = 0; i < number; i++) - list.add("fred" + i); - - list.setSelection(new int [0]); - assertEquals(list.getSelectionIndices(), new int[0]); - if (fCheckSWTPolicy) { - assertEquals(list.getFocusIndex(), -1); - } - - try { - list.setSelection((int[]) null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - list.setSelection(new int [] {2}); - assertEquals(list.getSelectionIndices(), new int[] {2}); - assertEquals(list.getFocusIndex(), 2); - - list.setSelection(new int [] {number}); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 2); - - list.setSelection(new int [] {1, 0}); - assertEquals(list.getSelectionIndices(), new int[] {0, 1}); - assertEquals(list.getFocusIndex(), 1); - - list.setSelection(new int [] {-1, number}); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 1); - - list.setSelection(new int [] {number - 1, number}); - assertEquals(list.getSelectionIndices(), new int[] {number - 1}); - assertEquals(list.getFocusIndex(), number - 1); - - list.setSelection(new int [] {-1, 0}); - assertEquals(list.getSelectionIndices(), new int[] {0}); - assertEquals(list.getFocusIndex(), number - 1); - - int[] indices = new int [number]; - for (int i = 0; i < number; i++) { - indices[i] = i; - } - list.setSelection(indices); - assertEquals(list.getSelectionIndices(), indices); - assertEquals(list.getFocusIndex(), indices[0]); - - list.setSelection(new int [] {number, number}); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(new int [] {number - 1, number - 1}); - assertEquals(list.getSelectionIndices(), new int[] {number - 1}); - assertEquals(list.getFocusIndex(), number - 1); - - list.setSelection(new int [] {0, number, 1}); - assertEquals(list.getSelectionIndices(), new int[] {0, 1}); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(new int [] {number - 1, 0, number - 2}); - assertEquals(list.getSelectionIndices(), new int[] {0, number - 2, number - 1}); - assertEquals(list.getFocusIndex(), number - 1); - - list.removeAll(); - - list.setSelection(new int [0]); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), -1); - - try { - list.setSelection((int[]) null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - list.setSelection(new int [] {0}); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), -1); - - list.setSelection(new int [] {-1}); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), -1); - - list.setSelection(new int [] {0, 0}); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), -1); - - list.setSelection(new int [] {-1, 0}); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), -1); - - list.setSelection(new int [] {0, -1}); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), -1); - - setSingleList(); - for (int i = 0; i < number; i++) - list.add("fred" + i); - - list.setSelection(new int [0]); - assertEquals(list.getSelectionIndices(), new int[0]); - if (fCheckSWTPolicy) { - assertEquals(list.getFocusIndex(), -1); - } - - try { - list.setSelection((int[]) null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - list.setSelection(new int [] {2}); - assertEquals(list.getSelectionIndices(), new int[] {2}); - assertEquals(list.getFocusIndex(), 2); - - list.setSelection(new int [] {number}); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 2); - - list.setSelection(new int [] {1, 0}); - assertEquals(list.getSelectionIndices(), new int[] {1}); - assertEquals(list.getFocusIndex(), 1); - - list.setSelection(new int [] {-1, number}); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 1); - - list.setSelection(new int [] {number - 1, number}); - assertEquals(list.getSelectionIndices(), new int[] {number - 1}); - assertEquals(list.getFocusIndex(), number - 1); - - list.setSelection(new int [] {-1, 0}); - assertEquals(list.getSelectionIndices(), new int[] {0}); - assertEquals(list.getFocusIndex(), 0); - - indices = new int [number]; - for (int i = 0; i < number; i++) { - indices[i] = i; - } - list.setSelection(indices); - assertEquals(list.getSelectionIndices(), new int[] {indices[0]}); - assertEquals(list.getFocusIndex(), indices[0]); - - list.setSelection(new int [] {number, number}); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(new int [] {number - 1, number - 1}); - assertEquals(list.getSelectionIndices(), new int[] {number - 1}); - assertEquals(list.getFocusIndex(), number - 1); - - list.setSelection(new int [] {0, number, 1}); - assertEquals(list.getSelectionIndices(), new int[] {0}); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(new int [] {number - 1, 0, number - 2}); - assertEquals(list.getSelectionIndices(), new int[] {number - 1}); - assertEquals(list.getFocusIndex(), number - 1); - - list.removeAll(); - - list.setSelection(new int [0]); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), -1); - - try { - list.setSelection((int[]) null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - list.setSelection(new int [] {0}); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), -1); - - list.setSelection(new int [] {-1}); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), -1); - - list.setSelection(new int [] {0, 0}); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), -1); - - list.setSelection(new int [] {-1, 0}); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), -1); - - list.setSelection(new int [] {0, -1}); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), -1); -} - -public void test_setSelection$Ljava_lang_String() { - int number = 8; - for (int i = 0; i < number; i++) - list.add("fred " + i); - - list.setSelection(new String [0]); - assertEquals(list.getSelection(), new String[0]); - if (fCheckSWTPolicy) { - assertEquals(list.getFocusIndex(), -1); - } - - try { - list.setSelection((String[]) null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - list.setSelection(new String [] {"fred 2"}); - assertEquals(list.getSelection(), new String [] {"fred 2"}); - assertEquals(list.getFocusIndex(), 2); - - list.setSelection(new String [] {"fred " + number}); - assertEquals(list.getSelection(), new String [0]); - assertEquals(list.getFocusIndex(), 2); - - list.setSelection(new String [] {"fred 1", "fred 0"}); - assertEquals(list.getSelection(), new String [] {"fred 0", "fred 1"}); - assertEquals(list.getFocusIndex(), 1); - - list.setSelection(new String [] {"fred -1", "fred " + number}); - assertEquals(list.getSelection(), new String [0]); - assertEquals(list.getFocusIndex(), 1); - - list.setSelection(new String [] {"fred " + (number - 1), "fred " + number}); - assertEquals(list.getSelection(), new String [] {"fred " + (number - 1)}); - assertEquals(list.getFocusIndex(), number - 1); - - list.setSelection(new String [] {"fred -1", "fred 0"}); - assertEquals(list.getSelection(), new String [] {"fred 0"}); - assertEquals(list.getFocusIndex(), 0); - - String[] items = new String [number]; - for (int i = 0; i < number; i++) { - items[i] = "fred " + i; - } - list.setSelection(items); - assertEquals(list.getSelection(), items); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(new String [] {"fred " + number, "fred " + number}); - assertEquals(list.getSelection(), new String [0]); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(new String [] {"fred " + (number - 1), "fred " + (number - 1)}); - assertEquals(list.getSelection(), new String[] {"fred " + (number - 1)}); - assertEquals(list.getFocusIndex(), number - 1); - - list.setSelection(new String [] {"fred 0", "fred " + number, "fred 1"}); - assertEquals(list.getSelection(), new String[] {"fred 0", "fred 1"}); - assertEquals(list.getFocusIndex(), 0); - - if (fCheckSWTPolicy) { - list.removeAll(); - - list.setSelection(new String [0]); - assertEquals(list.getSelection(), new String[0]); - assertEquals(list.getFocusIndex(), -1); - - try { - list.setSelection((String[]) null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - list.setSelection(new String [] {"fred 0"}); - assertEquals(list.getSelection(), new String[0]); - assertEquals(list.getFocusIndex(), -1); - - list.setSelection(new String [] {"fred 0", "fred 0"}); - assertEquals(list.getSelection(), new String[0]); - assertEquals(list.getFocusIndex(), -1); - } - - setSingleList(); - for (int i = 0; i < number; i++) - list.add("fred " + i); - - list.setSelection(new String [0]); - assertEquals(list.getSelection(), new String[0]); - if (fCheckSWTPolicy) { - assertEquals(list.getFocusIndex(), -1); - } - - try { - list.setSelection((String[]) null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - list.setSelection(new String [] {"fred 2"}); - assertEquals(list.getSelection(), new String[] {"fred 2"}); - assertEquals(list.getFocusIndex(), 2); - - list.setSelection(new String [] {"fred " + number}); - assertEquals(list.getSelection(), new String[0]); - assertEquals(list.getFocusIndex(), 2); - - list.setSelection(new String [] {"fred 1", "fred 0"}); - assertEquals(list.getSelection(), new String[] {"fred 0"}); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(new String [] {"fred -1", "fred " + number}); - assertEquals(list.getSelection(), new String[0]); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(new String [] {"fred " + (number - 1), "fred " + number}); - assertEquals(list.getSelection(), new String[] {"fred " + (number - 1)}); - assertEquals(list.getFocusIndex(), number - 1); - - list.setSelection(new String [] {"fred -1", "fred 0"}); - assertEquals(list.getSelection(), new String[] {"fred 0"}); - assertEquals(list.getFocusIndex(), 0); - - items = new String[number]; - for (int i = 0; i < number; i++) { - items[i] = "fred " + i; - } - list.setSelection(items); - assertEquals(list.getSelection(), new String[] {"fred " + (number - 1)}); - assertEquals(list.getFocusIndex(), number - 1); - - list.setSelection(new String [] {"fred " + number, "fred " + number}); - assertEquals(list.getSelection(), new String[0]); - assertEquals(list.getFocusIndex(), number - 1); - - list.setSelection(new String [] {"fred " + (number - 1), "fred " + (number - 1)}); - assertEquals(list.getSelection(), new String[] {"fred " + (number - 1)}); - assertEquals(list.getFocusIndex(), number - 1); - - list.setSelection(new String [] {"fred 0", "fred " + number, "fred 1"}); - assertEquals(list.getSelection(), new String[] {"fred 1"}); - assertEquals(list.getFocusIndex(), 1); - - if (fCheckSWTPolicy) { - list.removeAll(); - - list.setSelection(new String [0]); - assertEquals(list.getSelection(), new String[0]); - assertEquals(list.getFocusIndex(), -1); - - try { - list.setSelection((String[]) null); - fail("No exception thrown"); - } catch (IllegalArgumentException e) { - } - - list.setSelection(new String [] {"fred 0"}); - assertEquals(list.getSelection(), new String[0]); - assertEquals(list.getFocusIndex(), -1); - - list.setSelection(new String [] {"fred 0", "fred 0"}); - assertEquals(list.getSelection(), new String[0]); - assertEquals(list.getFocusIndex(), -1); - } -} - -public void test_setSelectionI() { - int number = 8; - for (int i = 0; i < number; i++) { - list.add("fred" + i); - } - - list.setSelection(2); - assertEquals(list.getSelectionIndices(), new int[] {2}); - assertEquals(list.getFocusIndex(), 2); - - list.setSelection(-5); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 2); - - list.setSelection(0); - assertEquals(list.getSelectionIndices(), new int[] {0}); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(number); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(number - 1); - assertEquals(list.getSelectionIndices(), new int[] {number - 1}); - assertEquals(list.getFocusIndex(), number - 1); - - list.setSelection(-1); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), number - 1); - - if (fCheckSWTPolicy) { - list.removeAll(); - - list.setSelection(-2); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), -1); - - list.setSelection(0); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), -1); - - list.setSelection(-1); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), -1); - } - - setSingleList(); - - for (int i = 0; i < number; i++) { - list.add("fred" + i); - } - - list.setSelection(2); - assertEquals(list.getSelectionIndices(), new int[] {2}); - assertEquals(list.getFocusIndex(), 2); - - list.setSelection(-5); - assertEquals(list.getSelectionIndices(), new int[] {2}); - assertEquals(list.getFocusIndex(), 2); - - list.setSelection(0); - assertEquals(list.getSelectionIndices(), new int[] {0}); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(number); - assertEquals(list.getSelectionIndices(), new int[] {0}); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(number - 1); - assertEquals(list.getSelectionIndices(), new int[] {number - 1}); - assertEquals(list.getFocusIndex(), number - 1); - - list.setSelection(-1); - assertEquals(list.getSelectionIndices(), new int[] {number - 1}); - assertEquals(list.getFocusIndex(), number - 1); - - if (fCheckSWTPolicy) { - list.removeAll(); - - list.setSelection(0); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), -1); - - list.setSelection(-1); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), -1); - - list.setSelection(-2); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), -1); - } -} - -public void test_setSelectionII() { - int number = 8; - String[] items = new String[number]; - for (int i = 0; i < number; i++) - items[i] = "fred" + i; - - list.setItems(items); - - list.setSelection(1, 2); - assertEquals(list.getSelectionIndices(), new int[] {1, 2}); - assertEquals(list.getFocusIndex(), 1); - - list.setSelection(-3, -2); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 1); - - list.setSelection(0, 1); - assertEquals(list.getSelectionIndices(), new int[] {0, 1}); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(-2, -1); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(number - 2, number - 1); - assertEquals(list.getSelectionIndices(), new int[] {number - 2, number - 1}); - assertEquals(list.getFocusIndex(), number - 2); - - list.setSelection(number - 1, number); - assertEquals(list.getSelectionIndices(), new int[] {number - 1}); - assertEquals(list.getFocusIndex(), number - 1); - - list.setSelection(-1, 0); - assertEquals(list.getSelectionIndices(), new int[] {0}); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(number, number + 1); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(0, 0); - assertEquals(list.getSelectionIndices(), new int[] {0}); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(2, 1); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(number - 1, number - 1); - assertEquals(list.getSelectionIndices(), new int[] {number - 1}); - assertEquals(list.getFocusIndex(), number - 1); - - list.setSelection(-1, -1); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), number - 1); - - if (fCheckSWTPolicy) { - list.removeAll(); - - list.setSelection(-2, -1); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(-1, 0); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(0, 1); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(1, 0); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(0, -1); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 0); - } - - setSingleList(); - list.setItems(items); - - list.setSelection(1, 2); - assertEquals(list.getSelectionIndices(), new int[] {2}); - assertEquals(list.getFocusIndex(), 2); - - list.setSelection(-3, -2); - assertEquals(list.getSelectionIndices(), new int[] {2}); - assertEquals(list.getFocusIndex(), 2); - - list.setSelection(0, 1); - assertEquals(list.getSelectionIndices(), new int[] {1}); - assertEquals(list.getFocusIndex(), 1); - - list.setSelection(-2, -1); - assertEquals(list.getSelectionIndices(), new int[] {1}); - assertEquals(list.getFocusIndex(), 1); - - list.setSelection(number - 2, number - 1); - assertEquals(list.getSelectionIndices(), new int[] {number - 1}); - assertEquals(list.getFocusIndex(), number - 1); - - list.setSelection(number - 1, number); - assertEquals(list.getSelectionIndices(), new int[] {number - 1}); - assertEquals(list.getFocusIndex(), number - 1); - - list.setSelection(-1, 0); - assertEquals(list.getSelectionIndices(), new int[] {0}); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(number, number + 1); - assertEquals(list.getSelectionIndices(), new int[] {0}); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(0, 0); - assertEquals(list.getSelectionIndices(), new int[] {0}); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(2, 1); - assertEquals(list.getSelectionIndices(), new int[] {0}); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(number - 1, number - 1); - assertEquals(list.getSelectionIndices(), new int[] {number - 1}); - assertEquals(list.getFocusIndex(), number - 1); - - list.setSelection(-1, -1); - assertEquals(list.getSelectionIndices(), new int[] {number - 1}); - assertEquals(list.getFocusIndex(), number - 1); - - if (fCheckSWTPolicy) { - list.removeAll(); - - list.setSelection(-2, -1); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(-1, 0); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(0, 1); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(1, 0); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 0); - - list.setSelection(0, -1); - assertEquals(list.getSelectionIndices(), new int[0]); - assertEquals(list.getFocusIndex(), 0); - } -} - -public void test_setTopIndexI() { - list.setTopIndex(3); - assertEquals(list.getTopIndex(), 0); - String[] items = { "item0", "item1", "item2", "item3" }; - list.setItems(items); - for (int i = 0; i < items.length; i++) { - list.setTopIndex(i); - assertEquals(list.getTopIndex(), i); - } - - - setSingleList(); - list.setTopIndex(3); - assertEquals(0, list.getTopIndex()); - - list.setItems(items); - for (int i = 0; i < items.length; i++) { - list.setTopIndex(i); - assertEquals(i, list.getTopIndex()); - } - -} - -public void test_showSelection() { - String[] items = { "item0", "item1", "item2", "item3" }; - list.setItems(items); - list.setSelection(items); - list.showSelection(); - - - setSingleList(); - - list.setItems(items); - list.setSelection(items); - list.showSelection(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_List((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addLjava_lang_String"); - methodNames.addElement("test_addLjava_lang_StringI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_deselect$I"); - methodNames.addElement("test_deselectAll"); - methodNames.addElement("test_deselectI"); - methodNames.addElement("test_deselectII"); - methodNames.addElement("test_getFocusIndex"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItemHeight"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionCount"); - methodNames.addElement("test_getSelectionIndex"); - methodNames.addElement("test_getSelectionIndices"); - methodNames.addElement("test_getTopIndex"); - methodNames.addElement("test_indexOfLjava_lang_String"); - methodNames.addElement("test_indexOfLjava_lang_StringI"); - methodNames.addElement("test_isSelectedI"); - methodNames.addElement("test_remove$I"); - methodNames.addElement("test_removeAll"); - methodNames.addElement("test_removeI"); - methodNames.addElement("test_removeII"); - methodNames.addElement("test_removeLjava_lang_String"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_select$I"); - methodNames.addElement("test_selectAll"); - methodNames.addElement("test_selectI"); - methodNames.addElement("test_selectII"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setItemILjava_lang_String"); - methodNames.addElement("test_setItems$Ljava_lang_String"); - methodNames.addElement("test_setSelection$I"); - methodNames.addElement("test_setSelection$Ljava_lang_String"); - methodNames.addElement("test_setSelectionI"); - methodNames.addElement("test_setSelectionII"); - methodNames.addElement("test_setTopIndexI"); - methodNames.addElement("test_showSelection"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Scrollable.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addLjava_lang_String")) test_addLjava_lang_String(); - else if (getName().equals("test_addLjava_lang_StringI")) test_addLjava_lang_StringI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_deselect$I")) test_deselect$I(); - else if (getName().equals("test_deselectAll")) test_deselectAll(); - else if (getName().equals("test_deselectI")) test_deselectI(); - else if (getName().equals("test_deselectII")) test_deselectII(); - else if (getName().equals("test_getFocusIndex")) test_getFocusIndex(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItemHeight")) test_getItemHeight(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionCount")) test_getSelectionCount(); - else if (getName().equals("test_getSelectionIndex")) test_getSelectionIndex(); - else if (getName().equals("test_getSelectionIndices")) test_getSelectionIndices(); - else if (getName().equals("test_getTopIndex")) test_getTopIndex(); - else if (getName().equals("test_indexOfLjava_lang_String")) test_indexOfLjava_lang_String(); - else if (getName().equals("test_indexOfLjava_lang_StringI")) test_indexOfLjava_lang_StringI(); - else if (getName().equals("test_isSelectedI")) test_isSelectedI(); - else if (getName().equals("test_remove$I")) test_remove$I(); - else if (getName().equals("test_removeAll")) test_removeAll(); - else if (getName().equals("test_removeI")) test_removeI(); - else if (getName().equals("test_removeII")) test_removeII(); - else if (getName().equals("test_removeLjava_lang_String")) test_removeLjava_lang_String(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_select$I")) test_select$I(); - else if (getName().equals("test_selectAll")) test_selectAll(); - else if (getName().equals("test_selectI")) test_selectI(); - else if (getName().equals("test_selectII")) test_selectII(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setItemILjava_lang_String")) test_setItemILjava_lang_String(); - else if (getName().equals("test_setItems$Ljava_lang_String")) test_setItems$Ljava_lang_String(); - else if (getName().equals("test_setSelection$I")) test_setSelection$I(); - else if (getName().equals("test_setSelection$Ljava_lang_String")) test_setSelection$Ljava_lang_String(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else if (getName().equals("test_setSelectionII")) test_setSelectionII(); - else if (getName().equals("test_setTopIndexI")) test_setTopIndexI(); - else if (getName().equals("test_showSelection")) test_showSelection(); - else super.runTest(); -} - -/* custom */ -List list; -/** - * Test if 'deselect(u, v)' is the same as 'for (i=u; i<=v; ++i) deselect(i);' - */ -protected void deselectII_helper( - String[] items, - int start, - int end, - int[] expectedIndices) { - - list.setItems(items); - list.setSelection(items); - - list.deselect(start, end); - assertSame( - ":(" + start + ", " + end + "):", - expectedIndices, list.getSelectionIndices()); - - list.setSelection(items); - if ( 0 != (list.getStyle() & SWT.MULTI) ) { - assertSame("setSelection(items):", items, list.getSelection()); - } - - for (int i = start; i <= end; ++i) { - list.deselect(i); - } - assertSame( - ":(" + start + ", " + end + "):", - expectedIndices, list.getSelectionIndices()); - - list.deselectAll(); -} -/** - * Dispose of the main list and create a new, single-selection one. - */ -protected List setSingleList() { - list.dispose(); - list = new List(shell, SWT.SINGLE); - setWidget(list); - return list; -} -/** - * Similar to deselectII_helper, checks if select(u, v) is the same as - * for (i=u; i<=v; ++i) select(i) - */ -protected void selectII_helper( - String[] items, - int start, - int end, - int[] expectedIndices) { - list.setItems(items); - list.select(start, end); - assertSame( - ":(" + start + ", " + end + "):", - expectedIndices, list.getSelectionIndices()); - - list.deselectAll(); - assertEquals("deselectAll:", list.getSelectionIndices(), new int[] {}); - - for (int i = start; i <= end; i++) // <= on purpose - list.select(i); - - assertSame(":(" + start + ", " + end + "):", - expectedIndices, list.getSelectionIndices()); - - list.deselectAll(); -} -/** - * Similar to deselectII_helper, checks if select(int []arr) gives the same - * result as several individual select(int) calls. The int[] used for selection - * will be filled all integers from start to end inclusive, in order. - */ -protected void select$I_helper( - String[] items, - int start, - int end, - int[] expectedIndices) { - int[] selection = new int[end - start + 1]; - for (int i = 0; i < selection.length; ++i) { - selection[i] = i + start; - } - - list.select(selection); - - assertSame( - ":(" + start + ", " + end + "):", - expectedIndices, list.getSelectionIndices()); - - list.deselectAll(); - assertEquals("deselectAll:", list.getSelectionIndices(), new int[] {}); - - for (int i = start; i <= end; i++) // <= on purpose - list.select(i); - - assertSame( - ":(" + start + ", " + end + "):", - expectedIndices, list.getSelectionIndices()); - - list.deselectAll(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Listener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Listener.java deleted file mode 100644 index 086354f2ff..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Listener.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Listener - * - * @see org.eclipse.swt.widgets.Listener - */ -public class Test_org_eclipse_swt_widgets_Listener extends SwtTestCase { - -public Test_org_eclipse_swt_widgets_Listener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_handleEventLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_handleEventLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Listener((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_handleEventLorg_eclipse_swt_widgets_Event"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_handleEventLorg_eclipse_swt_widgets_Event")) test_handleEventLorg_eclipse_swt_widgets_Event(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Menu.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Menu.java deleted file mode 100644 index 1c69f033b9..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Menu.java +++ /dev/null @@ -1,382 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Menu - * - * @see org.eclipse.swt.widgets.Menu - */ -public class Test_org_eclipse_swt_widgets_Menu extends Test_org_eclipse_swt_widgets_Widget { - -public Test_org_eclipse_swt_widgets_Menu(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - menu = new Menu(shell); - setWidget(menu); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Control() { - Composite comp = new Composite(shell, SWT.NULL); - Menu testMenu = new Menu(comp); - comp.dispose(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_DecorationsI() { - Menu newMenu; - Shell nullShell = null; - try { - newMenu = new Menu(nullShell, SWT.NULL); - newMenu.dispose(); - fail("No exception thrown for parent == null"); - } catch (IllegalArgumentException e) { - } - - newMenu = new Menu(shell, SWT.NULL); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Menu() { - Menu newMenu; - newMenu = new Menu(menu); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_MenuItem() { - Menu newMenu; - MenuItem mItem = null; - try { - newMenu = new Menu(mItem); - newMenu.dispose(); - fail("No exception thrown for parent == null"); - } catch (IllegalArgumentException e) { - } - - mItem = new MenuItem(menu, SWT.NULL); - newMenu = new Menu(mItem); -} - -public void test_addHelpListenerLorg_eclipse_swt_events_HelpListener() { - listenerCalled = false; - HelpListener listener = new HelpListener() { - public void helpRequested(HelpEvent e) { - listenerCalled = true; - }; - }; - - try { - menu.addHelpListener(null); - fail("No exception thrown for addHelpListener with null argument"); - } catch (IllegalArgumentException e) { - } - - menu.addHelpListener(listener); - menu.notifyListeners(SWT.Help, new Event()); - assertTrue(listenerCalled); - - try { - menu.removeHelpListener(null); - fail("No exception thrown for removeHelpListener with null argument"); - } catch (IllegalArgumentException e) { - } - - listenerCalled = false; - menu.removeHelpListener(listener); - menu.notifyListeners(SWT.Help, new Event()); - assertFalse(listenerCalled); -} - -public void test_addMenuListenerLorg_eclipse_swt_events_MenuListener() { - listenerCalled = false; - MenuListener menuListener = new MenuListener() { - public void menuShown(MenuEvent e) { - listenerCalled = true; - }; - public void menuHidden(MenuEvent e) { - listenerCalled = true; - }; - }; - - try { - menu.addMenuListener(null); - fail("No exception thrown for addMenuListener with null argument"); - } catch (IllegalArgumentException e) { - } - - menu.addMenuListener(menuListener); - menu.notifyListeners(SWT.Show, new Event()); - assertTrue(":a:", listenerCalled); - - listenerCalled = false; - menu.notifyListeners(SWT.Hide, new Event()); - assertTrue(":b:", listenerCalled); - - try { - menu.removeMenuListener(null); - fail("No exception thrown for removeMenuListener with null argument"); - } catch (IllegalArgumentException e) { - } - - listenerCalled = false; - menu.removeMenuListener(menuListener); - menu.notifyListeners(SWT.Show, new Event()); - assertFalse(listenerCalled); -} - -public void test_getDefaultItem() { - // tested in setDefaultItem method -} - -public void test_getEnabled() { - // tested in setEnabled method -} - -public void test_getItemCount() { - int number = 10; - MenuItem ti; - for (int i = 0; i<number ; i++){ - assertEquals(menu.getItemCount(), i); - ti = new MenuItem(menu, 0); - } -} - -public void test_getItemI() { - MenuItem mItem0 = new MenuItem(menu, SWT.NULL); - MenuItem mItem1 = new MenuItem(menu, SWT.NULL); - assertEquals(menu.getItem(0), mItem0); - assertEquals(menu.getItem(1), mItem1); -} - -public void test_getItems() { - int number = 5; - MenuItem[] items = new MenuItem[number]; - for (int i = 0; i<number ; i++){ - items[i] = new MenuItem(menu, 0); - } - assertEquals(":a:", items, menu.getItems()); - - menu.getItems()[0].dispose(); - assertEquals(":b:", new MenuItem[]{items[1], items[2], items[3], items[4]}, menu.getItems()); - - menu.getItems()[3].dispose(); - assertEquals(":c:", new MenuItem[]{items[1], items[2], items[3]}, menu.getItems()); - - menu.getItems()[1].dispose(); - assertEquals(":d:", new MenuItem[]{items[1], items[3]}, menu.getItems()); -} - -public void test_getParent() { - assertEquals(menu.getParent(), shell); -} - -public void test_getParentItem() { - MenuItem mItem = new MenuItem(menu, SWT.CASCADE); - Menu newMenu = new Menu(shell, SWT.DROP_DOWN); - assertNull(newMenu.getParentItem()); - mItem.setMenu(newMenu); - assertEquals(newMenu.getParentItem(), mItem); -} - -public void test_getParentMenu() { - MenuItem mItem = new MenuItem(menu, SWT.CASCADE); - Menu newMenu = new Menu(shell, SWT.DROP_DOWN); - assertNull(newMenu.getParentMenu()); - mItem.setMenu(newMenu); - assertEquals(newMenu.getParentMenu(), menu); -} - -public void test_getShell() { - assertEquals(menu.getShell(), shell); -} - -public void test_getVisible() { - // tested in setVisible method -} - -public void test_indexOfLorg_eclipse_swt_widgets_MenuItem() { - int number = 10; - MenuItem[] mis = new MenuItem[number]; - for (int i = 0; i<number ; i++){ - mis[i] = new MenuItem(menu, SWT.NULL); - } - for (int i = 0; i<number ; i++){ - assertEquals(menu.indexOf(mis[i]), i); - if (i>1) - assertTrue(menu.indexOf(mis[i-1]) != i); - } -} - -public void test_isEnabled() { - // tested in setEnabled method -} - -public void test_isVisible() { - // This test can not be run as it currently is written. On Windows, if a - // menu has no menu items, it will not become visible. - // If we add menu items to the menu then a second problem is encountered - // because menu.setVisible() enters into a modal loop and execution of - // the JUnit test case will not continue until the menu is selected and closed. - if (true) return; - menu.setVisible(true); - assertTrue(menu.isVisible()); - - // api not implemented yet - if (fCheckVisibility) { - menu.setVisible(false); - assertEquals(menu.isVisible(), false); - } -} - -public void test_removeHelpListenerLorg_eclipse_swt_events_HelpListener() { - // tested in addHelpListener method -} - -public void test_removeMenuListenerLorg_eclipse_swt_events_MenuListener() { - // tested in addMenuListener method -} - -public void test_setDefaultItemLorg_eclipse_swt_widgets_MenuItem() { - MenuItem mItem0 = new MenuItem(menu, SWT.NULL); - MenuItem mItem1 = new MenuItem(menu, SWT.NULL); - menu.setDefaultItem(mItem0); - assertEquals(menu.getDefaultItem(), mItem0); - assertTrue("After setDefaultItem(mItem0):", menu.getDefaultItem() != mItem1); - menu.setDefaultItem(mItem1); - assertEquals(menu.getDefaultItem(), mItem1); - assertTrue("After setDefaultItem(mItem1):", menu.getDefaultItem() != mItem0); -} - -public void test_setEnabledZ() { - menu.setEnabled(true); - assertTrue(menu.getEnabled()); - menu.setEnabled(false); - assertFalse(menu.getEnabled()); -} - -public void test_setLocationII() { - menu.setLocation(0,0); -} - -public void test_setLocationLorg_eclipse_swt_graphics_Point() { - menu.setLocation(new Point(0,0)); - try { - menu.setLocation(null); - fail("No exception thrown for null argument"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_setVisibleZ() { - // This test can not be run as it currently is written. On Windows, if a - // menu has no menu items, it will not become visible. - // If we add menu items to the menu then a second problem is encountered - // because menu.setVisible() enters into a modal loop and execution of - // the JUnit test case will not continue until the menu is selected and closed. - if (true) return; - menu.setVisible(true); - assertTrue(menu.getVisible()); - // API not implemented yet - if (fCheckVisibility) { - menu.setVisible(false); - assertEquals(menu.getVisible(), false); - } -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Menu((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_DecorationsI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Menu"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_MenuItem"); - methodNames.addElement("test_addHelpListenerLorg_eclipse_swt_events_HelpListener"); - methodNames.addElement("test_addMenuListenerLorg_eclipse_swt_events_MenuListener"); - methodNames.addElement("test_getDefaultItem"); - methodNames.addElement("test_getEnabled"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getParentItem"); - methodNames.addElement("test_getParentMenu"); - methodNames.addElement("test_getShell"); - methodNames.addElement("test_getVisible"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_MenuItem"); - methodNames.addElement("test_isEnabled"); - methodNames.addElement("test_isVisible"); - methodNames.addElement("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener"); - methodNames.addElement("test_removeMenuListenerLorg_eclipse_swt_events_MenuListener"); - methodNames.addElement("test_setDefaultItemLorg_eclipse_swt_widgets_MenuItem"); - methodNames.addElement("test_setEnabledZ"); - methodNames.addElement("test_setLocationII"); - methodNames.addElement("test_setLocationLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setVisibleZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Control")) test_ConstructorLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_DecorationsI")) test_ConstructorLorg_eclipse_swt_widgets_DecorationsI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Menu")) test_ConstructorLorg_eclipse_swt_widgets_Menu(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_MenuItem")) test_ConstructorLorg_eclipse_swt_widgets_MenuItem(); - else if (getName().equals("test_addHelpListenerLorg_eclipse_swt_events_HelpListener")) test_addHelpListenerLorg_eclipse_swt_events_HelpListener(); - else if (getName().equals("test_addMenuListenerLorg_eclipse_swt_events_MenuListener")) test_addMenuListenerLorg_eclipse_swt_events_MenuListener(); - else if (getName().equals("test_getDefaultItem")) test_getDefaultItem(); - else if (getName().equals("test_getEnabled")) test_getEnabled(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getParentItem")) test_getParentItem(); - else if (getName().equals("test_getParentMenu")) test_getParentMenu(); - else if (getName().equals("test_getShell")) test_getShell(); - else if (getName().equals("test_getVisible")) test_getVisible(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_MenuItem")) test_indexOfLorg_eclipse_swt_widgets_MenuItem(); - else if (getName().equals("test_isEnabled")) test_isEnabled(); - else if (getName().equals("test_isVisible")) test_isVisible(); - else if (getName().equals("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener")) test_removeHelpListenerLorg_eclipse_swt_events_HelpListener(); - else if (getName().equals("test_removeMenuListenerLorg_eclipse_swt_events_MenuListener")) test_removeMenuListenerLorg_eclipse_swt_events_MenuListener(); - else if (getName().equals("test_setDefaultItemLorg_eclipse_swt_widgets_MenuItem")) test_setDefaultItemLorg_eclipse_swt_widgets_MenuItem(); - else if (getName().equals("test_setEnabledZ")) test_setEnabledZ(); - else if (getName().equals("test_setLocationII")) test_setLocationII(); - else if (getName().equals("test_setLocationLorg_eclipse_swt_graphics_Point")) test_setLocationLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setVisibleZ")) test_setVisibleZ(); - else super.runTest(); -} - -/* custom */ -Menu menu; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MenuItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MenuItem.java deleted file mode 100644 index 80523c4f88..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MenuItem.java +++ /dev/null @@ -1,334 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.MenuItem - * - * @see org.eclipse.swt.widgets.MenuItem - */ -public class Test_org_eclipse_swt_widgets_MenuItem extends Test_org_eclipse_swt_widgets_Item { - -public Test_org_eclipse_swt_widgets_MenuItem(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - menu = new Menu(shell); - menuItem = new MenuItem(menu, 0); - setWidget(menuItem); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_MenuI() { - MenuItem mItem = new MenuItem(menu, SWT.NULL); - assertNotNull(mItem); - - try { - new MenuItem(null, SWT.NULL); - fail("No exception thrown"); - } - catch (IllegalArgumentException e) { - } - mItem = new MenuItem(menu, SWT.CHECK); - assertTrue(mItem.getStyle()==SWT.CHECK); - mItem.dispose(); - mItem = new MenuItem(menu, SWT.CASCADE); - assertTrue(mItem.getStyle()==SWT.CASCADE); - mItem.dispose(); - mItem = new MenuItem(menu, SWT.PUSH); - assertTrue(mItem.getStyle()==SWT.PUSH); - mItem.dispose(); - mItem = new MenuItem(menu, SWT.SEPARATOR); - assertTrue(mItem.getStyle()==SWT.SEPARATOR); - mItem.dispose(); - mItem = new MenuItem(menu, SWT.RADIO); - assertTrue(mItem.getStyle()==SWT.RADIO); - mItem.dispose(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_MenuII() { - MenuItem mItem = new MenuItem(menu, SWT.NULL, 0); //create a menu item at index 0 - assertNotNull(mItem); - assertTrue(menu.getItem(0).equals(mItem)); - mItem = new MenuItem(menu, SWT.NULL, 1); - assertNotNull(mItem); - assertTrue(menu.getItem(1).equals(mItem)); -} - -public void test_addArmListenerLorg_eclipse_swt_events_ArmListener() { - listenerCalled = false; - ArmListener listener = new ArmListener() { - public void widgetArmed(ArmEvent e) { - listenerCalled = true; - }; - }; - - try { - menuItem.addArmListener(null); - fail("No exception thrown for addArmListener with null argument"); - } catch (IllegalArgumentException e) { - } - - menuItem.addArmListener(listener); - menuItem.notifyListeners(SWT.Arm, new Event()); - assertTrue(listenerCalled); - - try { - menuItem.removeArmListener(null); - fail("No exception thrown for removeArmListener with null argument"); - } catch (IllegalArgumentException e) { - } - listenerCalled = false; - menuItem.removeArmListener(listener); - menuItem.notifyListeners(SWT.Arm, new Event()); - assertFalse(listenerCalled); -} - -public void test_addHelpListenerLorg_eclipse_swt_events_HelpListener() { - listenerCalled = false; - HelpListener listener = new HelpListener() { - public void helpRequested(HelpEvent e) { - listenerCalled = true; - }; - }; - - try { - menuItem.addHelpListener(null); - fail("No exception thrown for addHelpListener with null argument"); - } catch (IllegalArgumentException e) { - } - - menuItem.addHelpListener(listener); - menuItem.notifyListeners(SWT.Help, new Event()); - assertTrue(listenerCalled); - - try { - menuItem.removeHelpListener(null); - fail("No exception thrown for removeHelpListener with null argument"); - } catch (IllegalArgumentException e) { - } - listenerCalled = false; - menuItem.removeHelpListener(listener); - menuItem.notifyListeners(SWT.Help, new Event()); - assertFalse(listenerCalled); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - listenerCalled = false; - SelectionListener listener = new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - listenerCalled = true; - }; - public void widgetDefaultSelected(SelectionEvent e) { - }; - }; - - try { - menuItem.addSelectionListener(null); - fail("No exception thrown for addSelectionListener with null argument"); - } catch (IllegalArgumentException e) { - } - - menuItem.addSelectionListener(listener); - menuItem.notifyListeners(SWT.Selection, new Event()); - assertTrue(listenerCalled); - - try { - menuItem.removeSelectionListener(null); - fail("No exception thrown for removeSelectionListener with null argument"); - } catch (IllegalArgumentException e) { - } - listenerCalled = false; - menuItem.removeSelectionListener(listener); - menuItem.notifyListeners(SWT.Selection, new Event()); - assertFalse(listenerCalled); -} - -public void test_getAccelerator() { - menuItem.setAccelerator(SWT.MOD1 + 'X'); - assertEquals(menuItem.getAccelerator(), SWT.MOD1 + 'X'); - menuItem.setAccelerator(SWT.MOD2 + 'Y'); - assertEquals(menuItem.getAccelerator(), SWT.MOD2 + 'Y'); - menuItem.setAccelerator(SWT.MOD3 + 'Z'); - assertEquals(menuItem.getAccelerator(), SWT.MOD3 + 'Z'); -} - -public void test_getEnabled() { - // tested in test_setEnabledZ() -} - -public void test_getMenu() { - // tested in test_setMenuLorg_eclipse_swt_widgets_Menu -} - -public void test_getParent() { - assertEquals(menuItem.getParent(), menu); -} - -public void test_getSelection() { - // tested in test_setSelectionZ() -} - -public void test_isEnabled() { - menuItem.setEnabled(true); - assertTrue(menuItem.isEnabled()); - menuItem.setEnabled(false); - assertEquals(menuItem.isEnabled(), false); -} - -public void test_removeArmListenerLorg_eclipse_swt_events_ArmListener() { - // tested in test_addArmListenerLorg_eclipse_swt_events_ArmListener() -} - -public void test_removeHelpListenerLorg_eclipse_swt_events_HelpListener() { - // tested in test_addHelpListenerLorg_eclipse_swt_events_HelpListener() -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - // tested in test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener -} - -public void test_setAcceleratorI() { - menuItem.setAccelerator(SWT.CTRL + 'Z'); - assertEquals(menuItem.getAccelerator(), SWT.CTRL + 'Z'); -} - -public void test_setEnabledZ() { - menuItem.setEnabled(true); - assertTrue(menuItem.getEnabled()); - menuItem.setEnabled(false); - assertEquals(menuItem.getEnabled(), false); -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - assertNull(menuItem.getImage()); - menuItem.setImage(images[0]); - assertEquals(images[0], menuItem.getImage()); - assertTrue(menuItem.getImage() != images[1]); - menuItem.setImage(null); - assertNull(menuItem.getImage()); -} - -public void test_setMenuLorg_eclipse_swt_widgets_Menu() { - assertNull(menuItem.getMenu()); - MenuItem mItem = new MenuItem(menu, SWT.CASCADE); - Menu newMenu = new Menu(shell, SWT.DROP_DOWN); - mItem.setMenu(newMenu); - assertEquals(mItem.getMenu(), newMenu); -} - -public void test_setSelectionZ() { - - int[] itemStyles = {SWT.CHECK, SWT.RADIO}; - for (int i=0; i<itemStyles.length; i++) - { - MenuItem mItem = new MenuItem(menu, itemStyles[i]); - mItem.setSelection(false); - assertEquals(mItem.getSelection(), false); - mItem.setSelection(true); - assertTrue(mItem.getSelection()); - mItem.dispose(); - } -} - -public void test_setTextLjava_lang_String() { - menuItem.setText("ABCDEFG"); - assertTrue(menuItem.getText().equals("ABCDEFG")); - try { - menuItem.setText(null); - fail("No exception thrown for addArmListener with null argument"); - } catch (IllegalArgumentException e) { - } - menuItem.setText("ABCDEFG"); - menuItem.setAccelerator(SWT.MOD1 + 'A'); - assertTrue(menuItem.getText().startsWith("ABCDEFG")); - menuItem.setAccelerator(0); - menuItem.setText("AB&CDEFG"); - assertTrue(menuItem.getText().equals("AB&CDEFG")); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_MenuItem((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_MenuI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_MenuII"); - methodNames.addElement("test_addArmListenerLorg_eclipse_swt_events_ArmListener"); - methodNames.addElement("test_addHelpListenerLorg_eclipse_swt_events_HelpListener"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_getAccelerator"); - methodNames.addElement("test_getEnabled"); - methodNames.addElement("test_getMenu"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_isEnabled"); - methodNames.addElement("test_removeArmListenerLorg_eclipse_swt_events_ArmListener"); - methodNames.addElement("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_setAcceleratorI"); - methodNames.addElement("test_setEnabledZ"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setMenuLorg_eclipse_swt_widgets_Menu"); - methodNames.addElement("test_setSelectionZ"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_MenuI")) test_ConstructorLorg_eclipse_swt_widgets_MenuI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_MenuII")) test_ConstructorLorg_eclipse_swt_widgets_MenuII(); - else if (getName().equals("test_addArmListenerLorg_eclipse_swt_events_ArmListener")) test_addArmListenerLorg_eclipse_swt_events_ArmListener(); - else if (getName().equals("test_addHelpListenerLorg_eclipse_swt_events_HelpListener")) test_addHelpListenerLorg_eclipse_swt_events_HelpListener(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_getAccelerator")) test_getAccelerator(); - else if (getName().equals("test_getEnabled")) test_getEnabled(); - else if (getName().equals("test_getMenu")) test_getMenu(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_isEnabled")) test_isEnabled(); - else if (getName().equals("test_removeArmListenerLorg_eclipse_swt_events_ArmListener")) test_removeArmListenerLorg_eclipse_swt_events_ArmListener(); - else if (getName().equals("test_removeHelpListenerLorg_eclipse_swt_events_HelpListener")) test_removeHelpListenerLorg_eclipse_swt_events_HelpListener(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_setAcceleratorI")) test_setAcceleratorI(); - else if (getName().equals("test_setEnabledZ")) test_setEnabledZ(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setMenuLorg_eclipse_swt_widgets_Menu")) test_setMenuLorg_eclipse_swt_widgets_Menu(); - else if (getName().equals("test_setSelectionZ")) test_setSelectionZ(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else super.runTest(); -} - -/* custom */ -Menu menu; -MenuItem menuItem; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MessageBox.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MessageBox.java deleted file mode 100644 index d761cfcf11..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_MessageBox.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.MessageBox - * - * @see org.eclipse.swt.widgets.MessageBox - */ -public class Test_org_eclipse_swt_widgets_MessageBox extends Test_org_eclipse_swt_widgets_Dialog { - -public Test_org_eclipse_swt_widgets_MessageBox(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - messageBox = new MessageBox(shell, SWT.NULL); - setDialog(messageBox); -} - -protected void tearDown() { - super.tearDown(); -} - -/** - * Possible exceptions: - * - * @exception IllegalArgumentException <ul> - * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> - * </ul> - * @exception SWTException <ul> - * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> - * <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li> - * </ul> - */ -public void test_ConstructorLorg_eclipse_swt_widgets_Shell(){ - MessageBox mb = new MessageBox(shell); - try { - new MessageBox(null); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ShellI not written"); -} - -public void test_getMessage() { - warnUnimpl("Test test_getMessage not written"); -} - -/** - * Makes the dialog visible and brings it to the front - * of the display. - * - * @return the ID of the button that was selected to dismiss the - * message box (e.g. SWT.OK, SWT.CANCEL, etc...) - */ -public void test_open(){ - if (fTestDialogOpen) - messageBox.open(); -} - -/** - * Sets the dialog's message, which is a description of - * the purpose for which it was opened. This message will be - * visible on the dialog while it is open. - */ -public void test_setMessageLjava_lang_String(){ - assertEquals(messageBox.getMessage(), ""); - String testStr = "test string"; - messageBox.setMessage(testStr); - assertEquals(messageBox.getMessage(), testStr); - messageBox.setMessage(""); - assertEquals(messageBox.getMessage(), ""); - try { - messageBox.setMessage(null); - fail("No exception thrown"); - } - catch (IllegalArgumentException e) { - } -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_MessageBox((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI"); - methodNames.addElement("test_getMessage"); - methodNames.addElement("test_open"); - methodNames.addElement("test_setMessageLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Dialog.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI(); - else if (getName().equals("test_getMessage")) test_getMessage(); - else if (getName().equals("test_open")) test_open(); - else if (getName().equals("test_setMessageLjava_lang_String")) test_setMessageLjava_lang_String(); - else super.runTest(); -} - -/* custom */ -MessageBox messageBox; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Monitor.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Monitor.java deleted file mode 100644 index 0ef64928cf..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Monitor.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Monitor - * - * @see org.eclipse.swt.widgets.Monitor - */ -public class Test_org_eclipse_swt_widgets_Monitor extends SwtTestCase { - -public Test_org_eclipse_swt_widgets_Monitor(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - display = Display.getDefault(); - monitors = display.getMonitors(); - primary = display.getPrimaryMonitor(); -} - -protected void tearDown() { -} - -public void test_equalsLjava_lang_Object() { - int i; - for (i = 0; i < monitors.length; i++) { - if (primary.equals(monitors[i])) break; - } - if (i == monitors.length) fail(); - for (i = 0; i < monitors.length; i++) { - Monitor test = monitors[i]; - for (int j = 0; j < monitors.length; j++) { - if (test.equals(monitors[j])) { - if (i != j) fail("Monitors "+i+" and "+j+" should not be equal"); - } - } - } -} - -public void test_getBounds() { - Rectangle bounds = primary.getBounds(); - assertNotNull(bounds); - for (int i = 0; i < monitors.length; i++) { - bounds = monitors[i].getBounds(); - assertNotNull(bounds); - } -} - -public void test_getClientArea() { - Rectangle bounds = primary.getClientArea(); - assertNotNull(bounds); - for (int i = 0; i < monitors.length; i++) { - bounds = monitors[i].getClientArea(); - assertNotNull(bounds); - } -} - -public void test_hashCode() { - for (int i = 0; i < monitors.length; i++) { - if (primary.equals(monitors[i])) { - assertTrue(primary.hashCode() == monitors[i].hashCode()); - break; - } - } -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Monitor((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_equalsLjava_lang_Object"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_hashCode"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_equalsLjava_lang_Object")) test_equalsLjava_lang_Object(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_hashCode")) test_hashCode(); -} - -/* custom */ -Display display = null; -Monitor[] monitors = null; -Monitor primary = null; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ProgressBar.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ProgressBar.java deleted file mode 100644 index 5dbecbd4ea..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ProgressBar.java +++ /dev/null @@ -1,610 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.ProgressBar - * - * @see org.eclipse.swt.widgets.ProgressBar - */ -public class Test_org_eclipse_swt_widgets_ProgressBar extends Test_org_eclipse_swt_widgets_Control { - -public Test_org_eclipse_swt_widgets_ProgressBar(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - progressBar = new ProgressBar(shell, 0); - setWidget(progressBar); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - try { - progressBar = new ProgressBar(null, 0); - fail("No exception thrown"); //should never get here - } - catch (IllegalArgumentException e) { - } - - int[] cases = {0, SWT.HORIZONTAL, SWT.VERTICAL}; - for (int i = 0; i < cases.length; i++) - progressBar = new ProgressBar(shell, cases[i]); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_getMaximum() { - warnUnimpl("Test test_getMaximum not written"); -} - -public void test_getMinimum() { - warnUnimpl("Test test_getMinimum not written"); -} - -public void test_getSelection() { - warnUnimpl("Test test_getSelection not written"); -} - -public void test_setFocus() { - warnUnimpl("Test test_setFocus not written"); -} - -public void test_setMaximumI() { - - int [][] testValues = getSetMaximumValues(); - - for (int i = 0; i < testValues.length; i++) { - int[] intArray = testValues[i]; - setDefaults(); - progressBar.setMaximum(intArray[0]); - report("setMaximum", intArray[0], intArray[1], intArray[2], intArray[3]); - } -} - -public void test_setMinimumI() { - - int [][] testValues = getSetMinimumValues(); - - for (int i = 0; i < testValues.length; i++) { - int[] intArray = testValues[i]; - setDefaults(); - progressBar.setMinimum(intArray[0]); - report("setMinimum", intArray[0], intArray[1], intArray[2], intArray[3]); - } -} - -public void test_setSelectionI() { - int [][] testValues = getSetSelectionValues(); - for (int i = 0; i < testValues.length; i++) { - int[] intArray = testValues[i]; - setDefaults(); - progressBar.setSelection(intArray[0]); - report("setSelection", intArray[0], intArray[1], intArray[2], intArray[3]); - } -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_ProgressBar((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getMaximum"); - methodNames.addElement("test_getMinimum"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_setFocus"); - methodNames.addElement("test_setMaximumI"); - methodNames.addElement("test_setMinimumI"); - methodNames.addElement("test_setSelectionI"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getMaximum")) test_getMaximum(); - else if (getName().equals("test_getMinimum")) test_getMinimum(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_setFocus")) test_setFocus(); - else if (getName().equals("test_setMaximumI")) test_setMaximumI(); - else if (getName().equals("test_setMinimumI")) test_setMinimumI(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else super.runTest(); -} - -/* custom */ -ProgressBar progressBar; -// this method must be private or protected so the auto-gen tool keeps it -private void report(String call, int set, int minExpected, int maxExpected, int selectionExpected) { - // Uncomment these lines and comment out call to check() if you want the test to report all errors without - // stopping. - - //if (progressBar.getMinimum() != minExpected) - //System.out.println(call + "(" + set + "): Minimum Expected: " + minExpected + " Actual: " + progressBar.getMinimum()); - //if (progressBar.getMaximum() != maxExpected) - //System.out.println(call + "(" + set + "): Maximum Expected: " + maxExpected + " Actual: " + progressBar.getMaximum()); - //if (progressBar.getSelection() != selectionExpected) - //System.out.println(call + "(" + set + "): Selection Expected: " + selectionExpected + " Actual: " + progressBar.getSelection()); - - check(minExpected, maxExpected, selectionExpected); -} -// this method must be private or protected so the auto-gen tool keeps it -private void check(int minExpected, int maxExpected, int selectionExpected) { - assertEquals(progressBar.getMaximum(), maxExpected); - assertEquals(progressBar.getMinimum(), minExpected); - assertEquals(progressBar.getSelection(), selectionExpected); -} -// this method must be private or protected so the auto-gen tool keeps it -private int[][] getSetMinimumValues() { -return new int[][] { -{-15, 10, 100, 50, }, -{-14, 10, 100, 50, }, -{-13, 10, 100, 50, }, -{-12, 10, 100, 50, }, -{-11, 10, 100, 50, }, -{-10, 10, 100, 50, }, -{-9, 10, 100, 50, }, -{-8, 10, 100, 50, }, -{-7, 10, 100, 50, }, -{-6, 10, 100, 50, }, -{-5, 10, 100, 50, }, -{-4, 10, 100, 50, }, -{-3, 10, 100, 50, }, -{-2, 10, 100, 50, }, -{-1, 10, 100, 50, }, -{0, 0, 100, 50, }, -{1, 1, 100, 50, }, -{2, 2, 100, 50, }, -{3, 3, 100, 50, }, -{4, 4, 100, 50, }, -{5, 5, 100, 50, }, -{6, 6, 100, 50, }, -{7, 7, 100, 50, }, -{8, 8, 100, 50, }, -{9, 9, 100, 50, }, -{10, 10, 100, 50, }, -{11, 11, 100, 50, }, -{12, 12, 100, 50, }, -{13, 13, 100, 50, }, -{14, 14, 100, 50, }, -{15, 15, 100, 50, }, -{16, 16, 100, 50, }, -{17, 17, 100, 50, }, -{18, 18, 100, 50, }, -{19, 19, 100, 50, }, -{20, 20, 100, 50, }, -{21, 21, 100, 50, }, -{22, 22, 100, 50, }, -{23, 23, 100, 50, }, -{24, 24, 100, 50, }, -{25, 25, 100, 50, }, -{26, 26, 100, 50, }, -{27, 27, 100, 50, }, -{28, 28, 100, 50, }, -{29, 29, 100, 50, }, -{30, 30, 100, 50, }, -{31, 31, 100, 50, }, -{32, 32, 100, 50, }, -{33, 33, 100, 50, }, -{34, 34, 100, 50, }, -{35, 35, 100, 50, }, -{36, 36, 100, 50, }, -{37, 37, 100, 50, }, -{38, 38, 100, 50, }, -{39, 39, 100, 50, }, -{40, 40, 100, 50, }, -{41, 41, 100, 50, }, -{42, 42, 100, 50, }, -{43, 43, 100, 50, }, -{44, 44, 100, 50, }, -{45, 45, 100, 50, }, -{46, 46, 100, 50, }, -{47, 47, 100, 50, }, -{48, 48, 100, 50, }, -{49, 49, 100, 50, }, -{50, 50, 100, 50, }, -{51, 51, 100, 51, }, -{52, 52, 100, 52, }, -{53, 53, 100, 53, }, -{54, 54, 100, 54, }, -{55, 55, 100, 55, }, -{56, 56, 100, 56, }, -{57, 57, 100, 57, }, -{58, 58, 100, 58, }, -{59, 59, 100, 59, }, -{60, 60, 100, 60, }, -{61, 61, 100, 61, }, -{62, 62, 100, 62, }, -{63, 63, 100, 63, }, -{64, 64, 100, 64, }, -{65, 65, 100, 65, }, -{66, 66, 100, 66, }, -{67, 67, 100, 67, }, -{68, 68, 100, 68, }, -{69, 69, 100, 69, }, -{70, 70, 100, 70, }, -{71, 71, 100, 71, }, -{72, 72, 100, 72, }, -{73, 73, 100, 73, }, -{74, 74, 100, 74, }, -{75, 75, 100, 75, }, -{76, 76, 100, 76, }, -{77, 77, 100, 77, }, -{78, 78, 100, 78, }, -{79, 79, 100, 79, }, -{80, 80, 100, 80, }, -{81, 81, 100, 81, }, -{82, 82, 100, 82, }, -{83, 83, 100, 83, }, -{84, 84, 100, 84, }, -{85, 85, 100, 85, }, -{86, 86, 100, 86, }, -{87, 87, 100, 87, }, -{88, 88, 100, 88, }, -{89, 89, 100, 89, }, -{90, 90, 100, 90, }, -{91, 91, 100, 91, }, -{92, 92, 100, 92, }, -{93, 93, 100, 93, }, -{94, 94, 100, 94, }, -{95, 95, 100, 95, }, -{96, 96, 100, 96, }, -{97, 97, 100, 97, }, -{98, 98, 100, 98, }, -{99, 99, 100, 99, }, -{100, 10, 100, 50, }, -{101, 10, 100, 50, }, -{102, 10, 100, 50, }, -{103, 10, 100, 50, }, -{104, 10, 100, 50, }, -{105, 10, 100, 50, }, -{106, 10, 100, 50, }, -{107, 10, 100, 50, }, -{108, 10, 100, 50, }, -{109, 10, 100, 50, }, -{110, 10, 100, 50, }, -{111, 10, 100, 50, }, -{112, 10, 100, 50, }, -{113, 10, 100, 50, }, -{114, 10, 100, 50, }, -{115, 10, 100, 50, }, -{116, 10, 100, 50, }, -{117, 10, 100, 50, }, -{118, 10, 100, 50, }, -{119, 10, 100, 50, }, -{120, 10, 100, 50, }, -{121, 10, 100, 50, }, -{122, 10, 100, 50, }, -{123, 10, 100, 50, }, -{124, 10, 100, 50, }, -}; -} -// this method must be private or protected so the auto-gen tool keeps it -private int[][] getSetMaximumValues() { -return new int[][] { -{-15, 10, 100, 50, }, -{-14, 10, 100, 50, }, -{-13, 10, 100, 50, }, -{-12, 10, 100, 50, }, -{-11, 10, 100, 50, }, -{-10, 10, 100, 50, }, -{-9, 10, 100, 50, }, -{-8, 10, 100, 50, }, -{-7, 10, 100, 50, }, -{-6, 10, 100, 50, }, -{-5, 10, 100, 50, }, -{-4, 10, 100, 50, }, -{-3, 10, 100, 50, }, -{-2, 10, 100, 50, }, -{-1, 10, 100, 50, }, -{0, 10, 100, 50, }, -{1, 10, 100, 50, }, -{2, 10, 100, 50, }, -{3, 10, 100, 50, }, -{4, 10, 100, 50, }, -{5, 10, 100, 50, }, -{6, 10, 100, 50, }, -{7, 10, 100, 50, }, -{8, 10, 100, 50, }, -{9, 10, 100, 50, }, -{10, 10, 100, 50, }, -{11, 10, 11, 11, }, -{12, 10, 12, 12, }, -{13, 10, 13, 13, }, -{14, 10, 14, 14, }, -{15, 10, 15, 15, }, -{16, 10, 16, 16, }, -{17, 10, 17, 17, }, -{18, 10, 18, 18, }, -{19, 10, 19, 19, }, -{20, 10, 20, 20, }, -{21, 10, 21, 21, }, -{22, 10, 22, 22, }, -{23, 10, 23, 23, }, -{24, 10, 24, 24, }, -{25, 10, 25, 25, }, -{26, 10, 26, 26, }, -{27, 10, 27, 27, }, -{28, 10, 28, 28, }, -{29, 10, 29, 29, }, -{30, 10, 30, 30, }, -{31, 10, 31, 31, }, -{32, 10, 32, 32, }, -{33, 10, 33, 33, }, -{34, 10, 34, 34, }, -{35, 10, 35, 35, }, -{36, 10, 36, 36, }, -{37, 10, 37, 37, }, -{38, 10, 38, 38, }, -{39, 10, 39, 39, }, -{40, 10, 40, 40, }, -{41, 10, 41, 41, }, -{42, 10, 42, 42, }, -{43, 10, 43, 43, }, -{44, 10, 44, 44, }, -{45, 10, 45, 45, }, -{46, 10, 46, 46, }, -{47, 10, 47, 47, }, -{48, 10, 48, 48, }, -{49, 10, 49, 49, }, -{50, 10, 50, 50, }, -{51, 10, 51, 50, }, -{52, 10, 52, 50, }, -{53, 10, 53, 50, }, -{54, 10, 54, 50, }, -{55, 10, 55, 50, }, -{56, 10, 56, 50, }, -{57, 10, 57, 50, }, -{58, 10, 58, 50, }, -{59, 10, 59, 50, }, -{60, 10, 60, 50, }, -{61, 10, 61, 50, }, -{62, 10, 62, 50, }, -{63, 10, 63, 50, }, -{64, 10, 64, 50, }, -{65, 10, 65, 50, }, -{66, 10, 66, 50, }, -{67, 10, 67, 50, }, -{68, 10, 68, 50, }, -{69, 10, 69, 50, }, -{70, 10, 70, 50, }, -{71, 10, 71, 50, }, -{72, 10, 72, 50, }, -{73, 10, 73, 50, }, -{74, 10, 74, 50, }, -{75, 10, 75, 50, }, -{76, 10, 76, 50, }, -{77, 10, 77, 50, }, -{78, 10, 78, 50, }, -{79, 10, 79, 50, }, -{80, 10, 80, 50, }, -{81, 10, 81, 50, }, -{82, 10, 82, 50, }, -{83, 10, 83, 50, }, -{84, 10, 84, 50, }, -{85, 10, 85, 50, }, -{86, 10, 86, 50, }, -{87, 10, 87, 50, }, -{88, 10, 88, 50, }, -{89, 10, 89, 50, }, -{90, 10, 90, 50, }, -{91, 10, 91, 50, }, -{92, 10, 92, 50, }, -{93, 10, 93, 50, }, -{94, 10, 94, 50, }, -{95, 10, 95, 50, }, -{96, 10, 96, 50, }, -{97, 10, 97, 50, }, -{98, 10, 98, 50, }, -{99, 10, 99, 50, }, -{100, 10, 100, 50, }, -{101, 10, 101, 50, }, -{102, 10, 102, 50, }, -{103, 10, 103, 50, }, -{104, 10, 104, 50, }, -{105, 10, 105, 50, }, -{106, 10, 106, 50, }, -{107, 10, 107, 50, }, -{108, 10, 108, 50, }, -{109, 10, 109, 50, }, -{110, 10, 110, 50, }, -{111, 10, 111, 50, }, -{112, 10, 112, 50, }, -{113, 10, 113, 50, }, -{114, 10, 114, 50, }, -{115, 10, 115, 50, }, -{116, 10, 116, 50, }, -{117, 10, 117, 50, }, -{118, 10, 118, 50, }, -{119, 10, 119, 50, }, -{120, 10, 120, 50, }, -{121, 10, 121, 50, }, -{122, 10, 122, 50, }, -{123, 10, 123, 50, }, -{124, 10, 124, 50, }, -}; -} -// this method must be private or protected so the auto-gen tool keeps it -private void setDefaults() { - progressBar.setMaximum(100); - progressBar.setMinimum(10); - progressBar.setSelection(50); -} -// this method must be private or protected so the auto-gen tool keeps it -private int[][] getSetSelectionValues() { -return new int[][] { -{-15, 10, 100, 10, }, -{-14, 10, 100, 10, }, -{-13, 10, 100, 10, }, -{-12, 10, 100, 10, }, -{-11, 10, 100, 10, }, -{-10, 10, 100, 10, }, -{-9, 10, 100, 10, }, -{-8, 10, 100, 10, }, -{-7, 10, 100, 10, }, -{-6, 10, 100, 10, }, -{-5, 10, 100, 10, }, -{-4, 10, 100, 10, }, -{-3, 10, 100, 10, }, -{-2, 10, 100, 10, }, -{-1, 10, 100, 10, }, -{0, 10, 100, 10, }, -{1, 10, 100, 10, }, -{2, 10, 100, 10, }, -{3, 10, 100, 10, }, -{4, 10, 100, 10, }, -{5, 10, 100, 10, }, -{6, 10, 100, 10, }, -{7, 10, 100, 10, }, -{8, 10, 100, 10, }, -{9, 10, 100, 10, }, -{10, 10, 100, 10, }, -{11, 10, 100, 11, }, -{12, 10, 100, 12, }, -{13, 10, 100, 13, }, -{14, 10, 100, 14, }, -{15, 10, 100, 15, }, -{16, 10, 100, 16, }, -{17, 10, 100, 17, }, -{18, 10, 100, 18, }, -{19, 10, 100, 19, }, -{20, 10, 100, 20, }, -{21, 10, 100, 21, }, -{22, 10, 100, 22, }, -{23, 10, 100, 23, }, -{24, 10, 100, 24, }, -{25, 10, 100, 25, }, -{26, 10, 100, 26, }, -{27, 10, 100, 27, }, -{28, 10, 100, 28, }, -{29, 10, 100, 29, }, -{30, 10, 100, 30, }, -{31, 10, 100, 31, }, -{32, 10, 100, 32, }, -{33, 10, 100, 33, }, -{34, 10, 100, 34, }, -{35, 10, 100, 35, }, -{36, 10, 100, 36, }, -{37, 10, 100, 37, }, -{38, 10, 100, 38, }, -{39, 10, 100, 39, }, -{40, 10, 100, 40, }, -{41, 10, 100, 41, }, -{42, 10, 100, 42, }, -{43, 10, 100, 43, }, -{44, 10, 100, 44, }, -{45, 10, 100, 45, }, -{46, 10, 100, 46, }, -{47, 10, 100, 47, }, -{48, 10, 100, 48, }, -{49, 10, 100, 49, }, -{50, 10, 100, 50, }, -{51, 10, 100, 51, }, -{52, 10, 100, 52, }, -{53, 10, 100, 53, }, -{54, 10, 100, 54, }, -{55, 10, 100, 55, }, -{56, 10, 100, 56, }, -{57, 10, 100, 57, }, -{58, 10, 100, 58, }, -{59, 10, 100, 59, }, -{60, 10, 100, 60, }, -{61, 10, 100, 61, }, -{62, 10, 100, 62, }, -{63, 10, 100, 63, }, -{64, 10, 100, 64, }, -{65, 10, 100, 65, }, -{66, 10, 100, 66, }, -{67, 10, 100, 67, }, -{68, 10, 100, 68, }, -{69, 10, 100, 69, }, -{70, 10, 100, 70, }, -{71, 10, 100, 71, }, -{72, 10, 100, 72, }, -{73, 10, 100, 73, }, -{74, 10, 100, 74, }, -{75, 10, 100, 75, }, -{76, 10, 100, 76, }, -{77, 10, 100, 77, }, -{78, 10, 100, 78, }, -{79, 10, 100, 79, }, -{80, 10, 100, 80, }, -{81, 10, 100, 81, }, -{82, 10, 100, 82, }, -{83, 10, 100, 83, }, -{84, 10, 100, 84, }, -{85, 10, 100, 85, }, -{86, 10, 100, 86, }, -{87, 10, 100, 87, }, -{88, 10, 100, 88, }, -{89, 10, 100, 89, }, -{90, 10, 100, 90, }, -{91, 10, 100, 91, }, -{92, 10, 100, 92, }, -{93, 10, 100, 93, }, -{94, 10, 100, 94, }, -{95, 10, 100, 95, }, -{96, 10, 100, 96, }, -{97, 10, 100, 97, }, -{98, 10, 100, 98, }, -{99, 10, 100, 99, }, -{100, 10, 100, 100, }, -{101, 10, 100, 100, }, -{102, 10, 100, 100, }, -{103, 10, 100, 100, }, -{104, 10, 100, 100, }, -{105, 10, 100, 100, }, -{106, 10, 100, 100, }, -{107, 10, 100, 100, }, -{108, 10, 100, 100, }, -{109, 10, 100, 100, }, -{110, 10, 100, 100, }, -{111, 10, 100, 100, }, -{112, 10, 100, 100, }, -{113, 10, 100, 100, }, -{114, 10, 100, 100, }, -{115, 10, 100, 100, }, -{116, 10, 100, 100, }, -{117, 10, 100, 100, }, -{118, 10, 100, 100, }, -{119, 10, 100, 100, }, -{120, 10, 100, 100, }, -{121, 10, 100, 100, }, -{122, 10, 100, 100, }, -{123, 10, 100, 100, }, -{124, 10, 100, 100, }, -}; -} - -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Sash.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Sash.java deleted file mode 100644 index 44763b34be..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Sash.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Sash - * - * @see org.eclipse.swt.widgets.Sash - */ -public class Test_org_eclipse_swt_widgets_Sash extends Test_org_eclipse_swt_widgets_Control { - -public Test_org_eclipse_swt_widgets_Sash(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - sash = new Sash(shell, 0); - setWidget(sash); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - try { - sash = new Sash(null, 0); - fail("No exception thrown"); //should never get here - } - catch (IllegalArgumentException e) { - } - - int[] cases = {0, SWT.HORIZONTAL, SWT.VERTICAL}; - for (int i = 0; i < cases.length; i++) - sash = new Sash(shell, cases[i]); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - // overridden from Control because it does not make sense - // to set the font of a Sash. -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Sash((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else super.runTest(); -} - -/* custom */ -Sash sash; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scale.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scale.java deleted file mode 100644 index 4023671733..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scale.java +++ /dev/null @@ -1,646 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Scale - * - * @see org.eclipse.swt.widgets.Scale - */ -public class Test_org_eclipse_swt_widgets_Scale extends Test_org_eclipse_swt_widgets_Control { - -public Test_org_eclipse_swt_widgets_Scale(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - scale = new Scale(shell, 0); - setWidget(scale); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - try { - scale = new Scale(null, 0); - fail("No exception occurred"); //should never get here - } - catch (IllegalArgumentException e) { - } - - int[] cases = {0, SWT.HORIZONTAL, SWT.VERTICAL}; - for (int i = 0; i < cases.length; i++) - scale = new Scale(shell, cases[i]); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_getIncrement() { - warnUnimpl("Test test_getIncrement not written"); -} - -public void test_getMaximum() { - warnUnimpl("Test test_getMaximum not written"); -} - -public void test_getMinimum() { - warnUnimpl("Test test_getMinimum not written"); -} - -public void test_getPageIncrement() { - warnUnimpl("Test test_getPageIncrement not written"); -} - -public void test_getSelection() { - warnUnimpl("Test test_getSelection not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_setIncrementI() { - warnUnimpl("Test test_setIncrementI not written"); -} - -public void test_setMaximumI() { - - int [][] testValues = getSetMaximumValues(); - - for (int i = 0; i < testValues.length; i++) { - int[] intArray = testValues[i]; - setDefaults(); - scale.setMaximum(intArray[0]); - report("setMaximum", intArray[0], intArray[1], intArray[2], intArray[3]); - } -} - -public void test_setMinimumI() { - - - int [][] testValues = getSetMinimumValues(); - - for (int i = 0; i < testValues.length; i++) { - int[] intArray = testValues[i]; - setDefaults(); - scale.setMinimum(intArray[0]); - report("setMinimum", intArray[0], intArray[1], intArray[2], intArray[3]); - } -} - -public void test_setPageIncrementI() { - warnUnimpl("Test test_setPageIncrementI not written"); -} - -public void test_setSelectionI() { - int [][] testValues = getSetSelectionValues(); - for (int i = 0; i < testValues.length; i++) { - int[] intArray = testValues[i]; - setDefaults(); - scale.setSelection(intArray[0]); - report("setSelection", intArray[0], intArray[1], intArray[2], intArray[3]); - } -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Scale((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getIncrement"); - methodNames.addElement("test_getMaximum"); - methodNames.addElement("test_getMinimum"); - methodNames.addElement("test_getPageIncrement"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_setIncrementI"); - methodNames.addElement("test_setMaximumI"); - methodNames.addElement("test_setMinimumI"); - methodNames.addElement("test_setPageIncrementI"); - methodNames.addElement("test_setSelectionI"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getIncrement")) test_getIncrement(); - else if (getName().equals("test_getMaximum")) test_getMaximum(); - else if (getName().equals("test_getMinimum")) test_getMinimum(); - else if (getName().equals("test_getPageIncrement")) test_getPageIncrement(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_setIncrementI")) test_setIncrementI(); - else if (getName().equals("test_setMaximumI")) test_setMaximumI(); - else if (getName().equals("test_setMinimumI")) test_setMinimumI(); - else if (getName().equals("test_setPageIncrementI")) test_setPageIncrementI(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else super.runTest(); -} - -/* custom */ -public void test_setFontLorg_eclipse_swt_graphics_Font() { - // overridden from Control because it does not make sense - // to set the font of a Scale. -} - -Scale scale; - -// this method must be private or protected so the auto-gen tool keeps it -private void report(String call, int set, int minExpected, int maxExpected, int selectionExpected) { - //Uncomment these lines and comment out call to check() if you want the test to report all errors without - //stopping. - - //if (trackBar.getMinimum() != minExpected) - //System.out.println(call + "(" + set + "): Minimum Expected: " + minExpected + " Actual: " + trackBar.getMinimum()); - //if (trackBar.getMaximum() != maxExpected) - //System.out.println(call + "(" + set + "): Maximum Expected: " + maxExpected + " Actual: " + trackBar.getMaximum()); - //if (trackBar.getSelection() != selectionExpected) - //System.out.println(call + "(" + set + "): Selection Expected: " + selectionExpected + " Actual: " + trackBar.getSelection()); - check(minExpected, maxExpected, selectionExpected); -} -// this method must be private or protected so the auto-gen tool keeps it -private void check(int minExpected, int maxExpected, int selectionExpected) { - assertEquals(scale.getMaximum(), maxExpected); - assertEquals(scale.getMinimum(), minExpected); - assertEquals(scale.getSelection(), selectionExpected); -} -// this method must be private or protected so the auto-gen tool keeps it -private int[][] getSetMinimumValues() { -return new int[][] { -{-15, 10, 100, 50, }, -{-14, 10, 100, 50, }, -{-13, 10, 100, 50, }, -{-12, 10, 100, 50, }, -{-11, 10, 100, 50, }, -{-10, 10, 100, 50, }, -{-9, 10, 100, 50, }, -{-8, 10, 100, 50, }, -{-7, 10, 100, 50, }, -{-6, 10, 100, 50, }, -{-5, 10, 100, 50, }, -{-4, 10, 100, 50, }, -{-3, 10, 100, 50, }, -{-2, 10, 100, 50, }, -{-1, 10, 100, 50, }, -{0, 0, 100, 50, }, -{1, 1, 100, 50, }, -{2, 2, 100, 50, }, -{3, 3, 100, 50, }, -{4, 4, 100, 50, }, -{5, 5, 100, 50, }, -{6, 6, 100, 50, }, -{7, 7, 100, 50, }, -{8, 8, 100, 50, }, -{9, 9, 100, 50, }, -{10, 10, 100, 50, }, -{11, 11, 100, 50, }, -{12, 12, 100, 50, }, -{13, 13, 100, 50, }, -{14, 14, 100, 50, }, -{15, 15, 100, 50, }, -{16, 16, 100, 50, }, -{17, 17, 100, 50, }, -{18, 18, 100, 50, }, -{19, 19, 100, 50, }, -{20, 20, 100, 50, }, -{21, 21, 100, 50, }, -{22, 22, 100, 50, }, -{23, 23, 100, 50, }, -{24, 24, 100, 50, }, -{25, 25, 100, 50, }, -{26, 26, 100, 50, }, -{27, 27, 100, 50, }, -{28, 28, 100, 50, }, -{29, 29, 100, 50, }, -{30, 30, 100, 50, }, -{31, 31, 100, 50, }, -{32, 32, 100, 50, }, -{33, 33, 100, 50, }, -{34, 34, 100, 50, }, -{35, 35, 100, 50, }, -{36, 36, 100, 50, }, -{37, 37, 100, 50, }, -{38, 38, 100, 50, }, -{39, 39, 100, 50, }, -{40, 40, 100, 50, }, -{41, 41, 100, 50, }, -{42, 42, 100, 50, }, -{43, 43, 100, 50, }, -{44, 44, 100, 50, }, -{45, 45, 100, 50, }, -{46, 46, 100, 50, }, -{47, 47, 100, 50, }, -{48, 48, 100, 50, }, -{49, 49, 100, 50, }, -{50, 50, 100, 50, }, -{51, 51, 100, 51, }, -{52, 52, 100, 52, }, -{53, 53, 100, 53, }, -{54, 54, 100, 54, }, -{55, 55, 100, 55, }, -{56, 56, 100, 56, }, -{57, 57, 100, 57, }, -{58, 58, 100, 58, }, -{59, 59, 100, 59, }, -{60, 60, 100, 60, }, -{61, 61, 100, 61, }, -{62, 62, 100, 62, }, -{63, 63, 100, 63, }, -{64, 64, 100, 64, }, -{65, 65, 100, 65, }, -{66, 66, 100, 66, }, -{67, 67, 100, 67, }, -{68, 68, 100, 68, }, -{69, 69, 100, 69, }, -{70, 70, 100, 70, }, -{71, 71, 100, 71, }, -{72, 72, 100, 72, }, -{73, 73, 100, 73, }, -{74, 74, 100, 74, }, -{75, 75, 100, 75, }, -{76, 76, 100, 76, }, -{77, 77, 100, 77, }, -{78, 78, 100, 78, }, -{79, 79, 100, 79, }, -{80, 80, 100, 80, }, -{81, 81, 100, 81, }, -{82, 82, 100, 82, }, -{83, 83, 100, 83, }, -{84, 84, 100, 84, }, -{85, 85, 100, 85, }, -{86, 86, 100, 86, }, -{87, 87, 100, 87, }, -{88, 88, 100, 88, }, -{89, 89, 100, 89, }, -{90, 90, 100, 90, }, -{91, 91, 100, 91, }, -{92, 92, 100, 92, }, -{93, 93, 100, 93, }, -{94, 94, 100, 94, }, -{95, 95, 100, 95, }, -{96, 96, 100, 96, }, -{97, 97, 100, 97, }, -{98, 98, 100, 98, }, -{99, 99, 100, 99, }, -{100, 10, 100, 50, }, -{101, 10, 100, 50, }, -{102, 10, 100, 50, }, -{103, 10, 100, 50, }, -{104, 10, 100, 50, }, -{105, 10, 100, 50, }, -{106, 10, 100, 50, }, -{107, 10, 100, 50, }, -{108, 10, 100, 50, }, -{109, 10, 100, 50, }, -{110, 10, 100, 50, }, -{111, 10, 100, 50, }, -{112, 10, 100, 50, }, -{113, 10, 100, 50, }, -{114, 10, 100, 50, }, -{115, 10, 100, 50, }, -{116, 10, 100, 50, }, -{117, 10, 100, 50, }, -{118, 10, 100, 50, }, -{119, 10, 100, 50, }, -{120, 10, 100, 50, }, -{121, 10, 100, 50, }, -{122, 10, 100, 50, }, -{123, 10, 100, 50, }, -{124, 10, 100, 50, }, -}; -} -// this method must be private or protected so the auto-gen tool keeps it -private int[][] getSetMaximumValues() { -return new int[][] { -{-15, 10, 100, 50, }, -{-14, 10, 100, 50, }, -{-13, 10, 100, 50, }, -{-12, 10, 100, 50, }, -{-11, 10, 100, 50, }, -{-10, 10, 100, 50, }, -{-9, 10, 100, 50, }, -{-8, 10, 100, 50, }, -{-7, 10, 100, 50, }, -{-6, 10, 100, 50, }, -{-5, 10, 100, 50, }, -{-4, 10, 100, 50, }, -{-3, 10, 100, 50, }, -{-2, 10, 100, 50, }, -{-1, 10, 100, 50, }, -{0, 10, 100, 50, }, -{1, 10, 100, 50, }, -{2, 10, 100, 50, }, -{3, 10, 100, 50, }, -{4, 10, 100, 50, }, -{5, 10, 100, 50, }, -{6, 10, 100, 50, }, -{7, 10, 100, 50, }, -{8, 10, 100, 50, }, -{9, 10, 100, 50, }, -{10, 10, 100, 50, }, -{11, 10, 11, 11, }, -{12, 10, 12, 12, }, -{13, 10, 13, 13, }, -{14, 10, 14, 14, }, -{15, 10, 15, 15, }, -{16, 10, 16, 16, }, -{17, 10, 17, 17, }, -{18, 10, 18, 18, }, -{19, 10, 19, 19, }, -{20, 10, 20, 20, }, -{21, 10, 21, 21, }, -{22, 10, 22, 22, }, -{23, 10, 23, 23, }, -{24, 10, 24, 24, }, -{25, 10, 25, 25, }, -{26, 10, 26, 26, }, -{27, 10, 27, 27, }, -{28, 10, 28, 28, }, -{29, 10, 29, 29, }, -{30, 10, 30, 30, }, -{31, 10, 31, 31, }, -{32, 10, 32, 32, }, -{33, 10, 33, 33, }, -{34, 10, 34, 34, }, -{35, 10, 35, 35, }, -{36, 10, 36, 36, }, -{37, 10, 37, 37, }, -{38, 10, 38, 38, }, -{39, 10, 39, 39, }, -{40, 10, 40, 40, }, -{41, 10, 41, 41, }, -{42, 10, 42, 42, }, -{43, 10, 43, 43, }, -{44, 10, 44, 44, }, -{45, 10, 45, 45, }, -{46, 10, 46, 46, }, -{47, 10, 47, 47, }, -{48, 10, 48, 48, }, -{49, 10, 49, 49, }, -{50, 10, 50, 50, }, -{51, 10, 51, 50, }, -{52, 10, 52, 50, }, -{53, 10, 53, 50, }, -{54, 10, 54, 50, }, -{55, 10, 55, 50, }, -{56, 10, 56, 50, }, -{57, 10, 57, 50, }, -{58, 10, 58, 50, }, -{59, 10, 59, 50, }, -{60, 10, 60, 50, }, -{61, 10, 61, 50, }, -{62, 10, 62, 50, }, -{63, 10, 63, 50, }, -{64, 10, 64, 50, }, -{65, 10, 65, 50, }, -{66, 10, 66, 50, }, -{67, 10, 67, 50, }, -{68, 10, 68, 50, }, -{69, 10, 69, 50, }, -{70, 10, 70, 50, }, -{71, 10, 71, 50, }, -{72, 10, 72, 50, }, -{73, 10, 73, 50, }, -{74, 10, 74, 50, }, -{75, 10, 75, 50, }, -{76, 10, 76, 50, }, -{77, 10, 77, 50, }, -{78, 10, 78, 50, }, -{79, 10, 79, 50, }, -{80, 10, 80, 50, }, -{81, 10, 81, 50, }, -{82, 10, 82, 50, }, -{83, 10, 83, 50, }, -{84, 10, 84, 50, }, -{85, 10, 85, 50, }, -{86, 10, 86, 50, }, -{87, 10, 87, 50, }, -{88, 10, 88, 50, }, -{89, 10, 89, 50, }, -{90, 10, 90, 50, }, -{91, 10, 91, 50, }, -{92, 10, 92, 50, }, -{93, 10, 93, 50, }, -{94, 10, 94, 50, }, -{95, 10, 95, 50, }, -{96, 10, 96, 50, }, -{97, 10, 97, 50, }, -{98, 10, 98, 50, }, -{99, 10, 99, 50, }, -{100, 10, 100, 50, }, -{101, 10, 101, 50, }, -{102, 10, 102, 50, }, -{103, 10, 103, 50, }, -{104, 10, 104, 50, }, -{105, 10, 105, 50, }, -{106, 10, 106, 50, }, -{107, 10, 107, 50, }, -{108, 10, 108, 50, }, -{109, 10, 109, 50, }, -{110, 10, 110, 50, }, -{111, 10, 111, 50, }, -{112, 10, 112, 50, }, -{113, 10, 113, 50, }, -{114, 10, 114, 50, }, -{115, 10, 115, 50, }, -{116, 10, 116, 50, }, -{117, 10, 117, 50, }, -{118, 10, 118, 50, }, -{119, 10, 119, 50, }, -{120, 10, 120, 50, }, -{121, 10, 121, 50, }, -{122, 10, 122, 50, }, -{123, 10, 123, 50, }, -{124, 10, 124, 50, }, -}; -} -// this method must be private or protected so the auto-gen tool keeps it -private void setDefaults() { - scale.setMaximum(100); - scale.setMinimum(10); - scale.setSelection(50); -} -// this method must be private or protected so the auto-gen tool keeps it -private int[][] getSetSelectionValues() { -return new int[][] { -{-15, 10, 100, 10, }, -{-14, 10, 100, 10, }, -{-13, 10, 100, 10, }, -{-12, 10, 100, 10, }, -{-11, 10, 100, 10, }, -{-10, 10, 100, 10, }, -{-9, 10, 100, 10, }, -{-8, 10, 100, 10, }, -{-7, 10, 100, 10, }, -{-6, 10, 100, 10, }, -{-5, 10, 100, 10, }, -{-4, 10, 100, 10, }, -{-3, 10, 100, 10, }, -{-2, 10, 100, 10, }, -{-1, 10, 100, 10, }, -{0, 10, 100, 10, }, -{1, 10, 100, 10, }, -{2, 10, 100, 10, }, -{3, 10, 100, 10, }, -{4, 10, 100, 10, }, -{5, 10, 100, 10, }, -{6, 10, 100, 10, }, -{7, 10, 100, 10, }, -{8, 10, 100, 10, }, -{9, 10, 100, 10, }, -{10, 10, 100, 10, }, -{11, 10, 100, 11, }, -{12, 10, 100, 12, }, -{13, 10, 100, 13, }, -{14, 10, 100, 14, }, -{15, 10, 100, 15, }, -{16, 10, 100, 16, }, -{17, 10, 100, 17, }, -{18, 10, 100, 18, }, -{19, 10, 100, 19, }, -{20, 10, 100, 20, }, -{21, 10, 100, 21, }, -{22, 10, 100, 22, }, -{23, 10, 100, 23, }, -{24, 10, 100, 24, }, -{25, 10, 100, 25, }, -{26, 10, 100, 26, }, -{27, 10, 100, 27, }, -{28, 10, 100, 28, }, -{29, 10, 100, 29, }, -{30, 10, 100, 30, }, -{31, 10, 100, 31, }, -{32, 10, 100, 32, }, -{33, 10, 100, 33, }, -{34, 10, 100, 34, }, -{35, 10, 100, 35, }, -{36, 10, 100, 36, }, -{37, 10, 100, 37, }, -{38, 10, 100, 38, }, -{39, 10, 100, 39, }, -{40, 10, 100, 40, }, -{41, 10, 100, 41, }, -{42, 10, 100, 42, }, -{43, 10, 100, 43, }, -{44, 10, 100, 44, }, -{45, 10, 100, 45, }, -{46, 10, 100, 46, }, -{47, 10, 100, 47, }, -{48, 10, 100, 48, }, -{49, 10, 100, 49, }, -{50, 10, 100, 50, }, -{51, 10, 100, 51, }, -{52, 10, 100, 52, }, -{53, 10, 100, 53, }, -{54, 10, 100, 54, }, -{55, 10, 100, 55, }, -{56, 10, 100, 56, }, -{57, 10, 100, 57, }, -{58, 10, 100, 58, }, -{59, 10, 100, 59, }, -{60, 10, 100, 60, }, -{61, 10, 100, 61, }, -{62, 10, 100, 62, }, -{63, 10, 100, 63, }, -{64, 10, 100, 64, }, -{65, 10, 100, 65, }, -{66, 10, 100, 66, }, -{67, 10, 100, 67, }, -{68, 10, 100, 68, }, -{69, 10, 100, 69, }, -{70, 10, 100, 70, }, -{71, 10, 100, 71, }, -{72, 10, 100, 72, }, -{73, 10, 100, 73, }, -{74, 10, 100, 74, }, -{75, 10, 100, 75, }, -{76, 10, 100, 76, }, -{77, 10, 100, 77, }, -{78, 10, 100, 78, }, -{79, 10, 100, 79, }, -{80, 10, 100, 80, }, -{81, 10, 100, 81, }, -{82, 10, 100, 82, }, -{83, 10, 100, 83, }, -{84, 10, 100, 84, }, -{85, 10, 100, 85, }, -{86, 10, 100, 86, }, -{87, 10, 100, 87, }, -{88, 10, 100, 88, }, -{89, 10, 100, 89, }, -{90, 10, 100, 90, }, -{91, 10, 100, 91, }, -{92, 10, 100, 92, }, -{93, 10, 100, 93, }, -{94, 10, 100, 94, }, -{95, 10, 100, 95, }, -{96, 10, 100, 96, }, -{97, 10, 100, 97, }, -{98, 10, 100, 98, }, -{99, 10, 100, 99, }, -{100, 10, 100, 100, }, -{101, 10, 100, 100, }, -{102, 10, 100, 100, }, -{103, 10, 100, 100, }, -{104, 10, 100, 100, }, -{105, 10, 100, 100, }, -{106, 10, 100, 100, }, -{107, 10, 100, 100, }, -{108, 10, 100, 100, }, -{109, 10, 100, 100, }, -{110, 10, 100, 100, }, -{111, 10, 100, 100, }, -{112, 10, 100, 100, }, -{113, 10, 100, 100, }, -{114, 10, 100, 100, }, -{115, 10, 100, 100, }, -{116, 10, 100, 100, }, -{117, 10, 100, 100, }, -{118, 10, 100, 100, }, -{119, 10, 100, 100, }, -{120, 10, 100, 100, }, -{121, 10, 100, 100, }, -{122, 10, 100, 100, }, -{123, 10, 100, 100, }, -{124, 10, 100, 100, }, -}; -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ScrollBar.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ScrollBar.java deleted file mode 100644 index 3c0a95ff03..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ScrollBar.java +++ /dev/null @@ -1,922 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.ScrollBar - * - * @see org.eclipse.swt.widgets.ScrollBar - */ -public class Test_org_eclipse_swt_widgets_ScrollBar extends Test_org_eclipse_swt_widgets_Widget { - -public Test_org_eclipse_swt_widgets_ScrollBar(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - canvas = new Canvas(shell, SWT.H_SCROLL); - scrollBar = canvas.getHorizontalBar(); - canvas.setSize(100,100); - setWidget(scrollBar); - shell.pack(); - shell.open(); -} - -protected void tearDown() { - super.tearDown(); -} -protected String valueString(int[] intArray) { - return " ("+intArray[1]+","+intArray[2]+","+intArray[3]+","+intArray[4]+")"; -} -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - listenerCalled = false; - boolean exceptionThrown = false; - SelectionListener listener = new SelectionListener() { - public void widgetSelected(SelectionEvent event) { - listenerCalled = true; - } - public void widgetDefaultSelected(SelectionEvent event) { - } - }; - try { - scrollBar.addSelectionListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - scrollBar.addSelectionListener(listener); - scrollBar.setSelection(100); - assertTrue(":a:", listenerCalled == false); - scrollBar.removeSelectionListener(listener); - try { - scrollBar.removeSelectionListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } -} - -public void test_dispose() { - // tested in tearDown -} - -public void test_getEnabled() { - // tested in test_setEnabled() method -} - -public void test_getIncrement() { - // tested in test_setIncrement() method -} - -public void test_getMaximum() { - // tested in test_setMaximum() method -} - -public void test_getMinimum() { - // tested in test_setMinimum() method -} - -public void test_getPageIncrement() { - // tested in test_setPageIncrement() method -} - -public void test_getParent() { - assertEquals(canvas, scrollBar.getParent()); -} - -public void test_getSelection() { - // tested in test_setSelection() method -} - -public void test_getSize() { - assertTrue(scrollBar.getSize().x > 0); - assertTrue(scrollBar.getSize().y > 0); -} - -public void test_getThumb() { - // tested in test_setThumb() method -} - -public void test_getVisible() { - // tested in test_setVisible() method -} - -public void test_isEnabled() { - scrollBar.setEnabled(true); - assertTrue(scrollBar.isEnabled()); - - scrollBar.setEnabled(false); - assertTrue(!scrollBar.isEnabled()); -} - -public void test_isVisible() { - scrollBar.setVisible(true); - assertTrue(scrollBar.isVisible()); - scrollBar.setVisible(false); - assertTrue(!scrollBar.isVisible()); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - // tested in addSelectionListener method -} - -public void test_setEnabledZ() { - scrollBar.setEnabled(true); - assertTrue(scrollBar.getEnabled()); - - scrollBar.setEnabled(false); - assertTrue(!scrollBar.getEnabled()); -} - -public void test_setIncrementI() { - int[] cases = {1, 10, 10000}; - for (int i=0; i < cases.length; i++) - { - scrollBar.setIncrement(cases[i]); - assertEquals(cases[i], scrollBar.getIncrement()); - } - - scrollBar.setIncrement(25); - scrollBar.setIncrement(0); // setting to 0 fails silently - assertEquals(25, scrollBar.getIncrement()); -} - -public void test_setMaximumI(){ - int [][] testValues = getSetMaximumValues(); - - for (int i = 0; i < testValues.length; i++) { - int[] intArray = testValues[i]; - setDefaults(); - scrollBar.setMaximum(intArray[0]); - String valueString = valueString(intArray); - report("setMax "+intArray[0]+ valueString, intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]); - } -} - -public void test_setMinimumI(){ - int [][] testValues = getSetMinimumValues(); - - for (int i = 0; i < testValues.length; i++) { - int[] intArray = testValues[i]; - setDefaults(); - scrollBar.setMinimum(intArray[0]); - String valueString = valueString(intArray); - report("setMin "+intArray[0]+valueString, intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]); - } -} - -public void test_setPageIncrementI(){ - int[] cases = {1, 10, 10000}; - for (int i=0; i<cases.length; i++) - { - scrollBar.setPageIncrement(cases[i]); - assertEquals(scrollBar.getPageIncrement(), cases[i]); - } - - scrollBar.setPageIncrement(25); - scrollBar.setPageIncrement(0); // setting to 0 fails silently - assertEquals(25, scrollBar.getPageIncrement()); -} - -public void test_setSelectionI(){ - int [][] testValues = getSetSelectionValues(); - for (int i = 0; i < testValues.length; i++) { - int[] intArray = testValues[i]; - setDefaults(); - scrollBar.setSelection(intArray[0]); - String valueString = valueString(intArray); - report("setSel "+intArray[0]+valueString,intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]); - } -} - -public void test_setThumbI(){ - int [][] testValues = getSetThumbValues(); - for (int i = 0; i < testValues.length; i++) { - int[] intArray = testValues[i]; - setDefaults(); - scrollBar.setThumb(intArray[0]); - String valueString = valueString(intArray); - report("setThmb "+intArray[0]+valueString,intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]); - } -} - -public void test_setValuesIIIIII() { - scrollBar.setValues(10, 10, 50, 2, 5, 10); - assertTrue(":a:", scrollBar.getSelection() == 10); - assertTrue(":b:", scrollBar.getMinimum() == 10); - assertTrue(":c:", scrollBar.getMaximum() == 50); - assertTrue(":d:", scrollBar.getThumb() == 2); - assertTrue(":e:", scrollBar.getIncrement() == 5); - assertTrue(":f:", scrollBar.getPageIncrement() == 10); -} - -public void test_setVisibleZ() { - scrollBar.setVisible(true); - assertTrue(scrollBar.getVisible()); - - scrollBar.setVisible(false); - assertTrue(!scrollBar.getVisible()); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_ScrollBar((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getEnabled"); - methodNames.addElement("test_getIncrement"); - methodNames.addElement("test_getMaximum"); - methodNames.addElement("test_getMinimum"); - methodNames.addElement("test_getPageIncrement"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSize"); - methodNames.addElement("test_getThumb"); - methodNames.addElement("test_getVisible"); - methodNames.addElement("test_isEnabled"); - methodNames.addElement("test_isVisible"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_setEnabledZ"); - methodNames.addElement("test_setIncrementI"); - methodNames.addElement("test_setMaximumI"); - methodNames.addElement("test_setMinimumI"); - methodNames.addElement("test_setPageIncrementI"); - methodNames.addElement("test_setSelectionI"); - methodNames.addElement("test_setThumbI"); - methodNames.addElement("test_setValuesIIIIII"); - methodNames.addElement("test_setVisibleZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getEnabled")) test_getEnabled(); - else if (getName().equals("test_getIncrement")) test_getIncrement(); - else if (getName().equals("test_getMaximum")) test_getMaximum(); - else if (getName().equals("test_getMinimum")) test_getMinimum(); - else if (getName().equals("test_getPageIncrement")) test_getPageIncrement(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSize")) test_getSize(); - else if (getName().equals("test_getThumb")) test_getThumb(); - else if (getName().equals("test_getVisible")) test_getVisible(); - else if (getName().equals("test_isEnabled")) test_isEnabled(); - else if (getName().equals("test_isVisible")) test_isVisible(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_setEnabledZ")) test_setEnabledZ(); - else if (getName().equals("test_setIncrementI")) test_setIncrementI(); - else if (getName().equals("test_setMaximumI")) test_setMaximumI(); - else if (getName().equals("test_setMinimumI")) test_setMinimumI(); - else if (getName().equals("test_setPageIncrementI")) test_setPageIncrementI(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else if (getName().equals("test_setThumbI")) test_setThumbI(); - else if (getName().equals("test_setValuesIIIIII")) test_setValuesIIIIII(); - else if (getName().equals("test_setVisibleZ")) test_setVisibleZ(); - else super.runTest(); -} - -/* custom */ -ScrollBar scrollBar; -Canvas canvas; - -// this method must be private or protected so the auto-gen tool keeps it -private void report(String call, int set, int minExpected, int maxExpected, int selectionExpected, int thumbExpected) { - // Uncomment these lines and comment out call to check() if you want the test to report all errors without - // stopping. -// if (scrollBar.getMinimum() != minExpected) { -// System.out.println(call + " : Minimum Expected: " + minExpected + " Actual: " + scrollBar.getMinimum()); -// } -// if (scrollBar.getMaximum() != maxExpected){ -// System.out.println(call + " : Maximum Expected: " + maxExpected + " Actual: " + scrollBar.getMaximum()); -// } -// if (scrollBar.getSelection() != selectionExpected) { -// System.out.println(call + " : Selection Expected: " + selectionExpected + " Actual: " + scrollBar.getSelection()); -// } -// if (scrollBar.getThumb() != thumbExpected) { -// System.out.println(call + " : Thumb Expected: " + thumbExpected + " Actual: " + scrollBar.getThumb()); -// } - check(call, minExpected, maxExpected, selectionExpected, thumbExpected); -} -// this method must be private or protected so the auto-gen tool keeps it -private void check(String call, int minExpected, int maxExpected, int selectionExpected, int thumbExpected) { - assertEquals(call+" max ", maxExpected, scrollBar.getMaximum()); - assertEquals(call+" min ", minExpected, scrollBar.getMinimum()); - assertEquals(call+" sel ", selectionExpected, scrollBar.getSelection()); - assertEquals(call+" thmb ", thumbExpected, scrollBar.getThumb()); -} -// this method must be private or protected so the auto-gen tool keeps it -private int[][] getSetThumbValues() { -return new int[][] { -{-15, 10, 100, 50, 10}, -{-14, 10, 100, 50, 10}, -{-13, 10, 100, 50, 10}, -{-12, 10, 100, 50, 10}, -{-11, 10, 100, 50, 10}, -{-10, 10, 100, 50, 10}, -{-9, 10, 100, 50, 10}, -{-8, 10, 100, 50, 10}, -{-7, 10, 100, 50, 10}, -{-6, 10, 100, 50, 10}, -{-5, 10, 100, 50, 10}, -{-4, 10, 100, 50, 10}, -{-3, 10, 100, 50, 10}, -{-2, 10, 100, 50, 10}, -{-1, 10, 100, 50, 10}, -{0, 10, 100, 50, 10}, -{1, 10, 100, 50, 1}, -{2, 10, 100, 50, 2}, -{3, 10, 100, 50, 3}, -{4, 10, 100, 50, 4}, -{5, 10, 100, 50, 5}, -{6, 10, 100, 50, 6}, -{7, 10, 100, 50, 7}, -{8, 10, 100, 50, 8}, -{9, 10, 100, 50, 9}, -{10, 10, 100, 50, 10}, -{11, 10, 100, 50, 11}, -{12, 10, 100, 50, 12}, -{13, 10, 100, 50, 13}, -{14, 10, 100, 50, 14}, -{15, 10, 100, 50, 15}, -{16, 10, 100, 50, 16}, -{17, 10, 100, 50, 17}, -{18, 10, 100, 50, 18}, -{19, 10, 100, 50, 19}, -{20, 10, 100, 50, 20}, -{21, 10, 100, 50, 21}, -{22, 10, 100, 50, 22}, -{23, 10, 100, 50, 23}, -{24, 10, 100, 50, 24}, -{25, 10, 100, 50, 25}, -{26, 10, 100, 50, 26}, -{27, 10, 100, 50, 27}, -{28, 10, 100, 50, 28}, -{29, 10, 100, 50, 29}, -{30, 10, 100, 50, 30}, -{31, 10, 100, 50, 31}, -{32, 10, 100, 50, 32}, -{33, 10, 100, 50, 33}, -{34, 10, 100, 50, 34}, -{35, 10, 100, 50, 35}, -{36, 10, 100, 50, 36}, -{37, 10, 100, 50, 37}, -{38, 10, 100, 50, 38}, -{39, 10, 100, 50, 39}, -{40, 10, 100, 50, 40}, -{41, 10, 100, 50, 41}, -{42, 10, 100, 50, 42}, -{43, 10, 100, 50, 43}, -{44, 10, 100, 50, 44}, -{45, 10, 100, 50, 45}, -{46, 10, 100, 50, 46}, -{47, 10, 100, 50, 47}, -{48, 10, 100, 50, 48}, -{49, 10, 100, 50, 49}, -{50, 10, 100, 50, 50}, -{51, 10, 100, 49, 51}, -{52, 10, 100, 48, 52}, -{53, 10, 100, 47, 53}, -{54, 10, 100, 46, 54}, -{55, 10, 100, 45, 55}, -{56, 10, 100, 44, 56}, -{57, 10, 100, 43, 57}, -{58, 10, 100, 42, 58}, -{59, 10, 100, 41, 59}, -{60, 10, 100, 40, 60}, -{61, 10, 100, 39, 61}, -{62, 10, 100, 38, 62}, -{63, 10, 100, 37, 63}, -{64, 10, 100, 36, 64}, -{65, 10, 100, 35, 65}, -{66, 10, 100, 34, 66}, -{67, 10, 100, 33, 67}, -{68, 10, 100, 32, 68}, -{69, 10, 100, 31, 69}, -{70, 10, 100, 30, 70}, -{71, 10, 100, 29, 71}, -{72, 10, 100, 28, 72}, -{73, 10, 100, 27, 73}, -{74, 10, 100, 26, 74}, -{75, 10, 100, 25, 75}, -{76, 10, 100, 24, 76}, -{77, 10, 100, 23, 77}, -{78, 10, 100, 22, 78}, -{79, 10, 100, 21, 79}, -{80, 10, 100, 20, 80}, -{81, 10, 100, 19, 81}, -{82, 10, 100, 18, 82}, -{83, 10, 100, 17, 83}, -{84, 10, 100, 16, 84}, -{85, 10, 100, 15, 85}, -{86, 10, 100, 14, 86}, -{87, 10, 100, 13, 87}, -{88, 10, 100, 12, 88}, -{89, 10, 100, 11, 89}, -{90, 10, 100, 10, 90}, -{91, 10, 100, 10, 90}, -{92, 10, 100, 10, 90}, -{93, 10, 100, 10, 90}, -{94, 10, 100, 10, 90}, -{95, 10, 100, 10, 90}, -{96, 10, 100, 10, 90}, -{97, 10, 100, 10, 90}, -{98, 10, 100, 10, 90}, -{99, 10, 100, 10, 90}, -{100, 10, 100, 10, 90}, -{101, 10, 100, 10, 90}, -{102, 10, 100, 10, 90}, -{103, 10, 100, 10, 90}, -{104, 10, 100, 10, 90}, -{105, 10, 100, 10, 90}, -{106, 10, 100, 10, 90}, -{107, 10, 100, 10, 90}, -{108, 10, 100, 10, 90}, -{109, 10, 100, 10, 90}, -{110, 10, 100, 10, 90}, -{111, 10, 100, 10, 90}, -{112, 10, 100, 10, 90}, -{113, 10, 100, 10, 90}, -{114, 10, 100, 10, 90}, -{115, 10, 100, 10, 90}, -{116, 10, 100, 10, 90}, -{117, 10, 100, 10, 90}, -{118, 10, 100, 10, 90}, -{119, 10, 100, 10, 90}, -{120, 10, 100, 10, 90}, -{121, 10, 100, 10, 90}, -{122, 10, 100, 10, 90}, -{123, 10, 100, 10, 90}, -{124, 10, 100, 10, 90}, -}; -} -// this method must be private or protected so the auto-gen tool keeps it -private int[][] getSetMinimumValues() { -return new int[][] { -{-15, 10, 100, 50, 10}, -{-14, 10, 100, 50, 10}, -{-13, 10, 100, 50, 10}, -{-12, 10, 100, 50, 10}, -{-11, 10, 100, 50, 10}, -{-10, 10, 100, 50, 10}, -{-9, 10, 100, 50, 10}, -{-8, 10, 100, 50, 10}, -{-7, 10, 100, 50, 10}, -{-6, 10, 100, 50, 10}, -{-5, 10, 100, 50, 10}, -{-4, 10, 100, 50, 10}, -{-3, 10, 100, 50, 10}, -{-2, 10, 100, 50, 10}, -{-1, 10, 100, 50, 10}, -{0, 0, 100, 50, 10}, -{1, 1, 100, 50, 10}, -{2, 2, 100, 50, 10}, -{3, 3, 100, 50, 10}, -{4, 4, 100, 50, 10}, -{5, 5, 100, 50, 10}, -{6, 6, 100, 50, 10}, -{7, 7, 100, 50, 10}, -{8, 8, 100, 50, 10}, -{9, 9, 100, 50, 10}, -{10, 10, 100, 50, 10}, -{11, 11, 100, 50, 10}, -{12, 12, 100, 50, 10}, -{13, 13, 100, 50, 10}, -{14, 14, 100, 50, 10}, -{15, 15, 100, 50, 10}, -{16, 16, 100, 50, 10}, -{17, 17, 100, 50, 10}, -{18, 18, 100, 50, 10}, -{19, 19, 100, 50, 10}, -{20, 20, 100, 50, 10}, -{21, 21, 100, 50, 10}, -{22, 22, 100, 50, 10}, -{23, 23, 100, 50, 10}, -{24, 24, 100, 50, 10}, -{25, 25, 100, 50, 10}, -{26, 26, 100, 50, 10}, -{27, 27, 100, 50, 10}, -{28, 28, 100, 50, 10}, -{29, 29, 100, 50, 10}, -{30, 30, 100, 50, 10}, -{31, 31, 100, 50, 10}, -{32, 32, 100, 50, 10}, -{33, 33, 100, 50, 10}, -{34, 34, 100, 50, 10}, -{35, 35, 100, 50, 10}, -{36, 36, 100, 50, 10}, -{37, 37, 100, 50, 10}, -{38, 38, 100, 50, 10}, -{39, 39, 100, 50, 10}, -{40, 40, 100, 50, 10}, -{41, 41, 100, 50, 10}, -{42, 42, 100, 50, 10}, -{43, 43, 100, 50, 10}, -{44, 44, 100, 50, 10}, -{45, 45, 100, 50, 10}, -{46, 46, 100, 50, 10}, -{47, 47, 100, 50, 10}, -{48, 48, 100, 50, 10}, -{49, 49, 100, 50, 10}, -{50, 50, 100, 50, 10}, -{51, 51, 100, 51, 10}, -{52, 52, 100, 52, 10}, -{53, 53, 100, 53, 10}, -{54, 54, 100, 54, 10}, -{55, 55, 100, 55, 10}, -{56, 56, 100, 56, 10}, -{57, 57, 100, 57, 10}, -{58, 58, 100, 58, 10}, -{59, 59, 100, 59, 10}, -{60, 60, 100, 60, 10}, -{61, 61, 100, 61, 10}, -{62, 62, 100, 62, 10}, -{63, 63, 100, 63, 10}, -{64, 64, 100, 64, 10}, -{65, 65, 100, 65, 10}, -{66, 66, 100, 66, 10}, -{67, 67, 100, 67, 10}, -{68, 68, 100, 68, 10}, -{69, 69, 100, 69, 10}, -{70, 70, 100, 70, 10}, -{71, 71, 100, 71, 10}, -{72, 72, 100, 72, 10}, -{73, 73, 100, 73, 10}, -{74, 74, 100, 74, 10}, -{75, 75, 100, 75, 10}, -{76, 76, 100, 76, 10}, -{77, 77, 100, 77, 10}, -{78, 78, 100, 78, 10}, -{79, 79, 100, 79, 10}, -{80, 80, 100, 80, 10}, -{81, 81, 100, 81, 10}, -{82, 82, 100, 82, 10}, -{83, 83, 100, 83, 10}, -{84, 84, 100, 84, 10}, -{85, 85, 100, 85, 10}, -{86, 86, 100, 86, 10}, -{87, 87, 100, 87, 10}, -{88, 88, 100, 88, 10}, -{89, 89, 100, 89, 10}, -{90, 90, 100, 90, 10}, -{91, 91, 100, 91, 9}, -{92, 92, 100, 92, 8}, -{93, 93, 100, 93, 7}, -{94, 94, 100, 94, 6}, -{95, 95, 100, 95, 5}, -{96, 96, 100, 96, 4}, -{97, 97, 100, 97, 3}, -{98, 98, 100, 98, 2}, -{99, 99, 100, 99, 1}, -{100, 10, 100, 50, 10}, -{101, 10, 100, 50, 10}, -{102, 10, 100, 50, 10}, -{103, 10, 100, 50, 10}, -{104, 10, 100, 50, 10}, -{105, 10, 100, 50, 10}, -{106, 10, 100, 50, 10}, -{107, 10, 100, 50, 10}, -{108, 10, 100, 50, 10}, -{109, 10, 100, 50, 10}, -{110, 10, 100, 50, 10}, -{111, 10, 100, 50, 10}, -{112, 10, 100, 50, 10}, -{113, 10, 100, 50, 10}, -{114, 10, 100, 50, 10}, -{115, 10, 100, 50, 10}, -{116, 10, 100, 50, 10}, -{117, 10, 100, 50, 10}, -{118, 10, 100, 50, 10}, -{119, 10, 100, 50, 10}, -{120, 10, 100, 50, 10}, -{121, 10, 100, 50, 10}, -{122, 10, 100, 50, 10}, -{123, 10, 100, 50, 10}, -{124, 10, 100, 50, 10}, -}; -} -// this method must be private or protected so the auto-gen tool keeps it -private int[][] getSetMaximumValues() { -return new int[][] { -{-15, 10, 100, 50, 10}, -{-14, 10, 100, 50, 10}, -{-13, 10, 100, 50, 10}, -{-12, 10, 100, 50, 10}, -{-11, 10, 100, 50, 10}, -{-10, 10, 100, 50, 10}, -{-9, 10, 100, 50, 10}, -{-8, 10, 100, 50, 10}, -{-7, 10, 100, 50, 10}, -{-6, 10, 100, 50, 10}, -{-5, 10, 100, 50, 10}, -{-4, 10, 100, 50, 10}, -{-3, 10, 100, 50, 10}, -{-2, 10, 100, 50, 10}, -{-1, 10, 100, 50, 10}, -{0, 10, 100, 50, 10}, -{1, 10, 100, 50, 10}, -{2, 10, 100, 50, 10}, -{3, 10, 100, 50, 10}, -{4, 10, 100, 50, 10}, -{5, 10, 100, 50, 10}, -{6, 10, 100, 50, 10}, -{7, 10, 100, 50, 10}, -{8, 10, 100, 50, 10}, -{9, 10, 100, 50, 10}, -{10, 10, 100, 50, 10}, -{11, 10, 11, 10, 1}, -{12, 10, 12, 10, 2}, -{13, 10, 13, 10, 3}, -{14, 10, 14, 10, 4}, -{15, 10, 15, 10, 5}, -{16, 10, 16, 10, 6}, -{17, 10, 17, 10, 7}, -{18, 10, 18, 10, 8}, -{19, 10, 19, 10, 9}, -{20, 10, 20, 10, 10}, -{21, 10, 21, 11, 10}, -{22, 10, 22, 12, 10}, -{23, 10, 23, 13, 10}, -{24, 10, 24, 14, 10}, -{25, 10, 25, 15, 10}, -{26, 10, 26, 16, 10}, -{27, 10, 27, 17, 10}, -{28, 10, 28, 18, 10}, -{29, 10, 29, 19, 10}, -{30, 10, 30, 20, 10}, -{31, 10, 31, 21, 10}, -{32, 10, 32, 22, 10}, -{33, 10, 33, 23, 10}, -{34, 10, 34, 24, 10}, -{35, 10, 35, 25, 10}, -{36, 10, 36, 26, 10}, -{37, 10, 37, 27, 10}, -{38, 10, 38, 28, 10}, -{39, 10, 39, 29, 10}, -{40, 10, 40, 30, 10}, -{41, 10, 41, 31, 10}, -{42, 10, 42, 32, 10}, -{43, 10, 43, 33, 10}, -{44, 10, 44, 34, 10}, -{45, 10, 45, 35, 10}, -{46, 10, 46, 36, 10}, -{47, 10, 47, 37, 10}, -{48, 10, 48, 38, 10}, -{49, 10, 49, 39, 10}, -{50, 10, 50, 40, 10}, -{51, 10, 51, 41, 10}, -{52, 10, 52, 42, 10}, -{53, 10, 53, 43, 10}, -{54, 10, 54, 44, 10}, -{55, 10, 55, 45, 10}, -{56, 10, 56, 46, 10}, -{57, 10, 57, 47, 10}, -{58, 10, 58, 48, 10}, -{59, 10, 59, 49, 10}, -{60, 10, 60, 50, 10}, -{61, 10, 61, 50, 10}, -{62, 10, 62, 50, 10}, -{63, 10, 63, 50, 10}, -{64, 10, 64, 50, 10}, -{65, 10, 65, 50, 10}, -{66, 10, 66, 50, 10}, -{67, 10, 67, 50, 10}, -{68, 10, 68, 50, 10}, -{69, 10, 69, 50, 10}, -{70, 10, 70, 50, 10}, -{71, 10, 71, 50, 10}, -{72, 10, 72, 50, 10}, -{73, 10, 73, 50, 10}, -{74, 10, 74, 50, 10}, -{75, 10, 75, 50, 10}, -{76, 10, 76, 50, 10}, -{77, 10, 77, 50, 10}, -{78, 10, 78, 50, 10}, -{79, 10, 79, 50, 10}, -{80, 10, 80, 50, 10}, -{81, 10, 81, 50, 10}, -{82, 10, 82, 50, 10}, -{83, 10, 83, 50, 10}, -{84, 10, 84, 50, 10}, -{85, 10, 85, 50, 10}, -{86, 10, 86, 50, 10}, -{87, 10, 87, 50, 10}, -{88, 10, 88, 50, 10}, -{89, 10, 89, 50, 10}, -{90, 10, 90, 50, 10}, -{91, 10, 91, 50, 10}, -{92, 10, 92, 50, 10}, -{93, 10, 93, 50, 10}, -{94, 10, 94, 50, 10}, -{95, 10, 95, 50, 10}, -{96, 10, 96, 50, 10}, -{97, 10, 97, 50, 10}, -{98, 10, 98, 50, 10}, -{99, 10, 99, 50, 10}, -{100, 10, 100, 50, 10}, -{101, 10, 101, 50, 10}, -{102, 10, 102, 50, 10}, -{103, 10, 103, 50, 10}, -{104, 10, 104, 50, 10}, -{105, 10, 105, 50, 10}, -{106, 10, 106, 50, 10}, -{107, 10, 107, 50, 10}, -{108, 10, 108, 50, 10}, -{109, 10, 109, 50, 10}, -{110, 10, 110, 50, 10}, -{111, 10, 111, 50, 10}, -{112, 10, 112, 50, 10}, -{113, 10, 113, 50, 10}, -{114, 10, 114, 50, 10}, -{115, 10, 115, 50, 10}, -{116, 10, 116, 50, 10}, -{117, 10, 117, 50, 10}, -{118, 10, 118, 50, 10}, -{119, 10, 119, 50, 10}, -{120, 10, 120, 50, 10}, -{121, 10, 121, 50, 10}, -{122, 10, 122, 50, 10}, -{123, 10, 123, 50, 10}, -{124, 10, 124, 50, 10}, -}; -} -// this method must be private or protected so the auto-gen tool keeps it -private void setDefaults() { - scrollBar.setMaximum(100); - scrollBar.setMinimum(10); - scrollBar.setThumb(10); - scrollBar.setSelection(50); -} -// this method must be private or protected so the auto-gen tool keeps it -private int[][] getSetSelectionValues() { -return new int[][] { -{-15, 10, 100, 10, 10}, -{-14, 10, 100, 10, 10}, -{-13, 10, 100, 10, 10}, -{-12, 10, 100, 10, 10}, -{-11, 10, 100, 10, 10}, -{-10, 10, 100, 10, 10}, -{-9, 10, 100, 10, 10}, -{-8, 10, 100, 10, 10}, -{-7, 10, 100, 10, 10}, -{-6, 10, 100, 10, 10}, -{-5, 10, 100, 10, 10}, -{-4, 10, 100, 10, 10}, -{-3, 10, 100, 10, 10}, -{-2, 10, 100, 10, 10}, -{-1, 10, 100, 10, 10}, -{0, 10, 100, 10, 10}, -{1, 10, 100, 10, 10}, -{2, 10, 100, 10, 10}, -{3, 10, 100, 10, 10}, -{4, 10, 100, 10, 10}, -{5, 10, 100, 10, 10}, -{6, 10, 100, 10, 10}, -{7, 10, 100, 10, 10}, -{8, 10, 100, 10, 10}, -{9, 10, 100, 10, 10}, -{10, 10, 100, 10, 10}, -{11, 10, 100, 11, 10}, -{12, 10, 100, 12, 10}, -{13, 10, 100, 13, 10}, -{14, 10, 100, 14, 10}, -{15, 10, 100, 15, 10}, -{16, 10, 100, 16, 10}, -{17, 10, 100, 17, 10}, -{18, 10, 100, 18, 10}, -{19, 10, 100, 19, 10}, -{20, 10, 100, 20, 10}, -{21, 10, 100, 21, 10}, -{22, 10, 100, 22, 10}, -{23, 10, 100, 23, 10}, -{24, 10, 100, 24, 10}, -{25, 10, 100, 25, 10}, -{26, 10, 100, 26, 10}, -{27, 10, 100, 27, 10}, -{28, 10, 100, 28, 10}, -{29, 10, 100, 29, 10}, -{30, 10, 100, 30, 10}, -{31, 10, 100, 31, 10}, -{32, 10, 100, 32, 10}, -{33, 10, 100, 33, 10}, -{34, 10, 100, 34, 10}, -{35, 10, 100, 35, 10}, -{36, 10, 100, 36, 10}, -{37, 10, 100, 37, 10}, -{38, 10, 100, 38, 10}, -{39, 10, 100, 39, 10}, -{40, 10, 100, 40, 10}, -{41, 10, 100, 41, 10}, -{42, 10, 100, 42, 10}, -{43, 10, 100, 43, 10}, -{44, 10, 100, 44, 10}, -{45, 10, 100, 45, 10}, -{46, 10, 100, 46, 10}, -{47, 10, 100, 47, 10}, -{48, 10, 100, 48, 10}, -{49, 10, 100, 49, 10}, -{50, 10, 100, 50, 10}, -{51, 10, 100, 51, 10}, -{52, 10, 100, 52, 10}, -{53, 10, 100, 53, 10}, -{54, 10, 100, 54, 10}, -{55, 10, 100, 55, 10}, -{56, 10, 100, 56, 10}, -{57, 10, 100, 57, 10}, -{58, 10, 100, 58, 10}, -{59, 10, 100, 59, 10}, -{60, 10, 100, 60, 10}, -{61, 10, 100, 61, 10}, -{62, 10, 100, 62, 10}, -{63, 10, 100, 63, 10}, -{64, 10, 100, 64, 10}, -{65, 10, 100, 65, 10}, -{66, 10, 100, 66, 10}, -{67, 10, 100, 67, 10}, -{68, 10, 100, 68, 10}, -{69, 10, 100, 69, 10}, -{70, 10, 100, 70, 10}, -{71, 10, 100, 71, 10}, -{72, 10, 100, 72, 10}, -{73, 10, 100, 73, 10}, -{74, 10, 100, 74, 10}, -{75, 10, 100, 75, 10}, -{76, 10, 100, 76, 10}, -{77, 10, 100, 77, 10}, -{78, 10, 100, 78, 10}, -{79, 10, 100, 79, 10}, -{80, 10, 100, 80, 10}, -{81, 10, 100, 81, 10}, -{82, 10, 100, 82, 10}, -{83, 10, 100, 83, 10}, -{84, 10, 100, 84, 10}, -{85, 10, 100, 85, 10}, -{86, 10, 100, 86, 10}, -{87, 10, 100, 87, 10}, -{88, 10, 100, 88, 10}, -{89, 10, 100, 89, 10}, -{90, 10, 100, 90, 10}, -{91, 10, 100, 90, 10}, -{92, 10, 100, 90, 10}, -{93, 10, 100, 90, 10}, -{94, 10, 100, 90, 10}, -{95, 10, 100, 90, 10}, -{96, 10, 100, 90, 10}, -{97, 10, 100, 90, 10}, -{98, 10, 100, 90, 10}, -{99, 10, 100, 90, 10}, -{100, 10, 100, 90, 10}, -{101, 10, 100, 90, 10}, -{102, 10, 100, 90, 10}, -{103, 10, 100, 90, 10}, -{104, 10, 100, 90, 10}, -{105, 10, 100, 90, 10}, -{106, 10, 100, 90, 10}, -{107, 10, 100, 90, 10}, -{108, 10, 100, 90, 10}, -{109, 10, 100, 90, 10}, -{110, 10, 100, 90, 10}, -{111, 10, 100, 90, 10}, -{112, 10, 100, 90, 10}, -{113, 10, 100, 90, 10}, -{114, 10, 100, 90, 10}, -{115, 10, 100, 90, 10}, -{116, 10, 100, 90, 10}, -{117, 10, 100, 90, 10}, -{118, 10, 100, 90, 10}, -{119, 10, 100, 90, 10}, -{120, 10, 100, 90, 10}, -{121, 10, 100, 90, 10}, -{122, 10, 100, 90, 10}, -{123, 10, 100, 90, 10}, -{124, 10, 100, 90, 10}, -}; -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scrollable.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scrollable.java deleted file mode 100644 index 08b7469c99..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Scrollable.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Scrollable - * - * @see org.eclipse.swt.widgets.Scrollable - */ -public class Test_org_eclipse_swt_widgets_Scrollable extends Test_org_eclipse_swt_widgets_Control { - -public Test_org_eclipse_swt_widgets_Scrollable(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - // abstract class -} - -public void test_computeTrimIIII() { - scrollable.computeTrim(0, 0, 0, 0); -} - -public void test_getClientArea() { - scrollable.getClientArea(); -} - -public void test_getHorizontalBar() { - ScrollBar hbar = scrollable.getHorizontalBar(); -} - -public void test_getVerticalBar() { - ScrollBar vbar = scrollable.getVerticalBar(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Scrollable((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_computeTrimIIII"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_getHorizontalBar"); - methodNames.addElement("test_getVerticalBar"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_getHorizontalBar")) test_getHorizontalBar(); - else if (getName().equals("test_getVerticalBar")) test_getVerticalBar(); - else super.runTest(); -} - -/* custom */ - Scrollable scrollable; - -protected void setWidget(Widget w) { - scrollable = (Scrollable)w; - super.setWidget(w); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Shell.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Shell.java deleted file mode 100644 index dacc74d5ce..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Shell.java +++ /dev/null @@ -1,521 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Shell - * - * @see org.eclipse.swt.widgets.Shell - */ -public class Test_org_eclipse_swt_widgets_Shell extends Test_org_eclipse_swt_widgets_Decorations { - -public Test_org_eclipse_swt_widgets_Shell(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - testShell = new Shell(shell, SWT.NULL); - setWidget(shell); - assertTrue(testShell.getParent() == shell); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_Constructor() { - warnUnimpl("Test test_Constructor not written"); -} - -public void test_ConstructorI() { - /* this should test various combinations of STYLE bits, for now just test individual bits */ - int[] cases = {SWT.NO_TRIM, SWT.RESIZE, SWT.TITLE, SWT.CLOSE, SWT.MENU, SWT.MIN, SWT.BORDER, - SWT.CLIP_CHILDREN, SWT.CLIP_SIBLINGS, SWT.ON_TOP, SWT.FLAT, SWT.SMOOTH}; - Shell newShell; - for (int i = 0; i < cases.length; i++) { - newShell = new Shell(cases[i]); - assertTrue("a " +i, newShell.getDisplay() == shell.getDisplay()); - newShell.dispose(); - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Display() { - Display display = shell.getDisplay(); - Shell newShell = new Shell(display); - assertTrue("a: ", newShell.getDisplay() == display); - newShell.dispose(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_DisplayI() { - int[] cases = {SWT.NO_TRIM, SWT.RESIZE, SWT.TITLE, SWT.CLOSE, SWT.MENU, SWT.MIN, SWT.BORDER, - SWT.CLIP_CHILDREN, SWT.CLIP_SIBLINGS, SWT.ON_TOP, SWT.FLAT, SWT.SMOOTH}; - Shell newShell; - Display display = shell.getDisplay(); - for (int i = 0; i < cases.length; i++) { - newShell = new Shell(display, cases[i]); - assertTrue("a " +i, newShell.getDisplay() == shell.getDisplay()); - newShell.dispose(); - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Shell() { - Shell newShell = new Shell(shell); - assertTrue("a: ", newShell.getParent() == shell); - newShell.dispose(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ShellI() { - /* this should test various combinations of STYLE bits, for now just test individual bits */ - int[] cases = {SWT.NO_TRIM, SWT.RESIZE, SWT.TITLE, SWT.CLOSE, SWT.MENU, SWT.MIN, SWT.BORDER, - SWT.CLIP_CHILDREN, SWT.CLIP_SIBLINGS, SWT.ON_TOP, SWT.FLAT, SWT.SMOOTH}; - Shell newShell; - for (int i = 0; i < cases.length; i++) { - newShell = new Shell(shell, cases[i]); - assertTrue("a " +i, newShell.getParent() == shell); - newShell.dispose(); - } -} - -public void test_addShellListenerLorg_eclipse_swt_events_ShellListener() { - listenerCalled = false; - boolean exceptionThrown = false; - ShellListener listener = new ShellListener() { - public void shellActivated(ShellEvent e) { - listenerCalled = true; - } - public void shellClosed(ShellEvent e) { - } - public void shellDeactivated(ShellEvent e) { - } - public void shellDeiconified(ShellEvent e) { - } - public void shellIconified(ShellEvent e) { - } - }; - try { - shell.addShellListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - shell.addShellListener(listener); - shell.forceActive(); - /* can't assume listener is synchronously called when forceActive returned */ - /* assertTrue(":a:", listenerCalled == true); */ - - listenerCalled = false; - shell.removeShellListener(listener); - shell.forceActive(); - /* can't assume listener is synchronously called when forceActive returned */ - /* assertTrue(":b:", listenerCalled == false); */ - try { - shell.removeShellListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } -} - -public void test_close() { - - // bogus line that 'enabled' gpfs - // Shell newShell = new Shell(); - testShell.setBounds(20,30,200, 200); - testShell.open(); - testShell.close(); - shell.setBounds(20,30,200, 200); - shell.open(); -} - -public void test_dispose() { - Shell newShell = new Shell(); - newShell.dispose(); -} - -public void test_forceActive() { - shell.forceActive(); - /* can't assume listener is synchronously called when forceActive returned */ - /* assertTrue(":a:", shell.getDisplay().getActiveShell() == shell); */ -} - -public void test_getBounds() { - // tested in test_setBoundsIIII and test_setBoundsLorg_eclipse_swt_graphics_Rectangle -} - -public void test_getEnabled() { - assertTrue(":a0:", shell.getEnabled()); - shell.setEnabled(false); - assertTrue(":a:", !shell.getEnabled()); - shell.setEnabled(true); - assertTrue(":b:", shell.getEnabled()); -} - -public void test_getImeInputMode() { - int mode = shell.getImeInputMode(); - assertTrue(":a:", mode >= 0); -} - -public void test_getLocation() { - shell.setLocation(10,15); - assertTrue(":a:", shell.getLocation().x == 10); - assertTrue(":b:", shell.getLocation().y == 15); -} - -public void test_getRegion() { - // tested in test_setRegion() -} - -public void test_getShell() { - assertTrue(":a:", shell.getShell()==shell); - Shell shell_1 = new Shell(shell); - assertTrue(":b:", shell_1.getShell()== shell_1); - shell_1.dispose(); -} - -public void test_getShells() { - int num = shell.getShells().length; - assertTrue(":a:", num == 1); - Shell shell_1 = new Shell(shell); - num = shell.getShells().length; - assertTrue(":a:", num == 2); - shell_1.dispose(); -} - -public void test_isEnabled() { - assertTrue(":a:", shell.isEnabled()); - shell.setEnabled(false); - assertTrue(":b:", !shell.isEnabled()); - if (fCheckBogusTestCases) - assertTrue(":b1:", !testShell.isEnabled()); - shell.setEnabled(true); - assertTrue(":c:", shell.isEnabled()); - assertTrue(":a:", testShell.isEnabled()); - testShell.setEnabled(false); - assertTrue(":b:", !testShell.isEnabled()); - testShell.setEnabled(true); - assertTrue(":c:", testShell.isEnabled()); -} - -public void test_open() { - shell.open(); -} - - -public void test_removeShellListenerLorg_eclipse_swt_events_ShellListener() { - // tested in removeShellListener method -} - -public void test_setActive() { - shell.setActive(); - assertTrue(":a:", shell.getDisplay().getActiveShell() == shell); -} - -public void test_setEnabledZ() { - // tested in getEnabled method -} - -public void test_setImeInputModeI() { - shell.setImeInputMode(SWT.NONE); - assertTrue(":a:", shell.getImeInputMode() == SWT.NONE); -} - -public void test_setRegionLorg_eclipse_swt_graphics_Region() { - warnUnimpl("Test test_setRegionLorg_eclipse_swt_graphics_Region not written"); -} - -public void test_setVisibleZ() { - shell.setVisible(false); - assertTrue(":a:", !shell.isVisible()); - shell.setVisible(true); - assertTrue(":b:", shell.isVisible()); -} - -public void test_win32_newLorg_eclipse_swt_widgets_DisplayI() { - warnUnimpl("Test test_win32_newLorg_eclipse_swt_widgets_DisplayI not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Shell((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_Constructor"); - methodNames.addElement("test_ConstructorI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Display"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_DisplayI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Shell"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ShellI"); - methodNames.addElement("test_addShellListenerLorg_eclipse_swt_events_ShellListener"); - methodNames.addElement("test_close"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_forceActive"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getEnabled"); - methodNames.addElement("test_getImeInputMode"); - methodNames.addElement("test_getLocation"); - methodNames.addElement("test_getRegion"); - methodNames.addElement("test_getShell"); - methodNames.addElement("test_getShells"); - methodNames.addElement("test_isEnabled"); - methodNames.addElement("test_open"); - methodNames.addElement("test_removeShellListenerLorg_eclipse_swt_events_ShellListener"); - methodNames.addElement("test_setActive"); - methodNames.addElement("test_setEnabledZ"); - methodNames.addElement("test_setImeInputModeI"); - methodNames.addElement("test_setRegionLorg_eclipse_swt_graphics_Region"); - methodNames.addElement("test_setVisibleZ"); - methodNames.addElement("test_win32_newLorg_eclipse_swt_widgets_DisplayI"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Decorations.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_Constructor")) test_Constructor(); - else if (getName().equals("test_ConstructorI")) test_ConstructorI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Display")) test_ConstructorLorg_eclipse_swt_widgets_Display(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_DisplayI")) test_ConstructorLorg_eclipse_swt_widgets_DisplayI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Shell")) test_ConstructorLorg_eclipse_swt_widgets_Shell(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ShellI")) test_ConstructorLorg_eclipse_swt_widgets_ShellI(); - else if (getName().equals("test_addShellListenerLorg_eclipse_swt_events_ShellListener")) test_addShellListenerLorg_eclipse_swt_events_ShellListener(); - else if (getName().equals("test_close")) test_close(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_forceActive")) test_forceActive(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getEnabled")) test_getEnabled(); - else if (getName().equals("test_getImeInputMode")) test_getImeInputMode(); - else if (getName().equals("test_getLocation")) test_getLocation(); - else if (getName().equals("test_getRegion")) test_getRegion(); - else if (getName().equals("test_getShell")) test_getShell(); - else if (getName().equals("test_getShells")) test_getShells(); - else if (getName().equals("test_isEnabled")) test_isEnabled(); - else if (getName().equals("test_open")) test_open(); - else if (getName().equals("test_removeShellListenerLorg_eclipse_swt_events_ShellListener")) test_removeShellListenerLorg_eclipse_swt_events_ShellListener(); - else if (getName().equals("test_setActive")) test_setActive(); - else if (getName().equals("test_setEnabledZ")) test_setEnabledZ(); - else if (getName().equals("test_setImeInputModeI")) test_setImeInputModeI(); - else if (getName().equals("test_setRegionLorg_eclipse_swt_graphics_Region")) test_setRegionLorg_eclipse_swt_graphics_Region(); - else if (getName().equals("test_setVisibleZ")) test_setVisibleZ(); - else if (getName().equals("test_win32_newLorg_eclipse_swt_widgets_DisplayI")) test_win32_newLorg_eclipse_swt_widgets_DisplayI(); - else super.runTest(); -} - -/* custom */ -public void test_getParent () { - // overriding Control.test_getParent - assertTrue(shell.getParent()==null); - assertTrue(testShell.getParent() == shell); -} - -public void test_getStyle() { - // overriding Widget.test_getStyle - assertTrue("testShell not modeless", (testShell.getStyle () & SWT.MODELESS) == SWT.MODELESS); - int[] cases = {SWT.MODELESS, SWT.PRIMARY_MODAL, SWT.APPLICATION_MODAL, SWT.SYSTEM_MODAL}; - for (int i = 0; i < cases.length; i++) { - Shell testShell2 = new Shell(shell, cases[i]); - assertTrue("shell " + i, (testShell2.getStyle () & cases[i]) == cases[i]); - testShell2.dispose(); - } -} - -public void test_isVisible() { - // overriding Control.test_isVisible - testShell.setVisible(true); - assertTrue(testShell.isVisible()); - shell.setVisible(true); - assertTrue(shell.isVisible()); - - testShell.setVisible(true); - shell.setVisible(true); - assertTrue("shell.isVisible() a:", shell.isVisible()); - shell.setVisible(false); - assertTrue("shell.isVisible() b:", !shell.isVisible()); - if (fCheckBogusTestCases) - assertTrue("testShell.isVisible() c:", !testShell.isVisible()); -} - -public void test_setBoundsIIII() { - // overridden from Control because Shells have a minimum size -} - -public void test_setBoundsLorg_eclipse_swt_graphics_Rectangle() { - // overridden from Control because Shells have a minimum size -// /* windows */ -// /* note that there is a minimum size for a shell, this test will fail if p1.x < 112 or p1.y < 27 */ -// /* note that there is a maximum size for a shell, this test will fail if p1.x > 1292 or p1.y > 1036 */ -// if (SwtJunit.isWindows) { -// Point p1 = new Point(112, 27); -// Rectangle r1 = new Rectangle(20, 30, p1.x, p1.y); -// Rectangle r2; -// for (int i = 0; i < 11; i++) { -// testShell.setBounds(r1); -// r2 = testShell.getBounds(); -// assert("child shell iteration " + i + " set=" + r1 + " get=" + r2, r1.equals(r2)); -// r1.width += 100; -// r1.height += 100; -// } -// r1 = new Rectangle(20, 30, p1.x, p1.y); -// for (int i = 0; i < 11; i++) { -// shell.setBounds(r1); -// r2 = shell.getBounds(); -// assert("parent shell iteration " + i + " set=" + r1 + " get=" + r2, r1.equals(r2)); -// r1.width += 100; -// r1.height += 100; -// } -// } -// /* motif */ -// /* note that there is a minimum size for a shell, this test will fail if p1.x < 112 or p1.y < 27 */ -// /* note that there is a maximum size for a shell, this test will fail if p1.x > 1292 or p1.y > 1036 */ -// if (SwtJunit.isMotif) { -// Point p1 = new Point(15,35); -// Rectangle r1 = new Rectangle(20, 30, p1.x, p1.y); -// Rectangle r2; -// -// for (int i = 0; i < 15; i++) { -// testShell.setBounds(r1); -// r2 = testShell.getBounds(); -// assert("child shell iteration " + i + " set=" + r1 + " get=" + r2, r1.equals(r2)); -// r1.width += 100; -// r1.height += 100; -// } -// r1 = new Rectangle(50, 50, p1.x, p1.y); -// for (int i = 0; i < 11; i++) { -// shell.setBounds(r1); -// r2 = shell.getBounds(); -// assert("parent shell iteration " + i + " set=" + r1 + " get=" + r2, r1.equals(r2)); -// r1.width += 100; -// r1.height += 100; -// } -// } -} -public void test_setRegion() { - Region region = new Region(); - region.add(new Rectangle(10, 20, 100, 200)); - // test shell without style SWT.NO_TRIM - assertTrue(":a:", shell.getRegion() == null); - shell.setRegion(region); - assertTrue(":b:", shell.getRegion() == null); - shell.setRegion(null); - assertTrue(":c:", shell.getRegion() == null); - // test shell with style SWT.NO_TRIM - Display display = shell.getDisplay(); - Shell shell2 = new Shell(display, SWT.NO_TRIM); - assertTrue(":d:", shell2.getRegion() == null); - shell2.setRegion(region); - assertTrue(":e:", shell2.getRegion().handle == region.handle); - region.dispose(); - assertTrue(":f:", shell2.getRegion().isDisposed()); - shell2.setRegion(null); - assertTrue(":g:", shell2.getRegion() == null); -} -public void test_setSizeII() { - /* windows */ - /* note that there is a minimum size for a shell, this test will fail if p1.x < 112 or p1.y < 27 */ - /* note that there is a maximum size for a shell, this test will fail if p1.x > 1292 or p1.y > 1036 */ - if (SwtJunit.isWindows) { - Point newSize = new Point(112, 27); - for (int i = 0; i < 10; i++) { - testShell.setSize(newSize.x, newSize.y); - assertEquals(newSize, testShell.getSize()); - newSize.x += 100; - newSize.y += 100; - } - newSize = new Point(1292, 1036); - for (int i = 0; i < 10; i++) { - testShell.setSize(newSize.x, newSize.y); - assertEquals(newSize, testShell.getSize()); - newSize.x -= 100; - newSize.y -= 100; - } - } - - /* motif */ - /* note that there is a minimum size for a shell, this test will fail if p1.x < ?? or p1.y < ?? */ - /* note that there is a maximum size for a shell, this test will fail if p1.x > ?? or p1.y > ?? */ - if (SwtJunit.isMotif) { - Point newSize = new Point(2, 2); - for (int i = 0; i < 10; i++) { - testShell.setSize(newSize.x, newSize.y); - assertEquals(newSize, testShell.getSize()); - newSize.x += 100; - newSize.y += 100; - } - newSize = new Point(1600, 1600); - for (int i = 0; i < 10; i++) { - testShell.setSize(newSize.x, newSize.y); - assertEquals(newSize, testShell.getSize()); - newSize.x -= 100; - 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 < 112 or p1.y < 27 */ - /* note that there is a maximum size for a shell, this test will fail if p1.x > 1292 or p1.y > 1036 */ - if (SwtJunit.isWindows) { - Point newSize = new Point(112, 27); - for (int i = 0; i < 10; i++) { - testShell.setSize(newSize); - assertEquals(newSize, testShell.getSize()); - newSize.x += 100; - newSize.y += 100; - } - newSize = new Point(1292, 1036); - for (int i = 0; i < 10; i++) { - testShell.setSize(newSize); - assertEquals(newSize, testShell.getSize()); - newSize.x -= 100; - newSize.y -= 100; - } - } - - /* motif */ - /* note that there is a minimum size for a shell, this test will fail if p1.x < ?? or p1.y < ?? */ - /* note that there is a maximum size for a shell, this test will fail if p1.x > ?? or p1.y > ?? */ - if (SwtJunit.isMotif) { - Point newSize = new Point(2, 2); - for (int i = 0; i < 10; i++) { - testShell.setSize(newSize); - assertEquals(newSize, testShell.getSize()); - newSize.x += 100; - newSize.y += 100; - } - newSize = new Point(1600, 1600); - for (int i = 0; i < 10; i++) { - testShell.setSize(newSize); - assertEquals(newSize, testShell.getSize()); - newSize.x -= 100; - newSize.y -= 100; - } - } -} - -Shell testShell; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Slider.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Slider.java deleted file mode 100644 index a5011a4fb0..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Slider.java +++ /dev/null @@ -1,909 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Slider - * - * @see org.eclipse.swt.widgets.Slider - */ -public class Test_org_eclipse_swt_widgets_Slider extends Test_org_eclipse_swt_widgets_Control { - -public Test_org_eclipse_swt_widgets_Slider(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - slider = new Slider(shell, 0); - setWidget(slider); -} - -protected void tearDown() { - super.tearDown(); -} -protected String valueString(int[] intArray) { - return " ("+intArray[1]+","+intArray[2]+","+intArray[3]+","+intArray[4]+")"; -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - try { - slider = new Slider(null, 0); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } - - int[] cases = {0, SWT.HORIZONTAL, SWT.VERTICAL}; - for (int i = 0; i < cases.length; i++) - slider = new Slider(shell, cases[i]); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - listenerCalled = false; - boolean exceptionThrown = false; - SelectionListener listener = new SelectionListener() { - public void widgetSelected(SelectionEvent event) { - listenerCalled = true; - } - public void widgetDefaultSelected(SelectionEvent event) { - } - }; - try { - slider.addSelectionListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - slider.addSelectionListener(listener); - slider.setSelection(0); - assertTrue(":a:", listenerCalled == false); - slider.removeSelectionListener(listener); - try { - slider.removeSelectionListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } -} - -public void test_computeSizeIIZ() { - // super class method sufficient test -} - -public void test_getEnabled() { - // tested in setEnabled method -} - -public void test_getIncrement() { - int[] cases = {1, 10, 10000}; - for (int i=0; i<cases.length; i++) - { - slider.setIncrement(cases[i]); - assertTrue("case: " + String.valueOf(i), slider.getIncrement()==cases[i]); - } -} - -public void test_getMaximum() { - slider.setMaximum(2000); - assertTrue(":a:", slider.getMaximum() == 2000); - slider.setMaximum(20); - assertTrue(":b:", slider.getMaximum() == 20); - slider.setMaximum(-1); - assertTrue(":c:", slider.getMaximum() == 20); - slider.setMaximum(0); - assertTrue(":d:", slider.getMaximum() == 20); - slider.setMaximum(10); - assertTrue(":d:", slider.getMaximum() == 10); -} - -public void test_getMinimum() { - slider.setMinimum(5); - assertTrue(":a:", slider.getMinimum() == 5); - slider.setMinimum(20); - assertTrue(":b:", slider.getMinimum() == 20); - slider.setMinimum(-1); - assertTrue(":c:", slider.getMinimum() == 20); - slider.setMinimum(0); - assertTrue(":d:", slider.getMinimum() == 0); - slider.setMinimum(10); - assertTrue(":d:", slider.getMinimum() == 10); -} - -public void test_getPageIncrement() { - int[] cases = {1, 10, 10000}; - for (int i=0; i<cases.length; i++) - { - slider.setPageIncrement(cases[i]); - assertTrue("case: " + String.valueOf(i), slider.getPageIncrement()==cases[i]); - } -} - -public void test_getSelection() { - slider.setSelection(10); - assertTrue(":a:", slider.getSelection()== 10); - -} - -public void test_getThumb() { - // tested in test_setThumb() method -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - // tested in addSelectionListener method -} - -public void test_setEnabledZ() { - slider.setEnabled(true); - assertTrue(slider.getEnabled()); - slider.setEnabled(false); - assertEquals(slider.getEnabled(), false); -} - -public void test_setIncrementI() { - // tested in getIncrement method -} - -public void test_setMaximumI() { - - int [][] testValues = getSetMaximumValues(); - - for (int i = 0; i < testValues.length; i++) { - int[] intArray = testValues[i]; - setDefaults(); - slider.setMaximum(intArray[0]); - String valueString = valueString(intArray); - report("setMax "+intArray[0]+ valueString, intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]); - } -} - -public void test_setMinimumI() { - - int [][] testValues = getSetMinimumValues(); - - for (int i = 0; i < testValues.length; i++) { - int[] intArray = testValues[i]; - setDefaults(); - slider.setMinimum(intArray[0]); - String valueString = valueString(intArray); - report("setMin "+intArray[0]+valueString, intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]); - } -} - -public void test_setPageIncrementI() { - slider.setPageIncrement(3); - assertTrue(":a:", slider.getPageIncrement()== 3); -} - -public void test_setSelectionI() { - int [][] testValues = getSetSelectionValues(); - for (int i = 0; i < testValues.length; i++) { - int[] intArray = testValues[i]; - setDefaults(); - slider.setSelection(intArray[0]); - String valueString = valueString(intArray); - report("setSel "+intArray[0]+valueString,intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]); - } -} - -public void test_setThumbI() { - - int [][] testValues = getSetThumbValues(); - - for (int i = 0; i < testValues.length; i++) { - int[] intArray = testValues[i]; - setDefaults(); - slider.setThumb(intArray[0]); - String valueString = valueString(intArray); - report("setThmb "+intArray[0]+valueString,intArray[0], intArray[1], intArray[2], intArray[3], intArray[4]); - } -} - -public void test_setValuesIIIIII() { - slider.setValues(10, 10, 50, 2, 5, 10); - assertTrue(":a:", slider.getSelection() == 10); - assertTrue(":b:", slider.getMinimum() == 10); - assertTrue(":c:", slider.getMaximum() == 50); - assertTrue(":d:", slider.getThumb() == 2); - assertTrue(":e:", slider.getIncrement() == 5); - assertTrue(":f:", slider.getPageIncrement() == 10); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Slider((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_getEnabled"); - methodNames.addElement("test_getIncrement"); - methodNames.addElement("test_getMaximum"); - methodNames.addElement("test_getMinimum"); - methodNames.addElement("test_getPageIncrement"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getThumb"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_setEnabledZ"); - methodNames.addElement("test_setIncrementI"); - methodNames.addElement("test_setMaximumI"); - methodNames.addElement("test_setMinimumI"); - methodNames.addElement("test_setPageIncrementI"); - methodNames.addElement("test_setSelectionI"); - methodNames.addElement("test_setThumbI"); - methodNames.addElement("test_setValuesIIIIII"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Control.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_getEnabled")) test_getEnabled(); - else if (getName().equals("test_getIncrement")) test_getIncrement(); - else if (getName().equals("test_getMaximum")) test_getMaximum(); - else if (getName().equals("test_getMinimum")) test_getMinimum(); - else if (getName().equals("test_getPageIncrement")) test_getPageIncrement(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getThumb")) test_getThumb(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_setEnabledZ")) test_setEnabledZ(); - else if (getName().equals("test_setIncrementI")) test_setIncrementI(); - else if (getName().equals("test_setMaximumI")) test_setMaximumI(); - else if (getName().equals("test_setMinimumI")) test_setMinimumI(); - else if (getName().equals("test_setPageIncrementI")) test_setPageIncrementI(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else if (getName().equals("test_setThumbI")) test_setThumbI(); - else if (getName().equals("test_setValuesIIIIII")) test_setValuesIIIIII(); - else super.runTest(); -} - -/* custom */ -public void test_setFontLorg_eclipse_swt_graphics_Font() { - // overridden from Control because it does not make sense - // to set the font of a Slider. -} - -Slider slider; - -// this method must be private or protected so the auto-gen tool keeps it -private void report(String call, int set, int minExpected, int maxExpected, int selectionExpected, int thumbExpected) { - // Uncomment these lines and comment out call to check() if you want the test to report all errors without - // stopping. -// if (slider.getMinimum() != minExpected) { -// System.out.println(call + " : Minimum Expected: " + minExpected + " Actual: " + slider.getMinimum()); -// } -// if (slider.getMaximum() != maxExpected){ -// System.out.println(call + " : Maximum Expected: " + maxExpected + " Actual: " + slider.getMaximum()); -// } -// if (slider.getSelection() != selectionExpected) { -// System.out.println(call + " : Selection Expected: " + selectionExpected + " Actual: " + slider.getSelection()); -// } -// if (slider.getThumb() != thumbExpected) { -// System.out.println(call + " : Thumb Expected: " + thumbExpected + " Actual: " + slider.getThumb()); -// } - check(call, minExpected, maxExpected, selectionExpected, thumbExpected); -} -// this method must be private or protected so the auto-gen tool keeps it -private void check(String call, int minExpected, int maxExpected, int selectionExpected, int thumbExpected) { - assertEquals(call+" max ", maxExpected, slider.getMaximum()); - assertEquals(call+" min ", minExpected, slider.getMinimum()); - assertEquals(call+" sel ", selectionExpected, slider.getSelection()); - assertEquals(call+" thmb ", thumbExpected, slider.getThumb()); -} -// this method must be private or protected so the auto-gen tool keeps it -private int[][] getSetThumbValues() { -return new int[][] { -{-15, 10, 100, 50, 10}, -{-14, 10, 100, 50, 10}, -{-13, 10, 100, 50, 10}, -{-12, 10, 100, 50, 10}, -{-11, 10, 100, 50, 10}, -{-10, 10, 100, 50, 10}, -{-9, 10, 100, 50, 10}, -{-8, 10, 100, 50, 10}, -{-7, 10, 100, 50, 10}, -{-6, 10, 100, 50, 10}, -{-5, 10, 100, 50, 10}, -{-4, 10, 100, 50, 10}, -{-3, 10, 100, 50, 10}, -{-2, 10, 100, 50, 10}, -{-1, 10, 100, 50, 10}, -{0, 10, 100, 50, 10}, -{1, 10, 100, 50, 1}, -{2, 10, 100, 50, 2}, -{3, 10, 100, 50, 3}, -{4, 10, 100, 50, 4}, -{5, 10, 100, 50, 5}, -{6, 10, 100, 50, 6}, -{7, 10, 100, 50, 7}, -{8, 10, 100, 50, 8}, -{9, 10, 100, 50, 9}, -{10, 10, 100, 50, 10}, -{11, 10, 100, 50, 11}, -{12, 10, 100, 50, 12}, -{13, 10, 100, 50, 13}, -{14, 10, 100, 50, 14}, -{15, 10, 100, 50, 15}, -{16, 10, 100, 50, 16}, -{17, 10, 100, 50, 17}, -{18, 10, 100, 50, 18}, -{19, 10, 100, 50, 19}, -{20, 10, 100, 50, 20}, -{21, 10, 100, 50, 21}, -{22, 10, 100, 50, 22}, -{23, 10, 100, 50, 23}, -{24, 10, 100, 50, 24}, -{25, 10, 100, 50, 25}, -{26, 10, 100, 50, 26}, -{27, 10, 100, 50, 27}, -{28, 10, 100, 50, 28}, -{29, 10, 100, 50, 29}, -{30, 10, 100, 50, 30}, -{31, 10, 100, 50, 31}, -{32, 10, 100, 50, 32}, -{33, 10, 100, 50, 33}, -{34, 10, 100, 50, 34}, -{35, 10, 100, 50, 35}, -{36, 10, 100, 50, 36}, -{37, 10, 100, 50, 37}, -{38, 10, 100, 50, 38}, -{39, 10, 100, 50, 39}, -{40, 10, 100, 50, 40}, -{41, 10, 100, 50, 41}, -{42, 10, 100, 50, 42}, -{43, 10, 100, 50, 43}, -{44, 10, 100, 50, 44}, -{45, 10, 100, 50, 45}, -{46, 10, 100, 50, 46}, -{47, 10, 100, 50, 47}, -{48, 10, 100, 50, 48}, -{49, 10, 100, 50, 49}, -{50, 10, 100, 50, 50}, -{51, 10, 100, 49, 51}, -{52, 10, 100, 48, 52}, -{53, 10, 100, 47, 53}, -{54, 10, 100, 46, 54}, -{55, 10, 100, 45, 55}, -{56, 10, 100, 44, 56}, -{57, 10, 100, 43, 57}, -{58, 10, 100, 42, 58}, -{59, 10, 100, 41, 59}, -{60, 10, 100, 40, 60}, -{61, 10, 100, 39, 61}, -{62, 10, 100, 38, 62}, -{63, 10, 100, 37, 63}, -{64, 10, 100, 36, 64}, -{65, 10, 100, 35, 65}, -{66, 10, 100, 34, 66}, -{67, 10, 100, 33, 67}, -{68, 10, 100, 32, 68}, -{69, 10, 100, 31, 69}, -{70, 10, 100, 30, 70}, -{71, 10, 100, 29, 71}, -{72, 10, 100, 28, 72}, -{73, 10, 100, 27, 73}, -{74, 10, 100, 26, 74}, -{75, 10, 100, 25, 75}, -{76, 10, 100, 24, 76}, -{77, 10, 100, 23, 77}, -{78, 10, 100, 22, 78}, -{79, 10, 100, 21, 79}, -{80, 10, 100, 20, 80}, -{81, 10, 100, 19, 81}, -{82, 10, 100, 18, 82}, -{83, 10, 100, 17, 83}, -{84, 10, 100, 16, 84}, -{85, 10, 100, 15, 85}, -{86, 10, 100, 14, 86}, -{87, 10, 100, 13, 87}, -{88, 10, 100, 12, 88}, -{89, 10, 100, 11, 89}, -{90, 10, 100, 10, 90}, -{91, 10, 100, 10, 90}, -{92, 10, 100, 10, 90}, -{93, 10, 100, 10, 90}, -{94, 10, 100, 10, 90}, -{95, 10, 100, 10, 90}, -{96, 10, 100, 10, 90}, -{97, 10, 100, 10, 90}, -{98, 10, 100, 10, 90}, -{99, 10, 100, 10, 90}, -{100, 10, 100, 10, 90}, -{101, 10, 100, 10, 90}, -{102, 10, 100, 10, 90}, -{103, 10, 100, 10, 90}, -{104, 10, 100, 10, 90}, -{105, 10, 100, 10, 90}, -{106, 10, 100, 10, 90}, -{107, 10, 100, 10, 90}, -{108, 10, 100, 10, 90}, -{109, 10, 100, 10, 90}, -{110, 10, 100, 10, 90}, -{111, 10, 100, 10, 90}, -{112, 10, 100, 10, 90}, -{113, 10, 100, 10, 90}, -{114, 10, 100, 10, 90}, -{115, 10, 100, 10, 90}, -{116, 10, 100, 10, 90}, -{117, 10, 100, 10, 90}, -{118, 10, 100, 10, 90}, -{119, 10, 100, 10, 90}, -{120, 10, 100, 10, 90}, -{121, 10, 100, 10, 90}, -{122, 10, 100, 10, 90}, -{123, 10, 100, 10, 90}, -{124, 10, 100, 10, 90}, -}; -} -// this method must be private or protected so the auto-gen tool keeps it -private int[][] getSetMinimumValues() { -return new int[][] { -{-15, 10, 100, 50, 10}, -{-14, 10, 100, 50, 10}, -{-13, 10, 100, 50, 10}, -{-12, 10, 100, 50, 10}, -{-11, 10, 100, 50, 10}, -{-10, 10, 100, 50, 10}, -{-9, 10, 100, 50, 10}, -{-8, 10, 100, 50, 10}, -{-7, 10, 100, 50, 10}, -{-6, 10, 100, 50, 10}, -{-5, 10, 100, 50, 10}, -{-4, 10, 100, 50, 10}, -{-3, 10, 100, 50, 10}, -{-2, 10, 100, 50, 10}, -{-1, 10, 100, 50, 10}, -{0, 0, 100, 50, 10}, -{1, 1, 100, 50, 10}, -{2, 2, 100, 50, 10}, -{3, 3, 100, 50, 10}, -{4, 4, 100, 50, 10}, -{5, 5, 100, 50, 10}, -{6, 6, 100, 50, 10}, -{7, 7, 100, 50, 10}, -{8, 8, 100, 50, 10}, -{9, 9, 100, 50, 10}, -{10, 10, 100, 50, 10}, -{11, 11, 100, 50, 10}, -{12, 12, 100, 50, 10}, -{13, 13, 100, 50, 10}, -{14, 14, 100, 50, 10}, -{15, 15, 100, 50, 10}, -{16, 16, 100, 50, 10}, -{17, 17, 100, 50, 10}, -{18, 18, 100, 50, 10}, -{19, 19, 100, 50, 10}, -{20, 20, 100, 50, 10}, -{21, 21, 100, 50, 10}, -{22, 22, 100, 50, 10}, -{23, 23, 100, 50, 10}, -{24, 24, 100, 50, 10}, -{25, 25, 100, 50, 10}, -{26, 26, 100, 50, 10}, -{27, 27, 100, 50, 10}, -{28, 28, 100, 50, 10}, -{29, 29, 100, 50, 10}, -{30, 30, 100, 50, 10}, -{31, 31, 100, 50, 10}, -{32, 32, 100, 50, 10}, -{33, 33, 100, 50, 10}, -{34, 34, 100, 50, 10}, -{35, 35, 100, 50, 10}, -{36, 36, 100, 50, 10}, -{37, 37, 100, 50, 10}, -{38, 38, 100, 50, 10}, -{39, 39, 100, 50, 10}, -{40, 40, 100, 50, 10}, -{41, 41, 100, 50, 10}, -{42, 42, 100, 50, 10}, -{43, 43, 100, 50, 10}, -{44, 44, 100, 50, 10}, -{45, 45, 100, 50, 10}, -{46, 46, 100, 50, 10}, -{47, 47, 100, 50, 10}, -{48, 48, 100, 50, 10}, -{49, 49, 100, 50, 10}, -{50, 50, 100, 50, 10}, -{51, 51, 100, 51, 10}, -{52, 52, 100, 52, 10}, -{53, 53, 100, 53, 10}, -{54, 54, 100, 54, 10}, -{55, 55, 100, 55, 10}, -{56, 56, 100, 56, 10}, -{57, 57, 100, 57, 10}, -{58, 58, 100, 58, 10}, -{59, 59, 100, 59, 10}, -{60, 60, 100, 60, 10}, -{61, 61, 100, 61, 10}, -{62, 62, 100, 62, 10}, -{63, 63, 100, 63, 10}, -{64, 64, 100, 64, 10}, -{65, 65, 100, 65, 10}, -{66, 66, 100, 66, 10}, -{67, 67, 100, 67, 10}, -{68, 68, 100, 68, 10}, -{69, 69, 100, 69, 10}, -{70, 70, 100, 70, 10}, -{71, 71, 100, 71, 10}, -{72, 72, 100, 72, 10}, -{73, 73, 100, 73, 10}, -{74, 74, 100, 74, 10}, -{75, 75, 100, 75, 10}, -{76, 76, 100, 76, 10}, -{77, 77, 100, 77, 10}, -{78, 78, 100, 78, 10}, -{79, 79, 100, 79, 10}, -{80, 80, 100, 80, 10}, -{81, 81, 100, 81, 10}, -{82, 82, 100, 82, 10}, -{83, 83, 100, 83, 10}, -{84, 84, 100, 84, 10}, -{85, 85, 100, 85, 10}, -{86, 86, 100, 86, 10}, -{87, 87, 100, 87, 10}, -{88, 88, 100, 88, 10}, -{89, 89, 100, 89, 10}, -{90, 90, 100, 90, 10}, -{91, 91, 100, 91, 9}, -{92, 92, 100, 92, 8}, -{93, 93, 100, 93, 7}, -{94, 94, 100, 94, 6}, -{95, 95, 100, 95, 5}, -{96, 96, 100, 96, 4}, -{97, 97, 100, 97, 3}, -{98, 98, 100, 98, 2}, -{99, 99, 100, 99, 1}, -{100, 10, 100, 50, 10}, -{101, 10, 100, 50, 10}, -{102, 10, 100, 50, 10}, -{103, 10, 100, 50, 10}, -{104, 10, 100, 50, 10}, -{105, 10, 100, 50, 10}, -{106, 10, 100, 50, 10}, -{107, 10, 100, 50, 10}, -{108, 10, 100, 50, 10}, -{109, 10, 100, 50, 10}, -{110, 10, 100, 50, 10}, -{111, 10, 100, 50, 10}, -{112, 10, 100, 50, 10}, -{113, 10, 100, 50, 10}, -{114, 10, 100, 50, 10}, -{115, 10, 100, 50, 10}, -{116, 10, 100, 50, 10}, -{117, 10, 100, 50, 10}, -{118, 10, 100, 50, 10}, -{119, 10, 100, 50, 10}, -{120, 10, 100, 50, 10}, -{121, 10, 100, 50, 10}, -{122, 10, 100, 50, 10}, -{123, 10, 100, 50, 10}, -{124, 10, 100, 50, 10}, -}; -} -// this method must be private or protected so the auto-gen tool keeps it -private int[][] getSetMaximumValues() { -return new int[][] { -{-15, 10, 100, 50, 10}, -{-14, 10, 100, 50, 10}, -{-13, 10, 100, 50, 10}, -{-12, 10, 100, 50, 10}, -{-11, 10, 100, 50, 10}, -{-10, 10, 100, 50, 10}, -{-9, 10, 100, 50, 10}, -{-8, 10, 100, 50, 10}, -{-7, 10, 100, 50, 10}, -{-6, 10, 100, 50, 10}, -{-5, 10, 100, 50, 10}, -{-4, 10, 100, 50, 10}, -{-3, 10, 100, 50, 10}, -{-2, 10, 100, 50, 10}, -{-1, 10, 100, 50, 10}, -{0, 10, 100, 50, 10}, -{1, 10, 100, 50, 10}, -{2, 10, 100, 50, 10}, -{3, 10, 100, 50, 10}, -{4, 10, 100, 50, 10}, -{5, 10, 100, 50, 10}, -{6, 10, 100, 50, 10}, -{7, 10, 100, 50, 10}, -{8, 10, 100, 50, 10}, -{9, 10, 100, 50, 10}, -{10, 10, 100, 50, 10}, -{11, 10, 11, 10, 1}, -{12, 10, 12, 10, 2}, -{13, 10, 13, 10, 3}, -{14, 10, 14, 10, 4}, -{15, 10, 15, 10, 5}, -{16, 10, 16, 10, 6}, -{17, 10, 17, 10, 7}, -{18, 10, 18, 10, 8}, -{19, 10, 19, 10, 9}, -{20, 10, 20, 10, 10}, -{21, 10, 21, 11, 10}, -{22, 10, 22, 12, 10}, -{23, 10, 23, 13, 10}, -{24, 10, 24, 14, 10}, -{25, 10, 25, 15, 10}, -{26, 10, 26, 16, 10}, -{27, 10, 27, 17, 10}, -{28, 10, 28, 18, 10}, -{29, 10, 29, 19, 10}, -{30, 10, 30, 20, 10}, -{31, 10, 31, 21, 10}, -{32, 10, 32, 22, 10}, -{33, 10, 33, 23, 10}, -{34, 10, 34, 24, 10}, -{35, 10, 35, 25, 10}, -{36, 10, 36, 26, 10}, -{37, 10, 37, 27, 10}, -{38, 10, 38, 28, 10}, -{39, 10, 39, 29, 10}, -{40, 10, 40, 30, 10}, -{41, 10, 41, 31, 10}, -{42, 10, 42, 32, 10}, -{43, 10, 43, 33, 10}, -{44, 10, 44, 34, 10}, -{45, 10, 45, 35, 10}, -{46, 10, 46, 36, 10}, -{47, 10, 47, 37, 10}, -{48, 10, 48, 38, 10}, -{49, 10, 49, 39, 10}, -{50, 10, 50, 40, 10}, -{51, 10, 51, 41, 10}, -{52, 10, 52, 42, 10}, -{53, 10, 53, 43, 10}, -{54, 10, 54, 44, 10}, -{55, 10, 55, 45, 10}, -{56, 10, 56, 46, 10}, -{57, 10, 57, 47, 10}, -{58, 10, 58, 48, 10}, -{59, 10, 59, 49, 10}, -{60, 10, 60, 50, 10}, -{61, 10, 61, 50, 10}, -{62, 10, 62, 50, 10}, -{63, 10, 63, 50, 10}, -{64, 10, 64, 50, 10}, -{65, 10, 65, 50, 10}, -{66, 10, 66, 50, 10}, -{67, 10, 67, 50, 10}, -{68, 10, 68, 50, 10}, -{69, 10, 69, 50, 10}, -{70, 10, 70, 50, 10}, -{71, 10, 71, 50, 10}, -{72, 10, 72, 50, 10}, -{73, 10, 73, 50, 10}, -{74, 10, 74, 50, 10}, -{75, 10, 75, 50, 10}, -{76, 10, 76, 50, 10}, -{77, 10, 77, 50, 10}, -{78, 10, 78, 50, 10}, -{79, 10, 79, 50, 10}, -{80, 10, 80, 50, 10}, -{81, 10, 81, 50, 10}, -{82, 10, 82, 50, 10}, -{83, 10, 83, 50, 10}, -{84, 10, 84, 50, 10}, -{85, 10, 85, 50, 10}, -{86, 10, 86, 50, 10}, -{87, 10, 87, 50, 10}, -{88, 10, 88, 50, 10}, -{89, 10, 89, 50, 10}, -{90, 10, 90, 50, 10}, -{91, 10, 91, 50, 10}, -{92, 10, 92, 50, 10}, -{93, 10, 93, 50, 10}, -{94, 10, 94, 50, 10}, -{95, 10, 95, 50, 10}, -{96, 10, 96, 50, 10}, -{97, 10, 97, 50, 10}, -{98, 10, 98, 50, 10}, -{99, 10, 99, 50, 10}, -{100, 10, 100, 50, 10}, -{101, 10, 101, 50, 10}, -{102, 10, 102, 50, 10}, -{103, 10, 103, 50, 10}, -{104, 10, 104, 50, 10}, -{105, 10, 105, 50, 10}, -{106, 10, 106, 50, 10}, -{107, 10, 107, 50, 10}, -{108, 10, 108, 50, 10}, -{109, 10, 109, 50, 10}, -{110, 10, 110, 50, 10}, -{111, 10, 111, 50, 10}, -{112, 10, 112, 50, 10}, -{113, 10, 113, 50, 10}, -{114, 10, 114, 50, 10}, -{115, 10, 115, 50, 10}, -{116, 10, 116, 50, 10}, -{117, 10, 117, 50, 10}, -{118, 10, 118, 50, 10}, -{119, 10, 119, 50, 10}, -{120, 10, 120, 50, 10}, -{121, 10, 121, 50, 10}, -{122, 10, 122, 50, 10}, -{123, 10, 123, 50, 10}, -{124, 10, 124, 50, 10}, -}; -} -// this method must be private or protected so the auto-gen tool keeps it -private void setDefaults() { - - slider.setMaximum(100); - slider.setMinimum(10); - slider.setThumb(10); - slider.setSelection(50); - -} -// this method must be private or protected so the auto-gen tool keeps it -private int[][] getSetSelectionValues() { -return new int[][] { -{-15, 10, 100, 10, 10}, -{-14, 10, 100, 10, 10}, -{-13, 10, 100, 10, 10}, -{-12, 10, 100, 10, 10}, -{-11, 10, 100, 10, 10}, -{-10, 10, 100, 10, 10}, -{-9, 10, 100, 10, 10}, -{-8, 10, 100, 10, 10}, -{-7, 10, 100, 10, 10}, -{-6, 10, 100, 10, 10}, -{-5, 10, 100, 10, 10}, -{-4, 10, 100, 10, 10}, -{-3, 10, 100, 10, 10}, -{-2, 10, 100, 10, 10}, -{-1, 10, 100, 10, 10}, -{0, 10, 100, 10, 10}, -{1, 10, 100, 10, 10}, -{2, 10, 100, 10, 10}, -{3, 10, 100, 10, 10}, -{4, 10, 100, 10, 10}, -{5, 10, 100, 10, 10}, -{6, 10, 100, 10, 10}, -{7, 10, 100, 10, 10}, -{8, 10, 100, 10, 10}, -{9, 10, 100, 10, 10}, -{10, 10, 100, 10, 10}, -{11, 10, 100, 11, 10}, -{12, 10, 100, 12, 10}, -{13, 10, 100, 13, 10}, -{14, 10, 100, 14, 10}, -{15, 10, 100, 15, 10}, -{16, 10, 100, 16, 10}, -{17, 10, 100, 17, 10}, -{18, 10, 100, 18, 10}, -{19, 10, 100, 19, 10}, -{20, 10, 100, 20, 10}, -{21, 10, 100, 21, 10}, -{22, 10, 100, 22, 10}, -{23, 10, 100, 23, 10}, -{24, 10, 100, 24, 10}, -{25, 10, 100, 25, 10}, -{26, 10, 100, 26, 10}, -{27, 10, 100, 27, 10}, -{28, 10, 100, 28, 10}, -{29, 10, 100, 29, 10}, -{30, 10, 100, 30, 10}, -{31, 10, 100, 31, 10}, -{32, 10, 100, 32, 10}, -{33, 10, 100, 33, 10}, -{34, 10, 100, 34, 10}, -{35, 10, 100, 35, 10}, -{36, 10, 100, 36, 10}, -{37, 10, 100, 37, 10}, -{38, 10, 100, 38, 10}, -{39, 10, 100, 39, 10}, -{40, 10, 100, 40, 10}, -{41, 10, 100, 41, 10}, -{42, 10, 100, 42, 10}, -{43, 10, 100, 43, 10}, -{44, 10, 100, 44, 10}, -{45, 10, 100, 45, 10}, -{46, 10, 100, 46, 10}, -{47, 10, 100, 47, 10}, -{48, 10, 100, 48, 10}, -{49, 10, 100, 49, 10}, -{50, 10, 100, 50, 10}, -{51, 10, 100, 51, 10}, -{52, 10, 100, 52, 10}, -{53, 10, 100, 53, 10}, -{54, 10, 100, 54, 10}, -{55, 10, 100, 55, 10}, -{56, 10, 100, 56, 10}, -{57, 10, 100, 57, 10}, -{58, 10, 100, 58, 10}, -{59, 10, 100, 59, 10}, -{60, 10, 100, 60, 10}, -{61, 10, 100, 61, 10}, -{62, 10, 100, 62, 10}, -{63, 10, 100, 63, 10}, -{64, 10, 100, 64, 10}, -{65, 10, 100, 65, 10}, -{66, 10, 100, 66, 10}, -{67, 10, 100, 67, 10}, -{68, 10, 100, 68, 10}, -{69, 10, 100, 69, 10}, -{70, 10, 100, 70, 10}, -{71, 10, 100, 71, 10}, -{72, 10, 100, 72, 10}, -{73, 10, 100, 73, 10}, -{74, 10, 100, 74, 10}, -{75, 10, 100, 75, 10}, -{76, 10, 100, 76, 10}, -{77, 10, 100, 77, 10}, -{78, 10, 100, 78, 10}, -{79, 10, 100, 79, 10}, -{80, 10, 100, 80, 10}, -{81, 10, 100, 81, 10}, -{82, 10, 100, 82, 10}, -{83, 10, 100, 83, 10}, -{84, 10, 100, 84, 10}, -{85, 10, 100, 85, 10}, -{86, 10, 100, 86, 10}, -{87, 10, 100, 87, 10}, -{88, 10, 100, 88, 10}, -{89, 10, 100, 89, 10}, -{90, 10, 100, 90, 10}, -{91, 10, 100, 90, 10}, -{92, 10, 100, 90, 10}, -{93, 10, 100, 90, 10}, -{94, 10, 100, 90, 10}, -{95, 10, 100, 90, 10}, -{96, 10, 100, 90, 10}, -{97, 10, 100, 90, 10}, -{98, 10, 100, 90, 10}, -{99, 10, 100, 90, 10}, -{100, 10, 100, 90, 10}, -{101, 10, 100, 90, 10}, -{102, 10, 100, 90, 10}, -{103, 10, 100, 90, 10}, -{104, 10, 100, 90, 10}, -{105, 10, 100, 90, 10}, -{106, 10, 100, 90, 10}, -{107, 10, 100, 90, 10}, -{108, 10, 100, 90, 10}, -{109, 10, 100, 90, 10}, -{110, 10, 100, 90, 10}, -{111, 10, 100, 90, 10}, -{112, 10, 100, 90, 10}, -{113, 10, 100, 90, 10}, -{114, 10, 100, 90, 10}, -{115, 10, 100, 90, 10}, -{116, 10, 100, 90, 10}, -{117, 10, 100, 90, 10}, -{118, 10, 100, 90, 10}, -{119, 10, 100, 90, 10}, -{120, 10, 100, 90, 10}, -{121, 10, 100, 90, 10}, -{122, 10, 100, 90, 10}, -{123, 10, 100, 90, 10}, -{124, 10, 100, 90, 10}, -}; -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Synchronizer.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Synchronizer.java deleted file mode 100644 index 5c3efe5309..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Synchronizer.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Synchronizer - * - * @see org.eclipse.swt.widgets.Synchronizer - */ -public class Test_org_eclipse_swt_widgets_Synchronizer extends SwtTestCase { - -public Test_org_eclipse_swt_widgets_Synchronizer(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_widgets_Display() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_Display not written"); -} - - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Synchronizer((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_Display"); - return methodNames; -} - -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_Display")) test_ConstructorLorg_eclipse_swt_widgets_Display(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabFolder.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabFolder.java deleted file mode 100644 index 924d80051a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabFolder.java +++ /dev/null @@ -1,383 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.TabFolder - * - * @see org.eclipse.swt.widgets.TabFolder - */ -public class Test_org_eclipse_swt_widgets_TabFolder extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_widgets_TabFolder(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - makeCleanEnvironment(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - TabFolder newTabFolder; - try { - newTabFolder = new TabFolder(null, 0); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_computeTrimIIII() { - warnUnimpl("Test test_computeTrimIIII not written"); -} - -public void test_getClientArea() { - warnUnimpl("Test test_getClientArea not written"); -} - -public void test_getItemCount() { - int number = 10; - TabItem ti; - for (int i = 0; i<number ; i++){ - assertTrue(":a:" + i, tabFolder.getItemCount()==i); - ti = new TabItem(tabFolder, 0); - } -} - -public void test_getItemI() { - int number = 15; - TabItem[] items = new TabItem[number]; - for (int i = 0; i < number; i++) { - items[i] = new TabItem(tabFolder, 0); - } - - for (int i = 0; i < number; i++) { - assertTrue(":a:" +String.valueOf(i), tabFolder.getItem(i).equals(items[i])); - } - try { - tabFolder.getItem(number); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } - - try { - tabFolder.getItem(number+1); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } - - try { - tabFolder.getItem(-1); - fail("No exception thrown for index == -1"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_getItems() { - int number = 5; - TabItem[] items = new TabItem[number]; - - assertEquals(0, tabFolder.getItems().length); - - for (int i = 0; i<number ; i++){ - items[i] = new TabItem(tabFolder, 0); - } - assertEquals(items, tabFolder.getItems()); - - tabFolder.getItems()[0].dispose(); - assertEquals(new TabItem[]{items[1], items[2], items[3], items[4]}, tabFolder.getItems()); - - tabFolder.getItems()[3].dispose(); - assertEquals(new TabItem[]{items[1], items[2], items[3]}, tabFolder.getItems()); - - tabFolder.getItems()[1].dispose(); - assertEquals(new TabItem[]{items[1], items[3]}, tabFolder.getItems()); -} - -public void test_getSelection() { - int number = 10; - TabItem[] tis = new TabItem[number]; - for (int i = 0; i<number ; i++){ - tis[i] = new TabItem(tabFolder, 0); - } - assertTrue(":a:", tabFolder.getSelection()[0] == tis[0]); - for (int i = 0; i<number ; i++){ - tabFolder.setSelection(i); - assertTrue(":b:" + i, tabFolder.getSelection()[0]==tis[i]); - } -} - -public void test_getSelectionIndex() { - int number = 15; - TabItem[] items = new TabItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TabItem(tabFolder, 0); - - assertTrue(":a:", tabFolder.getSelectionIndex()==0); - - tabFolder.setSelection(new TabItem[]{items[2], items[number-1], items[10]}); - assertTrue(":b:", tabFolder.getSelectionIndex()==2); - - tabFolder.setSelection(items); - assertTrue(":c:", tabFolder.getSelectionIndex()==0); -} - -public void test_indexOfLorg_eclipse_swt_widgets_TabItem() { - int number = 10; - TabItem[] tis = new TabItem[number]; - for (int i = 0; i<number ; i++){ - tis[i] = new TabItem(tabFolder, 0); - } - for (int i = 0; i<number ; i++){ - assertTrue(":a:" + i, tabFolder.indexOf(tis[i])==i); - } - - // - makeCleanEnvironment(); - - for (int i = 0; i<number ; i++){ - tis[i] = new TabItem(tabFolder, 0); - } - for (int i = 0; i<number ; i++){ - try { - tabFolder.indexOf(null); - fail("No exception thrown for tabItem == null"); - } - catch (IllegalArgumentException e) { - } - } - - // - makeCleanEnvironment(); - number = 20; - TabItem[] items = new TabItem[number]; - - for (int i = 0; i < number; i++) { - items[i] = new TabItem(tabFolder, 0); - items[i].setText(String.valueOf(i)); - } - - //another tabFolder - TabFolder tabFolder_2 = new TabFolder(shell, 0); - TabItem[] items_2 = new TabItem[number]; - for (int i = 0; i < number; i++) { - items_2[i] = new TabItem(tabFolder_2, 0); - items_2[i].setText(String.valueOf(i)); - } - - for (int i = 0; i < number; i++) { - assertTrue(":a:" + String.valueOf(i), tabFolder.indexOf(items_2[i])==-1); - } - - // - TabFolder tabFolder2 = new TabFolder(shell, SWT.NULL); - TabItem tabItem = new TabItem(tabFolder2, SWT.NULL); - - assertTrue(":a:", tabFolder.indexOf(tabItem) == -1); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_setSelection$Lorg_eclipse_swt_widgets_TabItem() { - warnUnimpl("Test test_setSelection$Lorg_eclipse_swt_widgets_TabItem not written"); -} - -public void test_setSelectionI() { - int number = 10; - TabItem ti; - for (int i = 0; i<number ; i++){ - ti = new TabItem(tabFolder, 0); - } - for (int i = 0; i<number ; i++){ - tabFolder.setSelection(i); - assertEquals(i, tabFolder.getSelectionIndex()); - } - - // - makeCleanEnvironment(); - - for (int i = 0; i<number ; i++){ - ti = new TabItem(tabFolder, 0); - assertEquals("i=" + i, 0, tabFolder.getSelectionIndex()); - } - - // - makeCleanEnvironment(); - - number = 5; - TabItem[] items = new TabItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TabItem(tabFolder, 0); - try { - tabFolder.setSelection((TabItem[]) null); - fail("No exception thrown for selection == null"); - } - catch (IllegalArgumentException e) { - } - finally { - assertEquals(new TabItem[]{items[0]}, tabFolder.getSelection()); - } - - // - makeCleanEnvironment(); - - items = new TabItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TabItem(tabFolder, 0); - - tabFolder.setSelection(0); - assertEquals(new TabItem[]{items[0]}, tabFolder.getSelection()); - - tabFolder.setSelection(4); - assertEquals(new TabItem[]{items[4]}, tabFolder.getSelection()); - - tabFolder.setSelection(2); - assertEquals(new TabItem[]{items[2]}, tabFolder.getSelection()); - - tabFolder.setSelection(1); - assertEquals(new TabItem[]{items[1]}, tabFolder.getSelection()); - - tabFolder.setSelection(number + 1); - assertEquals(new TabItem[]{items[1]}, tabFolder.getSelection()); - -// tabFolder.setSelection(-1); -// assertEquals(0, tabFolder.getSelection().length); - - tabFolder.setSelection(3); - assertEquals(new TabItem[]{items[3]}, tabFolder.getSelection()); - -// tabFolder.setSelection(-2); -// assertEquals(0, tabFolder.getSelection().length); - - // - makeCleanEnvironment(); - - for (int i = 0; i < number; i++) - items[i] = new TabItem(tabFolder, 0); - - tabFolder.setSelection(new TabItem[]{}); - assertEquals(new TabItem[]{}, tabFolder.getSelection()); - - tabFolder.setSelection(new TabItem[] {items[0]}); - assertEquals(new TabItem[] {items[0]}, tabFolder.getSelection()); - - tabFolder.setSelection(new TabItem[] {items[3]}); - assertEquals(new TabItem[] {items[3]}, tabFolder.getSelection()); - - tabFolder.setSelection(new TabItem[] {items[4]}); - assertEquals(new TabItem[] {items[4]}, tabFolder.getSelection()); - - tabFolder.setSelection(new TabItem[] {items[2]}); - assertEquals(new TabItem[] {items[2]}, tabFolder.getSelection()); - - tabFolder.setSelection(new TabItem[] {items[1]}); - assertEquals(new TabItem[] {items[1]}, tabFolder.getSelection()); - - // - makeCleanEnvironment(); - - for (int i = 0; i < number; i++) - items[i] = new TabItem(tabFolder, 0); - try { - tabFolder.setSelection( new TabItem[]{items[0], null}); - tabFolder.setSelection( new TabItem[]{null}); - fail("No exception thrown for selection == null"); - } - catch (IllegalArgumentException e) { - } - finally { - assertEquals(new TabItem[]{items[0]}, tabFolder.getSelection()); - } -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_TabFolder((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_computeTrimIIII"); - methodNames.addElement("test_getClientArea"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionIndex"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_TabItem"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_setSelection$Lorg_eclipse_swt_widgets_TabItem"); - methodNames.addElement("test_setSelectionI"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII(); - else if (getName().equals("test_getClientArea")) test_getClientArea(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionIndex")) test_getSelectionIndex(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_TabItem")) test_indexOfLorg_eclipse_swt_widgets_TabItem(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_setSelection$Lorg_eclipse_swt_widgets_TabItem")) test_setSelection$Lorg_eclipse_swt_widgets_TabItem(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else super.runTest(); -} - -/* custom */ -protected TabFolder tabFolder; - -private void makeCleanEnvironment() { -// this method must be private or protected so the auto-gen tool keeps it - tabFolder = new TabFolder(shell, 0); - setWidget(tabFolder); -} - -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabItem.java deleted file mode 100644 index 866824d5a4..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TabItem.java +++ /dev/null @@ -1,172 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.TabItem - * - * @see org.eclipse.swt.widgets.TabItem - */ -public class Test_org_eclipse_swt_widgets_TabItem extends Test_org_eclipse_swt_widgets_Item { - -public Test_org_eclipse_swt_widgets_TabItem(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - tabFolder = new TabFolder(shell, 0); - tabItem = new TabItem(tabFolder, 0); - setWidget(tabItem); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TabFolderI() { - try { - new TabItem(null, SWT.NULL); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TabFolderII() { - TabItem tItem = new TabItem(tabFolder, SWT.NULL, 0); - - assertTrue(":a:", tabFolder.getItems()[0] == tItem); - - tItem = new TabItem(tabFolder, SWT.NULL, 1); - assertTrue(":b:", tabFolder.getItems()[1] == tItem); - - tItem = new TabItem(tabFolder, SWT.NULL, 1); - assertTrue(":c:", tabFolder.getItems()[1] == tItem); - - try { - new TabItem(tabFolder, SWT.NULL, -1); - fail("No exception thrown"); - } - catch (IllegalArgumentException e) { - } - finally { - assertTrue(":d:", tabFolder.getItems()[1] == tItem); - } - try { - new TabItem(tabFolder, SWT.NULL, tabFolder.getItemCount() + 1); - fail("No exception thrown"); - } - catch (IllegalArgumentException e) { - } - finally { - assertTrue(":e:", tabFolder.getItems()[1] == tItem); - } - try { - new TabItem(null, SWT.NULL, 0); - fail("No exception thrown"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_getControl() { - warnUnimpl("Test test_getControl not written"); -} - -public void test_getParent() { - assertTrue(":a: ", tabItem.getParent() == tabFolder); -} - -public void test_getToolTipText() { - warnUnimpl("Test test_getToolTipText not written"); -} - -public void test_setControlLorg_eclipse_swt_widgets_Control() { - Control control = new Table(tabFolder, SWT.NULL); - - assertTrue(":a: ", tabItem.getControl() == null); - - tabItem.setControl(control); - assertTrue(":b: ", tabItem.getControl() == control); - - tabItem.setControl(null); - assertTrue(":c: ", tabItem.getControl() == null); -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setTextLjava_lang_String() { - warnUnimpl("Test test_setTextLjava_lang_String not written"); -} - -public void test_setToolTipTextLjava_lang_String() { - tabItem.setToolTipText("fred"); - assertTrue(":a: ", tabItem.getToolTipText().equals("fred")); - tabItem.setToolTipText("fredttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt"); - assertTrue(":b: ", tabItem.getToolTipText().equals("fredttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt")); - tabItem.setToolTipText(null); - assertTrue(":c: ", tabItem.getToolTipText() == null); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_TabItem((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TabFolderI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TabFolderII"); - methodNames.addElement("test_getControl"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getToolTipText"); - methodNames.addElement("test_setControlLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setToolTipTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TabFolderI")) test_ConstructorLorg_eclipse_swt_widgets_TabFolderI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TabFolderII")) test_ConstructorLorg_eclipse_swt_widgets_TabFolderII(); - else if (getName().equals("test_getControl")) test_getControl(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getToolTipText")) test_getToolTipText(); - else if (getName().equals("test_setControlLorg_eclipse_swt_widgets_Control")) test_setControlLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setToolTipTextLjava_lang_String")) test_setToolTipTextLjava_lang_String(); - else super.runTest(); -} - -/* custom */ -TabFolder tabFolder; -TabItem tabItem; - -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java deleted file mode 100644 index 423003a9e4..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Table.java +++ /dev/null @@ -1,1574 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Table - * - * @see org.eclipse.swt.widgets.Table - */ -public class Test_org_eclipse_swt_widgets_Table extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_widgets_Table(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - makeCleanEnvironment(false); // by default, use multi-select table. -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - try { - new Table(null, 0); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_deselect$I() { - int number = 15; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.select(new int[] {0, 3}); - assertEquals(2, table.getSelectionCount()); - - table.deselect(new int[] {1, 2}); - assertEquals(2, table.getSelectionCount()); - - table.deselect(new int[] {1, 3, 5}); - assertEquals(1, table.getSelectionCount()); - - table.deselect(new int[] {9, 3, 0}); - assertEquals(0, table.getSelectionCount()); - - makeCleanEnvironment(false); - - items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.selectAll(); - assertEquals(number, table.getSelectionCount()); - - try{ - table.deselect(null); - fail("No exception thrown for selection == null"); - } - catch (IllegalArgumentException e) { - } - assertEquals(number, table.getSelectionCount()); - table.selectAll(); - - table.deselect(new int[] {}); - assertEquals(number, table.getSelectionCount()); - table.selectAll(); - - table.deselect(new int[] {-1, 100, -1000}); - assertEquals(number, table.getSelectionCount()); - table.selectAll(); - - table.deselect(new int[] {2, -1, 1, 100, 2}); - assertEquals(number-2, table.getSelectionCount()); - - table.deselect(new int[] {2, -1, 1, 100, 2}); - assertEquals(number-2, table.getSelectionCount()); - - table.deselect(new int[] {2, -1, 3, 100, 2}); - assertEquals(number-3, table.getSelectionCount()); -} - -public void test_deselectAll() { - int number = 15; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - assertEquals(0, table.getSelectionCount()); - table.select(new int[] {2, 4, 5, 10}); - - assertEquals(4, table.getSelectionCount()); - - table.deselectAll(); - assertEquals(0, table.getSelectionCount()); - - table.selectAll(); - assertEquals(number, table.getSelectionCount()); - - table.deselectAll(); - assertEquals(0, table.getSelectionCount()); -} - -public void test_deselectI() { - int number = 15; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) { - items[i] = new TableItem(table, 0); - } - assertEquals(0, table.getSelectionCount()); - - table.deselect(0); - assertEquals(0, table.getSelectionCount()); - - table.select(new int[] {0, 3, 6}); - assertEquals(3, table.getSelectionCount()); - - table.deselect(0); - assertEquals(2, table.getSelectionCount()); - - table.deselect(0); - assertEquals(2, table.getSelectionCount()); - - table.deselect(5); - assertEquals(2, table.getSelectionCount()); - - table.deselect(3); - assertEquals(1, table.getSelectionCount()); - - table.deselect(100); - assertEquals(1, table.getSelectionCount()); -} - -public void test_deselectII() { - int number = 15; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.select(new int[] {0, 3, 6}); - assertEquals(3, table.getSelectionCount()); - - table.deselect(7, 10); - assertEquals(3, table.getSelectionCount()); - - table.deselect(6, 10); - assertEquals(2, table.getSelectionCount()); - - table.deselect(1, 10); - assertEquals(1, table.getSelectionCount()); - - table.deselect(0, 10); - assertEquals(0, table.getSelectionCount()); - - table.deselect(0, 100); - assertEquals(0, table.getSelectionCount()); - - makeCleanEnvironment(false); - - items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.selectAll(); - assertEquals(number, table.getSelectionCount()); - - table.deselect(-10, 2); - assertEquals(number-3, table.getSelectionCount()); - table.selectAll(); - - table.deselect(-10, 2000); - assertEquals(0, table.getSelectionCount()); - table.selectAll(); - - table.deselect(2000, -10); - assertEquals(number, table.getSelectionCount()); - table.selectAll(); - - table.deselect(0, number-1); - assertEquals(0, table.getSelectionCount()); - table.selectAll(); - - table.deselect(0, 0); - assertEquals(number-1, table.getSelectionCount()); - table.selectAll(); - - table.deselect(number-1, number-1); - assertEquals(number-1, table.getSelectionCount()); - table.selectAll(); - table.deselect(-1, -1); - assertEquals(number, table.getSelectionCount()); - table.selectAll(); - - table.deselect(number, number); - assertEquals(number, table.getSelectionCount()); - table.selectAll(); -} - -public void test_getColumnCount() { - warnUnimpl("Test test_getColumnCount not written"); -} - -public void test_getColumnI() { - warnUnimpl("Test test_getColumnI not written"); -} - -public void test_getColumns() { - warnUnimpl("Test test_getColumns not written"); -} - -public void test_getGridLineWidth() { - table.getGridLineWidth(); -} - -public void test_getHeaderHeight() { - warnUnimpl("Test test_getHeaderHeight not written"); -} - -public void test_getHeaderVisible() { - warnUnimpl("Test test_getHeaderVisible not written"); -} - -public void test_getItemCount() { - int[] cases = {0, 10, 100}; - for (int j = 0; j < cases.length; j++) { - for (int i = 0; i < cases[j]; i++) { - TableItem ti = new TableItem(table, 0); - } - assertEquals("j="+ j, cases[j], table.getItemCount()); - table.removeAll(); - } - - // note: SWT.SINGLE - makeCleanEnvironment(true); - for (int j = 0; j < cases.length; j++) { - for (int i = 0; i < cases[j]; i++) { - TableItem ti = new TableItem(table, 0); - } - assertEquals("j="+ j, cases[j], table.getItemCount()); - table.removeAll(); - } -} - -public void test_getItemHeight() { - assertTrue(":a: Item height <= 0", table.getItemHeight() > 0); - new TableItem(table, 0); - assertTrue(":b: Item height <= 0", table.getItemHeight() > 0); -} - -public void test_getItemI() { - int number = 15; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - for (int i = 0; i < number; i++) - assertEquals("i=" + i, items[i], table.getItem(i)); - try { - table.getItem(number); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } - - try { - table.getItem(number+1); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } - - // note: SWT.SINGLE - makeCleanEnvironment(true); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - for (int i = 0; i < number; i++) { - assertEquals("i=" + i, items[i], table.getItem(i)); - } - try { - table.getItem(number); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } - - try { - table.getItem(number+1); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_getItemLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_getItemLorg_eclipse_swt_graphics_Point not written"); -} - -public void test_getItems() { - int[] cases = {0, 10, 100}; - for (int j = 0; j < cases.length; j++) { - for (int i = 0; i < cases[j]; i++) { - TableItem ti = new TableItem(table, 0); - } - assertEquals("j=" + j, cases[j], table.getItems().length); - table.removeAll(); - } - - for (int j = 0; j < cases.length; j++) { - for (int i = 0; i < cases[j]; i++) { - TableItem ti = new TableItem(table, 0); - ti.setText(String.valueOf(i)); - } - TableItem[] items = table.getItems(); - for (int i = 0; i < items.length; i++) { - assertEquals("j=" + j + ", i=" + i, String.valueOf(i), items[i].getText()); - } - table.removeAll(); - } - - // note SWT.SINGLE - makeCleanEnvironment(true); - - for (int j = 0; j < cases.length; j++) { - for (int i = 0; i < cases[j]; i++) { - TableItem ti = new TableItem(table, 0); - } - assertEquals("j=" + j, cases[j], table.getItems().length); - table.removeAll(); - } - - makeCleanEnvironment(true); - - for (int j = 0; j < cases.length; j++) { - for (int i = 0; i < cases[j]; i++) { - TableItem ti = new TableItem(table, 0); - ti.setText(String.valueOf(i)); - } - TableItem[] items = table.getItems(); - for (int i = 0; i < items.length; i++) { - assertEquals("j=" + j + ", i=" + i, String.valueOf(i), items[i].getText()); - } - table.removeAll(); - } -} - -public void test_getLinesVisible() { - warnUnimpl("Test test_getLinesVisible not written"); -} - -public void test_getSelection() { - int number = 15; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - assertEquals(new TableItem[] {}, table.getSelection()); - - table.setSelection(new TableItem[]{items[2], items[number-1], items[10]}); - assertSame(new TableItem[] {items[2], items[10], items[number-1]}, table.getSelection()); - - table.setSelection(items); - assertSame(items, table.getSelection()); - - // note: SWT.SINGLE - makeCleanEnvironment(true); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - assertEquals(new TableItem[] {}, table.getSelection()); - - table.setSelection(new TableItem[]{items[10], items[number-1], items[2]}); - assertEquals(new TableItem[] {items[10]}, table.getSelection()); - - table.setSelection(items); - assertEquals(new TableItem[] {items[0]}, table.getSelection()); -} - -public void test_getSelectionCount() { - int number = 15; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - assertEquals(0, table.getSelectionCount()); - - table.setSelection(new TableItem[]{items[2], items[number-1], items[10]}); - assertEquals(3, table.getSelectionCount()); - - table.setSelection(items); - assertEquals(number, table.getSelectionCount()); - - // note: SWT.SINGLE - makeCleanEnvironment(true); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - assertEquals(0, table.getSelectionCount()); - - table.setSelection(new TableItem[]{items[2], items[number-1], items[10]}); - assertEquals(1, table.getSelectionCount()); - - table.setSelection(items); - assertEquals(1, table.getSelectionCount()); -} - -public void test_getSelectionIndex() { - int number = 15; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - assertEquals(-1, table.getSelectionIndex()); - - table.setSelection(new TableItem[]{items[2], items[number-1], items[10]}); - assertEquals(2, table.getSelectionIndex()); - - table.setSelection(items); - assertEquals(0, table.getSelectionIndex()); - - // note: SWT.SINGLE - makeCleanEnvironment(true); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - assertEquals(-1, table.getSelectionIndex()); - - table.setSelection(new TableItem[]{items[2], items[number-1], items[10]}); - assertEquals(2, table.getSelectionIndex()); - - table.setSelection(items); - assertEquals(0, table.getSelectionIndex()); -} - -public void test_getSelectionIndices() { - int number = 15; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - assertEquals(new int[]{}, table.getSelectionIndices()); - table.setSelection(new TableItem[]{items[2], items[number-1], items[10]}); - assertSame(new int[]{2, 10, number-1}, table.getSelectionIndices()); // 10 < number - - int[] all = new int[number]; - for (int i = 0; i<number; i++) - all[i]=i; - table.setSelection(items); - assertSame(all, table.getSelectionIndices()); - - // note: SWT.SINGLE - makeCleanEnvironment(true); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - assertEquals(new int[]{}, table.getSelectionIndices()); - - table.setSelection(new TableItem[]{items[2], items[number-1], items[10]}); - assertEquals(new int[]{2}, table.getSelectionIndices()); - - table.setSelection(items); - assertEquals(new int[]{0}, table.getSelectionIndices()); -} - -public void test_getTopIndex() { - warnUnimpl("Test test_getTopIndex not written"); -} - -public void test_indexOfLorg_eclipse_swt_widgets_TableColumn() { - warnUnimpl("Test test_indexOfLorg_eclipse_swt_widgets_TableColumn not written"); -} - -public void test_indexOfLorg_eclipse_swt_widgets_TableItem() { - int number = 20; - TableItem[] items = new TableItem[number]; - - for (int i = 0; i < number; i++) { - items[i] = new TableItem(table, 0); - items[i].setText(String.valueOf(i)); - } - - for (int i = 0; i < number; i++) { - assertEquals(i, table.indexOf(items[i])); - } - - for (int i = 0; i < number; i++) { - try { - table.indexOf((TableItem)null); - fail("No exception thrown for tableItem == null"); - } - catch (IllegalArgumentException e) { - } - } - - // another table - Table table_2 = new Table(shell, 0); - TableItem[] items_2 = new TableItem[number]; - for (int i = 0; i < number; i++) { - items_2[i] = new TableItem(table_2, 0); - items_2[i].setText(String.valueOf(i)); - } - - for (int i = 0; i < number; i++) { - assertEquals("i=" + i, -1, table.indexOf(items_2[i])); - } - - // note: SWT.SINGLE - makeCleanEnvironment(true); - - number = 20; - items = new TableItem[number]; - - for (int i = 0; i < number; i++) { - items[i] = new TableItem(table, 0); - items[i].setText(String.valueOf(i)); - } - - for (int i = 0; i < number; i++) { - assertEquals(i, table.indexOf(items[i])); - } - - makeCleanEnvironment(true); - - for (int i = 0; i < number; i++) { - items[i] = new TableItem(table, 0); - items[i].setText(String.valueOf(i)); - } - - for (int i = 0; i < number; i++) { - try { - table.indexOf((TableItem)null); - fail("No exception thrown for tableItem == null"); - } - catch (IllegalArgumentException e) { - } - } - - makeCleanEnvironment(true); - - for (int i = 0; i < number; i++) { - items[i] = new TableItem(table, 0); - items[i].setText(String.valueOf(i)); - } - - // another table - table_2 = new Table(shell, 0); - items_2 = new TableItem[number]; - for (int i = 0; i < number; i++) { - items_2[i] = new TableItem(table_2, 0); - items_2[i].setText(String.valueOf(i)); - } - - for (int i = 0; i < number; i++) { - assertEquals("i=" + i, -1, table.indexOf(items_2[i])); - } -} - -public void test_isSelectedI() { - int number = 15; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - for (int i = 0; i < number; i++) - assertTrue(":a:" + i, !table.isSelected(i)); - table.setSelection(new TableItem[] {items[2], items[number-1], items[10]}); - for (int i = 0; i < number; i++) { - if (i == 2 || i == number-1 || i == 10) - assertTrue(":b:" + i, table.isSelected(i)); - else - assertTrue(":b:" + i, !table.isSelected(i)); - } - - table.setSelection(items); - for (int i = 0; i < number; i++) - assertTrue(":c:" + i, table.isSelected(i)); - - // note: SWT.SINGLE - makeCleanEnvironment(true); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - for (int i = 0; i < number; i++) - assertTrue(":d:" + i, !table.isSelected(i)); - table.setSelection(new TableItem[] {items[10], items[number-1], items[2]}); - for (int i = 0; i < number; i++) { - if (i == 10) - assertTrue(":e:" + i, table.isSelected(i)); - else - assertTrue(":e:" + i, !table.isSelected(i)); - } - - table.setSelection(items); - for (int i = 0; i < number; i++){ - if (i == 0) - assertTrue(":f:" + i, table.isSelected(i)); - else - assertTrue(":f:" + i, !table.isSelected(i)); - } -} - -public void test_remove$I() { - int number = 15; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - try { - table.remove(null); - fail("No exception thrown for tableItems == null"); - } - catch (IllegalArgumentException e) { - } - - try { - table.remove(new int[] {2, 1, 0, -100, 5, 5, 2, 1, 0, 0, 0}); - fail("No exception thrown for illegal index arguments"); - } - catch (IllegalArgumentException e) { - } - - try { - table.remove(new int[] {2, 1, 0, number, 5, 5, 2, 1, 0, 0, 0}); - fail("No exception thrown for illegal index arguments"); - } - catch (IllegalArgumentException e) { - } - - table.remove(new int[] {}); - - makeCleanEnvironment(false); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - assertTrue(":a:", !items[2].isDisposed()); - table.remove(new int[] {2}); - assertTrue(":b:", items[2].isDisposed()); - assertEquals(number-1, table.getItemCount()); - - assertTrue(":c:", !items[number-1].isDisposed()); - table.remove(new int[] {number-2}); - assertTrue(":d:", items[number-1].isDisposed()); - assertEquals(number-2, table.getItemCount()); - - assertTrue(":e:", !items[3].isDisposed()); - table.remove(new int[] {2}); - assertTrue(":f:", items[3].isDisposed()); - assertEquals(number-3, table.getItemCount()); - - assertTrue(":g:", !items[0].isDisposed()); - table.remove(new int[] {0}); - assertTrue(":h:", items[0].isDisposed()); - assertEquals(number-4, table.getItemCount()); -} - -public void test_removeAll() { - int number = 15; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.removeAll(); - - makeCleanEnvironment(false); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.removeAll(); - table.removeAll(); -} - -public void test_removeI() { - warnUnimpl("Test test_removeI not written"); -} - -public void test_removeII() { - int number = 5; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - try { - table.remove(-number, number + 100); - fail("No exception thrown for illegal index range"); - } catch (IllegalArgumentException e) {} - - makeCleanEnvironment(false); - - items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - table.remove(2, 3); - assertEquals(new TableItem[]{items[0], items[1], items[4]}, table.getItems()); - - makeCleanEnvironment(false); - - items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - try { - table.remove(2, 100); - fail("No exception thrown for illegal index range"); - } catch (IllegalArgumentException e) {} - assertEquals(items, table.getItems()); - - makeCleanEnvironment(false); - - items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - try { - table.remove(2, number); - fail("No exception thrown for illegal index range"); - } catch (IllegalArgumentException e) {} - assertEquals(items, table.getItems()); - - makeCleanEnvironment(false); - - items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - table.remove(2, number-1); - assertEquals(new TableItem[] {items[0], items[1]}, table.getItems()); - - makeCleanEnvironment(false); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - table.remove(0, 3); - assertEquals(new TableItem[] {items[4]}, table.getItems()); - - makeCleanEnvironment(false); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - table.remove(0, number-1); - assertEquals(new TableItem[] {}, table.getItems()); - - makeCleanEnvironment(false); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.remove(new int[] {}); - assertEquals(number, table.getItemCount()); - - makeCleanEnvironment(false); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - try { - table.remove(-20, -10); - fail("No exception thrown for illegal index range"); - } catch (IllegalArgumentException e) {} - assertEquals(items, table.getItems()); - - makeCleanEnvironment(false); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - try { - table.remove(20, 40); - fail("No exception thrown for illegal index range"); - } catch (IllegalArgumentException e) {} - assertEquals(items, table.getItems()); - - makeCleanEnvironment(false); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - table.remove(200, 40); - assertEquals(items, table.getItems()); - - makeCleanEnvironment(false); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - table.remove(2, 2); - assertEquals(new TableItem[]{items[0], items[1], items[3], items[4]}, table.getItems()); - - makeCleanEnvironment(false); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - table.remove(0, 0); - assertEquals(new TableItem[]{items[1], items[2], items[3], items[4]}, table.getItems()); - - makeCleanEnvironment(false); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - table.remove(4, 4); - assertEquals(new TableItem[]{items[0], items[1], items[2], items[3]}, table.getItems()); - - makeCleanEnvironment(false); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - assertEquals(number, table.getItemCount()); - try { - table.remove(-10, 2); - fail("No exception thrown for illegal index range"); - } catch (IllegalArgumentException e) {} - assertEquals(number, table.getItemCount()); - if (fCheckSWTPolicy) { - table.remove(10, 2); - assertEquals(number, table.getItemCount()); - } - table.remove(0, 2); - assertEquals(number - 3, table.getItemCount()); - assertEquals(new TableItem[] {items[3], items[4]}, table.getItems()); - try { - table.remove(1, 200); - fail("No exception thrown for illegal index range"); - } catch (IllegalArgumentException e) {} - assertEquals(number - 3, table.getItemCount()); - assertEquals(new TableItem[] {items[3], items[4]}, table.getItems()); - - makeCleanEnvironment(false); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.remove(0, number-1); - assertEquals(0, table.getItemCount()); - - makeCleanEnvironment(false); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - try { - table.remove(number, number); - fail("No exception thrown for illegal index range"); - } catch (IllegalArgumentException e) {} - - makeCleanEnvironment(false); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - try { - table.remove(number, number + 100); - fail("No exception thrown for illegal index range"); - } catch (IllegalArgumentException e) {} - - makeCleanEnvironment(false); - - number = 15; - items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.remove(new int[] {2, 1, 0, 5, 5}); - assertEquals(number-4, table.getItemCount()); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_select$I() { - try { - table.select(null); - fail("No exception thrown for selection == null"); - } - catch (IllegalArgumentException e) { - } - - int number = 15; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.select(new int[] {10, 2, 14}); - assertSame(new int[] {2, 10, 14}, table.getSelectionIndices()); - - // note: SWT.SINGLE - makeCleanEnvironment(true); - - try { - table.select(null); - fail("No exception thrown for selection == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_selectAll() { - int number = 5; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - assertEquals(new int[]{}, table.getSelectionIndices()); - table.selectAll(); - assertSame(new int[]{0, 1, 2, 3, 4}, table.getSelectionIndices()); - - // test single-selection table - makeCleanEnvironment(true); - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - assertEquals(new int[]{}, table.getSelectionIndices()); - table.selectAll(); - assertEquals(new int[]{}, table.getSelectionIndices()); -} - -public void test_selectI() { - int number = 15; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.select(new int[] {10, 2, 14}); - assertSame(new int[] {2, 10, 14}, table.getSelectionIndices()); - - table.select(7); - assertSame(new int[]{2, 7, 10, 14}, table.getSelectionIndices()); - - table.select(0); - assertSame(new int[]{0, 2, 7, 10, 14}, table.getSelectionIndices()); - - // note: SWT.SINGLE - makeCleanEnvironment(true); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - table.select(new int[] {number - 1, 10, 2 }); - assertEquals(number - 1, table.getSelectionIndex()); - table.setSelection(new int[] {number - 1,10, 2}); - assertEquals(number - 1, table.getSelectionIndex()); // for SINGLE setSelection and select are the same - - table.select(7); - assertEquals(new int[] {7}, table.getSelectionIndices()); - table.setSelection(7); - assertEquals(new int[] {7}, table.getSelectionIndices()); // for SINGLE setSelection and select are the same - - table.select(0); - assertEquals(new int[] {0}, table.getSelectionIndices()); - table.setSelection(0); - assertEquals(new int[] {0}, table.getSelectionIndices()); // for SINGLE setSelection and select are the same -} - -public void test_selectII() { - int number = 15; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.select(new int[] {10, 2, 14}); - assertSame(new int[] {2, 10, 14}, table.getSelectionIndices()); - - table.select(7); - assertSame(new int[]{2, 7, 10, 14}, table.getSelectionIndices()); - - table.select(0); - assertSame(new int[]{0, 2, 7, 10, 14}, table.getSelectionIndices()); - - table.select(4, 10); - assertSame(new int[]{0, 2, 4, 5, 6, 7, 8, 9, 10, 14}, table.getSelectionIndices()); - - table.select(4, 14); - assertSame(new int[]{0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, table.getSelectionIndices()); - - table.select(0, 7); - assertSame(new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, table.getSelectionIndices()); - - table.select(9, 5); - assertSame(new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, table.getSelectionIndices()); - - makeCleanEnvironment(false); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.select(-100, 1000); - assertEquals(number, table.getSelectionCount()); - table.deselectAll(); - assertEquals(0, table.getSelectionCount()); - table.select(0, 1000); - assertEquals(number, table.getSelectionCount()); - table.deselectAll(); - - table.select(0, number-1); - assertEquals(number, table.getSelectionCount()); - table.deselectAll(); - - table.select(0, 0); - assertEquals(1, table.getSelectionCount()); - table.deselectAll(); - - table.select(number-1, number); - assertEquals(1, table.getSelectionCount()); - table.deselectAll(); - - table.select(number, number); - assertEquals(0, table.getSelectionCount()); - table.deselectAll(); - - // note: SWT.SINGLE - makeCleanEnvironment(true); - - table.setSelection(0); - - if (fCheckSWTPolicy) { - table.select(4, 10); - assertEquals(new int[] {4}, table.getSelectionIndices()); - table.setSelection(4, 10); - assertEquals(new int[] {4}, table.getSelectionIndices()); //for SINGLE setSelection and select are the same - - table.select(5, number - 1); - assertEquals(new int[] {5}, table.getSelectionIndices()); - table.setSelection(5, number - 1); - assertEquals(new int[] {5}, table.getSelectionIndices()); //for SINGLE setSelection and select are the same - - table.select(0, 7); - assertEquals(new int[] {0}, table.getSelectionIndices()); - table.setSelection(0, 7); - assertEquals(new int[] {0}, table.getSelectionIndices()); //for SINGLE setSelection and select are the same - - table.select(9, 5); - assertEquals(new int[] {7}, table.getSelectionIndices()); - table.setSelection(9, 5); - assertEquals(new int[] {}, table.getSelectionIndices()); //for SINGLE setSelection and select are the same - } // ?? in this case maybe the sel. should be cleared - - makeCleanEnvironment(true); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - if (fCheckSWTPolicy) { - table.select(-100, 1000); - assertEquals(1, table.getSelectionCount()); - assertEquals(new int[] {number - 1}, table.getSelectionIndices()); - } - table.deselectAll(); - assertEquals(0, table.getSelectionCount()); - table.select(0, 1000); - assertEquals(1, table.getSelectionCount()); - if (fCheckSWTPolicy) - assertEquals(new int[] {number - 1}, table.getSelectionIndices()); - table.deselectAll(); - table.select(0, number - 1); - assertEquals(1, table.getSelectionCount()); - if (fCheckSWTPolicy) - assertEquals(new int[] {number - 1}, table.getSelectionIndices()); - table.deselectAll(); - table.select(0, 0); - assertEquals(1, table.getSelectionCount()); - assertEquals(new int[] {0}, table.getSelectionIndices()); - table.deselectAll(); - table.select(number - 1, number); - assertEquals(1, table.getSelectionCount()); - assertEquals(new int[] {number - 1}, table.getSelectionIndices()); - table.deselectAll(); - table.select(number, number); - assertEquals(0, table.getSelectionCount()); - assertEquals(new int[] {}, table.getSelectionIndices()); - table.deselectAll(); - - makeCleanEnvironment(true); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - table.select(-100, 1000); - if (fCheckSWTPolicy) { - assertEquals(1, table.getSelectionCount()); - assertEquals(new int[] {number - 1}, table.getSelectionIndices()); - } - table.deselectAll(); - assertEquals(0, table.getSelectionCount()); - table.select(1000, 0); - assertEquals(0, table.getSelectionCount()); - assertEquals(new int[] {}, table.getSelectionIndices()); - table.deselectAll(); - table.select(number - 1, 0); - if (fCheckSWTPolicy) - assertEquals(0, table.getSelectionCount()); - table.deselectAll(); - table.select(0, 0); - assertEquals(1, table.getSelectionCount()); - assertEquals(new int[] {0}, table.getSelectionIndices()); - table.deselectAll(); - table.select(-1, -1); - if (fCheckSWTPolicy) { - assertEquals(0, table.getSelectionCount()); - assertEquals(new int[] {}, table.getSelectionIndices()); - } - table.deselectAll(); - table.select(number, number); - if (fCheckSWTPolicy) { - assertEquals(0, table.getSelectionCount()); - assertEquals(new int[] {}, table.getSelectionIndices()); - } - table.deselectAll(); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - warnUnimpl("Test test_setFontLorg_eclipse_swt_graphics_Font not written"); -} - -public void test_setHeaderVisibleZ() { - table.setHeaderVisible(true); - assertTrue(table.getHeaderVisible()); - - table.setHeaderVisible(false); - assertTrue(!table.getHeaderVisible()); -} - -public void test_setLinesVisibleZ() { - table.setLinesVisible(true); - assertTrue(table.getLinesVisible()); - - table.setLinesVisible(false); - assertTrue(!table.getLinesVisible()); -} - -public void test_setRedrawZ() { - warnUnimpl("Test test_setRedrawZ not written"); -} - -public void test_setSelection$I() { - int number = 5; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - try { - table.setSelection((int[]) null); - fail("No exception thrown for selection == null"); - } - catch (IllegalArgumentException e) { - } - - table.setSelection(new int[]{}); - assertEquals(new int[]{}, table.getSelectionIndices()); - - table.setSelection(new int[]{0, 3, 2}); - assertSame(new int[]{0, 2, 3}, table.getSelectionIndices()); - - table.setSelection(new int[]{3, 2, 1}); - assertSame(new int[]{1, 2, 3}, table.getSelectionIndices()); - - table.setSelection(new int[]{1, 4, 0}); - assertSame(new int[]{0, 1, 4}, table.getSelectionIndices()); - table.setSelection(new int[]{0, 4, 0}); - assertSame(new int[]{0, 4}, table.getSelectionIndices()); - - table.setSelection(new int[]{2, 3, 4}); - assertSame(new int[]{2, 3, 4}, table.getSelectionIndices()); - - table.setSelection(new int[]{4, 4, 4, 4, 4, 4, 4}); - assertEquals(new int[]{4}, table.getSelectionIndices()); - - table.setSelection(new int[]{4}); - assertEquals(new int[]{4}, table.getSelectionIndices()); - - // test single-selection table - makeCleanEnvironment(true); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - try { - table.setSelection((int[]) null); - fail("No exception thrown for selection range == null"); - } - catch (IllegalArgumentException e) { - } - - makeCleanEnvironment(true); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - table.setSelection(new int[] {}); - assertEquals(new int[] {}, table.getSelectionIndices()); - table.setSelection(new int[] {0, 3, 2}); - if (fCheckSWTPolicy) - assertEquals(new int[] {2}, table.getSelectionIndices()); - table.setSelection(new int[] {3, 2, 1}); - if (fCheckSWTPolicy) - assertEquals(new int[] {1}, table.getSelectionIndices()); - table.setSelection(new int[] {1, 4, 0}); - if (fCheckSWTPolicy) - assertEquals(new int[] {0}, table.getSelectionIndices()); - table.setSelection(new int[] {0, 4, 1}); - if (fCheckSWTPolicy) - assertEquals(new int[] {0}, table.getSelectionIndices()); - table.setSelection(new int[] {2, 3, 4}); - if (fCheckSWTPolicy) - assertEquals(new int[] {4}, table.getSelectionIndices()); - table.setSelection(new int[] {4, 4, 4, 4, 4, 4, 4}); - assertEquals(new int[] {4}, table.getSelectionIndices()); - table.setSelection(new int[] {4}); - assertEquals(new int[] {4}, table.getSelectionIndices()); - - makeCleanEnvironment(true); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - try { - table.setSelection((TableItem[]) null); - fail("No exception thrown for selection range == null"); - } - catch (IllegalArgumentException e) { - } - finally { - assertEquals(0, table.getSelectionCount()); - } -} - -public void test_setSelection$Lorg_eclipse_swt_widgets_TableItem() { - int number = 5; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - try { - table.setSelection((TableItem[]) null); - fail("No exception thrown for selection range == null"); - } - catch (IllegalArgumentException e) { - } - finally { - assertEquals(0, table.getSelectionCount()); - } - - table.setSelection(new TableItem[]{}); - assertEquals(0, table.getSelectionCount()); - - table.setSelection(new TableItem[]{items[0], items[3], items[2]}); - assertSame(new TableItem[]{items[0], items[2], items[3]}, table.getSelection()); - table.setSelection(new TableItem[]{items[3], items[2], items[1]}); - assertSame(new TableItem[]{items[1], items[2], items[3]}, table.getSelection()); - - table.setSelection(new TableItem[]{items[1], items[4], items[0]}); - assertSame(new TableItem[]{items[0], items[1], items[4]}, table.getSelection()); - table.setSelection(new TableItem[]{items[0], items[4], items[0]}); - assertSame(new TableItem[]{items[0], items[4]}, table.getSelection()); - - table.setSelection(new TableItem[]{items[2], items[3], items[4]}); - assertSame(new TableItem[]{items[2], items[3], items[4]}, table.getSelection()); - - table.setSelection(new TableItem[]{items[4], items[4], items[4], items[4], items[4], items[4]}); - assertEquals(new TableItem[]{items[4]}, table.getSelection()); - table.setSelection(new TableItem[]{items[4]}); - assertEquals(new TableItem[]{items[4]}, table.getSelection()); - - makeCleanEnvironment(false); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.setSelection(new TableItem[] {items[0]}); - assertEquals(new TableItem[] {items[0]}, table.getSelection()); - - table.setSelection(new TableItem[] {items[3]}); - assertEquals(new TableItem[] {items[3]}, table.getSelection()); - - table.setSelection(new TableItem[] {items[4]}); - assertEquals(new TableItem[] {items[4]}, table.getSelection()); - table.setSelection(new TableItem[] {items[2]}); - assertEquals(new TableItem[] {items[2]}, table.getSelection()); - table.setSelection(new TableItem[] {items[1]}); - assertEquals(new TableItem[] {items[1]}, table.getSelection()); - - // test single-selection table - makeCleanEnvironment(true); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.setSelection(new TableItem[]{}); - assertEquals(0, table.getSelectionCount()); - - table.setSelection(new TableItem[]{items[0], items[3], items[2]}); - assertEquals(new TableItem[]{items[0]}, table.getSelection()); - - table.setSelection(new TableItem[]{items[3], items[2], items[1]}); - assertEquals(new TableItem[]{items[3]}, table.getSelection()); - - table.setSelection(new TableItem[]{items[1], items[4], items[0]}); - assertEquals(new TableItem[]{items[1]}, table.getSelection()); - - table.setSelection(new TableItem[]{items[0], items[4], items[0]}); - assertEquals(new TableItem[]{items[0]}, table.getSelection()); - - table.setSelection(new TableItem[]{items[2], items[3], items[4]}); - assertEquals(new TableItem[]{items[2]}, table.getSelection()); - - table.setSelection(new TableItem[]{items[4], items[4], items[4], items[4], items[4], items[4]}); - assertEquals(new TableItem[]{items[4]}, table.getSelection()); - - table.setSelection(new TableItem[]{items[4]}); - assertEquals(new TableItem[]{items[4]}, table.getSelection()); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.setSelection(new TableItem[] {items[0]}); - assertEquals(new TableItem[] {items[0]}, table.getSelection()); - - table.setSelection(new TableItem[] {items[3]}); - assertEquals(new TableItem[] {items[3]}, table.getSelection()); - - table.setSelection(new TableItem[] {items[4]}); - assertEquals(new TableItem[] {items[4]}, table.getSelection()); - - table.setSelection(new TableItem[] {items[2]}); - assertEquals(new TableItem[] {items[2]}, table.getSelection()); - - table.setSelection(new TableItem[] {items[1]}); - assertEquals(new TableItem[] {items[1]}, table.getSelection()); -} - -public void test_setSelectionI() { - int number = 5; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.setSelection(0); - assertEquals(new int[]{0}, table.getSelectionIndices()); - table.setSelection(3); - assertEquals(new int[]{3}, table.getSelectionIndices()); - table.setSelection(4); - assertEquals(new int[]{4}, table.getSelectionIndices()); - - table.setSelection(2); - assertEquals(new int[]{2}, table.getSelectionIndices()); - - table.setSelection(1); - assertEquals(new int[]{1}, table.getSelectionIndices()); - - // test single-selection table - makeCleanEnvironment(true); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.setSelection(0); - assertEquals(new int[]{0}, table.getSelectionIndices()); - - table.setSelection(3); - assertEquals(new int[]{3}, table.getSelectionIndices()); - - table.setSelection(4); - assertEquals(new int[]{4}, table.getSelectionIndices()); - - table.setSelection(2); - assertEquals(new int[]{2}, table.getSelectionIndices()); - - table.setSelection(1); - assertEquals(new int[]{1}, table.getSelectionIndices()); - -} - -public void test_setSelectionII() { - int number = 5; - TableItem[] items = new TableItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - - table.setSelection(0, 1); - assertSame(new int[]{0, 1}, table.getSelectionIndices()); - - table.setSelection(2, 4); - assertSame(new int[]{2, 3, 4}, table.getSelectionIndices()); - - table.setSelection(3, 4); - assertSame(new int[]{3, 4}, table.getSelectionIndices()); - - table.setSelection(5, 4); - assertEquals(new int[]{}, table.getSelectionIndices()); - - table.setSelection(2, 2); - assertEquals(new int[]{2}, table.getSelectionIndices()); - - table.setSelection(1, 4); - assertSame(new int[]{1, 2, 3, 4}, table.getSelectionIndices()); - - table.setSelection(0, 4); - assertSame(new int[]{0, 1, 2, 3, 4}, table.getSelectionIndices()); - - // test single-selection table - makeCleanEnvironment(true); - - for (int i = 0; i < number; i++) - items[i] = new TableItem(table, 0); - table.setSelection(0, 1); - if (fCheckSWTPolicy) - assertEquals(new int[] {1}, table.getSelectionIndices()); - table.setSelection(2, 4); - if (fCheckSWTPolicy) - assertEquals(new int[] {4}, table.getSelectionIndices()); - table.setSelection(5, 4); - if (fCheckSWTPolicy) - assertEquals(new int[] {}, table.getSelectionIndices()); - table.setSelection(2, 2); - assertEquals(new int[] {2}, table.getSelectionIndices()); - table.setSelection(1, 4); - if (fCheckSWTPolicy) - assertEquals(new int[] {4}, table.getSelectionIndices()); - table.setSelection(0, 4); - if (fCheckSWTPolicy) - assertEquals(new int[] {4}, table.getSelectionIndices()); -} - -public void test_setTopIndexI() { - warnUnimpl("Test test_setTopIndexI not written"); -} - -public void test_showItemLorg_eclipse_swt_widgets_TableItem() { - warnUnimpl("Test test_showItemLorg_eclipse_swt_widgets_TableItem not written"); -} - -public void test_showSelection() { - table.showSelection(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Table((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_deselect$I"); - methodNames.addElement("test_deselectAll"); - methodNames.addElement("test_deselectI"); - methodNames.addElement("test_deselectII"); - methodNames.addElement("test_getColumnCount"); - methodNames.addElement("test_getColumnI"); - methodNames.addElement("test_getColumns"); - methodNames.addElement("test_getGridLineWidth"); - methodNames.addElement("test_getHeaderHeight"); - methodNames.addElement("test_getHeaderVisible"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItemHeight"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItemLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getLinesVisible"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionCount"); - methodNames.addElement("test_getSelectionIndex"); - methodNames.addElement("test_getSelectionIndices"); - methodNames.addElement("test_getTopIndex"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_TableColumn"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_TableItem"); - methodNames.addElement("test_isSelectedI"); - methodNames.addElement("test_remove$I"); - methodNames.addElement("test_removeAll"); - methodNames.addElement("test_removeI"); - methodNames.addElement("test_removeII"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_select$I"); - methodNames.addElement("test_selectAll"); - methodNames.addElement("test_selectI"); - methodNames.addElement("test_selectII"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setHeaderVisibleZ"); - methodNames.addElement("test_setLinesVisibleZ"); - methodNames.addElement("test_setRedrawZ"); - methodNames.addElement("test_setSelection$I"); - methodNames.addElement("test_setSelection$Lorg_eclipse_swt_widgets_TableItem"); - methodNames.addElement("test_setSelectionI"); - methodNames.addElement("test_setSelectionII"); - methodNames.addElement("test_setTopIndexI"); - methodNames.addElement("test_showItemLorg_eclipse_swt_widgets_TableItem"); - methodNames.addElement("test_showSelection"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_deselect$I")) test_deselect$I(); - else if (getName().equals("test_deselectAll")) test_deselectAll(); - else if (getName().equals("test_deselectI")) test_deselectI(); - else if (getName().equals("test_deselectII")) test_deselectII(); - else if (getName().equals("test_getColumnCount")) test_getColumnCount(); - else if (getName().equals("test_getColumnI")) test_getColumnI(); - else if (getName().equals("test_getColumns")) test_getColumns(); - else if (getName().equals("test_getGridLineWidth")) test_getGridLineWidth(); - else if (getName().equals("test_getHeaderHeight")) test_getHeaderHeight(); - else if (getName().equals("test_getHeaderVisible")) test_getHeaderVisible(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItemHeight")) test_getItemHeight(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItemLorg_eclipse_swt_graphics_Point")) test_getItemLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getLinesVisible")) test_getLinesVisible(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionCount")) test_getSelectionCount(); - else if (getName().equals("test_getSelectionIndex")) test_getSelectionIndex(); - else if (getName().equals("test_getSelectionIndices")) test_getSelectionIndices(); - else if (getName().equals("test_getTopIndex")) test_getTopIndex(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_TableColumn")) test_indexOfLorg_eclipse_swt_widgets_TableColumn(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_TableItem")) test_indexOfLorg_eclipse_swt_widgets_TableItem(); - else if (getName().equals("test_isSelectedI")) test_isSelectedI(); - else if (getName().equals("test_remove$I")) test_remove$I(); - else if (getName().equals("test_removeAll")) test_removeAll(); - else if (getName().equals("test_removeI")) test_removeI(); - else if (getName().equals("test_removeII")) test_removeII(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_select$I")) test_select$I(); - else if (getName().equals("test_selectAll")) test_selectAll(); - else if (getName().equals("test_selectI")) test_selectI(); - else if (getName().equals("test_selectII")) test_selectII(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setHeaderVisibleZ")) test_setHeaderVisibleZ(); - else if (getName().equals("test_setLinesVisibleZ")) test_setLinesVisibleZ(); - else if (getName().equals("test_setRedrawZ")) test_setRedrawZ(); - else if (getName().equals("test_setSelection$I")) test_setSelection$I(); - else if (getName().equals("test_setSelection$Lorg_eclipse_swt_widgets_TableItem")) test_setSelection$Lorg_eclipse_swt_widgets_TableItem(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else if (getName().equals("test_setSelectionII")) test_setSelectionII(); - else if (getName().equals("test_setTopIndexI")) test_setTopIndexI(); - else if (getName().equals("test_showItemLorg_eclipse_swt_widgets_TableItem")) test_showItemLorg_eclipse_swt_widgets_TableItem(); - else if (getName().equals("test_showSelection")) test_showSelection(); - else super.runTest(); -} - -/* custom */ -protected Table table; - -private void makeCleanEnvironment(boolean singleMode) { -// this method must be private or protected so the auto-gen tool keeps it - if ( singleMode == false ) - table = new Table(shell, SWT.MULTI); - else - table = new Table(shell, SWT.SINGLE); - setWidget(table); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableColumn.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableColumn.java deleted file mode 100644 index a1d0442dc0..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableColumn.java +++ /dev/null @@ -1,261 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.TableColumn - * - * @see org.eclipse.swt.widgets.TableColumn - */ -public class Test_org_eclipse_swt_widgets_TableColumn extends Test_org_eclipse_swt_widgets_Item { - -public Test_org_eclipse_swt_widgets_TableColumn(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - table = new Table(shell, SWT.SINGLE); - tableColumn = new TableColumn(table, SWT.NULL); - setWidget(tableColumn); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TableI() { - try { - new TableColumn(null, SWT.NULL); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TableII() { - try { - new TableColumn(null, SWT.NULL, 0); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } - - try { - new TableColumn(table, SWT.NULL, -1); - fail("No exception thrown for index == -1"); - } - catch (IllegalArgumentException e) { - } - - try { - new TableColumn(table, SWT.NULL, 2); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_addControlListenerLorg_eclipse_swt_events_ControlListener() { - warnUnimpl("Test test_addControlListenerLorg_eclipse_swt_events_ControlListener not written"); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - try { - tableColumn.addSelectionListener(null); - fail("No exception thrown for selectionListener == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_getAlignment() { - warnUnimpl("Test test_getAlignment not written"); -} - -public void test_getParent() { - warnUnimpl("Test test_getParent not written"); -} - -public void test_getResizable() { - warnUnimpl("Test test_getResizable not written"); -} - -public void test_getWidth() { - int testWidth = 42; - -// try { -// tableColumn.setWidth(-1); -// assertTrue("No exception thrown", false); -// } -// catch (IllegalArgumentException e) { -// assertTrue("Wrong error thrown: " + e, e.getMessage().equals("Argument not valid")); -// } -// catch (SWTException e) { -// assertTrue("Wrong error thrown: " + e, e.getMessage().equals("Argument not valid")); -// } - - tableColumn.setWidth(0); - assertTrue(":a: width=" + tableColumn.getWidth() + " should be=" + 0, tableColumn.getWidth() == 0); - - tableColumn.setWidth(testWidth); - assertTrue(":b: width=" + tableColumn.getWidth() + " should be=" + testWidth, tableColumn.getWidth() == testWidth); - - tableColumn.setWidth(testWidth); - assertTrue(":c: width=" + tableColumn.getWidth() + " should be=" + testWidth, tableColumn.getWidth() == testWidth); -} - -public void test_pack() { - warnUnimpl("Test test_pack not written"); -} - -public void test_removeControlListenerLorg_eclipse_swt_events_ControlListener() { - warnUnimpl("Test test_removeControlListenerLorg_eclipse_swt_events_ControlListener not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - SelectionListener listener = new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) {}}; - - tableColumn.removeSelectionListener(listener); - tableColumn.addSelectionListener(listener); - tableColumn.removeSelectionListener(listener); - try { - tableColumn.removeSelectionListener(null); - fail("No exception thrown for selectionListener == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_setAlignmentI() { - TableColumn column2; - - assertTrue(":a:", tableColumn.getAlignment() == SWT.LEFT); - - tableColumn.setAlignment(-1); - assertTrue(":b:", tableColumn.getAlignment() == SWT.LEFT); - - tableColumn.setAlignment(SWT.RIGHT); - assertTrue( - ":c: Should not be allowed to set alignment of the first column", - tableColumn.getAlignment() == SWT.LEFT); - - column2 = new TableColumn(table, SWT.NULL); - column2.setAlignment(SWT.RIGHT); - assertTrue(":d:", column2.getAlignment() == SWT.RIGHT); - - column2.setAlignment(SWT.CENTER); - assertTrue(":e:", column2.getAlignment() == SWT.CENTER); - - column2.setAlignment(SWT.LEFT); - assertTrue(":f:", column2.getAlignment() == SWT.LEFT); -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setResizableZ() { - assertTrue(":a:", tableColumn.getResizable() == true); - - tableColumn.setResizable(false); - assertTrue(":b:", tableColumn.getResizable() == false); - - tableColumn.setResizable(false); - assertTrue(":c:", tableColumn.getResizable() == false); - - tableColumn.setResizable(true); - assertTrue(":d:", tableColumn.getResizable() == true); -} - -public void test_setTextLjava_lang_String() { - assertTrue(":a:", tableColumn.getText() == ""); - - tableColumn.setText("text"); - assertTrue(":b:", tableColumn.getText() == "text"); - - try { - tableColumn.setText(null); - fail("No exception thrown for column header == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_setWidthI() { - warnUnimpl("Test test_setWidthI not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_TableColumn((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TableI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TableII"); - methodNames.addElement("test_addControlListenerLorg_eclipse_swt_events_ControlListener"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_getAlignment"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getResizable"); - methodNames.addElement("test_getWidth"); - methodNames.addElement("test_pack"); - methodNames.addElement("test_removeControlListenerLorg_eclipse_swt_events_ControlListener"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_setAlignmentI"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setResizableZ"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setWidthI"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TableI")) test_ConstructorLorg_eclipse_swt_widgets_TableI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TableII")) test_ConstructorLorg_eclipse_swt_widgets_TableII(); - else if (getName().equals("test_addControlListenerLorg_eclipse_swt_events_ControlListener")) test_addControlListenerLorg_eclipse_swt_events_ControlListener(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_getAlignment")) test_getAlignment(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getResizable")) test_getResizable(); - else if (getName().equals("test_getWidth")) test_getWidth(); - else if (getName().equals("test_pack")) test_pack(); - else if (getName().equals("test_removeControlListenerLorg_eclipse_swt_events_ControlListener")) test_removeControlListenerLorg_eclipse_swt_events_ControlListener(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_setAlignmentI")) test_setAlignmentI(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setResizableZ")) test_setResizableZ(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setWidthI")) test_setWidthI(); - else super.runTest(); -} - -/* custom */ -protected TableColumn tableColumn; -protected Table table; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java deleted file mode 100644 index 364da12912..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java +++ /dev/null @@ -1,537 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.TableItem - * - * @see org.eclipse.swt.widgets.TableItem - */ -public class Test_org_eclipse_swt_widgets_TableItem extends Test_org_eclipse_swt_widgets_Item { - -public Test_org_eclipse_swt_widgets_TableItem(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - makeCleanEnvironment(); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TableI() { - try { - new TableItem(null, SWT.NULL); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TableII() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_TableII not written"); -} - -public void test_getBackground() { - // tested in test_setBackgroundLorg_eclipse_swt_graphics_Color -} - -public void test_getBackgroundI() { - warnUnimpl("Test test_getBackgroundI not written"); -} - -public void test_getBoundsI() { - int boundsX; - Rectangle bounds; - Table table2 = new Table(shell, SWT.CHECK); - TableItem tableItem2 = new TableItem(table2, SWT.NULL); - bounds = tableItem.getBounds(0); - assertTrue(":a:", bounds.x > 0 && bounds.width > 0); - boundsX = bounds.x; - bounds = tableItem.getBounds(-1); - assertTrue(":b:", bounds.equals(new Rectangle(0, 0, 0, 0))); - bounds = tableItem.getBounds(1); - assertTrue(":c:", bounds.equals(new Rectangle(0, 0, 0, 0))); - //table2.setWidths(new int[] {30}); - TableColumn column = new TableColumn(table2, SWT.NONE, 0); - column.setWidth(30); - bounds = tableItem2.getBounds(0); - assertTrue(":d:", bounds.x > boundsX && bounds.width > 0); - bounds = tableItem2.getBounds(-1); - assertEquals(new Rectangle(0, 0, 0, 0), bounds); - bounds = tableItem2.getBounds(1); - assertEquals(new Rectangle(0, 0, 0, 0), bounds); - - - // - makeCleanEnvironment(); - - Image image = images[0]; - table2.dispose(); - table2 = new Table(shell, SWT.CHECK); - tableItem2.dispose(); - tableItem2 = new TableItem(table2, SWT.NULL); - column.dispose(); - - new TableColumn(table, SWT.NULL); - new TableColumn(table, SWT.NULL); - tableItem.setImage(1, image); - bounds = tableItem.getBounds(0); - assertTrue(":a:", bounds.x >= 0 && bounds.width >= 0); - boundsX = bounds.x; - bounds = tableItem.getBounds(-1); - assertEquals(new Rectangle(0, 0, 0, 0), bounds); - bounds = tableItem.getBounds(1); - //assert(":c:", bounds.x > 0 && bounds.width > 0); // ?? setting the image in one column does not affect width of other columns - assertTrue(":c:", bounds.x >= 0 && bounds.height >= 0); - - column = new TableColumn(table2, SWT.NULL); - column.setWidth(30); - new TableColumn(table2, SWT.NULL); - tableItem2.setImage(1, image); - bounds = tableItem2.getBounds(0); - assertTrue(":d:", bounds.x > boundsX && bounds.width > 0); - bounds = tableItem2.getBounds(-1); - assertEquals(new Rectangle(0, 0, 0, 0), bounds); - bounds = tableItem2.getBounds(1); - //assert(":f:", bounds.x > 0 && bounds.width > 0); // ?? setting the image in one column does not affect width of other columns - assertTrue(":f:", bounds.x > 0 && bounds.height > 0); -} - -public void test_getChecked() { - warnUnimpl("Test test_getChecked not written"); -} - -public void test_getForeground() { - // tested in test_setForegroundLorg_eclipse_swt_graphics_Color -} - -public void test_getForegroundI() { - warnUnimpl("Test test_getForegroundI not written"); -} - -public void test_getGrayed() { - warnUnimpl("Test test_getGrayed not written"); -} - -public void test_getImageBoundsI() { -/** - * Test without item image - */ - Rectangle bounds; - Table table2 = new Table(shell, SWT.CHECK); - TableItem tableItem2 = new TableItem(table2, SWT.NULL); - int imageX; - - assertEquals(new Rectangle(0, 0, 0, 0), tableItem.getImageBounds(-1)); - - bounds = tableItem.getImageBounds(0); - assertTrue(":b:", bounds.x > 0 && bounds.width == 0); - imageX = bounds.x; - - assertEquals(new Rectangle(0, 0, 0, 0), tableItem.getImageBounds(1)); - - assertEquals(new Rectangle(0, 0, 0, 0), tableItem2.getImageBounds(-1)); - - bounds = tableItem2.getImageBounds(0); - assertTrue(":e:", bounds.x > imageX && bounds.width == 0); - - assertEquals(new Rectangle(0, 0, 0, 0), tableItem2.getImageBounds(1)); - // - makeCleanEnvironment(); - - Image image = images[0]; - int imageWidth = image.getBounds().width; - int imageHeight; - - tableItem.setImage(0, image); - imageHeight = table.getItemHeight() - table.getGridLineWidth(); - assertEquals(new Rectangle(0, 0, 0, 0), tableItem.getImageBounds(-1)); - - bounds = tableItem.getImageBounds(0); -// assertTrue(":b:", bounds.x > 0 && bounds.width == imageWidth && bounds.height == imageHeight); -// assertEquals(new Rectangle(0, 0, 0, 0), tableItem.getImageBounds(1)); - - - // - makeCleanEnvironment(); - - table2.dispose(); - table2 = new Table(shell, SWT.CHECK); - tableItem2.dispose(); - tableItem2 = new TableItem(table2, SWT.NULL); - Rectangle imageBounds = image.getBounds(); - imageWidth = imageBounds.width; tableItem2.setImage(0, image); - imageHeight = table2.getItemHeight() - table2.getGridLineWidth(); - assertEquals(new Rectangle(0, 0, 0, 0), tableItem2.getImageBounds(-1)); - - bounds = tableItem2.getImageBounds(0); // bounds.width should be check box width if they are wider than image -// assertTrue(":b:", bounds.x > 0 && bounds.width > 0 && bounds.height == imageHeight); -// assertEquals(new Rectangle(0, 0, 0, 0), tableItem2.getImageBounds(1)); - - - // - makeCleanEnvironment(); - - table2.dispose(); - table2 = new Table(shell, SWT.CHECK); - tableItem2.dispose(); - tableItem2 = new TableItem(table2, SWT.NULL); - image = images[1]; - imageBounds = image.getBounds(); - imageWidth = imageBounds.width; - tableItem2.setImage(0, image); - imageHeight = table2.getItemHeight() - table2.getGridLineWidth(); - assertEquals(new Rectangle(0, 0, 0, 0), tableItem2.getImageBounds(-1)); - bounds = tableItem2.getImageBounds(0); // bounds.width should be check box width if check box is wider than image -// assertTrue(":b:", bounds.x > 0 && bounds.width > 0 && bounds.height == imageHeight); - assertEquals(new Rectangle(0, 0, 0, 0), tableItem2.getImageBounds(1)); -} - -public void test_getImageI() { - warnUnimpl("Test test_getImageI not written"); -} - -public void test_getImageIndent() { - warnUnimpl("Test test_getImageIndent not written"); -} - -public void test_getParent() { - assertEquals(table, tableItem.getParent()); -} - -public void test_getTextI() { - warnUnimpl("Test test_getTextI not written"); -} - -public void test_setBackgroundILorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setBackgroundILorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(tableItem.getDisplay(), 255, 0, 0); - tableItem.setBackground(color); - assertEquals(color, tableItem.getBackground()); - tableItem.setBackground(null); - assertEquals(table.getBackground(),tableItem.getBackground()); - color.dispose(); - try { - tableItem.setBackground(color); - fail("No exception thrown for color disposed"); - } catch (IllegalArgumentException e) { - } -} - -public void test_setCheckedZ() { - assertEquals(false, tableItem.getChecked()); - - tableItem.setChecked(true); - assertEquals(false, tableItem.getChecked()); - Table t = new Table(shell, SWT.CHECK); - TableItem ti = new TableItem(t, SWT.NULL); - ti.setChecked(true); - assertTrue(ti.getChecked()); - - ti.setChecked(false); - assertEquals(false, ti.getChecked()); - t.dispose(); -} - -public void test_setForegroundILorg_eclipse_swt_graphics_Color() { - warnUnimpl("Test test_setForegroundILorg_eclipse_swt_graphics_Color not written"); -} - -public void test_setForegroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(tableItem.getDisplay(), 255, 0, 0); - tableItem.setForeground(color); - assertEquals(color, tableItem.getForeground()); - tableItem.setForeground(null); - assertEquals(table.getForeground(),tableItem.getForeground()); - color.dispose(); - try { - tableItem.setForeground(color); - fail("No exception thrown for color disposed"); - } catch (IllegalArgumentException e) { - } -} - -public void test_setGrayedZ() { - warnUnimpl("Test test_setGrayedZ not written"); -} - -public void test_setImage$Lorg_eclipse_swt_graphics_Image() { - assertNull(tableItem.getImage(1)); - tableItem.setImage(-1, null); - assertNull(tableItem.getImage(-1)); - - tableItem.setImage(0, images[0]); - assertEquals(images[0], tableItem.getImage(0)); - String texts[] = new String[images.length]; - for (int i = 0; i < texts.length; i++) { - texts[i] = String.valueOf(i); - } - - //table.setText(texts); // create enough columns for TableItem.setImage(Image[]) to work - int columnCount = table.getColumnCount(); - if (columnCount < texts.length) { - for (int i = columnCount; i < texts.length; i++){ - TableColumn column = new TableColumn(table, SWT.NONE); - } - } - TableColumn[] columns = table.getColumns(); - for (int i = 0; i < texts.length; i++) { - columns[i].setText(texts[i]); - } - tableItem.setImage(1, images[1]); - assertEquals(images[1], tableItem.getImage(1)); - tableItem.setImage(images); - for (int i = 0; i < images.length; i++) { - assertEquals(images[i], tableItem.getImage(i)); - } - try { - tableItem.setImage((Image []) null); - fail("No exception thrown for images == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_setImageILorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageILorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setImageIndentI() { - assertEquals(0, tableItem.getImageIndent()); - tableItem.setImageIndent(1); - assertEquals(1, tableItem.getImageIndent()); - tableItem.setImageIndent(-1); - assertEquals(1, tableItem.getImageIndent()); -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setText$Ljava_lang_String() { - final String TestString = "test"; - final String TestStrings[] = new String[] {TestString, TestString + "1", TestString + "2"}; - - try { - tableItem.setText((String []) null); - fail("No exception thrown for strings == null"); - } - catch (IllegalArgumentException e) { - } - - /* - * Test the getText/setText API with a Table that has only - * the default column. - */ - - assertEquals(0, tableItem.getText(1).length()); - - tableItem.setText(TestStrings); - assertEquals(TestStrings[0], tableItem.getText(0)); - for (int i = 1; i < TestStrings.length; i++) { - assertEquals(0, tableItem.getText(i).length()); - } - - - /* - * Test the getText/setText API with a Table that enough - * columns to fit all test item texts. - */ - - int columnCount = table.getColumnCount(); - if (columnCount < images.length) { - for (int i = columnCount; i < images.length; i++){ - TableColumn column = new TableColumn(table, SWT.NONE); - } - } - TableColumn[] columns = table.getColumns(); - for (int i = 0; i < TestStrings.length; i++) { - columns[i].setText(TestStrings[i]); - } - assertEquals(0, tableItem.getText(1).length()); - -} - -public void test_setTextILjava_lang_String(){ - final String TestString = "test"; - final String TestStrings[] = new String[] {TestString, TestString + "1", TestString + "2"}; - - /* - * Test the getText/setText API with a Table that has only - * the default column. - */ - - assertEquals(0, tableItem.getText(1).length()); - tableItem.setText(1, TestString); - assertEquals(0, tableItem.getText(1).length()); - assertEquals(0, tableItem.getText(0).length()); - - tableItem.setText(0, TestString); - assertEquals(TestString, tableItem.getText(0)); - tableItem.setText(-1, TestStrings[1]); - assertEquals(0, tableItem.getText(-1).length()); - - /* - * Test the getText/setText API with a Table that enough - * columns to fit all test item texts. - */ - - makeCleanEnvironment(); - - //table.setText(TestStrings); // create anough columns for TableItem.setText(String[]) to work - int columnCount = table.getColumnCount(); - if (columnCount < images.length) { - for (int i = columnCount; i < images.length; i++){ - TableColumn column = new TableColumn(table, SWT.NONE); - } - } - TableColumn[] columns = table.getColumns(); - for (int i = 0; i < TestStrings.length; i++) { - columns[i].setText(TestStrings[i]); - } - assertEquals(0, tableItem.getText(1).length()); - - - tableItem.setText(1, TestString); - assertEquals(TestString, tableItem.getText(1)); - assertEquals(0, tableItem.getText(0).length()); - - tableItem.setText(0, TestString); - assertEquals(TestString, tableItem.getText(0)); - - - tableItem.setText(-1, TestStrings[1]); - assertEquals(0, tableItem.getText(-1).length()); - - - try { - tableItem.setText(-1, null); - fail("No exception thrown for string == null"); - } - catch (IllegalArgumentException e) { - } - - try { - tableItem.setText(0, null); - fail("No exception thrown for string == null"); - } - catch (IllegalArgumentException e) { - } - - -} - -public void test_setTextLjava_lang_String() { - warnUnimpl("Test test_setTextLjava_lang_String not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_TableItem((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TableI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TableII"); - methodNames.addElement("test_getBackground"); - methodNames.addElement("test_getBackgroundI"); - methodNames.addElement("test_getBoundsI"); - methodNames.addElement("test_getChecked"); - methodNames.addElement("test_getForeground"); - methodNames.addElement("test_getForegroundI"); - methodNames.addElement("test_getGrayed"); - methodNames.addElement("test_getImageBoundsI"); - methodNames.addElement("test_getImageI"); - methodNames.addElement("test_getImageIndent"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getTextI"); - methodNames.addElement("test_setBackgroundILorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setCheckedZ"); - methodNames.addElement("test_setForegroundILorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setGrayedZ"); - methodNames.addElement("test_setImage$Lorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setImageILorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setImageIndentI"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setText$Ljava_lang_String"); - methodNames.addElement("test_setTextILjava_lang_String"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TableI")) test_ConstructorLorg_eclipse_swt_widgets_TableI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TableII")) test_ConstructorLorg_eclipse_swt_widgets_TableII(); - else if (getName().equals("test_getBackground")) test_getBackground(); - else if (getName().equals("test_getBackgroundI")) test_getBackgroundI(); - else if (getName().equals("test_getBoundsI")) test_getBoundsI(); - else if (getName().equals("test_getChecked")) test_getChecked(); - else if (getName().equals("test_getForeground")) test_getForeground(); - else if (getName().equals("test_getForegroundI")) test_getForegroundI(); - else if (getName().equals("test_getGrayed")) test_getGrayed(); - else if (getName().equals("test_getImageBoundsI")) test_getImageBoundsI(); - else if (getName().equals("test_getImageI")) test_getImageI(); - else if (getName().equals("test_getImageIndent")) test_getImageIndent(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getTextI")) test_getTextI(); - else if (getName().equals("test_setBackgroundILorg_eclipse_swt_graphics_Color")) test_setBackgroundILorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setCheckedZ")) test_setCheckedZ(); - else if (getName().equals("test_setForegroundILorg_eclipse_swt_graphics_Color")) test_setForegroundILorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setGrayedZ")) test_setGrayedZ(); - else if (getName().equals("test_setImage$Lorg_eclipse_swt_graphics_Image")) test_setImage$Lorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setImageILorg_eclipse_swt_graphics_Image")) test_setImageILorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setImageIndentI")) test_setImageIndentI(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setText$Ljava_lang_String")) test_setText$Ljava_lang_String(); - else if (getName().equals("test_setTextILjava_lang_String")) test_setTextILjava_lang_String(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else super.runTest(); -} - -/* custom */ -Table table; -TableItem tableItem; - -// this method must be private or protected so the auto-gen tool keeps it -private void makeCleanEnvironment() { - if ( tableItem != null ) tableItem.dispose(); - if ( table != null ) table.dispose(); - table = new Table(shell, 0); - tableItem = new TableItem(table, 0); - setWidget(tableItem); -} -} 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 deleted file mode 100644 index 96017d55e4..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Text.java +++ /dev/null @@ -1,1324 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; - -import org.eclipse.swt.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Text - * - * @see org.eclipse.swt.widgets.Text - */ -public class Test_org_eclipse_swt_widgets_Text extends Test_org_eclipse_swt_widgets_Scrollable { - -public Test_org_eclipse_swt_widgets_Text(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - shell.pack(); - shell.open(); - makeCleanEnvironment(false); // use multi-line by default -} - -protected void tearDown() { - super.tearDown(); - shell.dispose(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - try { - text = new Text(null, 0); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } - - int[] cases = {0, SWT.SINGLE, SWT.MULTI, SWT.MULTI | SWT.V_SCROLL, SWT.MULTI | SWT.H_SCROLL, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, - SWT.WRAP}; - for (int i = 0; i < cases.length; i++) - text = new Text(shell, cases[i]); -} - -public void test_addModifyListenerLorg_eclipse_swt_events_ModifyListener() { - boolean exceptionThrown = false; - ModifyListener listener = new ModifyListener() { - public void modifyText(ModifyEvent event) { - listenerCalled = true; - } - }; - try { - text.addModifyListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - // test whether all content modifying API methods send a Modify event - text.addModifyListener(listener); - listenerCalled = false; - text.setText("new text"); - assertTrue("setText does not send event", listenerCalled); - - listenerCalled = false; - text.removeModifyListener(listener); - // cause to call the listener. - text.setText("line"); - assertTrue("Listener not removed", listenerCalled == false); - try { - text.removeModifyListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - boolean exceptionThrown = false; - listenerCalled = false; - SelectionListener listener = new SelectionListener() { - public void widgetSelected(SelectionEvent event) { - listenerCalled = true; - } - public void widgetDefaultSelected(SelectionEvent event) { - } - }; - try { - text.addSelectionListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - text.addSelectionListener(listener); - text.setText("12345"); - text.setSelection(1,3); - assertTrue(":a:", listenerCalled == false); - text.removeSelectionListener(listener); - try { - text.removeSelectionListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } -} - -public void test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener() { - final String line = "Line1"; - final String newLine = "NewLine1"; - boolean exceptionThrown = false; - text.setText(""); - - // test null listener case - try { - text.addVerifyListener(null); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue("Expected exception not thrown", exceptionThrown); - - // test append case - VerifyListener listener = new VerifyListener() { - public void verifyText(VerifyEvent event) { - listenerCalled = true; - assertEquals("Verify event data invalid", 0, event.start); - assertEquals("Verify event data invalid", 0, event.end); - assertEquals("Verify event data invalid", line, event.text); - event.text = newLine; - } - }; - text.addVerifyListener(listener); - listenerCalled = false; - text.append(line); - assertTrue("append does not send event", listenerCalled); - assertEquals("Listener failed", newLine, text.getText()); - text.removeVerifyListener(listener); - - // test insert case - listener = new VerifyListener() { - public void verifyText(VerifyEvent event) { - listenerCalled = true; - assertEquals("Verify event data invalid", 8, event.start); - assertEquals("Verify event data invalid", 8, event.end); - assertEquals("Verify event data invalid", line, event.text); - event.text = newLine; - } - }; - text.addVerifyListener(listener); - listenerCalled = false; - text.insert(line); - assertTrue("insert does not send event", listenerCalled); - assertEquals("Listener failed", newLine + newLine, text.getText()); - text.removeVerifyListener(listener); - - // test setText case - listener = new VerifyListener() { - public void verifyText(VerifyEvent event) { - listenerCalled = true; - assertEquals("Verify event data invalid", 0, event.start); - assertEquals("Verify event data invalid", 16, event.end); - assertEquals("Verify event data invalid", line, event.text); - event.text = newLine; - } - }; - text.addVerifyListener(listener); - text.setText(line); - assertTrue("setText does not send event", listenerCalled); - assertEquals("Listener failed", newLine, text.getText()); - - // test remove case - listenerCalled = false; - text.removeVerifyListener(listener); - text.setText(line); - assertTrue("Listener not removed", listenerCalled == false); -} - -public void test_appendLjava_lang_String() { - try { - text.append(null); - fail("No exception thrown for string == null"); - } - catch (IllegalArgumentException e) { - } - - text.setText("01"); - text.append("23"); - assertEquals("0123", text.getText()); - text.append("45"); - assertEquals("012345", text.getText()); - text.setSelection(0); - text.append("67"); - assertEquals("01234567", text.getText()); - - text.setText("01"); - text.append("23"); - assertEquals("0123", text.getText()); - text.append("4" + delimiterString+ "5"); - assertEquals("01234" + delimiterString +"5", text.getText()); - text.setSelection(0); - text.append("67"); - assertEquals("01234" + delimiterString+"567", text.getText()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - try { - text.append(null); - fail("No exception thrown on string == null"); - } - catch (IllegalArgumentException e) { - } - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.setText("01"); - text.append("23"); - assertEquals("0123", text.getText()); - text.append("45"); - assertEquals("012345", text.getText()); - text.setSelection(0); - text.append("67"); - assertEquals("01234567", text.getText()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.setText("01"); - text.append("23"); - assertEquals("0123", text.getText()); - text.append("4" + delimiterString+"5"); - assertEquals("01234" + delimiterString+"5", text.getText()); - text.setSelection(0); - text.append("67"); - assertEquals("01234" + delimiterString+"567", text.getText()); -} - -public void test_clearSelection() { - text.setText("01234567890"); - assertEquals("", text.getSelectionText()); - text.selectAll(); - assertEquals("01234567890", text.getSelectionText()); - text.clearSelection(); - assertEquals("", text.getSelectionText()); - - text.setText("01234567890"); - assertEquals("", text.getSelectionText()); - text.selectAll(); - assertEquals("01234567890", text.getSelectionText()); - text.clearSelection(); - assertEquals("", text.getSelectionText()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.setText("01234567890"); - assertEquals("", text.getSelectionText()); - text.selectAll(); - assertEquals("01234567890", text.getSelectionText()); - text.clearSelection(); - assertEquals("", text.getSelectionText()); -} - -public void test_computeSizeIIZ() { - // super class test is sufficient -} - -public void test_copy() { - text.copy(); - - text.selectAll(); - text.copy(); - assertEquals("", text.getSelectionText()); - - text.setText("00000"); - text.selectAll(); - text.copy(); - text.setSelection(2); - assertEquals("", text.getSelectionText()); - - text.setText(""); - text.paste(); - assertEquals("00000", text.getText()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.copy(); - - text.selectAll(); - text.copy(); - assertEquals("", text.getSelectionText()); - - text.setText("00000"); - text.selectAll(); - text.copy(); - text.setSelection(2); - assertEquals("", text.getSelectionText()); - - text.setText(""); - text.paste(); - assertEquals("00000", text.getText()); -} - -public void test_cut() { - text.cut(); - text.setText("01234567890"); - text.setSelection(2, 5); - text.cut(); - assertEquals("01567890", text.getText()); - - text.selectAll(); - text.cut(); - assertEquals("", text.getText()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.cut(); - - text.setText("01234567890"); - text.setSelection(2, 5); - text.cut(); - assertEquals("01567890", text.getText()); - - text.selectAll(); - text.cut(); - assertEquals("", text.getText()); -} - -public void test_getCaretLineNumber() { - assertTrue(":a:", text.getCaretLineNumber() == 0); - text.setText("Line0\r\n"); - assertTrue(":b:", text.getCaretLineNumber() == 0); - text.setTopIndex(1); - assertTrue(":c:", text.getCaretLineNumber() == 0); - - text.append("Line1"); - assertTrue(":d:", text.getCaretLineNumber() == 1); - String newText = "Line-1\r\n"; - text.setSelection(0,0); - text.insert(newText); - assertTrue(":e:", text.getCaretLineNumber() == 1); - - text.setSelection(0,0); - assertTrue(":f:", text.getCaretLineNumber() == 0); - text.setSelection(8,8); - assertTrue(":g:", text.getCaretLineNumber() == 1); -} - -public void test_getCaretLocation() { - // account for insets when asserting - text.setSize(200,50); - text.setSelection(0,0); - text.insert(""); - assertTrue(":a:", text.getCaretLocation().x >= 0); - assertTrue(":a:", text.getCaretLocation().y >= 0); - text.setText("Line0\r\nLine1\r\nLine2"); - text.insert(""); - assertTrue(":b:", text.getCaretLocation().x >= 0); - assertTrue(":b:", text.getCaretLocation().y >= 0); - text.setSelection(1,1); - assertTrue(":c:", text.getCaretLocation().x > 0); - assertTrue(":c:", text.getCaretLocation().y >= 0); -} - -public void test_getCaretPosition() { - text.setText("Line"); - assertTrue(":a:", text.getCaretPosition() == 0); - text.append("123"); - assertTrue(":b:", text.getCaretPosition() == 7); - text.setSelection(1,3); - text.insert("123"); - assertTrue(":b:", text.getCaretPosition() == 4); -} - -public void test_getCharCount() { - assertEquals(0, text.getCharCount()); - text.setText(""); - assertEquals(0, text.getCharCount()); - text.setText("01234567890"); - assertEquals(11, text.getCharCount()); - - text.setText("012345" + delimiterString+"67890"); - assertEquals(11 + delimiterString.length(), text.getCharCount()); //might be bogus on UNIX - - text.setText(""); - assertEquals(0, text.getCharCount()); - - text.setText("01234\t567890"); - assertEquals(12, text.getCharCount()); - - // - text.setText(""); - assertEquals(0, text.getCharCount()); - text.setText("01234567890"); - assertEquals(11, text.getCharCount()); - - text.setText("012345" + delimiterString+"67890"); - assertEquals(11 + delimiterString.length(), text.getCharCount()); //might be bogus on UNIX - - text.setText(""); - assertEquals(0, text.getCharCount()); - - text.setText("01234\t567890"); - assertEquals(12, text.getCharCount()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - assertEquals(0, text.getCharCount()); - text.setText(""); - assertEquals(0, text.getCharCount()); - text.setText("01234567890"); - assertEquals(11, text.getCharCount()); - if (fCheckBogusTestCases) { - text.setText("012345"+ delimiterString + "67890"); - assertEquals(11 + delimiterString.length(), text.getCharCount()); //might be bogus on UNIX - } - text.setText(""); - assertEquals(0, text.getCharCount()); - if (!SwtJunit.isAIX) { - text.setText("01234\t567890"); - assertEquals(12, text.getCharCount()); - } -} - -public void test_getDoubleClickEnabled() { - text.setDoubleClickEnabled(true); - assertTrue(text.getDoubleClickEnabled()); - - text.setDoubleClickEnabled(false); - assertEquals(false, text.getDoubleClickEnabled()); - - // this method tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.setDoubleClickEnabled(true); - assertTrue(text.getDoubleClickEnabled()); - - text.setDoubleClickEnabled(false); - assertEquals(false, text.getDoubleClickEnabled()); -} - -public void test_getEchoChar() { - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.setEchoChar('a'); - assertEquals('a', text.getEchoChar()); -} - -public void test_getEditable() { - assertTrue(":a:", text.getEditable() == true); - text.setEditable(true); - assertTrue(":b:", text.getEditable() == true); - text.setEditable(false); - assertTrue(":c:", text.getEditable() == false); - text.setEditable(false); - assertTrue(":d:", text.getEditable() == false); - text.setEditable(true); - assertTrue(":e:", text.getEditable() == true); -} - -public void test_getLineCount() { - assertEquals(1, text.getLineCount()); - text.append("dddasd" + delimiterString); - assertEquals(2, text.getLineCount()); - text.append("ddasdasdasdasd" + delimiterString); - assertEquals(3, text.getLineCount()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - assertEquals(1, text.getLineCount()); - text.append("dddasd" + delimiterString); - assertEquals(1, text.getLineCount()); - text.append("ddasdasdasdasd" + delimiterString); - assertEquals(1, text.getLineCount()); -} - -public void test_getLineDelimiter() { - String platform = SWT.getPlatform(); - String delimiter = text.getLineDelimiter(); - if (platform.equals("win32")) { - assertTrue(":a:", delimiter.equals("\r\n")); - } else if (platform.equals("motif")) { - assertTrue(":a:", delimiter.equals("\n")); - } -} - -public void test_getLineHeight() { - assertTrue(":a:", text.getLineHeight() > 0); -} - -public void test_getOrientation() { - // tested in setOrientation -} - -public void test_getSelection() { - text.setText("01234567890"); - text.setSelection(new Point(2, 2)); - assertTrue(":b:", text.getSelection().equals(new Point(2, 2))); - text.setSelection(new Point(2, 3)); - assertTrue(":c:", text.getSelection().equals(new Point(2, 3))); - text.setSelection(new Point(3, 11)); - assertTrue(":d:", text.getSelection().equals(new Point(3, 11))); - text.setText("01234567890"); - text.setSelection(4); - assertTrue(":a:", text.getSelection().equals(new Point(4, 4))); - text.setSelection(11); - assertTrue(":b:", text.getSelection().equals(new Point(11, 11))); - text.setSelection(new Point(3, 2)); - assertTrue(":c:", text.getSelection().equals(new Point(2, 3))); -} - -public void test_getSelectionCount() { - text.setText("01234567890"); - assertTrue(":a:", text.getSelectionCount()==0); - text.setSelection(2, 4); - assertTrue(":b:", text.getSelectionCount()==2); - text.setSelection(2, 11); - assertTrue(":c:", text.getSelectionCount()==9); - text.setText("0123\n4567890"); - assertTrue(":d:", text.getSelectionCount()==0); - text.setSelection(2, 4); - assertTrue(":e:", text.getSelectionCount()==2); - text.setSelection(2, 12); - assertTrue(":f:", text.getSelectionCount()==10); -} - -public void test_getSelectionText() { - text.setText("01234567890"); - assertEquals("", text.getSelectionText()); - text.setSelection(3, 7); - assertEquals("3456", text.getSelectionText()); - - text.selectAll(); - assertEquals("01234567890", text.getSelectionText()); -} - -public void test_getTabs() { - 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() { - assertEquals("", text.getText()); - text.setText("01234567890"); - assertEquals("01234567890", text.getText()); - text.setText(""); - assertEquals("", text.getText()); - String string = "012345" + delimiterString + "67890"; - text.setText(string); - assertEquals(string, text.getText()); -} - -public void test_getTextII() { - assertEquals("", text.getText()); - assertEquals("", text.getText(-4,-4)); - assertEquals("", text.getText(-4,-2)); - assertEquals("", text.getText(-2,-1)); - assertEquals("", text.getText(-1,-1)); - assertEquals("", text.getText(-1,0)); - assertEquals("", text.getText(0,0)); - assertEquals("", text.getText(0,1)); - - text.setText("a"); - assertEquals("", text.getText(-4,-4)); - assertEquals("", text.getText(-4,-2)); - assertEquals("", text.getText(-2,-1)); - assertEquals("", text.getText(-1,-1)); - assertEquals("a", text.getText(-1,0)); - assertEquals("a", text.getText(0,0)); - assertEquals("a", text.getText(0,1)); - - text.setText("01234567890"); - assertEquals("345", text.getText(3, 5)); - assertEquals("012", text.getText(-1, 2)); - assertEquals("34567890", text.getText(3, 100)); - assertEquals("", text.getText(5, 3)); - - text.setText(""); - text.setEchoChar('*'); - - assertEquals("", text.getText()); - assertEquals("", text.getText(-4,-4)); - assertEquals("", text.getText(-4,-2)); - assertEquals("", text.getText(-2,-1)); - assertEquals("", text.getText(-1,-1)); - assertEquals("", text.getText(-1,0)); - assertEquals("", text.getText(0,0)); - assertEquals("", text.getText(0,1)); - - text.setText("a"); - assertEquals("", text.getText(-4,-4)); - assertEquals("", text.getText(-4,-2)); - assertEquals("", text.getText(-2,-1)); - assertEquals("", text.getText(-1,-1)); - assertEquals("a", text.getText(-1,0)); - assertEquals("a", text.getText(0,0)); - assertEquals("a", text.getText(0,1)); - - text.setText("01234567890"); - assertEquals("345", text.getText(3, 5)); - assertEquals("012", text.getText(-1, 2)); - assertEquals("34567890", text.getText(3, 100)); - assertEquals("", text.getText(5, 3)); -} - -public void test_getTextLimit() { - text.setTextLimit(10); - assertTrue(":a:", text.getTextLimit() == 10); -} - -public void test_getTopIndex() { - text.setSize(50,text.getLineHeight() * 2); - text.setTopIndex(0); - assertEquals(0, text.getTopIndex()); - text.append(delimiterString +"0123456789"); - text.setTopIndex(1); - assertEquals(1, text.getTopIndex()); - text.setTopIndex(17); - assertEquals(1, text.getTopIndex()); -} - -public void test_getTopPixel() { - text.setText("Line0\r\nLine0a\r\n"); - - assertTrue(":a:", text.getTopPixel() == 0); - text.setTopIndex(-2); - assertTrue(":b:", text.getTopPixel() == 0); - text.setTopIndex(-1); - assertTrue(":c:", text.getTopPixel() == 0); - text.setTopIndex(1); - assertTrue(":d:", text.getTopPixel() == text.getLineHeight()); - text.setSize(10, text.getLineHeight()); - text.setTopIndex(2); - assertTrue(":e:", text.getTopPixel() == text.getLineHeight() * 2); - text.setTopIndex(0); - assertTrue(":f:", text.getTopPixel() == 0); - text.setTopIndex(3); - assertTrue(":g:", text.getTopPixel() == text.getLineHeight() * 2); -} - -public void test_insertLjava_lang_String() { - try { - text.insert(null); - fail("No exception thrown for string == null"); - } - catch (IllegalArgumentException e) { - } - - assertEquals("", text.getText()); - text.insert(""); - assertEquals("", text.getText()); - text.insert("fred"); - assertEquals("fred", text.getText()); - text.setSelection(2); - text.insert("helmut"); - assertEquals("frhelmuted", text.getText()); - - text.setText("01234567890"); - text.setSelection(4); - assertEquals(1, text.getLineCount()); - text.insert(delimiterString); - assertEquals(2, text.getLineCount()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - try { - text.insert(null); - fail("No exception thrown on string == null"); - } - catch (IllegalArgumentException e) { - } - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - assertEquals("", text.getText()); - text.insert(""); - assertEquals("", text.getText()); - text.insert("fred"); - assertEquals("fred", text.getText()); - text.setSelection(2); - text.insert("helmut"); - assertEquals("frhelmuted", text.getText()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.setText("01234567890"); - text.setSelection(4); - assertEquals(1, text.getLineCount()); - text.insert(Text.DELIMITER); - assertEquals(1, text.getLineCount()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - try { - text.insert(null); - fail("No exception thrown on string == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_isVisible() { - // overriding test_isVisible() from Control - control.setVisible(true); - assertTrue(control.isVisible()); - - control.setVisible(false); - assertTrue(!control.isVisible()); - - if (!SwtJunit.isAIX) { - control.setVisible(true); - shell.setVisible(true); - assertTrue("Window should be visible", control.isVisible()); - shell.setVisible(false); - assertTrue("Window should not be visible", !control.isVisible()); - } -} - -public void test_paste() { - text.setText("01234567890"); - text.setSelection(2, 4); - assertEquals("01234567890", text.getText()); - text.copy(); - text.setSelection(0); - text.paste(); - assertEquals("2301234567890", text.getText()); - text.copy(); - text.setSelection(3); - text.paste(); - assertEquals("230231234567890", text.getText()); - - text.setText("0" + delimiterString + "1"); - text.selectAll(); - text.copy(); - text.setSelection(0); - text.paste(); - assertEquals("0" + delimiterString + "1" + "0" + delimiterString + "1", text.getText()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.setText("01234567890"); - text.setSelection(2, 4); - assertEquals("01234567890", text.getText()); - text.copy(); - text.setSelection(0); - text.paste(); - assertEquals("2301234567890", text.getText()); - text.copy(); - text.setSelection(3); - text.paste(); - assertEquals("230231234567890", text.getText()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.setText("0" + delimiterString + "1"); - text.selectAll(); - text.copy(); - text.setSelection(0); - text.paste(); - - if (fCheckSWTPolicy) - assertEquals("0" + delimiterString + "1" + "0" + delimiterString + "1", text.getText()); -} - -public void test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener() { - // tested in addModifyListener method -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - // tested in addSelectionListener method -} - -public void test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener() { - // tested in addVerifyListener method -} - -public void test_selectAll() { - text.setText("01234567890"); - assertEquals("01234567890", text.getText()); - text.selectAll(); - assertEquals("01234567890", text.getSelectionText()); - text.cut(); - assertEquals("", text.getText()); - - text.setText("01234" + delimiterString+"567890"); - assertEquals("01234" + delimiterString+"567890", text.getText()); - text.selectAll(); - assertEquals("01234" + delimiterString+"567890", text.getSelectionText()); - text.cut(); - assertEquals("", text.getText()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.setText("01234567890"); - assertEquals("01234567890", text.getText()); - text.selectAll(); - assertEquals("01234567890", text.getSelectionText()); - text.cut(); - assertEquals("", text.getText()); - - // tests a SINGLE line text editor - if (fCheckBogusTestCases) { - text.setText("01234" + delimiterString+"567890"); - assertEquals("01234" + delimiterString+"567890", text.getText()); - text.selectAll(); - assertEquals("01234" + delimiterString+"567890", text.getSelectionText()); - text.cut(); - assertEquals("", text.getText()); - } -} - -public void test_setDoubleClickEnabledZ() { - text.setDoubleClickEnabled(true); - assertTrue(text.getDoubleClickEnabled()); - - text.setDoubleClickEnabled(false); - assertEquals(false, text.getDoubleClickEnabled()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.setDoubleClickEnabled(true); - assertTrue(text.getDoubleClickEnabled()); - - text.setDoubleClickEnabled(false); - assertEquals(false, text.getDoubleClickEnabled()); -} - -public void test_setEchoCharC() { - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - for (int i=0; i<128; i++){ - text.setEchoChar((char) i); - assertEquals((char)i, text.getEchoChar()); - } - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.setEchoChar('a'); - assertEquals('a', text.getEchoChar()); - - text.setEchoChar((char) 0); - assertEquals((char)0, text.getEchoChar()); - - text.setEchoChar('\n'); - assertEquals('\n', text.getEchoChar()); - - for (int i=0; i<128; i++){ - text.setEchoChar((char) i); - assertEquals((char)i, text.getEchoChar()); - } -} - -public void test_setEditableZ() { - text.setEditable(true); - assertTrue(":a:", text.getEditable() == true); - text.setEditable(false); - assertTrue(":b:", text.getEditable() == false); - text.setEditable(false); - assertTrue(":c:", text.getEditable() == false); - text.setEditable(true); - assertTrue(":d:", text.getEditable() == true); -} - -public void test_setFontLorg_eclipse_swt_graphics_Font() { - FontData fontData = text.getFont().getFontData()[0]; - int lineHeight; - Font font; - - font = new Font(text.getDisplay(), fontData.getName(), 8, fontData.getStyle()); - text.setFont(font); - 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); - 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() { - text.setRedraw(false); - text.setRedraw(true); -} - -public void test_setSelectionI() { - text.setText("01234567890"); - assertEquals("", text.getSelectionText()); - text.setSelection(3, 7); - assertEquals("3456", text.getSelectionText()); - text.setSelection(3, 0); - assertEquals("012", text.getSelectionText()); -} - -public void test_setSelectionII() { - text.setText("01234567890"); - assertEquals(0, text.getSelectionCount()); - text.setSelection(2, 4); - assertEquals(2, text.getSelectionCount()); - text.setSelection(2, 100); - assertEquals(9, text.getSelectionCount()); - - text.setText("0123" + delimiterString +"4567890"); - assertEquals(0, text.getSelectionCount()); - text.setSelection(2, 4); - assertEquals(2, text.getSelectionCount()); - text.setSelection(2, 100); - assertEquals(9 + delimiterString.length(), text.getSelectionCount()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.setText("01234567890"); - assertEquals(0, text.getSelectionCount()); - text.setSelection(2, 4); - assertEquals(2, text.getSelectionCount()); - text.setSelection(2, 100); - assertEquals(9, text.getSelectionCount()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.setText("0123"+ delimiterString+"4567890"); - assertEquals(0, text.getSelectionCount()); - text.setSelection(2, 4); - assertEquals(2, text.getSelectionCount()); - if (fCheckBogusTestCases) { - text.setSelection(2, 100); - assertEquals(9 +delimiterString.length(), text.getSelectionCount()); - } -} - -public void test_setSelectionLorg_eclipse_swt_graphics_Point() { - text.setText("dsdsdasdslaasdas"); - try { - text.setSelection((Point) null); - fail("No exception thrown for selection == null"); - } - catch (IllegalArgumentException e) { - } - - text.setText("01234567890"); - text.setSelection(new Point(2, 2)); - assertEquals(new Point(2, 2), text.getSelection()); - - text.setSelection(new Point(3, 2)); - assertEquals(new Point(2, 3), text.getSelection()); - - text.setSelection(new Point(3, 100)); - assertEquals(new Point(3, 11), text.getSelection()); - - text.setText("01234567890"); - text.setSelection(4); - assertEquals(new Point(4, 4), text.getSelection()); - - text.setSelection(100); - assertEquals(new Point(11, 11), text.getSelection()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.setText("dsdsdasdslaasdas"); - try { - text.setSelection((Point) null); - fail("No exception thrown for selection == null"); - } - catch (IllegalArgumentException e) { - } - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.setText("01234567890"); - - text.setSelection(new Point(2, 2)); - assertEquals(new Point(2, 2), text.getSelection()); - - text.setSelection(new Point(3, 2)); - assertEquals(new Point(2, 3), text.getSelection()); - - text.setSelection(new Point(3, 100)); - assertEquals(new Point(3, 11), text.getSelection()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.setText("01234567890"); - text.setSelection(4); - assertEquals(new Point(4, 4), text.getSelection()); - - text.setSelection(100); - assertEquals(new Point(11, 11), text.getSelection()); -} - -public void test_setTabsI() { - if (SwtJunit.isMotif) { - for (int i = 0; i < 200; i++) { - text.setTabs(i); - assertEquals(8, text.getTabs()); - } - } else { - for (int i = 0; i < 200; i++) { - text.setTabs(i); - assertEquals(i, text.getTabs()); - } - } -} - -public void test_setTextLimitI() { - boolean exceptionThrown = false; - - text.setTextLimit(10); - assertTrue(":a:", text.getTextLimit() == 10); - - text.setTextLimit(Text.LIMIT); - assertTrue(":b:", text.getTextLimit() == Text.LIMIT); - - try { - text.setTextLimit(0); - } - catch (IllegalArgumentException e) { - exceptionThrown = true; - } - assertTrue(":c:", exceptionThrown == true); - exceptionThrown = false; -} - -public void test_setTextLjava_lang_String() { - try { - text.setText(null); - fail("No exception thrown for string == null"); - } - catch (IllegalArgumentException e) { - } - - text.setText(""); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - assertEquals("", text.getText()); - text.setText("01234567890"); - assertEquals("01234567890", text.getText()); - text.setText(""); - assertEquals("", text.getText()); - if (fCheckBogusTestCases) { - text.setText("012345" + delimiterString+ "67890"); - assertEquals("012345" + delimiterString +"67890", text.getText()); - } - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - assertEquals("", text.getText()); - - text.setText("01234567890"); - assertEquals("345", text.getText(3, 5)); - assertEquals("012", text.getText(-1, 2)); - assertEquals("34567890", text.getText(3, 100)); - assertEquals("", text.getText(5, 3)); - - text.setText(""); - assertEquals("", text.getText(-1, 0)); - assertEquals("", text.getText(0, 10)); - assertEquals("", text.getText(1, 0)); -} - -public void test_setTopIndexI() { - int number = 100; - for (int i = 0; i < number; i++) { - text.append("01234\n"); - } - for (int i = 1; i < number; i++) { - text.setTopIndex(i); - assertEquals(i, text.getTopIndex()); - } - - text.setTopIndex(number+5); - assertEquals(number, text.getTopIndex()); - - // tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.setText("01234567890"); - text.append(Text.DELIMITER +"01234567890"); - text.setTopIndex(0); - assertEquals(0, text.getTopIndex()); - text.setTopIndex(1); - assertEquals(0, text.getTopIndex()); - text.setTopIndex(17); - assertEquals(0, text.getTopIndex()); - - text.setText(""); - for (int i = 0; i < number; i++) { - text.append("01234" + Text.DELIMITER); - } - for (int i = 0; i < number; i++) { - text.setTopIndex(i); - assertEquals(0, text.getTopIndex()); - } -} - -public void test_showSelection() { - text.showSelection(); - - text.selectAll(); - text.showSelection(); - - text.setText("00000"); - text.selectAll(); - text.showSelection(); - text.clearSelection(); - text.showSelection(); - - // this method tests a SINGLE line text editor - makeCleanEnvironment(true); - - text.showSelection(); - - text.selectAll(); - text.showSelection(); - - - text.setText("00000"); - text.selectAll(); - text.showSelection(); - - text.clearSelection(); - text.showSelection(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Text((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener"); - methodNames.addElement("test_appendLjava_lang_String"); - methodNames.addElement("test_clearSelection"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_copy"); - methodNames.addElement("test_cut"); - methodNames.addElement("test_getCaretLineNumber"); - methodNames.addElement("test_getCaretLocation"); - methodNames.addElement("test_getCaretPosition"); - methodNames.addElement("test_getCharCount"); - methodNames.addElement("test_getDoubleClickEnabled"); - methodNames.addElement("test_getEchoChar"); - methodNames.addElement("test_getEditable"); - methodNames.addElement("test_getLineCount"); - methodNames.addElement("test_getLineDelimiter"); - methodNames.addElement("test_getLineHeight"); - methodNames.addElement("test_getOrientation"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionCount"); - methodNames.addElement("test_getSelectionText"); - methodNames.addElement("test_getTabs"); - methodNames.addElement("test_getText"); - methodNames.addElement("test_getTextII"); - methodNames.addElement("test_getTextLimit"); - methodNames.addElement("test_getTopIndex"); - methodNames.addElement("test_getTopPixel"); - methodNames.addElement("test_insertLjava_lang_String"); - methodNames.addElement("test_paste"); - methodNames.addElement("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener"); - methodNames.addElement("test_selectAll"); - methodNames.addElement("test_setDoubleClickEnabledZ"); - methodNames.addElement("test_setEchoCharC"); - methodNames.addElement("test_setEditableZ"); - methodNames.addElement("test_setFontLorg_eclipse_swt_graphics_Font"); - methodNames.addElement("test_setOrientationI"); - methodNames.addElement("test_setRedrawZ"); - methodNames.addElement("test_setSelectionI"); - methodNames.addElement("test_setSelectionII"); - methodNames.addElement("test_setSelectionLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_setTabsI"); - methodNames.addElement("test_setTextLimitI"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setTopIndexI"); - methodNames.addElement("test_showSelection"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Scrollable.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_addModifyListenerLorg_eclipse_swt_events_ModifyListener(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener")) test_addVerifyListenerLorg_eclipse_swt_events_VerifyListener(); - else if (getName().equals("test_appendLjava_lang_String")) test_appendLjava_lang_String(); - else if (getName().equals("test_clearSelection")) test_clearSelection(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_copy")) test_copy(); - else if (getName().equals("test_cut")) test_cut(); - else if (getName().equals("test_getCaretLineNumber")) test_getCaretLineNumber(); - else if (getName().equals("test_getCaretLocation")) test_getCaretLocation(); - else if (getName().equals("test_getCaretPosition")) test_getCaretPosition(); - else if (getName().equals("test_getCharCount")) test_getCharCount(); - else if (getName().equals("test_getDoubleClickEnabled")) test_getDoubleClickEnabled(); - else if (getName().equals("test_getEchoChar")) test_getEchoChar(); - else if (getName().equals("test_getEditable")) test_getEditable(); - else if (getName().equals("test_getLineCount")) test_getLineCount(); - else if (getName().equals("test_getLineDelimiter")) test_getLineDelimiter(); - else if (getName().equals("test_getLineHeight")) test_getLineHeight(); - else if (getName().equals("test_getOrientation")) test_getOrientation(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionCount")) test_getSelectionCount(); - else if (getName().equals("test_getSelectionText")) test_getSelectionText(); - else if (getName().equals("test_getTabs")) test_getTabs(); - else if (getName().equals("test_getText")) test_getText(); - else if (getName().equals("test_getTextII")) test_getTextII(); - else if (getName().equals("test_getTextLimit")) test_getTextLimit(); - else if (getName().equals("test_getTopIndex")) test_getTopIndex(); - else if (getName().equals("test_getTopPixel")) test_getTopPixel(); - else if (getName().equals("test_insertLjava_lang_String")) test_insertLjava_lang_String(); - else if (getName().equals("test_paste")) test_paste(); - else if (getName().equals("test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener")) test_removeModifyListenerLorg_eclipse_swt_events_ModifyListener(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener")) test_removeVerifyListenerLorg_eclipse_swt_events_VerifyListener(); - else if (getName().equals("test_selectAll")) test_selectAll(); - else if (getName().equals("test_setDoubleClickEnabledZ")) test_setDoubleClickEnabledZ(); - else if (getName().equals("test_setEchoCharC")) test_setEchoCharC(); - else if (getName().equals("test_setEditableZ")) test_setEditableZ(); - else if (getName().equals("test_setFontLorg_eclipse_swt_graphics_Font")) test_setFontLorg_eclipse_swt_graphics_Font(); - else if (getName().equals("test_setOrientationI")) test_setOrientationI(); - else if (getName().equals("test_setRedrawZ")) test_setRedrawZ(); - else if (getName().equals("test_setSelectionI")) test_setSelectionI(); - else if (getName().equals("test_setSelectionII")) test_setSelectionII(); - else if (getName().equals("test_setSelectionLorg_eclipse_swt_graphics_Point")) test_setSelectionLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_setTabsI")) test_setTabsI(); - else if (getName().equals("test_setTextLimitI")) test_setTextLimitI(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setTopIndexI")) test_setTopIndexI(); - else if (getName().equals("test_showSelection")) test_showSelection(); - else super.runTest(); -} - -/* custom */ -Text text; -String delimiterString; - -/** - * Clean up the environment for a new test. - * - * @param single true if the new text widget should be single-line. - */ -private void makeCleanEnvironment(boolean single) { -// this method must be private or protected so the auto-gen tool keeps it - if ( text != null ) text.dispose(); - - if ( single == true ) - text = new Text(shell, SWT.SINGLE); - else - text = new Text(shell, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); - setWidget(text); - delimiterString = Text.DELIMITER; -} -protected void setWidget(Widget w) { - text = (Text)w; - super.setWidget(w); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolBar.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolBar.java deleted file mode 100644 index 8e74a6035c..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolBar.java +++ /dev/null @@ -1,196 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.ToolBar - * - * @see org.eclipse.swt.widgets.ToolBar - */ -public class Test_org_eclipse_swt_widgets_ToolBar extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_widgets_ToolBar(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - toolBar = new ToolBar(shell, 0); - setWidget(toolBar); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - try { - new ToolBar(null, 0); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_computeTrimIIII() { - warnUnimpl("Test test_computeTrimIIII not written"); -} - -public void test_getItemCount() { - int number = 10; - ToolItem ti; - for (int i = 0; i<number ; i++){ - assertTrue(":a:" + i, toolBar.getItemCount()==i); - ti = new ToolItem(toolBar, 0); - } -} - -public void test_getItemI() { - int number = 5; - ToolItem[] items = new ToolItem[number]; - for (int i = 0; i<number ; i++){ - items[i] = new ToolItem(toolBar, 0); - } - for (int i = 0; i<number ; i++){ - assertTrue(":a:", toolBar.getItem(i)==items[i]); - } - - toolBar = new ToolBar(shell, 0); - number = 5; - items = new ToolItem[number]; - for (int i = 0; i<number ; i++){ - items[i] = new ToolItem(toolBar, 0); - } - try { - toolBar.getItem(number); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_getItemLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_getItemLorg_eclipse_swt_graphics_Point not written"); -} - -public void test_getItems() { - int number = 5; - ToolItem[] items = new ToolItem[number]; - for (int i = 0; i<number ; i++){ - items[i] = new ToolItem(toolBar, 0); - } - assertEquals(items, toolBar.getItems()); - - toolBar.getItems()[0].dispose(); - assertEquals(new ToolItem[]{items[1], items[2], items[3], items[4]}, toolBar.getItems()); - - toolBar.getItems()[3].dispose(); - assertEquals(new ToolItem[]{items[1], items[2], items[3]}, toolBar.getItems()); - - toolBar.getItems()[1].dispose(); - assertEquals(new ToolItem[]{items[1], items[3]}, toolBar.getItems()); -} - -public void test_getRowCount() { - toolBar = new ToolBar(shell, SWT.WRAP); - int number = 5; - ToolItem[] items = new ToolItem[number]; - for (int i = 0; i<number ; i++){ - items[i] = new ToolItem(toolBar, 0); - } - assertTrue(":a:" + toolBar.getRowCount(), toolBar.getRowCount()==number); //???? because of Size(0, 0) - - toolBar = new ToolBar(shell, 0); - number = 5; - items = new ToolItem[number]; - for (int i = 0; i<number ; i++){ - items[i] = new ToolItem(toolBar, 0); - } - assertTrue(":a:", toolBar.getRowCount()==1); -} - -public void test_indexOfLorg_eclipse_swt_widgets_ToolItem() { - int number = 10; - ToolItem[] tis = new ToolItem[number]; - for (int i = 0; i<number ; i++){ - tis[i] = new ToolItem(toolBar, 0); - } - for (int i = 0; i<number ; i++){ - assertTrue(":a:" + i, toolBar.indexOf(tis[i])==i); - } - - number = 10; - tis = new ToolItem[number]; - for (int i = 0; i<number ; i++){ - tis[i] = new ToolItem(toolBar, 0); - } - for (int i = 0; i<number ; i++){ - try { - toolBar.indexOf(null); - fail("No exception thrown for toolItem == null"); - } - catch (IllegalArgumentException e) { - } - } -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_ToolBar((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_computeTrimIIII"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItemI"); - methodNames.addElement("test_getItemLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getRowCount"); - methodNames.addElement("test_indexOfLorg_eclipse_swt_widgets_ToolItem"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_computeTrimIIII")) test_computeTrimIIII(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItemI")) test_getItemI(); - else if (getName().equals("test_getItemLorg_eclipse_swt_graphics_Point")) test_getItemLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getRowCount")) test_getRowCount(); - else if (getName().equals("test_indexOfLorg_eclipse_swt_widgets_ToolItem")) test_indexOfLorg_eclipse_swt_widgets_ToolItem(); - else super.runTest(); -} - -/* custom */ -protected ToolBar toolBar; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolItem.java deleted file mode 100644 index aad2025e86..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_ToolItem.java +++ /dev/null @@ -1,215 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.ToolItem - * - * @see org.eclipse.swt.widgets.ToolItem - */ -public class Test_org_eclipse_swt_widgets_ToolItem extends Test_org_eclipse_swt_widgets_Item { - -public Test_org_eclipse_swt_widgets_ToolItem(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - toolBar = new ToolBar(shell, 0); - toolItem = new ToolItem(toolBar, 0); - setWidget(toolItem); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ToolBarI() { - try { - new ToolItem(null, SWT.NULL); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_ToolBarII() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_ToolBarII not written"); -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_getBounds() { - warnUnimpl("Test test_getBounds not written"); -} - -public void test_getControl() { - warnUnimpl("Test test_getControl not written"); -} - -public void test_getDisabledImage() { - warnUnimpl("Test test_getDisabledImage not written"); -} - -public void test_getEnabled() { - warnUnimpl("Test test_getEnabled not written"); -} - -public void test_getHotImage() { - warnUnimpl("Test test_getHotImage not written"); -} - -public void test_getParent() { - warnUnimpl("Test test_getParent not written"); -} - -public void test_getSelection() { - // Test for method boolean org.eclipse.swt.widgets.ToolItem.getSelection() - warnUnimpl( "Test Test_org_eclipse_swt_widgets_ToolItem.test_5_getSelection not written"); -} - -public void test_getToolTipText() { - toolItem.setToolTipText("fred"); - assertTrue(":a: ", toolItem.getToolTipText().equals("fred")); - toolItem.setToolTipText("fredttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt"); - assertTrue(":a: ", toolItem.getToolTipText().equals("fredttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt")); -} - -public void test_getWidth() { - warnUnimpl("Test test_getWidth not written"); -} - -public void test_isEnabled() { - // Test for method boolean org.eclipse.swt.widgets.ToolItem.isEnabled() - warnUnimpl( "Test Test_org_eclipse_swt_widgets_ToolItem.test_7_isEnabled not written"); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_setControlLorg_eclipse_swt_widgets_Control() { - warnUnimpl("Test test_setControlLorg_eclipse_swt_widgets_Control not written"); -} - -public void test_setDisabledImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setDisabledImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setEnabledZ() { - // Test for method void org.eclipse.swt.widgets.ToolItem.setEnabled(boolean) - warnUnimpl( "Test Test_org_eclipse_swt_widgets_ToolItem.test_8_setEnabled not written"); -} - -public void test_setHotImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setHotImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setSelectionZ() { - warnUnimpl("Test test_setSelectionZ not written"); -} - -public void test_setTextLjava_lang_String() { - warnUnimpl("Test test_setTextLjava_lang_String not written"); -} - -public void test_setToolTipTextLjava_lang_String() { - warnUnimpl("Test test_setToolTipTextLjava_lang_String not written"); -} - -public void test_setWidthI() { - warnUnimpl("Test test_setWidthI not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_ToolItem((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ToolBarI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_ToolBarII"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getControl"); - methodNames.addElement("test_getDisabledImage"); - methodNames.addElement("test_getEnabled"); - methodNames.addElement("test_getHotImage"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getToolTipText"); - methodNames.addElement("test_getWidth"); - methodNames.addElement("test_isEnabled"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_setControlLorg_eclipse_swt_widgets_Control"); - methodNames.addElement("test_setDisabledImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setEnabledZ"); - methodNames.addElement("test_setHotImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setSelectionZ"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addElement("test_setToolTipTextLjava_lang_String"); - methodNames.addElement("test_setWidthI"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ToolBarI")) test_ConstructorLorg_eclipse_swt_widgets_ToolBarI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_ToolBarII")) test_ConstructorLorg_eclipse_swt_widgets_ToolBarII(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getControl")) test_getControl(); - else if (getName().equals("test_getDisabledImage")) test_getDisabledImage(); - else if (getName().equals("test_getEnabled")) test_getEnabled(); - else if (getName().equals("test_getHotImage")) test_getHotImage(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getToolTipText")) test_getToolTipText(); - else if (getName().equals("test_getWidth")) test_getWidth(); - else if (getName().equals("test_isEnabled")) test_isEnabled(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_setControlLorg_eclipse_swt_widgets_Control")) test_setControlLorg_eclipse_swt_widgets_Control(); - else if (getName().equals("test_setDisabledImageLorg_eclipse_swt_graphics_Image")) test_setDisabledImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setEnabledZ")) test_setEnabledZ(); - else if (getName().equals("test_setHotImageLorg_eclipse_swt_graphics_Image")) test_setHotImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setSelectionZ")) test_setSelectionZ(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else if (getName().equals("test_setToolTipTextLjava_lang_String")) test_setToolTipTextLjava_lang_String(); - else if (getName().equals("test_setWidthI")) test_setWidthI(); - else super.runTest(); -} - -/* custom */ -ToolBar toolBar; -ToolItem toolItem; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tracker.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tracker.java deleted file mode 100644 index 4b3fca6440..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tracker.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Tracker - * - * @see org.eclipse.swt.widgets.Tracker - */ -public class Test_org_eclipse_swt_widgets_Tracker extends Test_org_eclipse_swt_widgets_Widget { - -public Test_org_eclipse_swt_widgets_Tracker(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - tracker = new Tracker(shell, 0); - setWidget(tracker); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_CompositeI not written"); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_DisplayI() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_widgets_DisplayI not written"); -} - -public void test_addControlListenerLorg_eclipse_swt_events_ControlListener() { - warnUnimpl("Test test_addControlListenerLorg_eclipse_swt_events_ControlListener not written"); -} - -public void test_close() { - warnUnimpl("Test test_close not written"); -} - -public void test_getRectangles() { - warnUnimpl("Test test_getRectangles not written"); -} - -public void test_getStippled() { - warnUnimpl("Test test_getStippled not written"); -} - -public void test_open() { - warnUnimpl("Test test_open not written"); -} - -public void test_removeControlListenerLorg_eclipse_swt_events_ControlListener() { - warnUnimpl("Test test_removeControlListenerLorg_eclipse_swt_events_ControlListener not written"); -} - -public void test_setCursorLorg_eclipse_swt_graphics_Cursor() { - warnUnimpl("Test test_setCursorLorg_eclipse_swt_graphics_Cursor not written"); -} - -public void test_setRectangles$Lorg_eclipse_swt_graphics_Rectangle() { - warnUnimpl("Test test_setRectangles$Lorg_eclipse_swt_graphics_Rectangle not written"); -} - -public void test_setStippledZ() { - warnUnimpl("Test test_setStippledZ not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Tracker((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_DisplayI"); - methodNames.addElement("test_addControlListenerLorg_eclipse_swt_events_ControlListener"); - methodNames.addElement("test_close"); - methodNames.addElement("test_getRectangles"); - methodNames.addElement("test_getStippled"); - methodNames.addElement("test_open"); - methodNames.addElement("test_removeControlListenerLorg_eclipse_swt_events_ControlListener"); - methodNames.addElement("test_setCursorLorg_eclipse_swt_graphics_Cursor"); - methodNames.addElement("test_setRectangles$Lorg_eclipse_swt_graphics_Rectangle"); - methodNames.addElement("test_setStippledZ"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Widget.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_DisplayI")) test_ConstructorLorg_eclipse_swt_widgets_DisplayI(); - else if (getName().equals("test_addControlListenerLorg_eclipse_swt_events_ControlListener")) test_addControlListenerLorg_eclipse_swt_events_ControlListener(); - else if (getName().equals("test_close")) test_close(); - else if (getName().equals("test_getRectangles")) test_getRectangles(); - else if (getName().equals("test_getStippled")) test_getStippled(); - else if (getName().equals("test_open")) test_open(); - else if (getName().equals("test_removeControlListenerLorg_eclipse_swt_events_ControlListener")) test_removeControlListenerLorg_eclipse_swt_events_ControlListener(); - else if (getName().equals("test_setCursorLorg_eclipse_swt_graphics_Cursor")) test_setCursorLorg_eclipse_swt_graphics_Cursor(); - else if (getName().equals("test_setRectangles$Lorg_eclipse_swt_graphics_Rectangle")) test_setRectangles$Lorg_eclipse_swt_graphics_Rectangle(); - else if (getName().equals("test_setStippledZ")) test_setStippledZ(); - else super.runTest(); -} - -/* custom */ - Tracker tracker; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java deleted file mode 100644 index ea8ad0a8d8..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Tree.java +++ /dev/null @@ -1,552 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Tree - * - * @see org.eclipse.swt.widgets.Tree - */ -public class Test_org_eclipse_swt_widgets_Tree extends Test_org_eclipse_swt_widgets_Composite { - -public Test_org_eclipse_swt_widgets_Tree(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - tree = new Tree(shell, SWT.MULTI); - setWidget(tree); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() { - try { - tree = new Tree(null, 0); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } - - int[] cases = {0, SWT.BORDER}; - for (int i = 0; i < cases.length; i++) - tree = new Tree(shell, cases[i]); - - cases = new int[]{0, 10, 100}; - for (int j = 0; j < cases.length; j++) { - for (int i = 0; i < cases[j]; i++) { - TreeItem ti = new TreeItem(tree, 0); - } - assertEquals(cases[j], tree.getItemCount()); - tree.removeAll(); - } -} - -public void test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_addTreeListenerLorg_eclipse_swt_events_TreeListener() { - warnUnimpl("Test test_addTreeListenerLorg_eclipse_swt_events_TreeListener not written"); -} - -public void test_computeSizeIIZ() { - warnUnimpl("Test test_computeSizeIIZ not written"); -} - -public void test_deselectAll() { - int number = 15; - TreeItem[] items = new TreeItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TreeItem(tree, 0); - - assertEquals(0, tree.getSelectionCount()); - tree.setSelection(new TreeItem[] {items[2], items[4], items[5], items[10]}); - - assertEquals(4, tree.getSelectionCount()); - - tree.deselectAll(); - assertEquals(0, tree.getSelectionCount()); - - tree.selectAll(); - assertEquals(number, tree.getSelectionCount()); - - tree.deselectAll(); - assertEquals(0, tree.getSelectionCount()); -} - -public void test_getItemCount() { - warnUnimpl("Test test_getItemCount not written"); -} - -public void test_getItemHeight() { - assertTrue(":a: Item height is 0", tree.getItemHeight() > 0); - new TreeItem(tree, 0); - assertTrue(":b: Item height is 0", tree.getItemHeight() > 0); -} - -public void test_getItemLorg_eclipse_swt_graphics_Point() { - warnUnimpl("Test test_getItemLorg_eclipse_swt_graphics_Point not written"); -} - -public void test_getItems() { - int[] cases = {0, 10, 100}; - for (int j = 0; j < cases.length; j++) { - for (int i = 0; i < cases[j]; i++) { - TreeItem ti = new TreeItem(tree, 0); - } - assertEquals(cases[j], tree.getItems().length); - tree.removeAll(); - assertEquals(0, tree.getItemCount()); - } - - makeCleanEnvironment(false); - - for (int j = 0; j < cases.length; j++) { - for (int i = 0; i < cases[j]; i++) { - TreeItem ti = new TreeItem(tree, 0); - ti.setText(String.valueOf(i)); - } - TreeItem[] items = tree.getItems(); - for (int i = 0; i < items.length; i++) { - assertEquals(String.valueOf(i), items[i].getText()); - } - tree.removeAll(); - assertEquals(0, tree.getItemCount()); - } -} - -public void test_getParentItem() { - assertNull(tree.getParentItem()); -} - -public void test_getSelection() { - warnUnimpl("Test test_getSelection not written"); -} - -public void test_getSelectionCount() { - makeCleanEnvironment(true); // use single-selection tree. - - int number = 15; - TreeItem[] items = new TreeItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TreeItem(tree, 0); - - assertEquals(0, tree.getSelectionCount()); - - tree.setSelection(new TreeItem[]{items[2], items[number-1], items[10]}); - assertEquals(1, tree.getSelectionCount()); - - tree.setSelection(items); - assertEquals(1, tree.getSelectionCount()); -} - -public void test_getTopItem() { -// tested in test_setTopItemLorg_eclipse_swt_widgets_TreeItem -} - -public void test_removeAll() { - tree.removeAll(); - - int number = 20; - TreeItem[] items = new TreeItem[number]; - for (int i = 0; i < number; i++) { - items[i] = new TreeItem(tree, 0); - } - tree.removeAll(); - assertEquals(0, tree.getItemCount()); -} - -public void test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener() { - warnUnimpl("Test test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener not written"); -} - -public void test_removeTreeListenerLorg_eclipse_swt_events_TreeListener() { - warnUnimpl("Test test_removeTreeListenerLorg_eclipse_swt_events_TreeListener not written"); -} - -public void test_selectAll() { - int number = 5; - TreeItem[] items = new TreeItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TreeItem(tree, 0); - - assertEquals(0, tree.getSelectionCount()); - tree.selectAll(); - assertEquals(number, tree.getSelectionCount()); - - makeCleanEnvironment(true); // single-selection tree - - items = new TreeItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TreeItem(tree, 0); - - assertEquals(0, tree.getSelectionCount()); - tree.selectAll(); - assertEquals(0, tree.getSelectionCount()); -} - -public void test_setInsertMarkLorg_eclipse_swt_widgets_TreeItemZ() { - warnUnimpl("Test test_setInsertMarkLorg_eclipse_swt_widgets_TreeItemZ not written"); -} - -public void test_setRedrawZ() { - warnUnimpl("Test test_setRedrawZ not written"); -} - -public void test_setSelection$Lorg_eclipse_swt_widgets_TreeItem() { - int number = 20; - TreeItem[] items = new TreeItem[number]; - for (int i = 0; i < number; i++) { - items[i] = new TreeItem(tree, 0); - } - TreeItem[] itemsToBeSelected = {items[5], items[16], items[19]}; - tree.setSelection(itemsToBeSelected); - TreeItem[] selItems = tree.getSelection(); - int selLength = selItems.length; - assertTrue(":len:" + String.valueOf(selLength), selLength == itemsToBeSelected.length); - for (int i = 0; i < itemsToBeSelected.length; i++) { - boolean found = false; - for (int j = 0; j < selLength; j++) { - if (itemsToBeSelected[i] == selItems[i]) { - found = true; - break; - } - } - if (!found) fail ("tree item not selected, index: " + i); - } - tree.setSelection(tree.getItems()); - assertEquals(":b:", items, tree.getSelection()); - tree.setSelection(new TreeItem[] {}); - assertEquals(":c:", new TreeItem[] {}, tree.getSelection()); - try { - tree.setSelection((TreeItem[]) null); - fail("No exception thrown for items == null"); - } - catch (IllegalArgumentException e) { - } - tree.removeAll(); - - makeCleanEnvironment(false); - - number = 5; - items = new TreeItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TreeItem(tree, 0); - try { - tree.setSelection((TreeItem[]) null); - fail("No exception thrown for items == null"); - } - catch (IllegalArgumentException e) { - } - assertEquals(0, tree.getSelectionCount()); - - makeCleanEnvironment(false); - - items = new TreeItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TreeItem(tree, 0); - - tree.setSelection(new TreeItem[]{}); - assertEquals(0, tree.getSelectionCount()); - - tree.setSelection(new TreeItem[]{items[0], items[3], items[2]}); - assertSame(":b:", new TreeItem[]{items[0], items[2], items[3]}, tree.getSelection()); - - tree.setSelection(new TreeItem[]{items[3], items[2], items[1]}); - assertSame(":c:", new TreeItem[]{items[1], items[2], items[3]}, tree.getSelection()); - - tree.setSelection(new TreeItem[]{items[1], items[4], items[0]}); - assertSame(":d:", new TreeItem[]{items[0], items[1], items[4]}, tree.getSelection()); - - tree.setSelection(new TreeItem[]{items[0], items[4], items[0]}); - assertSame(":e:", new TreeItem[]{items[0], items[4]}, tree.getSelection()); - - tree.setSelection(new TreeItem[]{items[2], items[3], items[4]}); - assertSame(":f:", new TreeItem[]{items[2], items[3], items[4]}, tree.getSelection()); - - tree.setSelection(new TreeItem[]{items[4], items[4], items[4], items[4], items[4], items[4]}); - assertEquals(":g:", new TreeItem[]{items[4]}, tree.getSelection()); - - tree.setSelection(new TreeItem[]{items[4]}); - assertEquals(":h:", new TreeItem[]{items[4]}, tree.getSelection()); - - makeCleanEnvironment(false); - - items = new TreeItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TreeItem(tree, 0); - - tree.setSelection(new TreeItem[] {items[0]}); - assertEquals(":a:", new TreeItem[] {items[0]}, tree.getSelection()); - - tree.setSelection(new TreeItem[] {items[3]}); - assertEquals(":b:", new TreeItem[] {items[3]}, tree.getSelection()); - - tree.setSelection(new TreeItem[] {items[4]}); - assertEquals(":c:", new TreeItem[] {items[4]}, tree.getSelection()); - - tree.setSelection(new TreeItem[] {items[2]}); - assertEquals(":d:", new TreeItem[] {items[2]}, tree.getSelection()); - - tree.setSelection(new TreeItem[] {items[1]}); - assertEquals(":e:", new TreeItem[] {items[1]}, tree.getSelection()); - - makeCleanEnvironment(true); // single-selection tree - - number = 15; - items = new TreeItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TreeItem(tree, 0); - - assertEquals(":a:", new TreeItem[] {}, tree.getSelection()); - - tree.setSelection(new TreeItem[]{items[10], items[number-1], items[2]}); - assertEquals(":b:", new TreeItem[] {items[10]}, tree.getSelection()); - - tree.setSelection(items); - assertEquals(":c:", new TreeItem[] {items[0]}, tree.getSelection()); - - makeCleanEnvironment(true); //single-selection tree - - number = 5; - items = new TreeItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TreeItem(tree, 0); - try { - tree.setSelection((TreeItem[]) null); - fail("No exception thrown for items == null"); - } - catch (IllegalArgumentException e) { - } - assertEquals(0, tree.getSelectionCount()); - - makeCleanEnvironment(true); // single-selection tree - - number = 5; - items = new TreeItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TreeItem(tree, 0); - - tree.setSelection(new TreeItem[]{}); - assertEquals(0, tree.getSelectionCount()); - - tree.setSelection(new TreeItem[]{items[0], items[3], items[2]}); - assertEquals(":b:", new TreeItem[]{items[0]}, tree.getSelection()); - - tree.setSelection(new TreeItem[]{items[3], items[2], items[1]}); - assertEquals(":c:", new TreeItem[]{items[3]}, tree.getSelection()); - - tree.setSelection(new TreeItem[]{items[1], items[4], items[0]}); - assertEquals(":d:", new TreeItem[]{items[1]}, tree.getSelection()); - - tree.setSelection(new TreeItem[]{items[0], items[4], items[0]}); - assertEquals(":e:", new TreeItem[]{items[0]}, tree.getSelection()); - - tree.setSelection(new TreeItem[]{items[2], items[3], items[4]}); - assertEquals(":f:", new TreeItem[]{items[2]}, tree.getSelection()); - - tree.setSelection(new TreeItem[]{items[4], items[4], items[4], items[4], items[4], items[4]}); - assertEquals(":g:", new TreeItem[]{items[4]}, tree.getSelection()); - - tree.setSelection(new TreeItem[]{items[4]}); - assertEquals(":h:", new TreeItem[]{items[4]}, tree.getSelection()); - - makeCleanEnvironment(true); //single-selection tree - - number = 5; - items = new TreeItem[number]; - for (int i = 0; i < number; i++) - items[i] = new TreeItem(tree, 0); - - tree.setSelection(new TreeItem[] {items[0]}); - assertEquals(":a:", new TreeItem[] {items[0]}, tree.getSelection()); - - tree.setSelection(new TreeItem[] {items[3]}); - assertEquals(":b:", new TreeItem[] {items[3]}, tree.getSelection()); - - tree.setSelection(new TreeItem[] {items[4]}); - assertEquals(":c:", new TreeItem[] {items[4]}, tree.getSelection()); - - tree.setSelection(new TreeItem[] {items[2]}); - assertEquals(":d:", new TreeItem[] {items[2]}, tree.getSelection()); - - tree.setSelection(new TreeItem[] {items[1]}); - assertEquals(":e:", new TreeItem[] {items[1]}, tree.getSelection()); -} - -public void test_setTopItemLorg_eclipse_swt_widgets_TreeItem() { - tree.removeAll(); - for (int i = 0; i < 10; i++) { - TreeItem item = new TreeItem(tree, 0); - } - TreeItem top = new TreeItem(tree, 0); - for (int i = 0; i < 10; i++) { - TreeItem item = new TreeItem(tree, 0); - } - tree.setSize(50,50); - shell.open(); - tree.setTopItem(top); - for (int i = 0; i < 10; i++) { - TreeItem item = new TreeItem(tree, 0); - } - TreeItem top2 = tree.getTopItem(); - shell.setVisible(false); - assertEquals(top, top2); - try { - shell.setVisible(true); - tree.setTopItem(null); - fail("No exception thrown for item == null"); - } catch (IllegalArgumentException e) { - } finally { - shell.setVisible (false); - } -} - -public void test_showItemLorg_eclipse_swt_widgets_TreeItem() { - try { - tree.showItem(null); - fail("No exception thrown for item == null"); - } - catch (IllegalArgumentException e) { - } - - int number = 20; - TreeItem[] items = new TreeItem[number]; - for (int i = 0; i < number; i++) { - items[i] = new TreeItem(tree, 0); - } - for(int i=0; i<number; i++) - tree.showItem(items[i]); - - tree.removeAll(); - - makeCleanEnvironment(false); - //showing somebody else's items - - items = new TreeItem[number]; - for (int i = 0; i < number; i++) { - items[i] = new TreeItem(tree, 0); - } - - Tree tree2 = new Tree(shell, 0); - TreeItem[] items2 = new TreeItem[number]; - for (int i = 0; i < number; i++) { - items2[i] = new TreeItem(tree2, 0); - }; - - for(int i=0; i<number; i++) - tree.showItem(items2[i]); - - tree.removeAll(); -} - -public void test_showSelection() { - TreeItem item; - - tree.showSelection(); - item = new TreeItem(tree, 0); - tree.setSelection(new TreeItem[]{item}); - tree.showSelection(); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Tree((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_CompositeI"); - methodNames.addElement("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_addTreeListenerLorg_eclipse_swt_events_TreeListener"); - methodNames.addElement("test_computeSizeIIZ"); - methodNames.addElement("test_deselectAll"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItemHeight"); - methodNames.addElement("test_getItemLorg_eclipse_swt_graphics_Point"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getParentItem"); - methodNames.addElement("test_getSelection"); - methodNames.addElement("test_getSelectionCount"); - methodNames.addElement("test_getTopItem"); - methodNames.addElement("test_removeAll"); - methodNames.addElement("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener"); - methodNames.addElement("test_removeTreeListenerLorg_eclipse_swt_events_TreeListener"); - methodNames.addElement("test_selectAll"); - methodNames.addElement("test_setInsertMarkLorg_eclipse_swt_widgets_TreeItemZ"); - methodNames.addElement("test_setRedrawZ"); - methodNames.addElement("test_setSelection$Lorg_eclipse_swt_widgets_TreeItem"); - methodNames.addElement("test_setTopItemLorg_eclipse_swt_widgets_TreeItem"); - methodNames.addElement("test_showItemLorg_eclipse_swt_widgets_TreeItem"); - methodNames.addElement("test_showSelection"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Composite.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_CompositeI")) test_ConstructorLorg_eclipse_swt_widgets_CompositeI(); - else if (getName().equals("test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_addSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_addTreeListenerLorg_eclipse_swt_events_TreeListener")) test_addTreeListenerLorg_eclipse_swt_events_TreeListener(); - else if (getName().equals("test_computeSizeIIZ")) test_computeSizeIIZ(); - else if (getName().equals("test_deselectAll")) test_deselectAll(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItemHeight")) test_getItemHeight(); - else if (getName().equals("test_getItemLorg_eclipse_swt_graphics_Point")) test_getItemLorg_eclipse_swt_graphics_Point(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getParentItem")) test_getParentItem(); - else if (getName().equals("test_getSelection")) test_getSelection(); - else if (getName().equals("test_getSelectionCount")) test_getSelectionCount(); - else if (getName().equals("test_getTopItem")) test_getTopItem(); - else if (getName().equals("test_removeAll")) test_removeAll(); - else if (getName().equals("test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener")) test_removeSelectionListenerLorg_eclipse_swt_events_SelectionListener(); - else if (getName().equals("test_removeTreeListenerLorg_eclipse_swt_events_TreeListener")) test_removeTreeListenerLorg_eclipse_swt_events_TreeListener(); - else if (getName().equals("test_selectAll")) test_selectAll(); - else if (getName().equals("test_setInsertMarkLorg_eclipse_swt_widgets_TreeItemZ")) test_setInsertMarkLorg_eclipse_swt_widgets_TreeItemZ(); - else if (getName().equals("test_setRedrawZ")) test_setRedrawZ(); - else if (getName().equals("test_setSelection$Lorg_eclipse_swt_widgets_TreeItem")) test_setSelection$Lorg_eclipse_swt_widgets_TreeItem(); - else if (getName().equals("test_setTopItemLorg_eclipse_swt_widgets_TreeItem")) test_setTopItemLorg_eclipse_swt_widgets_TreeItem(); - else if (getName().equals("test_showItemLorg_eclipse_swt_widgets_TreeItem")) test_showItemLorg_eclipse_swt_widgets_TreeItem(); - else if (getName().equals("test_showSelection")) test_showSelection(); - else super.runTest(); -} - -/* custom */ -public Tree tree; - -/** - * Clean up the environment for a new test. - * - * @param single true if the new tree should be a single-selection one, - * otherwise use multi-selection. - */ -private void makeCleanEnvironment(boolean single) { -// this method must be private or protected so the auto-gen tool keeps it - tree.dispose(); - tree = new Tree(shell, single?SWT.SINGLE:SWT.MULTI); - setWidget(tree); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java deleted file mode 100644 index 045455bfe1..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java +++ /dev/null @@ -1,300 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.graphics.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.TreeItem - * - * @see org.eclipse.swt.widgets.TreeItem - */ -public class Test_org_eclipse_swt_widgets_TreeItem extends Test_org_eclipse_swt_widgets_Item { - -public Test_org_eclipse_swt_widgets_TreeItem(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - super.setUp(); - tree = new Tree(shell, 0); - treeItem = new TreeItem(tree, 0); - setWidget(treeItem); -} - -protected void tearDown() { - super.tearDown(); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TreeI() { - try { - new TreeItem((TreeItem)null, SWT.NULL); - fail("No exception thrown for parent == null"); - } - catch (IllegalArgumentException e) { - } - - for (int i=0; i<10; i++) { - new TreeItem(tree, 0); - } - assertEquals(11, tree.getItemCount()); - new TreeItem(tree, 0, 5); - assertEquals(12, tree.getItemCount()); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TreeII() { - try { - new TreeItem(tree, 0, 5); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) { - } -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TreeItemI() { - for (int i = 0; i < 10; i++) { - new TreeItem(treeItem, 0); - } - assertEquals(10, treeItem.getItemCount()); - new TreeItem(treeItem, 0, 5); - assertEquals(1, tree.getItemCount()); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_TreeItemII() { - try { - new TreeItem(treeItem, 0, 5); - fail("No exception thrown for illegal index argument"); - } - catch (IllegalArgumentException e) {} - assertEquals(1, tree.getItemCount()); -} - -public void test_getBackground() { - // tested in test_setBackgroundLorg_eclipse_swt_graphics_Color -} - -public void test_getBounds() { - warnUnimpl("Test test_getBounds not written"); -} - -public void test_getChecked() { - Tree newTree = new Tree(shell, SWT.CHECK); - TreeItem tItem = new TreeItem(newTree,0); - assertEquals(false, tItem.getChecked()); - tItem.setChecked(true); - assertTrue(tItem.getChecked()); - tItem.setChecked(false); - assertEquals(false, tItem.getChecked()); -} - -public void test_getExpanded() { - assertEquals(false, treeItem.getExpanded()); - // there must be at least one subitem before you can set the treeitem expanded - new TreeItem(treeItem, 0); - treeItem.setExpanded(true); - assertTrue(treeItem.getExpanded()); - treeItem.setExpanded(false); - assertEquals(false, treeItem.getExpanded()); -} - -public void test_getForeground() { - // tested in test_setForegroundLorg_eclipse_swt_graphics_Color -} - -public void test_getGrayed() { - warnUnimpl("Test test_getGrayed not written"); -} - -public void test_getItemCount() { - for (int i = 0; i < 10; i++) { - assertEquals(i, treeItem.getItemCount()); - new TreeItem(treeItem, 0); - } - assertTrue("b: ", treeItem.getItemCount() == 10); -} - -public void test_getItems() { - if (fCheckBogusTestCases) { - int[] cases = {2, 10, 100}; - for (int j = 0; j < cases.length; j++) { - for (int i = 0; i < cases[j]; i++) { - TreeItem ti = new TreeItem(tree, 0); - } - assertEquals(cases[j], tree.getItems().length); - tree.removeAll(); - assertEquals(0, tree.getItemCount()); - } - } -} - -public void test_getParent() { - assertEquals(tree, treeItem.getParent()); -} - -public void test_getParentItem() { - TreeItem tItem = new TreeItem(treeItem, SWT.NULL); - assertEquals(treeItem, tItem.getParentItem()); -} - -public void test_setBackgroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(treeItem.getDisplay(), 255, 0, 0); - treeItem.setBackground(color); - assertEquals(color, treeItem.getBackground()); - treeItem.setBackground(null); - assertEquals(tree.getBackground(),treeItem.getBackground()); - color.dispose(); - try { - treeItem.setBackground(color); - fail("No exception thrown for color disposed"); - } catch (IllegalArgumentException e) { - } -} - - -public void test_setCheckedZ() { - assertEquals(false, treeItem.getChecked()); - - treeItem.setChecked(true); - assertEquals(false, treeItem.getChecked()); - - Tree t = new Tree(shell, SWT.CHECK); - TreeItem ti = new TreeItem(t, SWT.NULL); - ti.setChecked(true); - assertTrue(ti.getChecked()); - - ti.setChecked(false); - assertEquals(false, ti.getChecked()); - t.dispose(); -} - -public void test_setExpandedZ() { - assertEquals(false, treeItem.getExpanded()); - - // there must be at least one subitem before you can set the treeitem expanded - treeItem.setExpanded(true); - assertEquals(false, treeItem.getExpanded()); - - - new TreeItem(treeItem, SWT.NULL); - treeItem.setExpanded(true); - assertTrue(treeItem.getExpanded()); - treeItem.setExpanded(false); - assertEquals(false, treeItem.getExpanded()); - - TreeItem ti = new TreeItem(treeItem, SWT.NULL); - ti.setExpanded(true); - treeItem.setExpanded(false); - assertEquals(false, ti.getExpanded()); -} - -public void test_setForegroundLorg_eclipse_swt_graphics_Color() { - Color color = new Color(treeItem.getDisplay(), 255, 0, 0); - treeItem.setForeground(color); - assertEquals(color, treeItem.getForeground()); - treeItem.setForeground(null); - assertEquals(tree.getForeground(),treeItem.getForeground()); - color.dispose(); - try { - treeItem.setForeground(color); - fail("No exception thrown for color disposed"); - } catch (IllegalArgumentException e) { - } -} - -public void test_setGrayedZ() { - warnUnimpl("Test test_setGrayedZ not written"); -} - -public void test_setImageLorg_eclipse_swt_graphics_Image() { - warnUnimpl("Test test_setImageLorg_eclipse_swt_graphics_Image not written"); -} - -public void test_setTextLjava_lang_String() { - try { - treeItem.setText(null); - fail("No exception thrown for string == null"); - } - catch (IllegalArgumentException e) { - } -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_TreeItem((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TreeI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TreeII"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TreeItemI"); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_TreeItemII"); - methodNames.addElement("test_getBackground"); - methodNames.addElement("test_getBounds"); - methodNames.addElement("test_getChecked"); - methodNames.addElement("test_getExpanded"); - methodNames.addElement("test_getForeground"); - methodNames.addElement("test_getGrayed"); - methodNames.addElement("test_getItemCount"); - methodNames.addElement("test_getItems"); - methodNames.addElement("test_getParent"); - methodNames.addElement("test_getParentItem"); - methodNames.addElement("test_setBackgroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setCheckedZ"); - methodNames.addElement("test_setExpandedZ"); - methodNames.addElement("test_setForegroundLorg_eclipse_swt_graphics_Color"); - methodNames.addElement("test_setGrayedZ"); - methodNames.addElement("test_setImageLorg_eclipse_swt_graphics_Image"); - methodNames.addElement("test_setTextLjava_lang_String"); - methodNames.addAll(Test_org_eclipse_swt_widgets_Item.methodNames()); // add superclass method names - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TreeI")) test_ConstructorLorg_eclipse_swt_widgets_TreeI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TreeII")) test_ConstructorLorg_eclipse_swt_widgets_TreeII(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TreeItemI")) test_ConstructorLorg_eclipse_swt_widgets_TreeItemI(); - else if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_TreeItemII")) test_ConstructorLorg_eclipse_swt_widgets_TreeItemII(); - else if (getName().equals("test_getBackground")) test_getBackground(); - else if (getName().equals("test_getBounds")) test_getBounds(); - else if (getName().equals("test_getChecked")) test_getChecked(); - else if (getName().equals("test_getExpanded")) test_getExpanded(); - else if (getName().equals("test_getForeground")) test_getForeground(); - else if (getName().equals("test_getGrayed")) test_getGrayed(); - else if (getName().equals("test_getItemCount")) test_getItemCount(); - else if (getName().equals("test_getItems")) test_getItems(); - else if (getName().equals("test_getParent")) test_getParent(); - else if (getName().equals("test_getParentItem")) test_getParentItem(); - else if (getName().equals("test_setBackgroundLorg_eclipse_swt_graphics_Color")) test_setBackgroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setCheckedZ")) test_setCheckedZ(); - else if (getName().equals("test_setExpandedZ")) test_setExpandedZ(); - else if (getName().equals("test_setForegroundLorg_eclipse_swt_graphics_Color")) test_setForegroundLorg_eclipse_swt_graphics_Color(); - else if (getName().equals("test_setGrayedZ")) test_setGrayedZ(); - else if (getName().equals("test_setImageLorg_eclipse_swt_graphics_Image")) test_setImageLorg_eclipse_swt_graphics_Image(); - else if (getName().equals("test_setTextLjava_lang_String")) test_setTextLjava_lang_String(); - else super.runTest(); -} - -/* custom */ -TreeItem treeItem; -Tree tree; -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TypedListener.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TypedListener.java deleted file mode 100644 index 01d9b2c248..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TypedListener.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - - -import junit.framework.*; -import junit.textui.*; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.TypedListener - * - * @see org.eclipse.swt.widgets.TypedListener - */ -public class Test_org_eclipse_swt_widgets_TypedListener extends SwtTestCase { - -public Test_org_eclipse_swt_widgets_TypedListener(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void test_ConstructorLorg_eclipse_swt_internal_SWTEventListener() { - warnUnimpl("Test test_ConstructorLorg_eclipse_swt_internal_SWTEventListener not written"); -} - -public void test_getEventListener() { - warnUnimpl("Test test_getEventListener not written"); -} - -public void test_handleEventLorg_eclipse_swt_widgets_Event() { - warnUnimpl("Test test_handleEventLorg_eclipse_swt_widgets_Event not written"); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_TypedListener((String)e.nextElement())); - } - return suite; -} -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_internal_SWTEventListener"); - methodNames.addElement("test_getEventListener"); - methodNames.addElement("test_handleEventLorg_eclipse_swt_widgets_Event"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_internal_SWTEventListener")) test_ConstructorLorg_eclipse_swt_internal_SWTEventListener(); - else if (getName().equals("test_getEventListener")) test_getEventListener(); - else if (getName().equals("test_handleEventLorg_eclipse_swt_widgets_Event")) test_handleEventLorg_eclipse_swt_widgets_Event(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Widget.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Widget.java deleted file mode 100644 index 8f4cba8087..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_Widget.java +++ /dev/null @@ -1,218 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.GC; - -/** - * Automated Test Suite for class org.eclipse.swt.widgets.Widget - * - * @see org.eclipse.swt.widgets.Widget - */ -public class Test_org_eclipse_swt_widgets_Widget extends SwtTestCase { - // Use this variable to help validate callbacks - boolean listenerCalled; - -public Test_org_eclipse_swt_widgets_Widget(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { - shell = new Shell(); -} - -protected void tearDown() { - if (widget != null) { - assertEquals(false, widget.isDisposed()); - } - assertEquals(false, shell.isDisposed()); - shell.dispose(); - if (widget != null) { - assertTrue(widget.isDisposed()); - } - assertTrue(shell.isDisposed()); -} - -public void test_ConstructorLorg_eclipse_swt_widgets_WidgetI() { - // abstract class -} - -public void test_addDisposeListenerLorg_eclipse_swt_events_DisposeListener() { - DisposeListener listener = new DisposeListener() { - public void widgetDisposed(DisposeEvent e) { - } - }; - widget.addDisposeListener(listener); - widget.removeDisposeListener(listener); -} - -public void test_addListenerILorg_eclipse_swt_widgets_Listener() { - try { - widget.addListener(SWT.Dispose, null); - fail("No exception thrown for listener == null"); - } - catch (IllegalArgumentException e) { - } - - Listener listener = new Listener() { - public void handleEvent(Event e) { - } - }; - widget.addListener(SWT.Dispose, listener); - widget.removeListener(SWT.Dispose, listener); -} - -public void test_dispose() { - // tested in tearDown -} - -public void test_getData() { - // tested in test_setDataLjava_lang_Object -} - -public void test_getDataLjava_lang_String() { - // tested in test_setDataLjava_lang_StringLjava_lang_Object -} - -public void test_getDisplay() { - assertEquals(widget.getDisplay(), widget.getDisplay()); -} - -public void test_getStyle() { - // this test should be overridden by leaf subclasses -} - -public void test_isDisposed() { - assertEquals(false, widget.isDisposed()); -} - -public void test_notifyListenersILorg_eclipse_swt_widgets_Event() { - widget.notifyListeners(0, null); - Event event = new Event(); - GC gc = null; - if (widget instanceof Control) { - gc = event.gc = new GC((Control)widget); - } - widget.notifyListeners(SWT.Paint, event); - if (gc != null) gc.dispose(); -} - -public void test_removeDisposeListenerLorg_eclipse_swt_events_DisposeListener() { - // tested in test_addDisposeListenerLorg_eclipse_swt_events_DisposeListener -} - -public void test_removeListenerILorg_eclipse_swt_widgets_Listener() { - // this method is further tested by all of the removeTypedListener tests - try { - widget.removeListener(SWT.Paint, null); - fail("No exception thrown for listener == null"); - } - catch (IllegalArgumentException e) { - } - - widget.removeListener(SWT.Paint, new Listener() { - public void handleEvent(Event e) { - } - }); - - Listener listener = new Listener() { - public void handleEvent(Event e) { - } - }; - widget.addListener(SWT.Paint, listener); - widget.removeListener(SWT.Paint, listener); -} - -public void test_setDataLjava_lang_Object() { - widget.setData(widget); - assertEquals(widget, widget.getData()); - - widget.setData(null); - assertNull(widget.getData()); -} - -public void test_setDataLjava_lang_StringLjava_lang_Object() { - widget.setData("the widget", widget); - assertEquals(widget, widget.getData("the widget")); - - widget.setData("the widget", null); - assertNull(widget.getData("the widget")); -} - -public void test_toString() { - assertNotNull(widget.toString()); - assertTrue(widget.toString().length() > 0); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_org_eclipse_swt_widgets_Widget((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("test_ConstructorLorg_eclipse_swt_widgets_WidgetI"); - methodNames.addElement("test_addDisposeListenerLorg_eclipse_swt_events_DisposeListener"); - methodNames.addElement("test_addListenerILorg_eclipse_swt_widgets_Listener"); - methodNames.addElement("test_dispose"); - methodNames.addElement("test_getData"); - methodNames.addElement("test_getDataLjava_lang_String"); - methodNames.addElement("test_getDisplay"); - methodNames.addElement("test_getStyle"); - methodNames.addElement("test_isDisposed"); - methodNames.addElement("test_notifyListenersILorg_eclipse_swt_widgets_Event"); - methodNames.addElement("test_removeDisposeListenerLorg_eclipse_swt_events_DisposeListener"); - methodNames.addElement("test_removeListenerILorg_eclipse_swt_widgets_Listener"); - methodNames.addElement("test_setDataLjava_lang_Object"); - methodNames.addElement("test_setDataLjava_lang_StringLjava_lang_Object"); - methodNames.addElement("test_toString"); - return methodNames; -} -protected void runTest() throws Throwable { - if (getName().equals("test_ConstructorLorg_eclipse_swt_widgets_WidgetI")) test_ConstructorLorg_eclipse_swt_widgets_WidgetI(); - else if (getName().equals("test_addDisposeListenerLorg_eclipse_swt_events_DisposeListener")) test_addDisposeListenerLorg_eclipse_swt_events_DisposeListener(); - else if (getName().equals("test_addListenerILorg_eclipse_swt_widgets_Listener")) test_addListenerILorg_eclipse_swt_widgets_Listener(); - else if (getName().equals("test_dispose")) test_dispose(); - else if (getName().equals("test_getData")) test_getData(); - else if (getName().equals("test_getDataLjava_lang_String")) test_getDataLjava_lang_String(); - else if (getName().equals("test_getDisplay")) test_getDisplay(); - else if (getName().equals("test_getStyle")) test_getStyle(); - else if (getName().equals("test_isDisposed")) test_isDisposed(); - else if (getName().equals("test_notifyListenersILorg_eclipse_swt_widgets_Event")) test_notifyListenersILorg_eclipse_swt_widgets_Event(); - else if (getName().equals("test_removeDisposeListenerLorg_eclipse_swt_events_DisposeListener")) test_removeDisposeListenerLorg_eclipse_swt_events_DisposeListener(); - else if (getName().equals("test_removeListenerILorg_eclipse_swt_widgets_Listener")) test_removeListenerILorg_eclipse_swt_widgets_Listener(); - else if (getName().equals("test_setDataLjava_lang_Object")) test_setDataLjava_lang_Object(); - else if (getName().equals("test_setDataLjava_lang_StringLjava_lang_Object")) test_setDataLjava_lang_StringLjava_lang_Object(); - else if (getName().equals("test_toString")) test_toString(); -} - -/* custom */ -public Shell shell; -private Widget widget; - -protected void setWidget(Widget w) { - widget = w; -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Browser1.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Browser1.java deleted file mode 100644 index 05c9bbda35..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Browser1.java +++ /dev/null @@ -1,208 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit.browser; - -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.*; - -public class Browser1 { - public static boolean passed = false; - public static boolean locationChanging = false; - public static boolean locationChanged = false; - public static boolean progressCompleted = false; - - public static boolean test1(String url) { - System.out.println("URL Loading - args: "+url+" Expected Event Sequence: Location.changing > Location.changed (top true)> Progress.completed"); - passed = false; - locationChanging = locationChanged = progressCompleted = false; - - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - Browser browser = new Browser(shell, SWT.NONE); - browser.addLocationListener(new LocationListener() { - public void changing(LocationEvent event) { - System.out.println("changing "+event.location); - /* certain browsers do send multiple changing events. Safari does this. */ - passed = !locationChanged && !progressCompleted; - locationChanging = true; - if (!passed) shell.close(); - } - public void changed(LocationEvent event) { - System.out.println("changed "+event.location); - /* ignore non top frame loading */ - if (!event.top) return; - passed = locationChanging && !progressCompleted; - locationChanged = true; - if (!passed) shell.close(); - } - }); - browser.addProgressListener(new ProgressListener() { - public void changed(ProgressEvent event) { - } - public void completed(ProgressEvent event) { - System.out.println("completed"); - passed = locationChanging && locationChanged && !progressCompleted; - progressCompleted = true; - if (!passed) shell.close(); - if (passed) { - /* wait a little bit more before declaring it a success, - * in case bogus events follow this one. - */ - new Thread() { - public void run() { - System.out.println("timer start"); - try { sleep(2000); } catch (Exception e) {}; - if (!display.isDisposed()) - display.asyncExec(new Runnable(){ - public void run() { - System.out.println("timer asyncexec shell.close"); - if (!shell.isDisposed()) shell.close(); - } - }); - System.out.println("timer over"); - }; - }.start(); - } - } - }); - - shell.open(); - browser.setUrl(url); - - boolean timeout = runLoopTimer(display, shell, 600); - if (timeout) passed = false; - display.dispose(); - return passed; - } - - public static boolean test2(String url) { - System.out.println("URL Loading Filtering - args: "+url+" Expected Event Sequence: Location.changing cancel true > no Location.changed, no Progress.completed"); - locationChanging = locationChanged = progressCompleted = false; - passed = false; - final String[] locationCancelled = new String[1]; - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - final Browser browser = new Browser(shell, SWT.NONE); - browser.addLocationListener(new LocationListener() { - public void changing(LocationEvent event) { - System.out.println("changing "+event.location); - passed = !locationChanging && !locationChanged && !progressCompleted; - locationChanging = true; - if (!passed) { - shell.close(); - return; - } - event.doit = false; - new Thread() { - public void run() { - System.out.println("timer start"); - try { sleep(2000); } catch (Exception e) {}; - if (!display.isDisposed()) - display.asyncExec(new Runnable(){ - public void run() { - System.out.println("timer asyncexec shell.close"); - if (!shell.isDisposed()) shell.close(); - } - }); - System.out.println("timer over"); - }; - }.start(); - } - public void changed(LocationEvent event) { - /* - * Feature on Internet Explorer. If there is no current location, IE still fires a DocumentComplete - * following the BeforeNavigate2 cancel event. This DocumentComplete event contains an empty URL - * since the URL in BeforeNavigate2 was correctly cancelled. - * The test considers it is OK to send a Location.changed and a Progress.completed events after - * a Location.changing cancel true - at the condition that the current location is empty, - * otherwise it is considered that the location was not successfully cancelled. - */ - passed = event.location.length() == 0; - System.out.println("changed "+event.location+" "+passed); - locationChanged = true; - } - }); - browser.addProgressListener(new ProgressListener() { - public void changed(ProgressEvent event) { - } - public void completed(ProgressEvent event) { - /* - * Feature on Internet Explorer. If there is no current location, IE still fires a DocumentComplete - * following the BeforeNavigate2 cancel event. This DocumentComplete event contains an empty URL - * since the URL in BeforeNavigate2 was correctly cancelled. - * The test considers it is OK to send a Location.changed and a Progress.completed events after - * a Location.changing cancel true - at the condition that the current location is empty, - * otherwise it is considered that the location was not successfully cancelled. - */ - String location = browser.getUrl(); - passed = location.length() == 0; - System.out.println("completed "+passed); - progressCompleted = true; - } - }); - shell.open(); - browser.setUrl(url); - boolean timeout = runLoopTimer(display, shell, 600); - if (timeout) passed = false; - display.dispose(); - return passed; - } - - static boolean runLoopTimer(final Display display, final Shell shell, final int seconds) { - final boolean[] timeout = {false}; - new Thread() { - public void run() { - try { - for (int i = 0; i < seconds; i++) { - Thread.sleep(1000); - if (display.isDisposed() || shell.isDisposed()) return; - } - } - catch (Exception e) {} - timeout[0] = true; - /* wake up the event loop */ - if (!display.isDisposed()) { - display.asyncExec(new Runnable() { - public void run() { - if (!shell.isDisposed()) shell.redraw(); - } - }); - } - } - }.start(); - while (!timeout[0] && !shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); - return timeout[0]; - } - - public static boolean test() { - int fail = 0; - String[] urls = {"http://www.eclipse.org", "http://www.google.com", "http://www.ibm.com"}; - for (int i = 0; i < urls.length; i++) { - boolean result = test1(urls[i]); - System.out.print(result ? "." : "E"); - if (!result) fail++; - } - for (int i = 0; i < urls.length; i++) { - boolean result = test2(urls[i]); - System.out.print(result ? "." : "E"); - if (!result) fail++; - } - return fail == 0; - } - - public static void main(String[] argv) { - System.out.println("\r\nTests Finished. SUCCESS: "+test()); - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Browser2.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Browser2.java deleted file mode 100644 index 3b47733889..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Browser2.java +++ /dev/null @@ -1,212 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit.browser; - -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.*; - -public class Browser2 { - public static boolean passed = false; - public static boolean locationChanging = false; - public static boolean locationChanged = false; - public static boolean progressCompleted = false; - - public static boolean test1(String html) { - System.out.println("setText - args: "+html+" Expected Event Sequence: Location.changing > Location.changed > Progress.completed"); - passed = false; - locationChanging = locationChanged = progressCompleted = false; - - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - Browser browser = new Browser(shell, SWT.NONE); - browser.addLocationListener(new LocationListener() { - public void changing(LocationEvent event) { - System.out.println("changing "+event.location); - /* certain browsers do send multiple changing events. Safari does this. */ - passed = !locationChanged && !progressCompleted; - locationChanging = true; - if (!passed) shell.close(); - } - public void changed(LocationEvent event) { - System.out.println("changed "+event.location); - passed = locationChanging && !locationChanged && !progressCompleted; - locationChanged = true; - if (!passed) shell.close(); - } - }); - browser.addProgressListener(new ProgressListener() { - public void changed(ProgressEvent event) { - } - public void completed(ProgressEvent event) { - System.out.println("completed"); - passed = locationChanging && locationChanged && !progressCompleted; - progressCompleted = true; - if (!passed) shell.close(); - if (passed) { - /* wait a little bit more before declaring it a success, - * in case bogus events follow this one. - */ - new Thread() { - public void run() { - System.out.println("timer start"); - try { sleep(2000); } catch (Exception e) {}; - if (!display.isDisposed()) - display.asyncExec(new Runnable(){ - public void run() { - System.out.println("timer asyncexec shell.close"); - if (!shell.isDisposed()) shell.close(); - } - }); - System.out.println("timer over"); - }; - }.start(); - } - } - }); - - shell.open(); - browser.setText(html); - - boolean timeout = runLoopTimer(display, shell, 600); - if (timeout) passed = false; - display.dispose(); - return passed; - } - - public static boolean test2(String html) { - System.out.println("setText URL Loading Filtering - args: "+html+" Expected Event Sequence: Location.changing cancel true > no Location.changed, no Progress.completed"); - locationChanging = locationChanged = progressCompleted = false; - passed = false; - final String[] locationCancelled = new String[1]; - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - final Browser browser = new Browser(shell, SWT.NONE); - browser.addLocationListener(new LocationListener() { - public void changing(LocationEvent event) { - System.out.println("changing "+event.location); - passed = !locationChanging && !locationChanged && !progressCompleted; - locationChanging = true; - if (!passed) { - shell.close(); - return; - } - event.doit = false; - new Thread() { - public void run() { - System.out.println("timer start"); - try { sleep(2000); } catch (Exception e) {}; - if (!display.isDisposed()) - display.asyncExec(new Runnable(){ - public void run() { - System.out.println("timer asyncexec shell.close"); - if (!shell.isDisposed()) shell.close(); - } - }); - System.out.println("timer over"); - }; - }.start(); - } - public void changed(LocationEvent event) { - /* - * Feature on Internet Explorer. If there is no current location, IE still fires a DocumentComplete - * following the BeforeNavigate2 cancel event. This DocumentComplete event contains an empty URL - * since the URL in BeforeNavigate2 was correctly cancelled. - * The test considers it is OK to send a Location.changed and a Progress.completed events after - * a Location.changing cancel true - at the condition that the current location is empty, - * otherwise it is considered that the location was not successfully cancelled. - */ - passed = event.location.length() == 0; - System.out.println("changed "+event.location+" "+passed); - locationChanged = true; - } - }); - browser.addProgressListener(new ProgressListener() { - public void changed(ProgressEvent event) { - } - public void completed(ProgressEvent event) { - /* - * Feature on Internet Explorer. If there is no current location, IE still fires a DocumentComplete - * following the BeforeNavigate2 cancel event. This DocumentComplete event contains an empty URL - * since the URL in BeforeNavigate2 was correctly cancelled. - * The test considers it is OK to send a Location.changed and a Progress.completed events after - * a Location.changing cancel true - at the condition that the current location is empty, - * otherwise it is considered that the location was not successfully cancelled. - */ - String location = browser.getUrl(); - passed = location.length() == 0; - System.out.println("completed "+passed); - progressCompleted = true; - } - }); - shell.open(); - browser.setText(html); - boolean timeout = runLoopTimer(display, shell, 600); - if (timeout) passed = false; - display.dispose(); - return passed; - } - - static boolean runLoopTimer(final Display display, final Shell shell, final int seconds) { - final boolean[] timeout = {false}; - new Thread() { - public void run() { - try { - for (int i = 0; i < seconds; i++) { - Thread.sleep(1000); - if (display.isDisposed() || shell.isDisposed()) return; - } - } - catch (Exception e) {} - timeout[0] = true; - /* wake up the event loop */ - if (!display.isDisposed()) { - display.asyncExec(new Runnable() { - public void run() { - if (!shell.isDisposed()) shell.redraw(); - } - }); - } - } - }.start(); - while (!timeout[0] && !shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); - return timeout[0]; - } - - public static boolean test() { - int fail = 0; - String[] html = {file1}; - for (int i = 0; i < html.length; i++) { - boolean result = test1(html[i]); - System.out.print(result ? "." : "E"); - if (!result) fail++; - } - for (int i = 0; i < html.length; i++) { - boolean result = test2(html[i]); - System.out.print(result ? "." : "E"); - if (!result) fail++; - } - return fail == 0; - } - - public static void main(String[] argv) { - System.out.println("\r\nTests Finished. SUCCESS: "+test()); - } - - public static String file1 = "<HTML><HEAD>"+ - "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">"+ - "<TITLE>Test with 2 frames</TITLE>"+ - "</HEAD><BODY>some simple test case here</BODY></HTML>"; - -}
\ No newline at end of file diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Browser3.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Browser3.java deleted file mode 100644 index b827577bb1..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Browser3.java +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit.browser; - -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.*; - -public class Browser3 { - public static boolean passed = false; - public static boolean openWindow, locationChanging, locationChanged, visibilityShow, progressCompleted; - - public static boolean test1(String url) { - System.out.println("javascript window.open - args: "+url+" Expected Event Sequence: Browser1:OpenWindow.open > { Browser2:Location.changing, Browser2:Visibility.show, Browser2:Location.changed } > Browser2:Progress.completed"); - passed = false; - locationChanging = locationChanged = progressCompleted = false; - - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - final Browser browser1 = new Browser(shell, SWT.NONE); - final Shell shell2 = new Shell(display); - shell2.setLayout(new FillLayout()); - final Browser browser2 = new Browser(shell2, SWT.NONE); - browser1.addOpenWindowListener(new OpenWindowListener() { - public void open(WindowEvent event) { - openWindow = true; - Browser src = (Browser)event.widget; - if (src != browser1) { - System.out.println("Failure - expected "+browser1+", got "+src); - passed = false; - shell.close(); - return; - } - if (event.browser != null) { - System.out.println("Failure - expected null, got "+event.browser); - passed = false; - shell.close(); - return; - } - event.browser = browser2; - } - }); - browser2.addLocationListener(new LocationListener() { - public void changed(LocationEvent event) { - if (!openWindow || !locationChanging) { - System.out.println("Failure - LocationEvent.changing received at wrong time"); - passed = false; - shell.close(); - return; - } - locationChanged = true; - } - public void changing(LocationEvent event) { - if (!openWindow) { - System.out.println("Failure - LocationEvent.changing received at wrong time"); - passed = false; - shell.close(); - return; - } - locationChanging = true; - } - }); - browser2.addVisibilityWindowListener(new VisibilityWindowListener() { - public void hide(WindowEvent event) { - System.out.println("Failure - did not expect VisibilityEvent.hide"); - passed = false; - shell.close(); - } - public void show(WindowEvent event) { - if (!openWindow) { - System.out.println("Failure - VisibilityEvent.show received at wrong time"); - passed = false; - shell.close(); - return; - } - shell2.open(); - } - }); - browser2.addProgressListener(new ProgressListener() { - public void changed(ProgressEvent event) { - } - - public void completed(ProgressEvent event) { - new Thread() { - public void run() { - System.out.println("timer start"); - try { sleep(2000); } catch (Exception e) {}; - passed = true; - if (!display.isDisposed()) - display.asyncExec(new Runnable(){ - public void run() { - System.out.println("timer asyncexec shell.close"); - if (!shell.isDisposed()) shell.close(); - } - }); - System.out.println("timer over"); - }; - }.start(); - } - }); - - shell.open(); - browser1.setUrl(url); - - boolean timeout = runLoopTimer(display, shell, 600); - if (timeout) passed = false; - display.dispose(); - return passed; - } - - static boolean runLoopTimer(final Display display, final Shell shell, final int seconds) { - final boolean[] timeout = {false}; - new Thread() { - public void run() { - try { - for (int i = 0; i < seconds; i++) { - Thread.sleep(1000); - if (display.isDisposed() || shell.isDisposed()) return; - } - } - catch (Exception e) {} - timeout[0] = true; - /* wake up the event loop */ - if (!display.isDisposed()) { - display.asyncExec(new Runnable() { - public void run() { - if (!shell.isDisposed()) shell.redraw(); - } - }); - } - } - }.start(); - while (!timeout[0] && !shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); - return timeout[0]; - } - - public static boolean test() { - int fail = 0; - String url; - String pluginPath = System.getProperty("PLUGIN_PATH"); - System.out.println("PLUGIN_PATH <"+pluginPath+">"); - if (pluginPath == null) url = Browser3.class.getClassLoader().getResource("browser3.html").toString(); - else url = pluginPath + "/data/browser3.html"; - String[] urls = {url}; - for (int i = 0; i < urls.length; i++) { - boolean result = test1(urls[i]); - System.out.print(result ? "." : "E"); - if (!result) fail++; - } - return fail == 0; - } - - public static void main(String[] argv) { - System.out.println("\r\nTests Finished. SUCCESS: "+test()); - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Browser4.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Browser4.java deleted file mode 100644 index 8de44b4028..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Browser4.java +++ /dev/null @@ -1,189 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit.browser; - -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.*; - -public class Browser4 { - public static boolean passed = false; - public static boolean openWindow, locationChanging, locationChanged, visibilityShow, progressCompleted, closeWindow; - - public static boolean test1(String url) { - System.out.println("javascript window.open - args: "+url+" Expected Event Sequence: Browser1:OpenWindow.open > { Browser2:Location.changing, Browser2:Visibility.show, Browser2:Location.changed } > Browser2:Progress.completed > Browser2.CloseWindow.close"); - passed = false; - locationChanging = locationChanged = progressCompleted = false; - - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - final Browser browser1 = new Browser(shell, SWT.NONE); - final Shell shell2 = new Shell(display); - shell2.setLayout(new FillLayout()); - final Browser browser2 = new Browser(shell2, SWT.NONE); - browser1.addOpenWindowListener(new OpenWindowListener() { - public void open(WindowEvent event) { - openWindow = true; - Browser src = (Browser)event.widget; - if (src != browser1) { - System.out.println("Failure - expected "+browser1+", got "+src); - passed = false; - shell.close(); - return; - } - if (event.browser != null) { - System.out.println("Failure - expected null, got "+event.browser); - passed = false; - shell.close(); - return; - } - event.browser = browser2; - } - }); - browser2.addLocationListener(new LocationListener() { - public void changed(LocationEvent event) { - if (!openWindow || !locationChanging) { - System.out.println("Failure - Location.changing received at wrong time"); - passed = false; - shell.close(); - return; - } - locationChanged = true; - } - public void changing(LocationEvent event) { - if (!openWindow) { - System.out.println("Failure - Location.changing received at wrong time"); - passed = false; - shell.close(); - return; - } - locationChanging = true; - } - }); - browser2.addVisibilityWindowListener(new VisibilityWindowListener() { - public void hide(WindowEvent event) { - System.out.println("Failure - did not expect VisibilityEvent.hide"); - passed = false; - shell.close(); - } - public void show(WindowEvent event) { - if (!openWindow) { - System.out.println("Failure - Visibility.show received at wrong time"); - passed = false; - shell.close(); - return; - } - shell2.open(); - visibilityShow = true; - } - }); - browser2.addProgressListener(new ProgressListener() { - public void changed(ProgressEvent event) { - } - - public void completed(ProgressEvent event) { - if (!locationChanging || !locationChanged || !visibilityShow) { - System.out.println("Failure - Progress.completed received at wrong time"); - passed = false; - shell.close(); - return; - } - progressCompleted = true; - } - }); - browser2.addCloseWindowListener(new CloseWindowListener() { - public void close(WindowEvent event) { - if (!progressCompleted) { - System.out.println("Failure - CloseWindow.close received at wrong time"); - passed = false; - shell.close(); - return; - } - closeWindow = true; - final Browser browser = (Browser)event.widget; - Shell parent = browser.getShell(); - parent.close(); - - new Thread() { - public void run() { - System.out.println("timer start"); - try { sleep(2000); } catch (Exception e) {}; - passed = true; - if (!display.isDisposed()) - display.asyncExec(new Runnable(){ - public void run() { - System.out.println("timer asyncexec shell.close"); - if (!shell.isDisposed()) shell.close(); - } - }); - System.out.println("timer over"); - }; - }.start(); - } - }); - - shell.open(); - browser1.setUrl(url); - - boolean timeout = runLoopTimer(display, shell, 600); - if (timeout) passed = false; - display.dispose(); - return passed; - } - - static boolean runLoopTimer(final Display display, final Shell shell, final int seconds) { - final boolean[] timeout = {false}; - new Thread() { - public void run() { - try { - for (int i = 0; i < seconds; i++) { - Thread.sleep(1000); - if (display.isDisposed() || shell.isDisposed()) return; - } - } - catch (Exception e) {} - timeout[0] = true; - /* wake up the event loop */ - if (!display.isDisposed()) { - display.asyncExec(new Runnable() { - public void run() { - if (!shell.isDisposed()) shell.redraw(); - } - }); - } - } - }.start(); - while (!timeout[0] && !shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); - return timeout[0]; - } - - public static boolean test() { - int fail = 0; - String url; - String pluginPath = System.getProperty("PLUGIN_PATH"); - System.out.println("PLUGIN_PATH <"+pluginPath+">"); - if (pluginPath == null) url = Browser4.class.getClassLoader().getResource("browser4.html").toString(); - else url = pluginPath + "/data/browser4.html"; - String[] urls = {url}; - for (int i = 0; i < urls.length; i++) { - boolean result = test1(urls[i]); - System.out.print(result ? "." : "E"); - if (!result) fail++; - } - return fail == 0; - } - - public static void main(String[] argv) { - System.out.println("\r\nTests Finished. SUCCESS: "+test()); - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Browser5.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Browser5.java deleted file mode 100644 index ef16cc2183..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Browser5.java +++ /dev/null @@ -1,162 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit.browser; - -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.*; -import org.eclipse.swt.graphics.*; - -public class Browser5 { - public static boolean passed = false; - static Point[][] regressionBounds = { - {new Point(10,200), new Point(300,100)}, - {new Point(10,200), null}, - {null, new Point(300,100)}, - {null, null}}; - static int index = 0; - static int cntPassed = 0; - static int cntClosed = 0; - - public static boolean test1(String url) { - System.out.println("javascript window.open with location and size parameters - args: "+url+" Expected Event Sequence: Visibility.open"); - passed = false; - - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - final Browser browser = new Browser(shell, SWT.NONE); - browser.addOpenWindowListener(new OpenWindowListener() { - public void open(WindowEvent event) { - System.out.println("OpenWindow "+index); - Shell newShell = new Shell(display); - newShell.setLayout(new FillLayout()); - Browser browser = new Browser(newShell, SWT.NONE); - browser.setData("index", new Integer(index)); - browser.addVisibilityWindowListener(new VisibilityWindowListener() { - public void hide(WindowEvent event) { - } - public void show(WindowEvent event) { - Browser browser = (Browser)event.widget; - Shell parent = browser.getShell(); - if (event.location != null) parent.setLocation(event.location); - if (event.size != null) parent.setSize(event.size); - int index = ((Integer)browser.getData("index")).intValue(); - parent.setText("SWT Browser shell "+index); - parent.open(); - if (index < 0) { - /* Certain browsers fire multiple show events for no good reason. Further show events - * are considered 'legal' as long as they don't contain size and location information. - */ - if (event.location != null || event.size != null) { - System.out.println("Failure - Browser "+index+" is receiving multiple show events"); - passed = false; - shell.close(); - } else { - System.out.println("Unnecessary (but harmless) visibility.show event Browser "+index); - } - } else { - browser.setData("index", new Integer(-100-index)); - System.out.println("Visibility.show browser "+index+" location "+event.location+" size "+event.size); - /* Certain browsers include decorations to the expected size. Accept size that are larger or equal than - * expected. Certain browsers invent size or location when some parameters are missing. If we expect - * null for one of size or location, also accept non null answers. - */ - boolean checkLocation = (event.location == null && regressionBounds[index][0] == null) || - (event.location != null && event.location.equals(regressionBounds[index][0]) || - (event.location != null && regressionBounds[index][0] == null)); - boolean checkSize = ((event.size == null && regressionBounds[index][1] == null) || - (event.size != null && event.size.equals(regressionBounds[index][1])) || - (event.size != null && regressionBounds[index][1] == null) || - (event.size != null && event.size.x >= regressionBounds[index][1].x && event.size.y >= regressionBounds[index][1].y)); - System.out.println("Expected location "+regressionBounds[index][0]+" size "+regressionBounds[index][1]); - if (!checkSize || !checkLocation || ((event.size != null || event.location != null) && regressionBounds[index][0] == null && regressionBounds[index][1] == null)) { - System.out.println(" Failure "); - passed = false; - shell.close(); - return; - } else cntPassed++; - } - } - }); - browser.addCloseWindowListener(new CloseWindowListener() { - public void close(WindowEvent event) { - cntClosed++; - System.out.println("Close"); - Browser browser = (Browser)event.widget; - browser.getShell().close(); - if (cntPassed == regressionBounds.length) passed = true; - if (cntClosed == regressionBounds.length) { - shell.close(); - return; - } - } - }); - event.browser = browser; - index++; - } - }); - shell.open(); - browser.setUrl(url); - - boolean timeout = runLoopTimer(display, shell, 600); - if (timeout) passed = false; - display.dispose(); - return passed; - } - - static boolean runLoopTimer(final Display display, final Shell shell, final int seconds) { - final boolean[] timeout = {false}; - new Thread() { - public void run() { - try { - for (int i = 0; i < seconds; i++) { - Thread.sleep(1000); - if (display.isDisposed() || shell.isDisposed()) return; - } - } - catch (Exception e) {} - timeout[0] = true; - /* wake up the event loop */ - if (!display.isDisposed()) { - display.asyncExec(new Runnable() { - public void run() { - if (!shell.isDisposed()) shell.redraw(); - } - }); - } - } - }.start(); - while (!timeout[0] && !shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); - return timeout[0]; - } - - public static boolean test() { - int fail = 0; - String url; - String pluginPath = System.getProperty("PLUGIN_PATH"); - System.out.println("PLUGIN_PATH <"+pluginPath+">"); - if (pluginPath == null) url = Browser5.class.getClassLoader().getResource("browser5.html").toString(); - else url = pluginPath + "/data/browser5.html"; - String[] urls = {url}; - for (int i = 0; i < urls.length; i++) { - boolean result = test1(urls[i]); - System.out.print(result ? "." : "E"); - if (!result) fail++; - } - return fail == 0; - } - - public static void main(String[] argv) { - System.out.println("\r\nTests Finished. SUCCESS: "+test()); - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Browser6.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Browser6.java deleted file mode 100644 index 29a7eb151a..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Browser6.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit.browser; - -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.browser.*; -import org.eclipse.swt.*; - -public class Browser6 { - public static boolean passed = false; - - public static boolean test1(String url) { - System.out.println("URL Loading, verify get title event - args: "+url+" Expected Event Sequence: Title.changed"); - passed = false; - - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - Browser browser = new Browser(shell, SWT.NONE); - browser.addTitleListener(new TitleListener() { - public void changed(TitleEvent event) { - Browser browser = (Browser)event.widget; - String url = browser.getUrl(); - System.out.println("Title changed <"+event.title+"> for location <"+url+">"); - passed = true; - shell.close(); - } - }); - - shell.open(); - browser.setUrl(url); - - boolean timeout = runLoopTimer(display, shell, 600); - if (timeout) passed = false; - display.dispose(); - return passed; - } - - public static boolean test2(String url, final String expectedTitle) { - System.out.println("URL Loading, verify get title event - args: "+url+" Expected Event Sequence: Title.changed"); - passed = false; - - final Display display = new Display(); - final Shell shell = new Shell(display); - shell.setLayout(new FillLayout()); - Browser browser = new Browser(shell, SWT.NONE); - browser.addTitleListener(new TitleListener() { - public void changed(TitleEvent event) { - Browser browser = (Browser)event.widget; - String url = browser.getUrl(); - System.out.println("Title changed <"+event.title+"> for location <"+url+">"); - if (event.title.equals(expectedTitle)) { - passed = true; - shell.close(); - } - } - }); - browser.addProgressListener(new ProgressListener() { - public void changed(ProgressEvent event) { - } - public void completed(ProgressEvent event) { - shell.close(); - } - }); - shell.open(); - browser.setUrl(url); - - boolean timeout = runLoopTimer(display, shell, 600); - if (timeout) passed = false; - display.dispose(); - return passed; - } - - static boolean runLoopTimer(final Display display, final Shell shell, final int seconds) { - final boolean[] timeout = {false}; - new Thread() { - public void run() { - try { - for (int i = 0; i < seconds; i++) { - Thread.sleep(1000); - if (display.isDisposed() || shell.isDisposed()) return; - } - } - catch (Exception e) {} - timeout[0] = true; - /* wake up the event loop */ - if (!display.isDisposed()) { - display.asyncExec(new Runnable() { - public void run() { - if (!shell.isDisposed()) shell.redraw(); - } - }); - } - } - }.start(); - while (!timeout[0] && !shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); - return timeout[0]; - } - - public static boolean test() { - int fail = 0; - - String[] urls = {"http://www.eclipse.org", "http://www.google.com", "http://www.ibm.com"}; - for (int i = 0; i < urls.length; i++) { - boolean result = test1(urls[i]); - System.out.print(result ? "." : "E"); - if (!result) fail++; - } - - String pluginPath = System.getProperty("PLUGIN_PATH"); - System.out.println("PLUGIN_PATH <"+pluginPath+">"); - String url; - if (pluginPath == null) url = Browser6.class.getClassLoader().getResource("browser6.html").toString(); - else url = pluginPath + "/data/browser6.html"; - urls = new String[] {url}; - String[] titles = {"This is a test title that must be carefully checked when that page is loaded"}; - for (int i = 0; i < urls.length; i++) { - boolean result = test2(urls[i], titles[i]); - System.out.print(result ? "." : "E"); - if (!result) fail++; - } - - - return fail == 0; - } - - public static void main(String[] argv) { - System.out.println("\r\nTests Finished. SUCCESS: "+test()); - } -}
\ No newline at end of file diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Test_BrowserSuite.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Test_BrowserSuite.java deleted file mode 100644 index 7a3a760a3b..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/browser/Test_BrowserSuite.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.tests.junit.browser; - -import junit.framework.*; -import junit.textui.*; -import org.eclipse.swt.tests.junit.*; -import org.eclipse.swt.widgets.*; - -/** - * Automated Test Suite for class org.eclipse.swt.browser.StatusTextListener - * - * @see org.eclipse.swt.browser.StatusTextListener - */ -public class Test_BrowserSuite extends SwtTestCase { - -public Test_BrowserSuite(String name) { - super(name); -} - -public static void main(String[] args) { - TestRunner.run(suite()); -} - -protected void setUp() { -} - -protected void tearDown() { -} - -public void Browser1() { - System.out.println("** Browser1 **"); - boolean result = Browser1.test(); - assertTrue(result); -} - -public void Browser2() { - System.out.println("** Browser2 **"); - boolean result = Browser2.test(); - assertTrue(result); -} - -public void Browser3() { - System.out.println("** Browser3 **"); - boolean result = Browser3.test(); - assertTrue(result); -} - -public void Browser4() { - System.out.println("** Browser4 **"); - boolean result = Browser4.test(); - assertTrue(result); -} - -public void Browser5() { - System.out.println("** Browser5 **"); - boolean result = Browser5.test(); - assertTrue(result); -} - -public void Browser6() { - System.out.println("** Browser6 **"); - boolean result = Browser6.test(); - assertTrue(result); -} - -public static Test suite() { - TestSuite suite = new TestSuite(); - java.util.Vector methodNames = methodNames(); - java.util.Enumeration e = methodNames.elements(); - while (e.hasMoreElements()) { - suite.addTest(new Test_BrowserSuite((String)e.nextElement())); - } - return suite; -} - -public static java.util.Vector methodNames() { - java.util.Vector methodNames = new java.util.Vector(); - methodNames.addElement("Browser1"); - methodNames.addElement("Browser2"); - methodNames.addElement("Browser3"); - methodNames.addElement("Browser4"); - methodNames.addElement("Browser5"); - methodNames.addElement("Browser6"); - return methodNames; -} - -protected void runTest() throws Throwable { - /* - * The tests in this suite manage their own Display and event loop - * to validate asynchronous use cases. - * Dispose any previously existing display for the calling thread - * before starting the tests. - */ - Display display = Display.getCurrent(); - if (display != null) display.dispose(); - - if (getName().equals("Browser1")) Browser1(); - if (getName().equals("Browser2")) Browser2(); - if (getName().equals("Browser3")) Browser3(); - if (getName().equals("Browser4")) Browser4(); - if (getName().equals("Browser5")) Browser5(); - - /* - * Ensure we don't leave a Display from the tests we run. - */ - display = Display.getCurrent(); - if (display != null) display.dispose(); -} -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/empty.txt b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/empty.txt deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/empty.txt +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.bmp b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.bmp Binary files differdeleted file mode 100644 index 574351fbd4..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.bmp +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.gif b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.gif Binary files differdeleted file mode 100644 index 4e17c75cc2..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.gif +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.jpg b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.jpg Binary files differdeleted file mode 100644 index 3870170878..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.jpg +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.png b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.png Binary files differdeleted file mode 100644 index 9ef2dc09d2..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folder.png +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.bmp b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.bmp Binary files differdeleted file mode 100644 index 6ba1214663..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.bmp +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.gif b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.gif Binary files differdeleted file mode 100644 index 64886bbbfd..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.gif +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.jpg b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.jpg Binary files differdeleted file mode 100644 index faf88826b1..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.jpg +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.png b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.png Binary files differdeleted file mode 100644 index 9b36d62b38..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/folderOpen.png +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/interlaced_target.png b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/interlaced_target.png Binary files differdeleted file mode 100644 index 5b4745825b..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/interlaced_target.png +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/junitGen.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/junitGen.java deleted file mode 100644 index 926053ad36..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/junitGen.java +++ /dev/null @@ -1,748 +0,0 @@ -package org.eclipse.swt.tests.junit; - -import java.util.zip.*; -import java.util.*; -import java.lang.reflect.*; -import java.io.*; -import java.net.*; - -/** - * Create SWT Junit stubs based on a swt jar used as a reference - * Command line tool - run without parameters to get help information - */ -public class junitGen { - String destFolder = null; - int counter = 0; - - /** - * @param jarfile the url of a jar file - * @return all public classes in the jar - */ - public Vector getClasses(String jarfile) { - Vector vector = new Vector(); - try { - ZipFile zipFile = new ZipFile(jarfile); - File file = new File(jarfile); - URL url = file.toURL(); - ClassLoader loader = new URLClassLoader(new URL[] { url }); - - Enumeration entries = zipFile.entries(); - while (entries.hasMoreElements()) { - ZipEntry entry = (ZipEntry)entries.nextElement(); - String name = entry.getName(); - if (name.endsWith(".class")) { - name = name.substring(0, name.length() - ".class".length()); - name = name.replace('/', '.'); - Class clazz = Class.forName(name, false, loader); - if (filterClass(clazz)) vector.add(clazz); - } - } - } catch (Exception e) { - System.out.println("Exception " + e); - return null; - } - return vector; - } - /** - * Create a Junit java test file - * @param clazz class to create the test for - */ - public void createFileTest(Class clazz) { - try { - String name = getClassName(clazz); - name = destFolder + "/" + name + ".java"; - FileWriter writer = new FileWriter(name); - createSwtTest(writer, clazz); - writer.close(); - } catch (Exception e) { - System.out.println("Exception " + e); - } - - } - - void createSwtTest(FileWriter writer, Class clazz) throws IOException { - SwtTest test = new SwtTest(writer, clazz); - test.writeCopyRights(); - test.writePackage(); - test.newLine(); - test.writeImports(); - test.newLine(); - test.writeClassComments(); - test.writeClassDeclaration(); - test.newLine(); - test.writeConstructor(); - test.newLine(); - test.writeMain(); - test.newLine(); - test.writeSetUp(); - test.newLine(); - test.writeTearDown(); - test.newLine(); - test.writeMethods(); - test.newLine(); - test.writeSuite(); - test.newLine(); - test.writeMethodNames(); - test.newLine(); - test.writeRunTest(); - test.writeClassClosure(); - } - - public void setDestinationFolder(String dest) { - destFolder = dest; - } - - public void incrementCounter() { - counter++; - } - - public int getCounter() { - return counter; - } - - public static void createTests(String jarfile, String destFolder) { - junitGen gen = new junitGen(); - Vector classes = gen.getClasses(jarfile); - gen.setDestinationFolder(destFolder); - if (classes == null) { - System.out.println("No classes found."); - return; - } - Enumeration entries = classes.elements(); - while (entries.hasMoreElements()) { - gen.createFileTest((Class)entries.nextElement()); - } - System.out.println("Test stubs written: " + gen.getCounter()); - } - - public void diff(Vector oldClasses, Vector newClasses) { - SwtDiff diff = new SwtDiff(oldClasses, newClasses); - diff.compute(); - } - - public static void diffTests(String jarfileOld, String jarfileNew) { - junitGen gen = new junitGen(); - Vector oldClasses = gen.getClasses(jarfileOld); - if (oldClasses == null) { - System.out.println("No classes found in old jar"); - return; - } - Vector newClasses = gen.getClasses(jarfileNew); - if (newClasses == null) { - System.out.println("No classes found in new jar"); - return; - } - gen.diff(oldClasses, newClasses); - } - - public static void main(String[] args) { - if (args == null || args.length < 3) { - System.out.println("Usage: java junitGen flag arg1 arg2 ..."); - System.out.println(" where flag is one of:"); - System.out.println("create: create the junit test stubs"); - System.out.println(" arg1: source jar e.g. d:/swt.jar"); - System.out.println(" arg2: destination e.g. d:/tests"); - System.out.println("diff: diff 2 jars showing which tests must be removed,"); - System.out.println(" and added"); - System.out.println(" arg1: old jar e.g. d:/old/swt.jar"); - System.out.println(" arg2: new jar e.g. d:/new/swt.jar"); - return; - } - if (args[0].equals("create")) createTests(args[1], args[2]); - else if (args[0].equals("diff")) diffTests(args[1], args[2]); - } - - boolean filterClass(Class clazz) { - /* JUnit tests for public classes only */ - int modifiers = clazz.getModifiers(); - if (!Modifier.isPublic(modifiers)) return false; - - /* JUnit tests for classes which are not part of an internal package */ - String packageName = clazz.getPackage().getName(); - if (packageName.indexOf("internal") != -1) return false; - - /* JUnit tests for classes with public constructors or public methods */ - Constructor[] constructors = getFilteredConstructors(clazz); - Method[] methods = getFilteredMethods(clazz); - if (constructors.length == 0 && methods.length == 0) return false; - return true; - } - - String getClassName(Class clazz) { - String name = clazz.getName(); - name = "Test_" + name.replace('.', '_'); - return name; - } - - String getMethodName(Constructor constructor) { - String name = "test_Constructor"; - Class[] parameters = constructor.getParameterTypes(); - for (int i = 0; i < parameters.length; i++) { - name += getTypeSignature(parameters[i]); - } - return name; - } - - String getMethodName(Method method) { - String name = "test_" + method.getName(); - Class[] parameters = method.getParameterTypes(); - for (int i = 0; i < parameters.length; i++) { - name += getTypeSignature(parameters[i]); - } - return name; - } - - String getTypeSignature(Class clazz) { - if (clazz == Integer.TYPE) return "I"; - if (clazz == Boolean.TYPE) return "Z"; - if (clazz == Long.TYPE) return "J"; - if (clazz == Short.TYPE) return "S"; - if (clazz == Character.TYPE) return "C"; - if (clazz == Byte.TYPE) return "B"; - if (clazz == Float.TYPE) return "F"; - if (clazz == Double.TYPE) return "D"; - if (clazz.isArray()) { - Class componentType = clazz.getComponentType(); - return "$" + getTypeSignature(componentType); - } - return "L" + clazz.getName().replace('.', '_'); - } - - Constructor[] getFilteredConstructors(Class clazz) { - Constructor[] constructors = clazz.getConstructors(); - Arrays.sort(constructors, new Comparator() { - public int compare(Object a, Object b) { - return (getMethodName((Constructor)a).compareTo(getMethodName((Constructor)b))); - } - }); - int count = 0; - for (int i = 0; i < constructors.length; i++) { - Constructor constructor = constructors[i]; - int modifiers = constructor.getModifiers(); - if (Modifier.isPublic(modifiers)) { - constructors[count++] = constructors[i]; - } - } - Constructor[] result = new Constructor[count]; - System.arraycopy(constructors, 0, result, 0, count); - return result; - } - - Method[] getFilteredMethods(Class clazz) { - Method[] methods = clazz.getDeclaredMethods(); - Arrays.sort(methods, new Comparator() { - public int compare(Object a, Object b) { - return (getMethodName((Method)a).compareTo(getMethodName((Method)b))); - } - }); - int count = 0; - for (int i = 0; i < methods.length; i++) { - Method method = methods[i]; - int modifiers = method.getModifiers(); - if (Modifier.isPublic(modifiers)) { - methods[count++] = methods[i]; - } - } - Method[] result = new Method[count]; - System.arraycopy(methods, 0, result, 0, count); - return result; - } - - - public class SwtTest { - FileWriter writer; - Class clazz; - String lineSep = "\r\n"; - - SwtTest(FileWriter writer, Class clazz) { - this.writer = writer; - this.clazz = clazz; - } - - void newLine() throws IOException { - writer.write(lineSep); - } - - void writePackage() throws IOException { - writer.write("package org.eclipse.swt.tests.junit;"); - writer.write(lineSep); - writer.write(lineSep); - } - - void writeCopyRights() throws IOException { - writer.write( - "/*******************************************************************************" + lineSep + - " * Copyright (c) 2000, 2003 IBM Corporation and others." + lineSep + - " * All rights reserved. This program and the accompanying materials " + lineSep + - " * are made available under the terms of the Common Public License v1.0" + lineSep + - " * which accompanies this distribution, and is available at" + lineSep + - " * http://www.eclipse.org/legal/cpl-v10.html" + lineSep + - " * " + lineSep + - " * Contributors:" + lineSep + - " * IBM Corporation - initial API and implementation" + lineSep + - " *******************************************************************************/"); - writer.write(lineSep); - } - - void writeImports() throws IOException { - writer.write( - "import junit.framework.*;" + lineSep + - "import junit.textui.*;"); - writer.write(lineSep); - } - - void writeClassComments() throws IOException { - writer.write( - "/**" + lineSep + - " * Automated Test Suite for class " + clazz.getName() + lineSep + - " *" + lineSep + - " * @see " + clazz.getName() + lineSep + - " */" - ); - writer.write(lineSep); - } - - boolean hasSwtJunitSuperClass(Class clazz) { - Class superClass = clazz.getSuperclass(); - if (superClass == null) return false; - String packageName = superClass.getPackage().getName(); - if (!packageName.startsWith("org.eclipse.swt")) return false; - if (!filterClass(superClass)) return false; - return true; - } - - String getSwtJunitSuperClassName(Class clazz) { - String defaultClass = "SwtTestCase"; - Class superClass = clazz.getSuperclass(); - if (superClass == null) return defaultClass; - String packageName = superClass.getPackage().getName(); - if (!packageName.startsWith("org.eclipse.swt")) return defaultClass; - if (!filterClass(superClass)) return defaultClass; - return getClassName(superClass); - } - - void writeClassDeclaration() throws IOException { - String name = getClassName(clazz); - String superClassName = getSwtJunitSuperClassName(clazz); - writer.write( - "public class " + name + " extends " + superClassName +" {" - ); - writer.write(lineSep); - } - - void writeConstructor() throws IOException { - String name = getClassName(clazz); - writer.write(
"public " + name + "(String name) {" + lineSep + - " super(name);" + lineSep + - "}" - ); - writer.write(lineSep); - } - - void writeMain() throws IOException { - writer.write( - "public static void main(String[] args) {" + lineSep + - " TestRunner.run(suite());" + lineSep + - "}" - ); - writer.write(lineSep); - } - - void writeSetUp() throws IOException { - writer.write( - "protected void setUp() {" - ); - writer.write(lineSep); - if (hasSwtJunitSuperClass(clazz)) { - writer.write(" super.setUp();"); - writer.write(lineSep); - } - writer.write("}"); - writer.write(lineSep); - } - - void writeTearDown() throws IOException { - writer.write( - "protected void tearDown() {" - ); - writer.write(lineSep); - if (hasSwtJunitSuperClass(clazz)) { - writer.write(" super.tearDown();"); - writer.write(lineSep); - } - writer.write("}"); - writer.write(lineSep); - } - - void writeMethods() throws IOException { - Constructor[] constructors = getFilteredConstructors(clazz); - for (int i = 0; i < constructors.length; i++) { - writeMethod(constructors[i]); - if (i < constructors.length - 1) writer.write(lineSep); - } - - Method[] methods = getFilteredMethods(clazz); - if (constructors.length > 0 && methods.length > 0) writer.write(lineSep); - for (int i = 0; i < methods.length; i++) { - writeMethod(methods[i]); - if (i < methods.length - 1) writer.write(lineSep); - } - } - - void writeMethod(Constructor constructor) throws IOException { - String name = getMethodName(constructor); - writer.write( - "public void " + name + "() {" + lineSep + - " warnUnimpl(\"Test " + name + " not written\");" + lineSep + - "}" - ); - writer.write(lineSep); - incrementCounter(); - } - - void writeMethod(Method method) throws IOException { - String name = getMethodName(method); - writer.write( - "public void " + name + "() {" + lineSep + - " warnUnimpl(\"Test " + name + " not written\");" + lineSep + - "}" - ); - writer.write(lineSep); - incrementCounter(); - } - - void writeSuite() throws IOException { - String name = getClassName(clazz); - writer.write( - "public static Test suite() {" + lineSep + - " TestSuite suite = new TestSuite();" + lineSep + - " java.util.Vector methodNames = methodNames();" + lineSep + - " java.util.Enumeration e = methodNames.elements();" + lineSep + - " while (e.hasMoreElements()) {" + lineSep + - " suite.addTest(new " + name + "((String)e.nextElement()));" + lineSep + - " }" + lineSep + - " return suite;" + lineSep + - "}" - ); - writer.write(lineSep); - } - - void writeMethodNames() throws IOException { - writer.write( - "public static java.util.Vector methodNames() {" + lineSep + - " java.util.Vector methodNames = new java.util.Vector();" - ); - writer.write(lineSep); - Constructor[] constructors = getFilteredConstructors(clazz); - for (int i = 0; i < constructors.length; i++) { - String name = getMethodName(constructors[i]); - writer.write( - " methodNames.addElement(\"" + name + "\");" - ); - writer.write(lineSep); - } - Method[] methods = getFilteredMethods(clazz); - for (int i = 0; i < methods.length; i++) { - String name = getMethodName(methods[i]); - writer.write( - " methodNames.addElement(\"" + name + "\");" - ); - writer.write(lineSep); - } - if (hasSwtJunitSuperClass(clazz)) { - String superClassName = getSwtJunitSuperClassName(clazz); - writer.write(" methodNames.addAll(" + superClassName + ".methodNames()); // add superclass method names"); - writer.write(lineSep); - } - writer.write( - " return methodNames;" + lineSep + - "}" - ); - writer.write(lineSep); - } - - void writeRunTest() throws IOException { - writer.write( - "protected void runTest() throws Throwable {" - ); - writer.write(lineSep); - Constructor[] constructors = getFilteredConstructors(clazz); - Method[] methods = getFilteredMethods(clazz); - for (int i = 0; i < constructors.length + methods.length; i++) { - if (i == 0) writer.write(" if"); else writer.write(" else if"); - String name = i < constructors.length ? getMethodName(constructors[i]) : getMethodName(methods[i - constructors.length]); - writer.write( - " (getName().equals(\"" + name + "\")) " + name + "();" - ); - writer.write(lineSep); - } - if (hasSwtJunitSuperClass(clazz)) { - if (constructors.length + methods.length > 0) { - writer.write(" else "); - } else { - writer.write(" "); - } - writer.write("super.runTest();"); - writer.write(lineSep); - } - writer.write("}"); - writer.write(lineSep); - } - - void writeClassClosure() throws IOException { - writer.write("}"); - writer.write(lineSep); - } - } - - public class DiffClass { - /* the newClass has been added */ - public static final int NEW = 1; - /* the oldClass has been removed */ - public static final int REMOVED = 2; - /* the removedMethods from oldClass have been removed (if any) - * the newMethods from newClass have been added - */ - public static final int MODIFIED = 3; - - int type; - Class oldClass; - Class newClass; - Method[] removedMethods; - Method[] newMethods; - Constructor[] removedConstructors; - Constructor[] newConstructors; - - public DiffClass(int type, - Class oldClass, Class newClass, - Method[] removedMethods, Method[] newMethods, - Constructor[] removedConstructors, Constructor[] newConstructors) { - this.type = type; - this.oldClass = oldClass; - this.newClass = newClass; - this.removedMethods = removedMethods; - this.newMethods = newMethods; - this.removedConstructors = removedConstructors; - this.newConstructors = newConstructors; - } - - public String toString() { - switch (type) { - case NEW: { - return "NEW: " + getClassName(newClass); - } - case REMOVED: { - return "REMOVED: " + getClassName(oldClass); - } - case MODIFIED: { - String string = "MODIFIED: " + getClassName(oldClass); - if (removedConstructors != null) { - string += "\r\n\t" + removedConstructors.length + " constructor(s) removed"; - for (int i = 0; i < removedConstructors.length; i++) { - string += "\r\n\t" + getMethodName(removedConstructors[i]); - } - } - - if (newConstructors != null) { - string += "\r\n\t" + newConstructors.length + " constructor(s) added"; - for (int i = 0; i < newConstructors.length; i++) { - string += "\r\n\t" + getMethodName(newConstructors[i]); - } - } - if (removedMethods != null) { - string += "\r\n\t" + removedMethods.length + " method(s) removed"; - for (int i = 0; i < removedMethods.length; i++) { - string += "\r\n\t" + getMethodName(removedMethods[i]); - } - } - - if (newMethods != null) { - string += "\r\n\t" + newMethods.length + " method(s) added"; - for (int i = 0; i < newMethods.length; i++) { - string += "\r\n\t" + getMethodName(newMethods[i]); - } - } - return string; - } - default: { - return "invalid DiffClass "+type; - } - } - } - } - - public class SwtDiff { - Class[] oldClasses, newClasses; - /* removed[i] true means oldClasses[i] has been removed */ - boolean[] removed; - /* added[i] true means newClasses[i] has been added */ - boolean[] added; - /* old2New[i] == j >= 0 means oldClasses[i] corresponds to newClasses[j] */ - int[] old2New; - int[] new2Old; - Vector diffs = new Vector(); - - public SwtDiff(Vector oldClasses, Vector newClasses) { - Enumeration oldClassesEnum = oldClasses.elements(); - this.oldClasses = new Class[oldClasses.size()]; - int cnt = 0; - while (oldClassesEnum.hasMoreElements()) { - this.oldClasses[cnt++] = (Class)oldClassesEnum.nextElement(); - } - - Enumeration newClassesEnum = newClasses.elements(); - this.newClasses = new Class[newClasses.size()]; - cnt = 0; - while (newClassesEnum.hasMoreElements()) { - this.newClasses[cnt++] = (Class)newClassesEnum.nextElement(); - } - old2New = new int[this.oldClasses.length]; - new2Old = new int[this.newClasses.length]; - } - - public void compute() { - compareClasses(); - createClassDiff(); - outputClassDiff(); - } - - void compareClasses() { - for (int i = 0; i < oldClasses.length; i++) { - old2New[i] = -1; - for (int j = 0; j < newClasses.length; j++) { - if (oldClasses[i].getName().equals(newClasses[j].getName())) { - old2New[i] = j; - } - } - } - - for (int i = 0; i < newClasses.length; i++) { - new2Old[i] = -1; - for (int j = 0; j < oldClasses.length; j++) { - if (newClasses[i].getName().equals(oldClasses[j].getName())) { - new2Old[i] = j; - } - } - } - } - - void createClassDiff() { - for (int i = 0; i < old2New.length; i++) { - if (old2New[i] < 0) { - /* Found a class which has been removed */ - DiffClass diff = new DiffClass( - DiffClass.REMOVED, - oldClasses[i], - null, - null, - null, - null, - null); - diffs.add(diff); - } else { - /* Found a class which is either identical or which contains - * modified methods - */ - Class oldClass = oldClasses[i]; - Class newClass = newClasses[old2New[i]]; - Method[] removedMethods = getRemovedMethods(oldClass, newClass); - Method[] addedMethods = getAddedMethods(oldClass, newClass); - Constructor[] removedConstructors = getRemovedConstructors(oldClass, newClass); - Constructor[] addedConstructors = getAddedConstructors(oldClass, newClass); - if (removedMethods != null || addedMethods != null || - removedConstructors != null || addedConstructors != null) { - DiffClass diff = new DiffClass( - DiffClass.MODIFIED, - oldClass, - newClass, - removedMethods, - addedMethods, - removedConstructors, - addedConstructors - ); - diffs.add(diff); - } - } - } - for (int i = 0; i < new2Old.length; i++) { - if (new2Old[i] < 0) { - /* Found a class which has been added */ - DiffClass diff = new DiffClass( - DiffClass.NEW, - null, - newClasses[i], - null, - null, - null, - null - ); - diffs.add(diff); - } - } - } - - Method[] getRemovedMethods(Class oldClass, Class newClass) { - Method[] oldMethods = getFilteredMethods(oldClass); - Method[] newMethods = getFilteredMethods(newClass); - - int count = 0; - for (int i = 0; i < oldMethods.length; i++) { - String oldName = getMethodName(oldMethods[i]); - boolean removed = true; - for (int j = 0; j < newMethods.length; j++) { - String newName = getMethodName(newMethods[j]); - if (oldName.equals(newName)) { - removed = false; - break; - } - } - if (removed) oldMethods[count++] = oldMethods[i]; - } - if (count == 0) return null; - Method[] result = new Method[count]; - System.arraycopy(oldMethods, 0, result, 0, count); - return result; - } - - Method[] getAddedMethods(Class oldClass, Class newClass) { - return getRemovedMethods(newClass, oldClass); - } - - Constructor[] getRemovedConstructors(Class oldClass, Class newClass) { - Constructor[] oldConstructors = getFilteredConstructors(oldClass); - Constructor[] newConstructors = getFilteredConstructors(newClass); - - int count = 0; - for (int i = 0; i < oldConstructors.length; i++) { - String oldName = getMethodName(oldConstructors[i]); - boolean removed = true; - for (int j = 0; j < newConstructors.length; j++) { - String newName = getMethodName(newConstructors[j]); - if (oldName.equals(newName)) { - removed = false; - break; - } - } - if (removed) oldConstructors[count++] = oldConstructors[i]; - } - if (count == 0) return null; - Constructor[] result = new Constructor[count]; - System.arraycopy(oldConstructors, 0, result, 0, count); - return result; - } - - Constructor[] getAddedConstructors(Class oldClass, Class newClass) { - return getRemovedConstructors(newClass, oldClass); - } - - void outputClassDiff() { - Enumeration enum = diffs.elements(); - int changes = 0; - while (enum.hasMoreElements()) { - DiffClass diff = (DiffClass)enum.nextElement(); - System.out.println("["+changes+"] "+ diff); - changes++; - } - } - } -} diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.bmp b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.bmp Binary files differdeleted file mode 100644 index ec7d509e74..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.bmp +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.gif b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.gif Binary files differdeleted file mode 100644 index 4ee8b5a4a6..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.gif +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.jpg b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.jpg Binary files differdeleted file mode 100644 index 173ea1bf55..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.jpg +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.png b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.png Binary files differdeleted file mode 100644 index bb5d7eb843..0000000000 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/target.png +++ /dev/null diff --git a/tests/org.eclipse.swt.tests/about.html b/tests/org.eclipse.swt.tests/about.html deleted file mode 100644 index 9db411aab9..0000000000 --- a/tests/org.eclipse.swt.tests/about.html +++ /dev/null @@ -1,30 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<html> -<head> -<title>About</title> -<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>20th June, 2002</p> -<h3>License</h3> -<p>Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the -Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>. -For purposes of the CPL, "Program" will mean the Content.</p> - -<h3>Contributions</h3> - -<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise -made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such -Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p> - -<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or -other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the -host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available -to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also -providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of -the CPL.</p> - -</body> -</html>
\ No newline at end of file diff --git a/tests/org.eclipse.swt.tests/build.properties b/tests/org.eclipse.swt.tests/build.properties deleted file mode 100644 index 3ea73a8282..0000000000 --- a/tests/org.eclipse.swt.tests/build.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2003 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Common Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/cpl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -source.swttests.jar=JUnit Tests/ - -bin.includes=*.jar,plugin.xml,test.xml,about.html,plugin.properties,data/
\ No newline at end of file diff --git a/tests/org.eclipse.swt.tests/data/browser3.html b/tests/org.eclipse.swt.tests/data/browser3.html deleted file mode 100644 index 01ea43ea8a..0000000000 --- a/tests/org.eclipse.swt.tests/data/browser3.html +++ /dev/null @@ -1,6 +0,0 @@ -<html> -<script type="text/javascript">window.open("http://www.eclipse.org", "Dialog")</script> -<body> -This test uses javascript to open a new window. -</body> -</html> diff --git a/tests/org.eclipse.swt.tests/data/browser4.html b/tests/org.eclipse.swt.tests/data/browser4.html deleted file mode 100644 index 77e4bf506a..0000000000 --- a/tests/org.eclipse.swt.tests/data/browser4.html +++ /dev/null @@ -1,10 +0,0 @@ -<html> -<script type="text/javascript"> - w = window.open("browser4a.html", "Dialog"); - setTimeout("w.close()", 5000); -</script> -<body> -<p>This test uses javascript. -<p>It opens a new window. Sets a timer. Then close the new window when the timer expires. -</body> -</html> diff --git a/tests/org.eclipse.swt.tests/data/browser4a.html b/tests/org.eclipse.swt.tests/data/browser4a.html deleted file mode 100644 index 7e3585827c..0000000000 --- a/tests/org.eclipse.swt.tests/data/browser4a.html +++ /dev/null @@ -1,14 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html> -<head> - <meta http-equiv="content-type" - content="text/html; charset=ISO-8859-1"> - <title>simple page</title> -</head> -<body style="background-color: rgb(255, 204, 0); color: rgb(0, 0, 0);" - link="#0000ee" alink="#0000ee" vlink="#551a8b"> -<div style="text-align: center;"><big><big><big><big><big><big><span - style="font-weight: bold;">This is a simple page</span></big></big></big></big></big></big><br> -</div> -</body> -</html> diff --git a/tests/org.eclipse.swt.tests/data/browser5.html b/tests/org.eclipse.swt.tests/data/browser5.html deleted file mode 100644 index dc5bfce7fd..0000000000 --- a/tests/org.eclipse.swt.tests/data/browser5.html +++ /dev/null @@ -1,48 +0,0 @@ -<html> -<script type="text/javascript"> - var win; - function testOpen() { - win = window.open('javascript:"<h1>Simple New Window</h2>"', "", "left=10,top=200,height=100,width=300"); - } - function testResizeTo() { - win.resizeTo(600,800); - } - function testMoveTo() { - win.moveTo(200,100); - } - function testMoveBy() { - win.moveBy(2,2); - } - function testScrollBy() { - win.scrollBy(1,20); - } - function testResizeBy() { - win.resizeBy(2,3); - } - function testClose() { - win.close(); - } - - win1 = window.open('javascript:"<h1>Simple New Window 1</h2><p>bounds: left=10,top=200,height=100,width=300<p>"', "", "left=10,top=200,height=100,width=300"); - win2 = window.open('javascript:"<h1>Simple New Window 2</h2><p>bounds: left=10,top=200<p>"', "", "left=10,top=200"); - win3 = window.open('javascript:"<h1>Simple New Window 3</h2><p>bounds: height=100,width=300<p>"', "", "height=100,width=300"); - win4 = window.open('javascript:"<h1>Simple New Window 4</h2><p>bounds: not specified<p>"', "", ""); - - setTimeout("win1.close();win2.close();win3.close();win4.close()", 5000); - -</script> - -<form> - <input type="button" VALUE="window.open" onClick="testOpen()"> - <input type="button" VALUE="resizeTo" onClick="testResizeTo()"> - <input type="button" VALUE="moveTo" onClick="testMoveTo()"> - <input type="button" VALUE="moveBy" onClick="testMoveBy()"> - <input type="button" VALUE="scrollBy" onClick="testScrollBy()"> - <input type="button" VALUE="resizeBy" onClick="testResizeBy()"> - <input type="button" VALUE="close" onClick="testClose()"> -</FORM> -<body> -<p>This test uses javascript. -<p>It opens a new window. Sets a timer. Then close the new window when the timer expires. -</body> -</html> diff --git a/tests/org.eclipse.swt.tests/data/browser6.html b/tests/org.eclipse.swt.tests/data/browser6.html deleted file mode 100644 index 83275034fd..0000000000 --- a/tests/org.eclipse.swt.tests/data/browser6.html +++ /dev/null @@ -1,6 +0,0 @@ -<html> -<title>This is a test title that must be carefully checked when that page is loaded</title> -<body> -This test is used to automatically check the content of the title tag. -</body> -</html>
\ No newline at end of file diff --git a/tests/org.eclipse.swt.tests/plugin.properties b/tests/org.eclipse.swt.tests/plugin.properties deleted file mode 100644 index dc0ac13ba5..0000000000 --- a/tests/org.eclipse.swt.tests/plugin.properties +++ /dev/null @@ -1,12 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2003 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Common Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/cpl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -pluginName = Tests -providerName = Eclipse.org
\ No newline at end of file diff --git a/tests/org.eclipse.swt.tests/plugin.xml b/tests/org.eclipse.swt.tests/plugin.xml deleted file mode 100644 index df746b8036..0000000000 --- a/tests/org.eclipse.swt.tests/plugin.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- File written by PDE 1.0 --> -<plugin - id="org.eclipse.swt.tests" - name="%pluginName" - provider-name="%providerName" - version="2.1.0"> - -<requires> - <import plugin="org.junit"/> - <import plugin="org.eclipse.swt"/> -</requires> - -<runtime> - <library name="swttests.jar"> - <export name="*"/> - <packages prefixes="org.eclipse.swt.tests"/> - </library> - </runtime> -</plugin> diff --git a/tests/org.eclipse.swt.tests/test.xml b/tests/org.eclipse.swt.tests/test.xml deleted file mode 100644 index 23866ef0a7..0000000000 --- a/tests/org.eclipse.swt.tests/test.xml +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0"?> - -<project name="testsuite" default="run" basedir="."> - <!-- This file is intended to be more tightly coupled with the --> - <!-- org.eclipse.ui plugin, for testing. --> - - <!-- The property ${eclipse-home} should be passed into this script --> - - <!-- sets the properties eclipse-home, and library-file --> - <property name="eclipse-home" value="${basedir}/../.."/> - <property name="plugin-name" value="org.eclipse.swt.tests"/> - <property name="plugin-path" value="${eclipse-home}/plugins/${org.eclipse.swt.tests}"/> - <property name="library-file" value="${eclipse-home}/plugins/org.eclipse.test/library.xml"/> - - <!-- This target holds all initialization code that needs to be done for --> - <!-- all tests that are to be run. Initialization for individual tests --> - <!-- should be done within the body of the suite target. --> - <target name="init"> - <tstamp/> - <delete> - <fileset dir="${eclipse-home}" includes="org*.xml"/> - </delete> - </target> - - <!-- This target defines the tests that need to be run. --> - <target name="suite"> - <property name="data" value="${eclipse-home}/swt_sniff_folder"/> - <delete dir="${location1}" quiet="true"/> - <!-- Run all SWT tests on Windows. Run only Browser tests otherwise. --> - <condition property="class-tests" value="org.eclipse.swt.tests.junit.AllBrowserTests"> - <os family="unix"/> - </condition> - <condition property="class-tests" value="org.eclipse.swt.tests.junit.AllTests"> - <os family="windows"/> - </condition> - <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}"> - <property name="data-dir" value="${data}"/> - <property name="plugin-name" value="${plugin-name}"/> - <property name="classname" value="${class-tests}"/> - </ant> - </target> - - <!-- This target holds code to cleanup the testing environment after the tests --> - <!-- have been run. You can use this to delete temporary files that are created. --> - <target name="cleanup"> - </target> - - <!-- This target runs the test suite. Any actions that need to happen after all --> - <!-- the tests have been run should go here. --> - <target name="run" depends="init,suite,cleanup"> - <ant target="collect" antfile="${library-file}" dir="${eclipse-home}"> - <property name="includes" value="org*.xml"/> - <property name="output-file" value="${plugin-name}.xml"/> - </ant> - </target> - -</project> |