diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/Abstract4diacUITests.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/Abstract4diacUITests.java index 8dba174fb8..c55d3c784d 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/Abstract4diacUITests.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/Abstract4diacUITests.java @@ -33,10 +33,10 @@ import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.fordiac.ide.application.editparts.FBEditPart; import org.eclipse.fordiac.ide.application.editparts.SubAppForFBNetworkEditPart; +import org.eclipse.fordiac.ide.test.ui.helpers.StringNamesHelper; import org.eclipse.fordiac.ide.test.ui.swtbot.SWT4diacGefBot; import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefEditor; import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefViewer; -import org.eclipse.fordiac.ide.ui.FordiacMessages; import org.eclipse.gef.ConnectionEditPart; import org.eclipse.gef.EditPart; import org.eclipse.gef.GraphicalEditPart; @@ -68,127 +68,6 @@ public class Abstract4diacUITests { protected static SWT4diacGefBot bot; - // alphabetical order of static variable names - protected static final String ADAPTER = "Adapter"; //$NON-NLS-1$ - protected static final String APP = "App"; //$NON-NLS-1$ - protected static final String COMMENT = "Comment:"; //$NON-NLS-1$ - protected static final String CANCEL = "Cancel"; //$NON-NLS-1$ - protected static final String CREATE_INPUT_EVENT = "Create Input Event"; //$NON-NLS-1$ - protected static final String CREATE_OUTPUT_EVENT = "Create Output Event"; //$NON-NLS-1$ - protected static final String CREATE_DATA_INPUT = "Create Data Input"; //$NON-NLS-1$ - protected static final String CREATE_DATA_OUTPUT = "Create Data Output"; //$NON-NLS-1$ - protected static final String DATA = "Data"; //$NON-NLS-1$ - protected static final String DELETE = "Delete"; //$NON-NLS-1$ - protected static final String DELETE_PROJECT_WARNING = "Delete project contents on disk (cannot be undone)"; //$NON-NLS-1$ - protected static final String DELETE_RESOURCES = "Delete Resources"; //$NON-NLS-1$ - protected static final String DOT_BUTTON = "..."; //$NON-NLS-1$ - protected static final String EDIT = "Edit"; //$NON-NLS-1$ - protected static final String ELEMENTARY_TYPE = "Elementary Types"; //$NON-NLS-1$ - protected static final String EVENT = "Event"; //$NON-NLS-1$ - protected static final String EVENTS_NODE = "events"; //$NON-NLS-1$ - protected static final String E_CTUD_FB = "E_CTUD"; //$NON-NLS-1$ - protected static final String E_CTUD_TREE_ITEM = E_CTUD_FB + " [Event-Driven Up-Down Counter]"; //$NON-NLS-1$ - protected static final String E_CYCLE_FB = "E_CYCLE"; //$NON-NLS-1$ - protected static final String E_CYCLE_TREE_ITEM = "E_CYCLE [Peroidic event generator]"; //$NON-NLS-1$ - protected static final String E_DELAY_FB = "E_DELAY"; //$NON-NLS-1$ - protected static final String E_DEMUX_FB = "E_DEMUX"; //$NON-NLS-1$ - protected static final String E_DEMUX_TREE_ITEM = E_DEMUX_FB + " [Event demultiplexor]"; //$NON-NLS-1$ - protected static final String E_D_FF_FB = "E_D_FF"; //$NON-NLS-1$ - protected static final String E_D_FF_TREE_ITEM = E_D_FF_FB + " [Data latch (d) flip flop]"; //$NON-NLS-1$ - protected static final String E_N_TABLE_FB = "E_N_TABLE"; //$NON-NLS-1$ - protected static final String E_N_TABLE_TREE_ITEM = "E_N_TABLE [Generation of a finite train of sperate events]"; //$NON-NLS-1$ - protected static final String E_SELECT_FB = "E_SELECT"; //$NON-NLS-1$ - protected static final String E_SELECT_TREE_ITEM = E_SELECT_FB - + " [selection between two events based on boolean input G]"; - protected static final String E_SR_FB = "E_SR"; //$NON-NLS-1$ - protected static final String E_SR_TREE_ITEM = E_SR_FB + " [Event-driven bistable]"; //$NON-NLS-1$ - protected static final String E_SWITCH_FB = "E_SWITCH"; //$NON-NLS-1$ - protected static final String E_SWITCH_TREE_ITEM = "E_SWITCH [Switching (demultiplexing) an event based on boolean input G]"; //$NON-NLS-1$ - protected static final String E_TABLE_CTRL_FB = "E_TABLE_CTRL"; //$NON-NLS-1$ - protected static final String E_TABLE_CTRL_TREE_ITEM = "E_TABLE_CTRL [Support function block for E_TABLE]"; //$NON-NLS-1$ - protected static final String FBT_TEST_PROJECT1 = "FBTTestProject1"; //$NON-NLS-1$ - protected static final String FBT_TEST_PROJECT2 = "FBTTestProject2"; //$NON-NLS-1$ - protected static final String FBT_TEST_PROJECT3 = "FBTTestProject3"; //$NON-NLS-1$ - protected static final String FBT_TEST_PROJECT4 = "FBTTestProject4"; //$NON-NLS-1$ - protected static final String FILE = "File"; //$NON-NLS-1$ - protected static final String FINISH = "Finish"; //$NON-NLS-1$ - protected static final String FORBIDDEN_TYPE_NAME = "00_fbtype"; //$NON-NLS-1$ - protected static final String FORDIAC_IDE_PROJECT = "4diac IDE Project..."; //$NON-NLS-1$ - protected static final String F_SUB = "F_SUB"; //$NON-NLS-1$ - protected static final String GO_TO_CHILD = "Go To Child"; //$NON-NLS-1$ - protected static final String GO_TO_PARENT = "Go To Parent"; //$NON-NLS-1$ - protected static final String INITIAL_APPLICATION_NAME_LABEL = "Initial application name"; //$NON-NLS-1$ - protected static final String INITIAL_SYSTEM_NAME_LABEL = "Initial system name"; //$NON-NLS-1$ - protected static final String INSERT_FB = "Insert FB"; //$NON-NLS-1$ - protected static final String INTERFACE = "Interface"; //$NON-NLS-1$ - protected static final String NAME_LABEL = "Name:"; //$NON-NLS-1$ - protected static final String NAVIGATE = "Navigate"; //$NON-NLS-1$ - protected static final String NEW = "New"; //$NON-NLS-1$ - protected static final String NEW_4DIAC_PROJECT = "New 4diacProject"; //$NON-NLS-1$ - protected static final String NEW_SUBAPPLICATION = "New subapplication"; //$NON-NLS-1$ - protected static final String NEW_TYPE = FordiacMessages.NewType; - protected static final String OK = "OK"; //$NON-NLS-1$ - protected static final String PACKAGE_NAME1 = "pkg1"; //$NON-NLS-1$ - protected static final String PACKAGE_NAME2 = "pkg2"; //$NON-NLS-1$ - protected static final String PACKAGE_NAME = PACKAGE_NAME1 + "::" + PACKAGE_NAME2; //$NON-NLS-1$ - protected static final String PACKAGE_NAME_LABEL = FordiacMessages.Package + ":"; //$NON-NLS-1$ - protected static final String PARENT_FOLDER_NAME_LABEL = "Enter or select the parent folder:"; //$NON-NLS-1$ - protected static final String PROJECT_NAME = "UiTestProject"; //$NON-NLS-1$ - protected static final String PROJECT_NAME_APP = PROJECT_NAME + "App"; //$NON-NLS-1$ - protected static final String PROJECT_NAME_TREE_ITEM = PROJECT_NAME + " []"; //$NON-NLS-1$ - protected static final String PROJECT_NAME_LABEL = "Project name:"; //$NON-NLS-1$ - protected static final String PROPERTIES_TITLE = "Properties"; //$NON-NLS-1$ - protected static final String SELECT_ALL = "Select All"; //$NON-NLS-1$ - protected static final String SELECT_TYPE_LABEL = FordiacMessages.SelectType + ":"; //$NON-NLS-1$ - protected static final String SOURCE = "Source"; //$NON-NLS-1$ - protected static final String SUBAPP = "SubApp"; //$NON-NLS-1$ - protected static final String STRUCT = "Struct"; //$NON-NLS-1$ - protected static final String SYSTEM_EXPLORER_ID = "org.eclipse.fordiac.ide.systemmanagement.ui.systemexplorer"; //$NON-NLS-1$ - protected static final String SYSTEM_EXPLORER_LABEL = "System Explorer"; //$NON-NLS-1$ - protected static final String TEST_PARENT_FOLDER = "TestParentProject"; //$NON-NLS-1$ - protected static final String TOOLBAR_BUTTON_ZOOM_FIT_PAGE = "Zoom fit Page"; //$NON-NLS-1$ - protected static final String TEST_COMMENT = "Request from ideal Socket"; //$NON-NLS-1$ - protected static final String TYPE_LABEL = "Type:"; //$NON-NLS-1$ - protected static final String TYPE_LIBRARY_NODE = "Type Library"; //$NON-NLS-1$ - protected static final String TYPE_NAME_LABEL = FordiacMessages.TypeName + ":"; //$NON-NLS-1$ - protected static final String TYPE_PROJECT = "Type..."; //$NON-NLS-1$ - protected static final String TYPE_SELECTION = "Type Selection"; //$NON-NLS-1$ - protected static final String VAR_INOUT = "Var InOuts"; //$NON-NLS-1$ - protected static final String WITH = "With"; //$NON-NLS-1$ - - // FB pins and values - protected static final String ANY = "ANY"; //$NON-NLS-1$ - protected static final String START = "START"; //$NON-NLS-1$ - protected static final String STOP = "STOP"; //$NON-NLS-1$ - protected static final String D = "D"; //$NON-NLS-1$ - protected static final String DI1 = "DI1"; //$NON-NLS-1$ - protected static final String DO1 = "DO1"; //$NON-NLS-1$ - protected static final String G = "G"; //$NON-NLS-1$ - protected static final String N = "N"; //$NON-NLS-1$ - protected static final String Q = "Q"; //$NON-NLS-1$ - protected static final String R = "R"; //$NON-NLS-1$ - protected static final String S = "S"; //$NON-NLS-1$ - protected static final String CD = "CD"; //$NON-NLS-1$ - protected static final String CV = "CV"; //$NON-NLS-1$ - protected static final String DT = "DT"; //$NON-NLS-1$ - protected static final String EO = "EO"; //$NON-NLS-1$ - protected static final String EI = "EI"; //$NON-NLS-1$ - protected static final String EI1 = "EI1"; //$NON-NLS-1$ - protected static final String PV = "PV"; //$NON-NLS-1$ - protected static final String QD = "QD"; //$NON-NLS-1$ - protected static final String QU = "QU"; //$NON-NLS-1$ - protected static final String CLK = "CLK"; //$NON-NLS-1$ - protected static final String EO0 = "EO0"; //$NON-NLS-1$ - protected static final String EO1 = "EO1"; //$NON-NLS-1$ - protected static final String EO2 = "EO2"; //$NON-NLS-1$ - protected static final String DTO = "DTO"; //$NON-NLS-1$ - protected static final String IN1 = "IN1"; //$NON-NLS-1$ - protected static final String REQ = "REQ"; //$NON-NLS-1$ - protected static final String CLKO = "CLKO"; //$NON-NLS-1$ - protected static final String INIT = "INIT"; //$NON-NLS-1$ - protected static final String INT = "INT"; //$NON-NLS-1$ - protected static final String DEF_VAL = "T#0s"; //$NON-NLS-1$ - protected static final String NEW_VAL = "T#1s"; //$NON-NLS-1$ /** * Performs the necessary tasks to be able to perform the tests. @@ -214,13 +93,16 @@ protected static void beforeAll() { * PROJECT_NAME and is called from {@link #beforeAll() method beforeAll}. */ protected static void createProject() { - bot.menu(FILE).menu(NEW).menu(FORDIAC_IDE_PROJECT).click(); - final SWTBotShell shell = bot.shell(NEW_4DIAC_PROJECT); + bot.menu(StringNamesHelper.FILE).menu(StringNamesHelper.NEW).menu(StringNamesHelper.FORDIAC_IDE_PROJECT) + .click(); + final SWTBotShell shell = bot.shell(StringNamesHelper.NEW_4DIAC_PROJECT); shell.activate(); - bot.textWithLabel(PROJECT_NAME_LABEL).setText(PROJECT_NAME); - assertEquals(bot.textWithLabel(INITIAL_SYSTEM_NAME_LABEL).getText(), PROJECT_NAME); - assertEquals(bot.textWithLabel(INITIAL_APPLICATION_NAME_LABEL).getText(), PROJECT_NAME + APP); - bot.button(FINISH).click(); + bot.textWithLabel(StringNamesHelper.PROJECT_NAME_LABEL).setText(StringNamesHelper.PROJECT_NAME); + assertEquals(bot.textWithLabel(StringNamesHelper.INITIAL_SYSTEM_NAME_LABEL).getText(), + StringNamesHelper.PROJECT_NAME); + assertEquals(bot.textWithLabel(StringNamesHelper.INITIAL_APPLICATION_NAME_LABEL).getText(), + StringNamesHelper.PROJECT_NAME + StringNamesHelper.APP); + bot.button(StringNamesHelper.FINISH).click(); bot.waitUntil(shellCloses(shell)); } @@ -232,8 +114,8 @@ protected static void createProject() { */ protected static void dragAndDropEventsFB(final String fbName, final Point point) { final SWTBotTreeItem typeLibraryNode = expandTypeLibraryTreeItemInSystemExplorer(); - bot.waitUntil(treeItemHasNode(typeLibraryNode, EVENTS_NODE)); - final SWTBotTreeItem eventsNode = typeLibraryNode.getNode(EVENTS_NODE); + bot.waitUntil(treeItemHasNode(typeLibraryNode, StringNamesHelper.EVENTS_NODE)); + final SWTBotTreeItem eventsNode = typeLibraryNode.getNode(StringNamesHelper.EVENTS_NODE); eventsNode.select(); eventsNode.expand(); bot.waitUntil(treeItemHasNode(eventsNode, fbName)); @@ -242,7 +124,7 @@ protected static void dragAndDropEventsFB(final String fbName, final Point point eCycleNode.click(); // select application editor - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); final SWTBot4diacGefViewer viewer = (SWTBot4diacGefViewer) editor.getSWTBotGefViewer(); final SWTBotGefFigureCanvas canvas = viewer.getCanvas(); @@ -288,9 +170,9 @@ protected static boolean isSubAppNodeInSystemExplorerEmpty() { protected static void createSubappWithDragRectangle(final int fromXPosition, final int fromYPosition, final int toXPosition, final int toYPosition) { - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); editor.drag(fromXPosition, fromYPosition, toXPosition, toYPosition); - bot.menu(SOURCE).menu(NEW_SUBAPPLICATION).click(); + bot.menu(StringNamesHelper.SOURCE).menu(StringNamesHelper.NEW_SUBAPPLICATION).click(); } @@ -326,7 +208,7 @@ protected static void deleteFB(final SWTBot4diacGefEditor editor, final String F editor.setFocus(); final SWTBotGefEditPart fb = editor.getEditPart(FbInstanceName).parent(); fb.select().click(); - bot.menu(EDIT).menu(DELETE).click(); + bot.menu(StringNamesHelper.EDIT).menu(StringNamesHelper.DELETE).click(); } /** @@ -341,7 +223,7 @@ protected static void deleteFB(final SWTBot4diacGefEditor editor, final String F * @return SWTBot4diacGefViewer */ protected static SWTBot4diacGefViewer createConnection(final String pin1, final String pin2) { - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); final SWTBot4diacGefViewer viewer = (SWTBot4diacGefViewer) editor.getSWTBotGefViewer(); assertNotNull(viewer); @@ -371,7 +253,7 @@ protected static boolean checkIfConnectionCanBeFound(final String srcPinName, fi } protected static ConnectionEditPart findConnection(final String srcPinName, final String dstPinName) { - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); final SWTBot4diacGefViewer viewer = (SWTBot4diacGefViewer) editor.getSWTBotGefViewer(); final GraphicalViewer graphicalViewer = viewer.getGraphicalViewer(); @@ -490,7 +372,7 @@ protected static Rectangle getBoundsOfFB(final SWTBot4diacGefEditor editor, fina * @return editor The SWTBotGefEditor is returned */ protected static SWTBotGefEditor goToCompositeInstanceViewer(final String fb) { - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); final SWTBot4diacGefViewer viewer = (SWTBot4diacGefViewer) editor.getSWTBotGefViewer(); assertNotNull(viewer); @@ -512,14 +394,14 @@ protected static SWTBotGefEditor goToCompositeInstanceViewer(final String fb) { * @param typeLabel Name of the Type Label. */ protected static void createFBType(final String parentName, final String typeName, final String typeLabel) { - bot.menu(FILE).menu(NEW).menu(TYPE_PROJECT).click(); - final SWTBotShell shell = bot.shell(NEW_TYPE); + bot.menu(StringNamesHelper.FILE).menu(StringNamesHelper.NEW).menu(StringNamesHelper.TYPE_PROJECT).click(); + final SWTBotShell shell = bot.shell(StringNamesHelper.NEW_TYPE); shell.activate(); - bot.textWithLabel(TYPE_NAME_LABEL).setText(typeName); - bot.textWithLabel(PARENT_FOLDER_NAME_LABEL).setText(parentName); - assertEquals(bot.textWithLabel(TYPE_NAME_LABEL).getText(), typeName); - bot.tableWithLabel(SELECT_TYPE_LABEL).getTableItem(typeLabel).select(); - bot.button(FINISH).click(); + bot.textWithLabel(StringNamesHelper.TYPE_NAME_LABEL).setText(typeName); + bot.textWithLabel(StringNamesHelper.PARENT_FOLDER_NAME_LABEL).setText(parentName); + assertEquals(bot.textWithLabel(StringNamesHelper.TYPE_NAME_LABEL).getText(), typeName); + bot.tableWithLabel(StringNamesHelper.SELECT_TYPE_LABEL).getTableItem(typeLabel).select(); + bot.button(StringNamesHelper.FINISH).click(); bot.waitUntil(shellCloses(shell)); } @@ -529,13 +411,13 @@ protected static void createFBType(final String parentName, final String typeNam * @param typeName Name of the new type. */ protected static void deleteFBType(final String typeName) { - final SWTBotView systemExplorerView = bot.viewById(SYSTEM_EXPLORER_ID); + final SWTBotView systemExplorerView = bot.viewById(StringNamesHelper.SYSTEM_EXPLORER_ID); systemExplorerView.show(); final Composite systemExplorerComposite = (Composite) systemExplorerView.getWidget(); final Tree swtTree = bot.widget(WidgetMatcherFactory.widgetOfType(Tree.class), systemExplorerComposite); final SWTBotTree tree = new SWTBotTree(swtTree); - final SWTBotTreeItem parentItem = tree.getTreeItem(PROJECT_NAME); + final SWTBotTreeItem parentItem = tree.getTreeItem(StringNamesHelper.PROJECT_NAME); parentItem.expand(); SWTBotTreeItem projectItem = null; for (final SWTBotTreeItem item : parentItem.getItems()) { @@ -545,12 +427,12 @@ protected static void deleteFBType(final String typeName) { } } projectItem.select(); - bot.menu(EDIT).menu(DELETE).click(); + bot.menu(StringNamesHelper.EDIT).menu(StringNamesHelper.DELETE).click(); // the project deletion confirmation dialog - final SWTBotShell shell = bot.shell(DELETE_RESOURCES); + final SWTBotShell shell = bot.shell(StringNamesHelper.DELETE_RESOURCES); shell.activate(); - bot.button(OK).click(); + bot.button(StringNamesHelper.OK).click(); bot.waitUntil(shellCloses(shell)); final List nodeList = parentItem.getNodes(); assertFalse(nodeList.contains(typeName)); @@ -563,7 +445,7 @@ protected static void deleteFBType(final String typeName) { * @param typeName Name of the new type. */ protected static void openFBTypeInEditor(final String parentName, final String typeName) { - final SWTBotView systemExplorerView = bot.viewByTitle(SYSTEM_EXPLORER_LABEL); + final SWTBotView systemExplorerView = bot.viewByTitle(StringNamesHelper.SYSTEM_EXPLORER_LABEL); systemExplorerView.show(); final Composite systemExplorerComposite = (Composite) systemExplorerView.getWidget(); final Tree swtTree = bot.widget(WidgetMatcherFactory.widgetOfType(Tree.class), systemExplorerComposite); @@ -590,7 +472,7 @@ protected static void deletePin(final SWTBot4diacGefEditor editor, final String final SWTBotGefEditPart pin = editor.getEditPart(pinName); assertNotNull(pin); pin.click(); - editor.clickContextMenu(DELETE); + editor.clickContextMenu(StringNamesHelper.DELETE); assertNull(editor.getEditPart(pinName)); } @@ -610,17 +492,17 @@ protected static void createConnectionWithinFBTypeWithPropertySheet(final String final SWTBotGefEditPart port2 = editor.getEditPart(pin2); port2.click(); - SWTBot propertiesBot = bot.viewByTitle(PROPERTIES_TITLE).bot(); - bot.viewByTitle(PROPERTIES_TITLE).setFocus(); + SWTBot propertiesBot = bot.viewByTitle(StringNamesHelper.PROPERTIES_TITLE).bot(); + bot.viewByTitle(StringNamesHelper.PROPERTIES_TITLE).setFocus(); - if (PropertySheetHelper.selectPropertyTabItem(EVENT, propertiesBot)) { - propertiesBot = selectTabFromInterfaceProperties(EVENT); + if (PropertySheetHelper.selectPropertyTabItem(StringNamesHelper.EVENT, propertiesBot)) { + propertiesBot = selectTabFromInterfaceProperties(StringNamesHelper.EVENT); } else { - propertiesBot = selectTabFromInterfaceProperties(DATA); + propertiesBot = selectTabFromInterfaceProperties(StringNamesHelper.DATA); } // Find the group with the label "With" - final SWTBotTable table = propertiesBot.tableInGroup(WITH); + final SWTBotTable table = propertiesBot.tableInGroup(StringNamesHelper.WITH); table.select(pin1); table.getTableItem(pin1).toggleCheck(); @@ -644,17 +526,17 @@ protected static void removeConnectionWithinFBTypeWithPropertySheet(final String final SWTBotGefEditPart port2 = editor.getEditPart(pin2); port2.click(); - SWTBot propertiesBot = bot.viewByTitle(PROPERTIES_TITLE).bot(); - bot.viewByTitle(PROPERTIES_TITLE).setFocus(); + SWTBot propertiesBot = bot.viewByTitle(StringNamesHelper.PROPERTIES_TITLE).bot(); + bot.viewByTitle(StringNamesHelper.PROPERTIES_TITLE).setFocus(); - if (PropertySheetHelper.selectPropertyTabItem(EVENT, propertiesBot)) { - propertiesBot = selectTabFromInterfaceProperties(EVENT); + if (PropertySheetHelper.selectPropertyTabItem(StringNamesHelper.EVENT, propertiesBot)) { + propertiesBot = selectTabFromInterfaceProperties(StringNamesHelper.EVENT); } else { - propertiesBot = selectTabFromInterfaceProperties(DATA); + propertiesBot = selectTabFromInterfaceProperties(StringNamesHelper.DATA); } // Find the group with the label "With" - final SWTBotTable table = propertiesBot.tableInGroup(WITH); + final SWTBotTable table = propertiesBot.tableInGroup(StringNamesHelper.WITH); table.select(pin1); table.getTableItem(pin1).toggleCheck(); @@ -669,13 +551,13 @@ protected static void removeConnectionWithinFBTypeWithPropertySheet(final String */ protected static SWTBot selectTabFromInterfaceProperties(final String tabName) { // Interface tab - final SWTBotCTabItem interfaceTab = bot.cTabItem(INTERFACE); + final SWTBotCTabItem interfaceTab = bot.cTabItem(StringNamesHelper.INTERFACE); interfaceTab.activate(); interfaceTab.setFocus(); // Properties tab access - final SWTBot propertiesBot = bot.viewByTitle(PROPERTIES_TITLE).bot(); - bot.viewByTitle(PROPERTIES_TITLE).setFocus(); + final SWTBot propertiesBot = bot.viewByTitle(StringNamesHelper.PROPERTIES_TITLE).bot(); + bot.viewByTitle(StringNamesHelper.PROPERTIES_TITLE).setFocus(); // Tabs access inside property sheet PropertySheetHelper.selectPropertyTabItem(tabName, propertiesBot); @@ -686,7 +568,7 @@ protected static SWTBot selectTabFromInterfaceProperties(final String tabName) { * Returns from CompositeinstanceViewer back to Editing Area */ protected static void returnToEditingArea() { - bot.menu(NAVIGATE).menu(GO_TO_PARENT).click(); + bot.menu(StringNamesHelper.NAVIGATE).menu(StringNamesHelper.GO_TO_PARENT).click(); } /** @@ -694,21 +576,21 @@ protected static void returnToEditingArea() { */ @AfterAll protected static void deleteProject() { - final SWTBotView systemExplorerView = bot.viewById(SYSTEM_EXPLORER_ID); + final SWTBotView systemExplorerView = bot.viewById(StringNamesHelper.SYSTEM_EXPLORER_ID); systemExplorerView.show(); final Composite systemExplorerComposite = (Composite) systemExplorerView.getWidget(); final Tree swtTree = bot.widget(WidgetMatcherFactory.widgetOfType(Tree.class), systemExplorerComposite); final SWTBotTree tree = new SWTBotTree(swtTree); - final SWTBotTreeItem treeItem = tree.getTreeItem(PROJECT_NAME); + final SWTBotTreeItem treeItem = tree.getTreeItem(StringNamesHelper.PROJECT_NAME); treeItem.select(); - bot.menu(EDIT).menu(DELETE).click(); + bot.menu(StringNamesHelper.EDIT).menu(StringNamesHelper.DELETE).click(); // the project deletion confirmation dialog - final SWTBotShell shell = bot.shell(DELETE_RESOURCES); + final SWTBotShell shell = bot.shell(StringNamesHelper.DELETE_RESOURCES); shell.activate(); - bot.checkBox(DELETE_PROJECT_WARNING).select(); - bot.button(OK).click(); + bot.checkBox(StringNamesHelper.DELETE_PROJECT_WARNING).select(); + bot.button(StringNamesHelper.OK).click(); bot.waitUntil(shellCloses(shell)); } @@ -726,13 +608,13 @@ protected void cleanEditorArea() { final SWTBotTreeItem appNode = expandApplicationTreeItemInSystemExplorer(); appNode.contextMenu("Open").click(); - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); final SWTBot4diacGefViewer viewer = (SWTBot4diacGefViewer) editor.getSWTBotGefViewer(); viewer.getCanvas().setFocus(); - final SWTBotMenu editMenu = bot.menu(EDIT); - editMenu.menu(SELECT_ALL).click(); - final SWTBotMenu deleteMenu = editMenu.menu(DELETE); + final SWTBotMenu editMenu = bot.menu(StringNamesHelper.EDIT); + editMenu.menu(StringNamesHelper.SELECT_ALL).click(); + final SWTBotMenu deleteMenu = editMenu.menu(StringNamesHelper.DELETE); if (deleteMenu.isEnabled()) { // not all Tests have a remaining FB deleteMenu.click(); @@ -754,13 +636,13 @@ protected static void afterClass() { * @return treeProjectItem the expanded Project node */ private static SWTBotTreeItem expandProjectTreeItemInSystemExplorer() { - final SWTBotView systemExplorerView = bot.viewById(SYSTEM_EXPLORER_ID); + final SWTBotView systemExplorerView = bot.viewById(StringNamesHelper.SYSTEM_EXPLORER_ID); systemExplorerView.show(); final Composite systemExplorerComposite = (Composite) systemExplorerView.getWidget(); final Tree swtTree = bot.widget(WidgetMatcherFactory.widgetOfType(Tree.class), systemExplorerComposite); final SWTBotTree tree = new SWTBotTree(swtTree); assertNotNull(tree); - final SWTBotTreeItem treeProjectItem = tree.getTreeItem(PROJECT_NAME); + final SWTBotTreeItem treeProjectItem = tree.getTreeItem(StringNamesHelper.PROJECT_NAME); treeProjectItem.select(); treeProjectItem.expand(); return treeProjectItem; @@ -774,8 +656,8 @@ private static SWTBotTreeItem expandProjectTreeItemInSystemExplorer() { */ private static SWTBotTreeItem expandSystemTreeItemInSystemExplorer() { final SWTBotTreeItem treeProjectItem = expandProjectTreeItemInSystemExplorer(); - bot.waitUntil(treeItemHasNode(treeProjectItem, PROJECT_NAME_TREE_ITEM)); - final SWTBotTreeItem systemNode = treeProjectItem.getNode(PROJECT_NAME_TREE_ITEM); + bot.waitUntil(treeItemHasNode(treeProjectItem, StringNamesHelper.PROJECT_NAME_TREE_ITEM)); + final SWTBotTreeItem systemNode = treeProjectItem.getNode(StringNamesHelper.PROJECT_NAME_TREE_ITEM); systemNode.select(); systemNode.expand(); return systemNode; @@ -789,8 +671,8 @@ private static SWTBotTreeItem expandSystemTreeItemInSystemExplorer() { */ private static SWTBotTreeItem expandTypeLibraryTreeItemInSystemExplorer() { final SWTBotTreeItem treeProjectItem = expandProjectTreeItemInSystemExplorer(); - bot.waitUntil(treeItemHasNode(treeProjectItem, TYPE_LIBRARY_NODE)); - final SWTBotTreeItem typeLibraryNode = treeProjectItem.getNode(TYPE_LIBRARY_NODE); + bot.waitUntil(treeItemHasNode(treeProjectItem, StringNamesHelper.TYPE_LIBRARY_NODE)); + final SWTBotTreeItem typeLibraryNode = treeProjectItem.getNode(StringNamesHelper.TYPE_LIBRARY_NODE); typeLibraryNode.select(); typeLibraryNode.expand(); return typeLibraryNode; @@ -804,8 +686,8 @@ private static SWTBotTreeItem expandTypeLibraryTreeItemInSystemExplorer() { */ private static SWTBotTreeItem expandApplicationTreeItemInSystemExplorer() { final SWTBotTreeItem systemNode = expandSystemTreeItemInSystemExplorer(); - bot.waitUntil(treeItemHasNode(systemNode, PROJECT_NAME_APP)); - final SWTBotTreeItem appNode = systemNode.getNode(PROJECT_NAME_APP); + bot.waitUntil(treeItemHasNode(systemNode, StringNamesHelper.PROJECT_NAME_APP)); + final SWTBotTreeItem appNode = systemNode.getNode(StringNamesHelper.PROJECT_NAME_APP); assertNotNull(appNode); appNode.select(); appNode.expand(); @@ -821,7 +703,7 @@ private static SWTBotTreeItem expandApplicationTreeItemInSystemExplorer() { */ private static SWTBotTreeItem expandSubAppTreeItemInSystemExplorer() { final SWTBotTreeItem appNode = expandApplicationTreeItemInSystemExplorer(); - final SWTBotTreeItem subAppNode = appNode.getNode(SUBAPP); + final SWTBotTreeItem subAppNode = appNode.getNode(StringNamesHelper.SUBAPP); assertNotNull(subAppNode); subAppNode.select(); subAppNode.expand(); diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/Basic1FBNetworkEditingTests.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/Basic1FBNetworkEditingTests.java index 01e7553abc..1bae0b8538 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/Basic1FBNetworkEditingTests.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/Basic1FBNetworkEditingTests.java @@ -29,6 +29,8 @@ import org.eclipse.fordiac.ide.application.editparts.FBEditPart; import org.eclipse.fordiac.ide.application.editparts.InstanceNameEditPart; import org.eclipse.fordiac.ide.application.figures.InstanceNameFigure; +import org.eclipse.fordiac.ide.test.ui.helpers.PinNamesHelper; +import org.eclipse.fordiac.ide.test.ui.helpers.StringNamesHelper; import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefEditor; import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefViewer; import org.eclipse.gef.EditPartViewer; @@ -62,32 +64,32 @@ public class Basic1FBNetworkEditingTests extends Abstract4diacUITests { @Test public void dragAndDrop1FB() { // select FB E_CYCLE - final SWTBotView systemExplorerView = bot.viewById(SYSTEM_EXPLORER_ID); + final SWTBotView systemExplorerView = bot.viewById(StringNamesHelper.SYSTEM_EXPLORER_ID); systemExplorerView.show(); final Composite systemExplorerComposite = (Composite) systemExplorerView.getWidget(); final Tree swtTree = bot.widget(WidgetMatcherFactory.widgetOfType(Tree.class), systemExplorerComposite); final SWTBotTree tree = new SWTBotTree(swtTree); assertNotNull(tree); - final SWTBotTreeItem treeProjectItem = tree.getTreeItem(PROJECT_NAME); + final SWTBotTreeItem treeProjectItem = tree.getTreeItem(StringNamesHelper.PROJECT_NAME); assertNotNull(treeProjectItem); treeProjectItem.select(); treeProjectItem.expand(); - final SWTBotTreeItem typeLibraryNode = treeProjectItem.getNode(TYPE_LIBRARY_NODE); + final SWTBotTreeItem typeLibraryNode = treeProjectItem.getNode(StringNamesHelper.TYPE_LIBRARY_NODE); assertNotNull(typeLibraryNode); typeLibraryNode.select(); typeLibraryNode.expand(); - final SWTBotTreeItem eventsNode = typeLibraryNode.getNode(EVENTS_NODE); + final SWTBotTreeItem eventsNode = typeLibraryNode.getNode(StringNamesHelper.EVENTS_NODE); assertNotNull(eventsNode); eventsNode.select(); eventsNode.expand(); - bot.waitUntil(treeItemHasNode(eventsNode, E_CYCLE_TREE_ITEM)); - final SWTBotTreeItem eCycleNode = eventsNode.getNode(E_CYCLE_TREE_ITEM); + bot.waitUntil(treeItemHasNode(eventsNode, StringNamesHelper.E_CYCLE_TREE_ITEM)); + final SWTBotTreeItem eCycleNode = eventsNode.getNode(StringNamesHelper.E_CYCLE_TREE_ITEM); assertNotNull(eCycleNode); eCycleNode.select(); eCycleNode.click(); // select application editor - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); final SWTBot4diacGefViewer viewer = (SWTBot4diacGefViewer) editor.getSWTBotGefViewer(); assertNotNull(viewer); @@ -95,7 +97,7 @@ public void dragAndDrop1FB() { assertNotNull(canvas); final Point point = new Point(100, 100); eCycleNode.dragAndDrop(canvas, point); - assertNotNull(editor.getEditPart(E_CYCLE_FB)); + assertNotNull(editor.getEditPart(StringNamesHelper.E_CYCLE_FB)); } /** @@ -105,8 +107,8 @@ public void dragAndDrop1FB() { @SuppressWarnings("static-method") @Test public void isAddedFbInProjectAppNode() { - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, new Point(300, 100)); - final SWTBotView systemExplorerView = bot.viewById(SYSTEM_EXPLORER_ID); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, new Point(300, 100)); + final SWTBotView systemExplorerView = bot.viewById(StringNamesHelper.SYSTEM_EXPLORER_ID); assertNotNull(systemExplorerView); systemExplorerView.show(); final Composite systemExplorerComposite = (Composite) systemExplorerView.getWidget(); @@ -114,20 +116,20 @@ public void isAddedFbInProjectAppNode() { final Tree swtTree = bot.widget(WidgetMatcherFactory.widgetOfType(Tree.class), systemExplorerComposite); final SWTBotTree tree = new SWTBotTree(swtTree); assertNotNull(tree); - final SWTBotTreeItem treeProjectItem = tree.getTreeItem(PROJECT_NAME); + final SWTBotTreeItem treeProjectItem = tree.getTreeItem(StringNamesHelper.PROJECT_NAME); assertNotNull(treeProjectItem); treeProjectItem.select(); treeProjectItem.expand(); - final SWTBotTreeItem projectNode = treeProjectItem.getNode(PROJECT_NAME + " []"); //$NON-NLS-1$ + final SWTBotTreeItem projectNode = treeProjectItem.getNode(StringNamesHelper.PROJECT_NAME + " []"); //$NON-NLS-1$ assertNotNull(projectNode); projectNode.select(); projectNode.expand(); - final SWTBotTreeItem appNode = projectNode.getNode(PROJECT_NAME + "App"); //$NON-NLS-1$ + final SWTBotTreeItem appNode = projectNode.getNode(StringNamesHelper.PROJECT_NAME + "App"); //$NON-NLS-1$ assertNotNull(appNode); appNode.select(); appNode.expand(); assertNotNull(appNode.getNodes()); - assertTrue(appNode.getNode(E_CYCLE_FB).isVisible()); + assertTrue(appNode.getNode(StringNamesHelper.E_CYCLE_FB).isVisible()); } /** @@ -136,16 +138,16 @@ public void isAddedFbInProjectAppNode() { @SuppressWarnings("static-method") @Test public void deleteExistingFB() { - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, new Point(300, 100)); - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, new Point(300, 100)); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); - assertNotNull(editor.getEditPart(E_CYCLE_FB)); - editor.click(E_CYCLE_FB); - final SWTBotGefEditPart parent = editor.getEditPart(E_CYCLE_FB).parent(); + assertNotNull(editor.getEditPart(StringNamesHelper.E_CYCLE_FB)); + editor.click(StringNamesHelper.E_CYCLE_FB); + final SWTBotGefEditPart parent = editor.getEditPart(StringNamesHelper.E_CYCLE_FB).parent(); assertNotNull(parent); parent.click(); - bot.menu(EDIT).menu(DELETE).click(); - assertNull(editor.getEditPart(E_CYCLE_FB)); + bot.menu(StringNamesHelper.EDIT).menu(StringNamesHelper.DELETE).click(); + assertNull(editor.getEditPart(StringNamesHelper.E_CYCLE_FB)); } /** @@ -159,24 +161,26 @@ public void deleteExistingFB() { @SuppressWarnings("static-method") @Test public void selectFbViaMouseLeftClickRectangleOverFB() { - dragAndDropEventsFB(E_D_FF_TREE_ITEM, new Point(200, 200)); - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + dragAndDropEventsFB(StringNamesHelper.E_D_FF_TREE_ITEM, new Point(200, 200)); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); // drag rectangle next to FB, therefore FB should not be selected editor.drag(40, 40, 80, 80); assertThrows(TimeoutException.class, () -> editor.waitForSelectedFBEditPart()); List selectedEditParts = editor.selectedEditParts(); assertTrue(selectedEditParts.isEmpty()); - assertFalse(selectedEditParts.stream().filter(p -> p.part() instanceof FBEditPart) - .map(p -> (FBEditPart) p.part()).anyMatch(fb -> E_D_FF_FB.equals(fb.getModel().getName()))); + assertFalse( + selectedEditParts.stream().filter(p -> p.part() instanceof FBEditPart).map(p -> (FBEditPart) p.part()) + .anyMatch(fb -> StringNamesHelper.E_D_FF_FB.equals(fb.getModel().getName()))); // drag rectangle over to FB, therefore FB should be selected editor.drag(50, 50, 350, 350); assertDoesNotThrow(() -> editor.waitForSelectedFBEditPart()); selectedEditParts = editor.selectedEditParts(); assertFalse(selectedEditParts.isEmpty()); - assertTrue(selectedEditParts.stream().filter(p -> p.part() instanceof FBEditPart) - .map(p -> (FBEditPart) p.part()).anyMatch(fb -> E_D_FF_FB.equals(fb.getModel().getName()))); + assertTrue( + selectedEditParts.stream().filter(p -> p.part() instanceof FBEditPart).map(p -> (FBEditPart) p.part()) + .anyMatch(fb -> StringNamesHelper.E_D_FF_FB.equals(fb.getModel().getName()))); } /** @@ -190,13 +194,13 @@ public void selectFbViaMouseLeftClickRectangleOverFB() { @SuppressWarnings("static-method") @Test public void selectFbViaMouseLeftClickOnFB() { - dragAndDropEventsFB(E_SWITCH_TREE_ITEM, new Point(150, 250)); - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + dragAndDropEventsFB(StringNamesHelper.E_SWITCH_TREE_ITEM, new Point(150, 250)); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); // check bounds of FB - editor.getEditPart(E_SWITCH_FB); - editor.click(E_SWITCH_FB); - final SWTBotGefEditPart parent = editor.getEditPart(E_SWITCH_FB).parent(); + editor.getEditPart(StringNamesHelper.E_SWITCH_FB); + editor.click(StringNamesHelper.E_SWITCH_FB); + final SWTBotGefEditPart parent = editor.getEditPart(StringNamesHelper.E_SWITCH_FB).parent(); final IFigure figure = ((GraphicalEditPart) parent.part()).getFigure(); final Rectangle fbBounds = figure.getBounds().getCopy(); figure.translateToAbsolute(fbBounds); @@ -207,7 +211,7 @@ public void selectFbViaMouseLeftClickOnFB() { assertThrows(TimeoutException.class, () -> editor.waitForSelectedFBEditPart()); List selectedEditParts = editor.selectedEditParts(); assertFalse(selectedEditParts.isEmpty()); - assertFalse(isFbSelected(selectedEditParts, E_SWITCH_FB)); + assertFalse(isFbSelected(selectedEditParts, StringNamesHelper.E_SWITCH_FB)); // click next to the FB point = new Point(265, 350); @@ -215,7 +219,7 @@ public void selectFbViaMouseLeftClickOnFB() { assertThrows(TimeoutException.class, () -> editor.waitForSelectedFBEditPart()); selectedEditParts = editor.selectedEditParts(); assertFalse(selectedEditParts.isEmpty()); - assertFalse(isFbSelected(selectedEditParts, E_SWITCH_FB)); + assertFalse(isFbSelected(selectedEditParts, StringNamesHelper.E_SWITCH_FB)); // click exactly at the insertion point point = new Point(150, 250); @@ -224,7 +228,7 @@ public void selectFbViaMouseLeftClickOnFB() { assertDoesNotThrow(() -> editor.waitForSelectedFBEditPart()); selectedEditParts = editor.selectedEditParts(); assertFalse(selectedEditParts.isEmpty()); - assertTrue(isFbSelected(selectedEditParts, E_SWITCH_FB)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_SWITCH_FB)); // click within the FB bounds but not on a pin or instance name point = new Point(170, 300); @@ -233,7 +237,7 @@ public void selectFbViaMouseLeftClickOnFB() { assertDoesNotThrow(() -> editor.waitForSelectedFBEditPart()); selectedEditParts = editor.selectedEditParts(); assertFalse(selectedEditParts.isEmpty()); - assertTrue(isFbSelected(selectedEditParts, E_SWITCH_FB)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_SWITCH_FB)); // click within the FB bounds but not on a pin or instance name point = new Point(200, 340); @@ -242,7 +246,7 @@ public void selectFbViaMouseLeftClickOnFB() { assertDoesNotThrow(() -> editor.waitForSelectedFBEditPart()); selectedEditParts = editor.selectedEditParts(); assertFalse(selectedEditParts.isEmpty()); - assertTrue(isFbSelected(selectedEditParts, E_SWITCH_FB)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_SWITCH_FB)); } /** @@ -258,12 +262,12 @@ public void selectFbViaMouseLeftClickOnFB() { @Test public void moveFB() { final Point pos1 = new Point(200, 200); - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, pos1); - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, pos1); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); - assertNotNull(editor.getEditPart(E_CYCLE_FB)); - editor.click(E_CYCLE_FB); - SWTBotGefEditPart parent = editor.getEditPart(E_CYCLE_FB).parent(); + assertNotNull(editor.getEditPart(StringNamesHelper.E_CYCLE_FB)); + editor.click(StringNamesHelper.E_CYCLE_FB); + SWTBotGefEditPart parent = editor.getEditPart(StringNamesHelper.E_CYCLE_FB).parent(); assertNotNull(parent); IFigure figure = ((GraphicalEditPart) parent.part()).getFigure(); @@ -283,7 +287,7 @@ public void moveFB() { editor.drag(parent, pos2.x, pos2.y); final org.eclipse.draw2d.geometry.Point posToCheck2 = new org.eclipse.draw2d.geometry.Point(pos2); - parent = editor.getEditPart(E_CYCLE_FB).parent(); + parent = editor.getEditPart(StringNamesHelper.E_CYCLE_FB).parent(); figure = ((GraphicalEditPart) parent.part()).getFigure(); fbBounds = figure.getBounds().getCopy(); figure.translateToAbsolute(fbBounds); @@ -300,16 +304,16 @@ public void moveFB() { @SuppressWarnings("static-method") @Test public void editDTofECycle() { - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, new Point(200, 200)); - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, new Point(200, 200)); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); - editor.getEditPart(DEF_VAL); - editor.doubleClick(DEF_VAL); + editor.getEditPart(PinNamesHelper.DEF_VAL); + editor.doubleClick(PinNamesHelper.DEF_VAL); final SWTBotEclipseEditor e = editor.toTextEditor(); assertNotNull(e); - e.setText(NEW_VAL); + e.setText(PinNamesHelper.NEW_VAL); e.save(); - assertNotNull(editor.getEditPart(NEW_VAL)); + assertNotNull(editor.getEditPart(PinNamesHelper.NEW_VAL)); } /** @@ -321,14 +325,14 @@ public void editDTofECycle() { @SuppressWarnings("static-method") @Test public void directEditorDefaultValueTest() { - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, new Point(200, 100)); - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, new Point(200, 100)); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); - editor.getEditPart(DEF_VAL); - editor.doubleClick(DEF_VAL); + editor.getEditPart(PinNamesHelper.DEF_VAL); + editor.doubleClick(PinNamesHelper.DEF_VAL); final SWTBotEclipseEditor e = editor.toTextEditor(); assertNotNull(e); - assertEquals(DEF_VAL, e.getText()); + assertEquals(PinNamesHelper.DEF_VAL, e.getText()); e.save(); } @@ -341,18 +345,18 @@ public void directEditorDefaultValueTest() { @SuppressWarnings("static-method") @Test public void directEditorNewValueTest() { - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, new Point(200, 100)); - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, new Point(200, 100)); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); - editor.getEditPart(DEF_VAL); - editor.doubleClick(DEF_VAL); + editor.getEditPart(PinNamesHelper.DEF_VAL); + editor.doubleClick(PinNamesHelper.DEF_VAL); final SWTBotEclipseEditor e = editor.toTextEditor(); assertNotNull(e); - e.setText(NEW_VAL); + e.setText(PinNamesHelper.NEW_VAL); e.save(); - editor.getEditPart(NEW_VAL); - editor.doubleClick(NEW_VAL); - assertEquals(NEW_VAL, editor.toTextEditor().getText()); + editor.getEditPart(PinNamesHelper.NEW_VAL); + editor.doubleClick(PinNamesHelper.NEW_VAL); + assertEquals(PinNamesHelper.NEW_VAL, editor.toTextEditor().getText()); } /** @@ -361,8 +365,8 @@ public void directEditorNewValueTest() { @SuppressWarnings("static-method") @Test public void editFBName() { - dragAndDropEventsFB(E_SR_TREE_ITEM, new Point(100, 100)); - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + dragAndDropEventsFB(StringNamesHelper.E_SR_TREE_ITEM, new Point(100, 100)); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); final SWTBot4diacGefViewer viewer = (SWTBot4diacGefViewer) editor.getSWTBotGefViewer(); @@ -376,18 +380,18 @@ public void editFBName() { assertNotNull(figure); final String text = figure.getText(); - if (E_SR_FB.equals(text)) { + if (StringNamesHelper.E_SR_FB.equals(text)) { iNFigure = figure; final Rectangle bounds = figure.getBounds().getCopy(); assertNotNull(bounds); figure.translateToAbsolute(bounds); editor.setFocus(); editor.doubleClick(bounds.x, bounds.y); - bot.text(E_SR_FB).setText(newName); + bot.text(StringNamesHelper.E_SR_FB).setText(newName); bot.activeShell().pressShortcut(Keystrokes.CR); assertEquals(newName, figure.getText()); break; - } + } } } assertNotNull(iNFigure); @@ -408,8 +412,8 @@ public void editFBName() { @SuppressWarnings("static-method") @Test public void validConnectionBetweenEventInputPinAndEventOutputPin() { - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, new Point(200, 200)); - final SWTBot4diacGefViewer viewer = createConnection(START, EO); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, new Point(200, 200)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.START, PinNamesHelper.EO); assertDoesNotThrow(viewer::waitForConnection); } @@ -425,8 +429,8 @@ public void validConnectionBetweenEventInputPinAndEventOutputPin() { @SuppressWarnings("static-method") @Test public void validConnectionBetweenEventOutputPinAndEventInputPin() { - dragAndDropEventsFB(E_N_TABLE_TREE_ITEM, new Point(100, 100)); - final SWTBot4diacGefViewer viewer = createConnection(EO1, START); + dragAndDropEventsFB(StringNamesHelper.E_N_TABLE_TREE_ITEM, new Point(100, 100)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.EO1, PinNamesHelper.START); assertDoesNotThrow(viewer::waitForConnection); } @@ -442,8 +446,8 @@ public void validConnectionBetweenEventOutputPinAndEventInputPin() { @SuppressWarnings("static-method") @Test public void validConnectionBetweenUintDataInputPinAndUintDataOutputPin() { - dragAndDropEventsFB(E_CTUD_TREE_ITEM, new Point(150, 150)); - final SWTBot4diacGefViewer viewer = createConnection(PV, CV); + dragAndDropEventsFB(StringNamesHelper.E_CTUD_TREE_ITEM, new Point(150, 150)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.PV, PinNamesHelper.CV); assertDoesNotThrow(viewer::waitForConnection); } @@ -459,8 +463,8 @@ public void validConnectionBetweenUintDataInputPinAndUintDataOutputPin() { @SuppressWarnings("static-method") @Test public void validConnectionBetweenBoolInputPinAndBoolOutputPin() { - dragAndDropEventsFB(E_D_FF_TREE_ITEM, new Point(150, 150)); - final SWTBot4diacGefViewer viewer = createConnection(D, Q); + dragAndDropEventsFB(StringNamesHelper.E_D_FF_TREE_ITEM, new Point(150, 150)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.D, PinNamesHelper.Q); assertDoesNotThrow(viewer::waitForConnection); } @@ -472,24 +476,24 @@ public void validConnectionBetweenBoolInputPinAndBoolOutputPin() { public void connectionCanBeFoundAfterMovingFB() { // in progress final Point pos1 = new Point(100, 150); - dragAndDropEventsFB(E_TABLE_CTRL_TREE_ITEM, pos1); - createConnection(INIT, CLKO); - createConnection(N, CV); + dragAndDropEventsFB(StringNamesHelper.E_TABLE_CTRL_TREE_ITEM, pos1); + createConnection(PinNamesHelper.INIT, PinNamesHelper.CLKO); + createConnection(PinNamesHelper.N, PinNamesHelper.CV); - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); final SWTBot4diacGefViewer viewer = (SWTBot4diacGefViewer) editor.getSWTBotGefViewer(); assertNotNull(viewer); final SWTBotGefFigureCanvas canvas = viewer.getCanvas(); assertNotNull(canvas); canvas.setFocus(); - assertTrue(checkIfConnectionCanBeFound(CLKO, INIT)); - assertTrue(checkIfConnectionCanBeFound(CV, N)); + assertTrue(checkIfConnectionCanBeFound(PinNamesHelper.CLKO, PinNamesHelper.INIT)); + assertTrue(checkIfConnectionCanBeFound(PinNamesHelper.CV, PinNamesHelper.N)); assertNotNull(editor); - assertNotNull(editor.getEditPart(E_TABLE_CTRL_FB)); - editor.click(E_TABLE_CTRL_FB); - SWTBotGefEditPart parent = editor.getEditPart(E_TABLE_CTRL_FB).parent(); + assertNotNull(editor.getEditPart(StringNamesHelper.E_TABLE_CTRL_FB)); + editor.click(StringNamesHelper.E_TABLE_CTRL_FB); + SWTBotGefEditPart parent = editor.getEditPart(StringNamesHelper.E_TABLE_CTRL_FB).parent(); assertNotNull(parent); IFigure figure = ((GraphicalEditPart) parent.part()).getFigure(); @@ -509,15 +513,15 @@ public void connectionCanBeFoundAfterMovingFB() { editor.drag(parent, pos2.x, pos2.y); final org.eclipse.draw2d.geometry.Point posToCheck2 = new org.eclipse.draw2d.geometry.Point(pos2); - parent = editor.getEditPart(E_TABLE_CTRL_FB).parent(); + parent = editor.getEditPart(StringNamesHelper.E_TABLE_CTRL_FB).parent(); figure = ((GraphicalEditPart) parent.part()).getFigure(); fbBounds = figure.getBounds().getCopy(); figure.translateToAbsolute(fbBounds); assertEquals(posToCheck2.x, fbBounds.x); assertEquals(posToCheck2.y, fbBounds.y); - assertTrue(checkIfConnectionCanBeFound(CLKO, INIT)); - assertTrue(checkIfConnectionCanBeFound(CV, N)); + assertTrue(checkIfConnectionCanBeFound(PinNamesHelper.CLKO, PinNamesHelper.INIT)); + assertTrue(checkIfConnectionCanBeFound(PinNamesHelper.CV, PinNamesHelper.N)); } /** @@ -533,8 +537,8 @@ public void connectionCanBeFoundAfterMovingFB() { @SuppressWarnings("static-method") @Test public void invalidConnectionBetweenEventInputPinAndEventInputPin() { - dragAndDropEventsFB(E_N_TABLE_TREE_ITEM, new Point(100, 100)); - final SWTBot4diacGefViewer viewer = createConnection(START, STOP); + dragAndDropEventsFB(StringNamesHelper.E_N_TABLE_TREE_ITEM, new Point(100, 100)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.START, PinNamesHelper.STOP); assertThrows(TimeoutException.class, viewer::waitForConnection); } @@ -551,8 +555,8 @@ public void invalidConnectionBetweenEventInputPinAndEventInputPin() { @SuppressWarnings("static-method") @Test public void invalidConnectionBetweenEventInputPinAndUintInputPin() { - dragAndDropEventsFB(E_N_TABLE_TREE_ITEM, new Point(150, 100)); - final SWTBot4diacGefViewer viewer = createConnection(START, N); + dragAndDropEventsFB(StringNamesHelper.E_N_TABLE_TREE_ITEM, new Point(150, 100)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.START, PinNamesHelper.N); assertThrows(TimeoutException.class, viewer::waitForConnection); } @@ -569,8 +573,8 @@ public void invalidConnectionBetweenEventInputPinAndUintInputPin() { @SuppressWarnings("static-method") @Test public void invalidConnectionBetweenEventInputPinAndTimeInputPin() { - dragAndDropEventsFB(E_N_TABLE_TREE_ITEM, new Point(150, 100)); - final SWTBot4diacGefViewer viewer = createConnection(START, DT); + dragAndDropEventsFB(StringNamesHelper.E_N_TABLE_TREE_ITEM, new Point(150, 100)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.START, PinNamesHelper.DT); assertThrows(TimeoutException.class, viewer::waitForConnection); } @@ -587,8 +591,8 @@ public void invalidConnectionBetweenEventInputPinAndTimeInputPin() { @SuppressWarnings("static-method") @Test public void invalidConnectionBetweenEventInputPinAndBoolInputPin() { - dragAndDropEventsFB(E_D_FF_TREE_ITEM, new Point(150, 100)); - final SWTBot4diacGefViewer viewer = createConnection(CLK, D); + dragAndDropEventsFB(StringNamesHelper.E_D_FF_TREE_ITEM, new Point(150, 100)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.CLK, PinNamesHelper.D); assertThrows(TimeoutException.class, viewer::waitForConnection); } @@ -605,8 +609,8 @@ public void invalidConnectionBetweenEventInputPinAndBoolInputPin() { @SuppressWarnings("static-method") @Test public void invalidConnectionBetweenEventInputPinAndUintOutputPin() { - dragAndDropEventsFB(E_CTUD_TREE_ITEM, new Point(100, 150)); - final SWTBot4diacGefViewer viewer = createConnection(CD, CV); + dragAndDropEventsFB(StringNamesHelper.E_CTUD_TREE_ITEM, new Point(100, 150)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.CD, PinNamesHelper.CV); assertThrows(TimeoutException.class, viewer::waitForConnection); } @@ -623,8 +627,8 @@ public void invalidConnectionBetweenEventInputPinAndUintOutputPin() { @SuppressWarnings("static-method") @Test public void invalidConnectionBetweenEventInputPinAndTimeOutputPin() { - dragAndDropEventsFB(E_TABLE_CTRL_TREE_ITEM, new Point(100, 100)); - final SWTBot4diacGefViewer viewer = createConnection(INIT, DTO); + dragAndDropEventsFB(StringNamesHelper.E_TABLE_CTRL_TREE_ITEM, new Point(100, 100)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.INIT, PinNamesHelper.DTO); assertThrows(TimeoutException.class, viewer::waitForConnection); } @@ -641,8 +645,8 @@ public void invalidConnectionBetweenEventInputPinAndTimeOutputPin() { @SuppressWarnings("static-method") @Test public void invalidConnectionBetweenEventInputPinAndBoolOutputPin() { - dragAndDropEventsFB(E_CTUD_TREE_ITEM, new Point(100, 150)); - final SWTBot4diacGefViewer viewer = createConnection(CD, QU); + dragAndDropEventsFB(StringNamesHelper.E_CTUD_TREE_ITEM, new Point(100, 150)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.CD, PinNamesHelper.QU); assertThrows(TimeoutException.class, viewer::waitForConnection); } @@ -659,8 +663,8 @@ public void invalidConnectionBetweenEventInputPinAndBoolOutputPin() { @SuppressWarnings("static-method") @Test public void invalidConnectionBetweenTimeInputPinAndTimeOutputPin() { - dragAndDropEventsFB(E_TABLE_CTRL_TREE_ITEM, new Point(100, 100)); - final SWTBot4diacGefViewer viewer = createConnection(DT, DTO); + dragAndDropEventsFB(StringNamesHelper.E_TABLE_CTRL_TREE_ITEM, new Point(100, 100)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.DT, PinNamesHelper.DTO); assertThrows(TimeoutException.class, viewer::waitForConnection); } @@ -677,8 +681,8 @@ public void invalidConnectionBetweenTimeInputPinAndTimeOutputPin() { @SuppressWarnings("static-method") @Test public void invalidConnectionBetweenTimeInputPinAndUintInputPin() { - dragAndDropEventsFB(E_N_TABLE_TREE_ITEM, new Point(100, 100)); - final SWTBot4diacGefViewer viewer = createConnection(DT, N); + dragAndDropEventsFB(StringNamesHelper.E_N_TABLE_TREE_ITEM, new Point(100, 100)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.DT, PinNamesHelper.N); assertThrows(TimeoutException.class, viewer::waitForConnection); } @@ -695,8 +699,8 @@ public void invalidConnectionBetweenTimeInputPinAndUintInputPin() { @SuppressWarnings("static-method") @Test public void invalidConnectionBetweenUintInputPinAndBoolOutputPin() { - dragAndDropEventsFB(E_CTUD_TREE_ITEM, new Point(100, 100)); - final SWTBot4diacGefViewer viewer = createConnection(PV, QU); + dragAndDropEventsFB(StringNamesHelper.E_CTUD_TREE_ITEM, new Point(100, 100)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.PV, PinNamesHelper.QU); assertThrows(TimeoutException.class, viewer::waitForConnection); } @@ -713,8 +717,8 @@ public void invalidConnectionBetweenUintInputPinAndBoolOutputPin() { @SuppressWarnings("static-method") @Test public void invalidConnectionBetweenEventOutputPinAndUintInputPin() { - dragAndDropEventsFB(E_N_TABLE_TREE_ITEM, new Point(100, 100)); - final SWTBot4diacGefViewer viewer = createConnection(EO0, N); + dragAndDropEventsFB(StringNamesHelper.E_N_TABLE_TREE_ITEM, new Point(100, 100)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.EO0, PinNamesHelper.N); assertThrows(TimeoutException.class, viewer::waitForConnection); } @@ -731,8 +735,8 @@ public void invalidConnectionBetweenEventOutputPinAndUintInputPin() { @SuppressWarnings("static-method") @Test public void invalidConnectionBetweenEventOutputPinAndTimeInputPin() { - dragAndDropEventsFB(E_N_TABLE_TREE_ITEM, new Point(100, 100)); - final SWTBot4diacGefViewer viewer = createConnection(EO1, DT); + dragAndDropEventsFB(StringNamesHelper.E_N_TABLE_TREE_ITEM, new Point(100, 100)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.EO1, PinNamesHelper.DT); assertThrows(TimeoutException.class, viewer::waitForConnection); } @@ -749,8 +753,8 @@ public void invalidConnectionBetweenEventOutputPinAndTimeInputPin() { @SuppressWarnings("static-method") @Test public void invalidConnectionBetweenEventOutputPinAndBoolInputPin() { - dragAndDropEventsFB(E_D_FF_TREE_ITEM, new Point(100, 100)); - final SWTBot4diacGefViewer viewer = createConnection(EO, D); + dragAndDropEventsFB(StringNamesHelper.E_D_FF_TREE_ITEM, new Point(100, 100)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.EO, PinNamesHelper.D); assertThrows(TimeoutException.class, viewer::waitForConnection); } @@ -767,8 +771,8 @@ public void invalidConnectionBetweenEventOutputPinAndBoolInputPin() { @SuppressWarnings("static-method") @Test public void invalidConnectionBetweenEventOutputPinAndEventOutputPin() { - dragAndDropEventsFB(E_N_TABLE_TREE_ITEM, new Point(100, 100)); - final SWTBot4diacGefViewer viewer = createConnection(EO0, EO2); + dragAndDropEventsFB(StringNamesHelper.E_N_TABLE_TREE_ITEM, new Point(100, 100)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.EO0, PinNamesHelper.EO2); assertThrows(TimeoutException.class, viewer::waitForConnection); } @@ -785,8 +789,8 @@ public void invalidConnectionBetweenEventOutputPinAndEventOutputPin() { @SuppressWarnings("static-method") @Test public void invalidConnectionBetweenEventOutputPinAndUintOutputPin() { - dragAndDropEventsFB(E_TABLE_CTRL_TREE_ITEM, new Point(100, 100)); - final SWTBot4diacGefViewer viewer = createConnection(CLKO, CV); + dragAndDropEventsFB(StringNamesHelper.E_TABLE_CTRL_TREE_ITEM, new Point(100, 100)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.CLKO, PinNamesHelper.CV); assertThrows(TimeoutException.class, viewer::waitForConnection); } @@ -803,8 +807,8 @@ public void invalidConnectionBetweenEventOutputPinAndUintOutputPin() { @SuppressWarnings("static-method") @Test public void invalidConnectionBetweenEventOutputPinAndTimeOutputPin() { - dragAndDropEventsFB(E_TABLE_CTRL_TREE_ITEM, new Point(100, 100)); - final SWTBot4diacGefViewer viewer = createConnection(CLKO, DTO); + dragAndDropEventsFB(StringNamesHelper.E_TABLE_CTRL_TREE_ITEM, new Point(100, 100)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.CLKO, PinNamesHelper.DTO); assertThrows(TimeoutException.class, viewer::waitForConnection); } @@ -821,8 +825,8 @@ public void invalidConnectionBetweenEventOutputPinAndTimeOutputPin() { @SuppressWarnings("static-method") @Test public void invalidConnectionBetweenEventOutputPinAndBoolOutputPin() { - dragAndDropEventsFB(E_D_FF_TREE_ITEM, new Point(100, 100)); - final SWTBot4diacGefViewer viewer = createConnection(EO, Q); + dragAndDropEventsFB(StringNamesHelper.E_D_FF_TREE_ITEM, new Point(100, 100)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.EO, PinNamesHelper.Q); assertThrows(TimeoutException.class, viewer::waitForConnection); } @@ -839,8 +843,8 @@ public void invalidConnectionBetweenEventOutputPinAndBoolOutputPin() { @SuppressWarnings("static-method") @Test public void invalidConnectionBetweenBoolOutputPinAndBoolOutputPin() { - dragAndDropEventsFB(E_CTUD_TREE_ITEM, new Point(100, 100)); - final SWTBot4diacGefViewer viewer = createConnection(QU, QD); + dragAndDropEventsFB(StringNamesHelper.E_CTUD_TREE_ITEM, new Point(100, 100)); + final SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.QU, PinNamesHelper.QD); assertThrows(TimeoutException.class, viewer::waitForConnection); } diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/Basic2FBNetworkEditingTests.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/Basic2FBNetworkEditingTests.java index 82ff91dcc1..82efd34aa7 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/Basic2FBNetworkEditingTests.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/Basic2FBNetworkEditingTests.java @@ -25,6 +25,8 @@ import org.eclipse.draw2d.PolylineConnection; import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.fordiac.ide.test.ui.helpers.PinNamesHelper; +import org.eclipse.fordiac.ide.test.ui.helpers.StringNamesHelper; import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefEditor; import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefViewer; import org.eclipse.gef.ConnectionEditPart; @@ -56,31 +58,31 @@ public class Basic2FBNetworkEditingTests extends Abstract4diacUITests { @Test public void dragAndDrop2FB() { // select FB E_CYCLE - final SWTBotView systemExplorerView = bot.viewById(SYSTEM_EXPLORER_ID); + final SWTBotView systemExplorerView = bot.viewById(StringNamesHelper.SYSTEM_EXPLORER_ID); systemExplorerView.show(); final Composite systemExplorerComposite = (Composite) systemExplorerView.getWidget(); final Tree swtTree = bot.widget(WidgetMatcherFactory.widgetOfType(Tree.class), systemExplorerComposite); final SWTBotTree tree = new SWTBotTree(swtTree); assertNotNull(tree); - final SWTBotTreeItem treeProjectItem = tree.getTreeItem(PROJECT_NAME); + final SWTBotTreeItem treeProjectItem = tree.getTreeItem(StringNamesHelper.PROJECT_NAME); assertNotNull(treeProjectItem); treeProjectItem.select(); treeProjectItem.expand(); - final SWTBotTreeItem typeLibraryNode = treeProjectItem.getNode(TYPE_LIBRARY_NODE); + final SWTBotTreeItem typeLibraryNode = treeProjectItem.getNode(StringNamesHelper.TYPE_LIBRARY_NODE); assertNotNull(typeLibraryNode); typeLibraryNode.select(); typeLibraryNode.expand(); - final SWTBotTreeItem eventsNode = typeLibraryNode.getNode(EVENTS_NODE); + final SWTBotTreeItem eventsNode = typeLibraryNode.getNode(StringNamesHelper.EVENTS_NODE); assertNotNull(eventsNode); eventsNode.select(); eventsNode.expand(); - bot.waitUntil(treeItemHasNode(eventsNode, E_CYCLE_TREE_ITEM)); - final SWTBotTreeItem eCycleNode = eventsNode.getNode(E_CYCLE_TREE_ITEM); + bot.waitUntil(treeItemHasNode(eventsNode, StringNamesHelper.E_CYCLE_TREE_ITEM)); + final SWTBotTreeItem eCycleNode = eventsNode.getNode(StringNamesHelper.E_CYCLE_TREE_ITEM); assertNotNull(eCycleNode); eCycleNode.select(); eCycleNode.click(); // select application editor - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); final SWTBot4diacGefViewer viewer = (SWTBot4diacGefViewer) editor.getSWTBotGefViewer(); assertNotNull(viewer); @@ -88,20 +90,20 @@ public void dragAndDrop2FB() { assertNotNull(canvas); final Point point1 = new Point(100, 100); eCycleNode.dragAndDrop(canvas, point1); - assertNotNull(editor.getEditPart(E_CYCLE_FB)); - final Rectangle absPos1 = getAbsolutePosition(editor, E_CYCLE_FB); + assertNotNull(editor.getEditPart(StringNamesHelper.E_CYCLE_FB)); + final Rectangle absPos1 = getAbsolutePosition(editor, StringNamesHelper.E_CYCLE_FB); assertEquals(point1.x, absPos1.x); assertEquals(point1.y, absPos1.y); // select FB E_SWITCH - final SWTBotTreeItem eSwitchNode = eventsNode.getNode(E_SWITCH_TREE_ITEM); + final SWTBotTreeItem eSwitchNode = eventsNode.getNode(StringNamesHelper.E_SWITCH_TREE_ITEM); assertNotNull(eSwitchNode); eSwitchNode.select(); eSwitchNode.click(); final Point point2 = new Point(300, 150); eSwitchNode.dragAndDrop(canvas, point2); - assertNotNull(editor.getEditPart(E_SWITCH_FB)); - final Rectangle absPos2 = getAbsolutePosition(editor, E_SWITCH_FB); + assertNotNull(editor.getEditPart(StringNamesHelper.E_SWITCH_FB)); + final Rectangle absPos2 = getAbsolutePosition(editor, StringNamesHelper.E_SWITCH_FB); assertEquals(point2.x, absPos2.x); assertEquals(point2.y, absPos2.y); } @@ -114,19 +116,19 @@ public void dragAndDrop2FB() { @SuppressWarnings("static-method") @Test public void delete1FB() { - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, new Point(300, 100)); - dragAndDropEventsFB(E_SWITCH_TREE_ITEM, new Point(100, 100)); - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, new Point(300, 100)); + dragAndDropEventsFB(StringNamesHelper.E_SWITCH_TREE_ITEM, new Point(100, 100)); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); - assertNotNull(editor.getEditPart(E_CYCLE_FB)); - assertNotNull(editor.getEditPart(E_SWITCH_FB)); - editor.click(E_CYCLE_FB); - final SWTBotGefEditPart parent = editor.getEditPart(E_CYCLE_FB).parent(); + assertNotNull(editor.getEditPart(StringNamesHelper.E_CYCLE_FB)); + assertNotNull(editor.getEditPart(StringNamesHelper.E_SWITCH_FB)); + editor.click(StringNamesHelper.E_CYCLE_FB); + final SWTBotGefEditPart parent = editor.getEditPart(StringNamesHelper.E_CYCLE_FB).parent(); assertNotNull(parent); parent.click(); - bot.menu(EDIT).menu(DELETE).click(); - assertNull(editor.getEditPart(E_CYCLE_FB)); - assertNotNull(editor.getEditPart(E_SWITCH_FB)); + bot.menu(StringNamesHelper.EDIT).menu(StringNamesHelper.DELETE).click(); + assertNull(editor.getEditPart(StringNamesHelper.E_CYCLE_FB)); + assertNotNull(editor.getEditPart(StringNamesHelper.E_SWITCH_FB)); assertTrue(editor.selectedEditParts().isEmpty()); } @@ -142,25 +144,25 @@ public void delete1FB() { @SuppressWarnings("static-method") @Test public void select2FBsViaMouseLeftClickOnFB() { - dragAndDropEventsFB(E_N_TABLE_TREE_ITEM, new Point(100, 100)); - dragAndDropEventsFB(E_CTUD_TREE_ITEM, new Point(300, 100)); - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + dragAndDropEventsFB(StringNamesHelper.E_N_TABLE_TREE_ITEM, new Point(100, 100)); + dragAndDropEventsFB(StringNamesHelper.E_CTUD_TREE_ITEM, new Point(300, 100)); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); // drag rectangle next to FBs, therefore FBs should not be selected editor.drag(40, 40, 200, 200); assertThrows(TimeoutException.class, editor::waitForSelectedFBEditPart); List selectedEditParts = editor.selectedEditParts(); assertTrue(selectedEditParts.isEmpty()); - assertFalse(isFbSelected(selectedEditParts, E_N_TABLE_FB)); - assertFalse(isFbSelected(selectedEditParts, E_CTUD_FB)); + assertFalse(isFbSelected(selectedEditParts, StringNamesHelper.E_N_TABLE_FB)); + assertFalse(isFbSelected(selectedEditParts, StringNamesHelper.E_CTUD_FB)); // drag rectangle over FBs, therefore FBs should be selected editor.drag(50, 50, 500, 300); assertDoesNotThrow(editor::waitForSelectedFBEditPart); selectedEditParts = editor.selectedEditParts(); assertFalse(selectedEditParts.isEmpty()); - assertTrue(isFbSelected(selectedEditParts, E_N_TABLE_FB)); - assertTrue(isFbSelected(selectedEditParts, E_CTUD_FB)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_N_TABLE_FB)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_CTUD_FB)); } /** @@ -177,28 +179,28 @@ public void select2FBsViaMouseLeftClickOnFB() { @Test public void move1FB() { final Point pos1 = new Point(100, 100); - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, pos1); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, pos1); final Point pos2 = new Point(350, 100); - dragAndDropEventsFB(E_N_TABLE_TREE_ITEM, pos2); + dragAndDropEventsFB(StringNamesHelper.E_N_TABLE_TREE_ITEM, pos2); // select E_CYCLE and check position of E_CYCLE - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); - assertNotNull(editor.getEditPart(E_CYCLE_FB)); - editor.click(E_CYCLE_FB); - final SWTBotGefEditPart fb1 = editor.getEditPart(E_CYCLE_FB).parent(); + assertNotNull(editor.getEditPart(StringNamesHelper.E_CYCLE_FB)); + editor.click(StringNamesHelper.E_CYCLE_FB); + final SWTBotGefEditPart fb1 = editor.getEditPart(StringNamesHelper.E_CYCLE_FB).parent(); assertNotNull(fb1); - final Rectangle fb1Bounds1 = getAbsolutePosition(editor, E_CYCLE_FB); + final Rectangle fb1Bounds1 = getAbsolutePosition(editor, StringNamesHelper.E_CYCLE_FB); assertTrue(fb1Bounds1.contains(pos1.x, pos1.y)); // check position of E_N_TABLE - final Rectangle fb2Bounds1 = getAbsolutePosition(editor, E_N_TABLE_FB); + final Rectangle fb2Bounds1 = getAbsolutePosition(editor, StringNamesHelper.E_N_TABLE_FB); assertTrue(fb2Bounds1.contains(pos2.x, pos2.y)); // move E_CYCLE and check new position final Point pos3 = new Point(125, 185); editor.drag(fb1, pos3.x, pos3.y); - final Rectangle fb1Bounds2 = getAbsolutePosition(editor, E_CYCLE_FB); + final Rectangle fb1Bounds2 = getAbsolutePosition(editor, StringNamesHelper.E_CYCLE_FB); assertTrue(fb1Bounds2.contains(pos3.x, pos3.y)); // check if E_N_TABLE is still on same position @@ -218,33 +220,33 @@ public void move1FB() { @Test public void moveBothFBOneAfterAnother() { final Point pos1 = new Point(200, 200); - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, pos1); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, pos1); final Point pos2 = new Point(400, 200); - dragAndDropEventsFB(E_SWITCH_TREE_ITEM, pos2); + dragAndDropEventsFB(StringNamesHelper.E_SWITCH_TREE_ITEM, pos2); // select and move E_CYCLE - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); - assertNotNull(editor.getEditPart(E_CYCLE_FB)); - editor.click(E_CYCLE_FB); - final SWTBotGefEditPart fb1 = editor.getEditPart(E_CYCLE_FB).parent(); + assertNotNull(editor.getEditPart(StringNamesHelper.E_CYCLE_FB)); + editor.click(StringNamesHelper.E_CYCLE_FB); + final SWTBotGefEditPart fb1 = editor.getEditPart(StringNamesHelper.E_CYCLE_FB).parent(); assertNotNull(fb1); - final Rectangle fb1Bounds1 = getAbsolutePosition(editor, E_CYCLE_FB); + final Rectangle fb1Bounds1 = getAbsolutePosition(editor, StringNamesHelper.E_CYCLE_FB); assertTrue(fb1Bounds1.contains(pos1.x, pos1.y)); final Point pos3 = new Point(85, 85); editor.drag(fb1, pos3.x, pos3.y); - final Rectangle fb1Bounds2 = getAbsolutePosition(editor, E_CYCLE_FB); + final Rectangle fb1Bounds2 = getAbsolutePosition(editor, StringNamesHelper.E_CYCLE_FB); assertTrue(fb1Bounds2.contains(pos3.x, pos3.y)); // select and move E_SWITCH - editor.click(E_SWITCH_FB); - final SWTBotGefEditPart fb2 = editor.getEditPart(E_SWITCH_FB).parent(); + editor.click(StringNamesHelper.E_SWITCH_FB); + final SWTBotGefEditPart fb2 = editor.getEditPart(StringNamesHelper.E_SWITCH_FB).parent(); assertNotNull(fb2); - final Rectangle fb2Bounds1 = getAbsolutePosition(editor, E_SWITCH_FB); + final Rectangle fb2Bounds1 = getAbsolutePosition(editor, StringNamesHelper.E_SWITCH_FB); assertTrue(fb2Bounds1.contains(pos2.x, pos2.y)); final Point pos4 = new Point(285, 85); editor.drag(fb2, pos4.x, pos4.y); - final Rectangle fb2Bounds2 = getAbsolutePosition(editor, E_SWITCH_FB); + final Rectangle fb2Bounds2 = getAbsolutePosition(editor, StringNamesHelper.E_SWITCH_FB); assertTrue(fb2Bounds2.contains(pos4.x, pos4.y)); } @@ -260,14 +262,14 @@ public void moveBothFBOneAfterAnother() { @Test public void moveBothFBTogether() { final Point absPos1Fb1 = new Point(100, 100); - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, absPos1Fb1); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, absPos1Fb1); final Point absPos1Fb2 = new Point(100, 220); - dragAndDropEventsFB(E_SR_TREE_ITEM, absPos1Fb2); - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + dragAndDropEventsFB(StringNamesHelper.E_SR_TREE_ITEM, absPos1Fb2); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); - final Rectangle fb1Bounds1 = getAbsolutePosition(editor, E_CYCLE_FB); + final Rectangle fb1Bounds1 = getAbsolutePosition(editor, StringNamesHelper.E_CYCLE_FB); assertTrue(fb1Bounds1.contains(absPos1Fb1.x, absPos1Fb1.y)); - final Rectangle fb2Bounds1 = getAbsolutePosition(editor, E_SR_FB); + final Rectangle fb2Bounds1 = getAbsolutePosition(editor, StringNamesHelper.E_SR_FB); assertTrue(fb2Bounds1.contains(absPos1Fb2.x, absPos1Fb2.y)); // drag rectangle over FBs, therefore FBs should be selected @@ -275,8 +277,8 @@ public void moveBothFBTogether() { assertDoesNotThrow(editor::waitForSelectedFBEditPart); List selectedEditParts = editor.selectedEditParts(); assertFalse(selectedEditParts.isEmpty()); - assertTrue(isFbSelected(selectedEditParts, E_CYCLE_FB)); - assertTrue(isFbSelected(selectedEditParts, E_SR_FB)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_CYCLE_FB)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_SR_FB)); // move selection by clicking on point within selection (120, 120) and drag to // new Point (285, 85) @@ -287,8 +289,8 @@ public void moveBothFBTogether() { assertDoesNotThrow(editor::waitForSelectedFBEditPart); selectedEditParts = editor.selectedEditParts(); assertFalse(selectedEditParts.isEmpty()); - assertTrue(isFbSelected(selectedEditParts, E_CYCLE_FB)); - assertTrue(isFbSelected(selectedEditParts, E_SR_FB)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_CYCLE_FB)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_SR_FB)); // Calculation of translation final int translationX = pointTo.x - pointFrom.x; @@ -297,7 +299,7 @@ public void moveBothFBTogether() { // Calculation of new Position of E_CYCLEs final int absPos2Fb1X = absPos1Fb1.x + translationX; final int absPos2Fb1Y = absPos1Fb1.y + translationY; - final Rectangle fb1Bounds2 = getAbsolutePosition(editor, E_CYCLE_FB); + final Rectangle fb1Bounds2 = getAbsolutePosition(editor, StringNamesHelper.E_CYCLE_FB); assertEquals(absPos2Fb1X, fb1Bounds2.x); assertEquals(absPos2Fb1Y, fb1Bounds2.y); assertTrue(fb1Bounds2.contains(absPos2Fb1X, absPos2Fb1Y)); @@ -305,7 +307,7 @@ public void moveBothFBTogether() { // Calculation of new Position of E_SR final int absPos2Fb2X = absPos1Fb2.x + translationX; final int absPos2Fb2Y = absPos1Fb2.y + translationY; - final Rectangle fb2Bounds2 = getAbsolutePosition(editor, E_SR_FB); + final Rectangle fb2Bounds2 = getAbsolutePosition(editor, StringNamesHelper.E_SR_FB); assertEquals(absPos2Fb2X, fb2Bounds2.x); assertEquals(absPos2Fb2Y, fb2Bounds2.y); assertTrue(fb2Bounds2.contains(absPos2Fb2X, absPos2Fb2Y)); @@ -326,20 +328,20 @@ public void moveBothFBTogether() { @Test public void checkIfConnectionRemainsAfterMoving1FB() { final Point pos1 = new Point(100, 50); - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, pos1); - dragAndDropEventsFB(E_DEMUX_TREE_ITEM, new Point(300, 50)); - createConnection(EO, EI); - final ConnectionEditPart connection = findConnection(EO, EI); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, pos1); + dragAndDropEventsFB(StringNamesHelper.E_DEMUX_TREE_ITEM, new Point(300, 50)); + createConnection(PinNamesHelper.EO, PinNamesHelper.EI); + final ConnectionEditPart connection = findConnection(PinNamesHelper.EO, PinNamesHelper.EI); assertNotNull(connection); // select E_CYCLE - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); - assertNotNull(editor.getEditPart(E_CYCLE_FB)); - editor.click(E_CYCLE_FB); - final SWTBotGefEditPart fb1 = editor.getEditPart(E_CYCLE_FB).parent(); + assertNotNull(editor.getEditPart(StringNamesHelper.E_CYCLE_FB)); + editor.click(StringNamesHelper.E_CYCLE_FB); + final SWTBotGefEditPart fb1 = editor.getEditPart(StringNamesHelper.E_CYCLE_FB).parent(); assertNotNull(fb1); - final Rectangle fb1Bounds1 = getAbsolutePosition(editor, E_CYCLE_FB); + final Rectangle fb1Bounds1 = getAbsolutePosition(editor, StringNamesHelper.E_CYCLE_FB); assertTrue(fb1Bounds1.contains(pos1.x, pos1.y)); // get connection start and end point @@ -354,7 +356,7 @@ public void checkIfConnectionRemainsAfterMoving1FB() { // move E_CYCLE editor.drag(fb1, pos2.x, pos2.y); - final Rectangle fb1Bounds2 = getAbsolutePosition(editor, E_CYCLE_FB); + final Rectangle fb1Bounds2 = getAbsolutePosition(editor, StringNamesHelper.E_CYCLE_FB); assertTrue(fb1Bounds2.contains(pos2.x, pos2.y)); assertNotNull(connection); final org.eclipse.draw2d.geometry.Point newStartPointConnection = polyLineConnection.getPoints() @@ -384,22 +386,22 @@ public void checkIfConnectionRemainsAfterMoving1FB() { @Test public void checkIfConnectionRemainsAfterMovingBothFBsOneAfterAnother() { final Point pos1 = new Point(375, 75); - dragAndDropEventsFB(E_SELECT_TREE_ITEM, pos1); + dragAndDropEventsFB(StringNamesHelper.E_SELECT_TREE_ITEM, pos1); final Point pos2 = new Point(175, 125); - dragAndDropEventsFB(E_CTUD_TREE_ITEM, pos2); - createConnection(QU, G); - final ConnectionEditPart connection = findConnection(QU, G); + dragAndDropEventsFB(StringNamesHelper.E_CTUD_TREE_ITEM, pos2); + createConnection(PinNamesHelper.QU, PinNamesHelper.G); + final ConnectionEditPart connection = findConnection(PinNamesHelper.QU, PinNamesHelper.G); assertNotNull(connection); // select E_SELECT - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); - assertNotNull(editor.getEditPart(E_CTUD_FB)); - assertNotNull(editor.getEditPart(E_SELECT_FB)); - editor.click(E_SELECT_FB); - final SWTBotGefEditPart fb1 = editor.getEditPart(E_SELECT_FB).parent(); + assertNotNull(editor.getEditPart(StringNamesHelper.E_CTUD_FB)); + assertNotNull(editor.getEditPart(StringNamesHelper.E_SELECT_FB)); + editor.click(StringNamesHelper.E_SELECT_FB); + final SWTBotGefEditPart fb1 = editor.getEditPart(StringNamesHelper.E_SELECT_FB).parent(); assertNotNull(fb1); - final Rectangle fb1Bounds1 = getAbsolutePosition(editor, E_SELECT_FB); + final Rectangle fb1Bounds1 = getAbsolutePosition(editor, StringNamesHelper.E_SELECT_FB); assertTrue(fb1Bounds1.contains(pos1.x, pos1.y)); // get connection start and end point @@ -418,7 +420,7 @@ public void checkIfConnectionRemainsAfterMovingBothFBsOneAfterAnother() { // move E_SELECT editor.drag(fb1, pos3.x, pos3.y); - final Rectangle fb1Bounds2 = getAbsolutePosition(editor, E_SELECT_FB); + final Rectangle fb1Bounds2 = getAbsolutePosition(editor, StringNamesHelper.E_SELECT_FB); assertTrue(fb1Bounds2.contains(pos3.x, pos3.y)); assertNotNull(connection); org.eclipse.draw2d.geometry.Point newStartPointConnection = polyLineConnection.getPoints().getFirstPoint(); @@ -429,14 +431,14 @@ public void checkIfConnectionRemainsAfterMovingBothFBsOneAfterAnother() { assertEquals(endPointConnection.y + (long) fb1DeltaY, newEndPointConnection.y); // select E_CTUD - editor.click(E_CTUD_FB); - final SWTBotGefEditPart fb2 = editor.getEditPart(E_CTUD_FB).parent(); + editor.click(StringNamesHelper.E_CTUD_FB); + final SWTBotGefEditPart fb2 = editor.getEditPart(StringNamesHelper.E_CTUD_FB).parent(); assertNotNull(fb2); - final Rectangle fb2Bounds1 = getAbsolutePosition(editor, E_CTUD_FB); + final Rectangle fb2Bounds1 = getAbsolutePosition(editor, StringNamesHelper.E_CTUD_FB); assertTrue(fb2Bounds1.contains(pos2.x, pos2.y)); // move E_CTUD editor.drag(fb2, pos4.x, pos4.y); - final Rectangle fb2Bounds2 = getAbsolutePosition(editor, E_CTUD_FB); + final Rectangle fb2Bounds2 = getAbsolutePosition(editor, StringNamesHelper.E_CTUD_FB); assertTrue(fb2Bounds2.contains(pos4.x, pos4.y)); assertNotNull(connection); newStartPointConnection = polyLineConnection.getPoints().getFirstPoint(); @@ -461,13 +463,13 @@ public void checkIfConnectionRemainsAfterMovingBothFBsOneAfterAnother() { @Test public void checkIfConnectionRemainsAfterMovingBothFBsTogether() { final Point pos1 = new Point(200, 100); - dragAndDropEventsFB(E_DEMUX_TREE_ITEM, pos1); + dragAndDropEventsFB(StringNamesHelper.E_DEMUX_TREE_ITEM, pos1); final Point pos2 = new Point(100, 275); - dragAndDropEventsFB(E_SR_TREE_ITEM, pos2); - createConnection(EO1, R); - ConnectionEditPart connection = findConnection(EO1, R); + dragAndDropEventsFB(StringNamesHelper.E_SR_TREE_ITEM, pos2); + createConnection(PinNamesHelper.EO1, PinNamesHelper.R); + ConnectionEditPart connection = findConnection(PinNamesHelper.EO1, PinNamesHelper.R); assertNotNull(connection); - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); // get connection start and end point final PolylineConnection polyLineConnection = (PolylineConnection) connection.getFigure(); @@ -479,8 +481,8 @@ public void checkIfConnectionRemainsAfterMovingBothFBsTogether() { assertDoesNotThrow(editor::waitForSelectedFBEditPart); List selectedEditParts = editor.selectedEditParts(); assertFalse(selectedEditParts.isEmpty()); - assertTrue(isFbSelected(selectedEditParts, E_DEMUX_FB)); - assertTrue(isFbSelected(selectedEditParts, E_SR_FB)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_DEMUX_FB)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_SR_FB)); // move selection by clicking on one FB but not on instance name or a pin final Point pointFrom = new Point(125, 300); @@ -490,15 +492,15 @@ public void checkIfConnectionRemainsAfterMovingBothFBsTogether() { assertDoesNotThrow(editor::waitForSelectedFBEditPart); selectedEditParts = editor.selectedEditParts(); assertFalse(selectedEditParts.isEmpty()); - assertTrue(isFbSelected(selectedEditParts, E_DEMUX_FB)); - assertTrue(isFbSelected(selectedEditParts, E_SR_FB)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_DEMUX_FB)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_SR_FB)); // calculation of translation final int translationX = pointTo.x - pointFrom.x; final int translationY = pointTo.y - pointFrom.y; // check if connection has been moved - connection = findConnection(EO1, R); + connection = findConnection(PinNamesHelper.EO1, PinNamesHelper.R); assertNotNull(connection); final org.eclipse.draw2d.geometry.Point newStartPointConnection = polyLineConnection.getPoints() .getFirstPoint(); diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/BasicMultipleFBNetworkEditingTests.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/BasicMultipleFBNetworkEditingTests.java index 9e431189b8..37f1e59e90 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/BasicMultipleFBNetworkEditingTests.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/BasicMultipleFBNetworkEditingTests.java @@ -16,6 +16,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; +import org.eclipse.fordiac.ide.test.ui.helpers.StringNamesHelper; import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefEditor; import org.eclipse.swt.graphics.Point; import org.junit.jupiter.api.Disabled; @@ -52,14 +53,14 @@ public class BasicMultipleFBNetworkEditingTests extends Abstract4diacUITests { @SuppressWarnings("static-method") @Test public void checkIfNewFbGetsNextFreeRunningNumber() { - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, new Point(100, 100)); - dragAndDropEventsFB(E_SR_TREE_ITEM, new Point(300, 100)); - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, new Point(500, 100)); - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, new Point(100, 250)); - dragAndDropEventsFB(E_SR_TREE_ITEM, new Point(300, 250)); - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, new Point(500, 250)); - - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, new Point(100, 100)); + dragAndDropEventsFB(StringNamesHelper.E_SR_TREE_ITEM, new Point(300, 100)); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, new Point(500, 100)); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, new Point(100, 250)); + dragAndDropEventsFB(StringNamesHelper.E_SR_TREE_ITEM, new Point(300, 250)); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, new Point(500, 250)); + + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); assertTrue(isFBNamePresendOnEditingArea(editor, E_CYCLE)); @@ -87,12 +88,12 @@ public void checkIfNewFbGetsNextFreeRunningNumber() { @SuppressWarnings("static-method") @Test public void checkIfNewFbGetsSmallestNextFreeRunningNumber() { - dragAndDropEventsFB(E_SWITCH_TREE_ITEM, new Point(50, 100)); - dragAndDropEventsFB(E_SWITCH_TREE_ITEM, new Point(250, 100)); - dragAndDropEventsFB(E_SWITCH_TREE_ITEM, new Point(450, 100)); - dragAndDropEventsFB(E_SWITCH_TREE_ITEM, new Point(50, 250)); + dragAndDropEventsFB(StringNamesHelper.E_SWITCH_TREE_ITEM, new Point(50, 100)); + dragAndDropEventsFB(StringNamesHelper.E_SWITCH_TREE_ITEM, new Point(250, 100)); + dragAndDropEventsFB(StringNamesHelper.E_SWITCH_TREE_ITEM, new Point(450, 100)); + dragAndDropEventsFB(StringNamesHelper.E_SWITCH_TREE_ITEM, new Point(50, 250)); - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); assertTrue(isFBNamePresendOnEditingArea(editor, E_SWITCH)); @@ -104,7 +105,7 @@ public void checkIfNewFbGetsSmallestNextFreeRunningNumber() { deleteFB(editor, E_SWITCH_2); assertFalse(isFBNamePresendOnEditingArea(editor, E_SWITCH_2)); - dragAndDropEventsFB(E_SWITCH_TREE_ITEM, new Point(450, 250)); + dragAndDropEventsFB(StringNamesHelper.E_SWITCH_TREE_ITEM, new Point(450, 250)); assertTrue(isFBNamePresendOnEditingArea(editor, E_SWITCH_2)); deleteFB(editor, E_SWITCH); @@ -112,10 +113,10 @@ public void checkIfNewFbGetsSmallestNextFreeRunningNumber() { assertFalse(isFBNamePresendOnEditingArea(editor, E_SWITCH)); assertFalse(isFBNamePresendOnEditingArea(editor, E_SWITCH_1)); - dragAndDropEventsFB(E_SWITCH_TREE_ITEM, new Point(450, 100)); - dragAndDropEventsFB(E_SWITCH_TREE_ITEM, new Point(250, 100)); - dragAndDropEventsFB(E_SWITCH_TREE_ITEM, new Point(250, 250)); - dragAndDropEventsFB(E_SWITCH_TREE_ITEM, new Point(50, 100)); + dragAndDropEventsFB(StringNamesHelper.E_SWITCH_TREE_ITEM, new Point(450, 100)); + dragAndDropEventsFB(StringNamesHelper.E_SWITCH_TREE_ITEM, new Point(250, 100)); + dragAndDropEventsFB(StringNamesHelper.E_SWITCH_TREE_ITEM, new Point(250, 250)); + dragAndDropEventsFB(StringNamesHelper.E_SWITCH_TREE_ITEM, new Point(50, 100)); assertTrue(isFBNamePresendOnEditingArea(editor, E_SWITCH)); assertTrue(isFBNamePresendOnEditingArea(editor, E_SWITCH_1)); assertTrue(isFBNamePresendOnEditingArea(editor, E_SWITCH_4)); diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/CompositeInstanceViewerTests.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/CompositeInstanceViewerTests.java index 23a200d841..d78ed8f01d 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/CompositeInstanceViewerTests.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/CompositeInstanceViewerTests.java @@ -26,6 +26,8 @@ import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.fordiac.ide.fbtypeeditor.network.viewer.CompositeInstanceViewer; import org.eclipse.fordiac.ide.model.ui.editors.AbstractBreadCrumbEditor; +import org.eclipse.fordiac.ide.test.ui.helpers.PinNamesHelper; +import org.eclipse.fordiac.ide.test.ui.helpers.StringNamesHelper; import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefViewer; import org.eclipse.gef.ConnectionEditPart; import org.eclipse.gef.GraphicalEditPart; @@ -50,14 +52,14 @@ public class CompositeInstanceViewerTests extends Abstract4diacUITests { @SuppressWarnings("static-method") @Test public void compositeInstanceViewerAppearsAfterDoubleClickOnFB() { - dragAndDropEventsFB(E_N_TABLE_TREE_ITEM, new Point(200, 100)); - final SWTBotGefEditor editor = goToCompositeInstanceViewer(E_N_TABLE_FB); + dragAndDropEventsFB(StringNamesHelper.E_N_TABLE_TREE_ITEM, new Point(200, 100)); + final SWTBotGefEditor editor = goToCompositeInstanceViewer(StringNamesHelper.E_N_TABLE_FB); UIThreadRunnable.syncExec(() -> { final IEditorPart editorPart = editor.getReference().getEditor(false); if (editorPart instanceof final AbstractBreadCrumbEditor breadCrumbEditor) { final String title = breadCrumbEditor.getBreadcrumb().getActiveItem().getText(); - assertEquals(E_N_TABLE_FB, title); + assertEquals(StringNamesHelper.E_N_TABLE_FB, title); assertTrue(breadCrumbEditor.getActiveEditor() instanceof CompositeInstanceViewer); } }); @@ -79,14 +81,14 @@ public void compositeInstanceViewerAppearsAfterDoubleClickOnFB() { @SuppressWarnings("static-method") @Test public void compositeInstanceViewerMoveFB() { - dragAndDropEventsFB(E_N_TABLE_TREE_ITEM, new Point(200, 200)); - goToCompositeInstanceViewer(E_N_TABLE_FB); + dragAndDropEventsFB(StringNamesHelper.E_N_TABLE_TREE_ITEM, new Point(200, 200)); + goToCompositeInstanceViewer(StringNamesHelper.E_N_TABLE_FB); - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); - assertNotNull(editor.getEditPart(F_SUB)); - editor.click(F_SUB); - SWTBotGefEditPart parent = editor.getEditPart(F_SUB).parent(); + assertNotNull(editor.getEditPart(StringNamesHelper.F_SUB)); + editor.click(StringNamesHelper.F_SUB); + SWTBotGefEditPart parent = editor.getEditPart(StringNamesHelper.F_SUB).parent(); assertNotNull(parent); IFigure figure = ((GraphicalEditPart) parent.part()).getFigure(); @@ -104,7 +106,7 @@ public void compositeInstanceViewerMoveFB() { editor.drag(parent, pos2.x, pos2.y); final org.eclipse.draw2d.geometry.Point posToCheck2 = new org.eclipse.draw2d.geometry.Point(pos2); - parent = editor.getEditPart(F_SUB).parent(); + parent = editor.getEditPart(StringNamesHelper.F_SUB).parent(); figure = ((GraphicalEditPart) parent.part()).getFigure(); fbBounds = figure.getBounds().getCopy(); figure.translateToAbsolute(fbBounds); @@ -124,25 +126,25 @@ public void compositeInstanceViewerMoveFB() { @SuppressWarnings("static-method") @Test public void compositeInstanceViewerDeleteFB() { - dragAndDropEventsFB(E_N_TABLE_TREE_ITEM, new Point(200, 200)); - goToCompositeInstanceViewer(E_N_TABLE_FB); + dragAndDropEventsFB(StringNamesHelper.E_N_TABLE_TREE_ITEM, new Point(200, 200)); + goToCompositeInstanceViewer(StringNamesHelper.E_N_TABLE_FB); - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); - assertNotNull(editor.getEditPart(E_DEMUX_FB)); - editor.click(E_DEMUX_FB); - final SWTBotGefEditPart parent = editor.getEditPart(E_DEMUX_FB).parent(); + assertNotNull(editor.getEditPart(StringNamesHelper.E_DEMUX_FB)); + editor.click(StringNamesHelper.E_DEMUX_FB); + final SWTBotGefEditPart parent = editor.getEditPart(StringNamesHelper.E_DEMUX_FB).parent(); assertNotNull(parent); parent.click(); - assertTrue(bot.menu(EDIT).isVisible()); - bot.menu(EDIT).click(); - assertTrue(bot.menu(DELETE).isVisible()); - assertFalse(bot.menu(DELETE).isEnabled()); + assertTrue(bot.menu(StringNamesHelper.EDIT).isVisible()); + bot.menu(StringNamesHelper.EDIT).click(); + assertTrue(bot.menu(StringNamesHelper.DELETE).isVisible()); + assertFalse(bot.menu(StringNamesHelper.DELETE).isEnabled()); - bot.menu(EDIT).menu(SELECT_ALL).click(); - assertTrue(bot.menu(DELETE).isVisible()); - assertFalse(bot.menu(DELETE).isEnabled()); + bot.menu(StringNamesHelper.EDIT).menu(StringNamesHelper.SELECT_ALL).click(); + assertTrue(bot.menu(StringNamesHelper.DELETE).isVisible()); + assertFalse(bot.menu(StringNamesHelper.DELETE).isEnabled()); returnToEditingArea(); } @@ -153,13 +155,13 @@ public void compositeInstanceViewerDeleteFB() { @SuppressWarnings("static-method") @Test public void compositeInstanceViewerAddAnotherFB() { - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, new Point(200, 200)); - goToCompositeInstanceViewer(E_CYCLE_FB); - dragAndDropEventsFB(E_SWITCH_TREE_ITEM, new Point(100, 100)); - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, new Point(200, 200)); + goToCompositeInstanceViewer(StringNamesHelper.E_CYCLE_FB); + dragAndDropEventsFB(StringNamesHelper.E_SWITCH_TREE_ITEM, new Point(100, 100)); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editor); - assertNotNull(editor.getEditPart(E_DELAY_FB)); - assertNull(editor.getEditPart(E_SWITCH_FB)); + assertNotNull(editor.getEditPart(StringNamesHelper.E_DELAY_FB)); + assertNull(editor.getEditPart(StringNamesHelper.E_SWITCH_FB)); returnToEditingArea(); } @@ -181,15 +183,15 @@ public void compositeInstanceViewerEditingOfFB() { @SuppressWarnings("static-method") @Test public void compositeInstanceViewerConnectionCanBeAdded() { - dragAndDropEventsFB(E_N_TABLE_TREE_ITEM, new Point(200, 200)); - goToCompositeInstanceViewer(E_N_TABLE_FB); - SWTBot4diacGefViewer viewer = createConnection(EO, EI); + dragAndDropEventsFB(StringNamesHelper.E_N_TABLE_TREE_ITEM, new Point(200, 200)); + goToCompositeInstanceViewer(StringNamesHelper.E_N_TABLE_FB); + SWTBot4diacGefViewer viewer = createConnection(PinNamesHelper.EO, PinNamesHelper.EI); assertThrows(TimeoutException.class, viewer::waitForConnection); - viewer = createConnection(N, CV); + viewer = createConnection(PinNamesHelper.N, PinNamesHelper.CV); assertThrows(TimeoutException.class, viewer::waitForConnection); - viewer = createConnection(START, STOP); + viewer = createConnection(PinNamesHelper.START, PinNamesHelper.STOP); assertThrows(TimeoutException.class, viewer::waitForConnection); - viewer = createConnection(START, EO0); + viewer = createConnection(PinNamesHelper.START, PinNamesHelper.EO0); assertThrows(TimeoutException.class, viewer::waitForConnection); returnToEditingArea(); } @@ -200,12 +202,12 @@ public void compositeInstanceViewerConnectionCanBeAdded() { @SuppressWarnings("static-method") @Test public void compositeInstanceViewerDeleteConnection() { - dragAndDropEventsFB(E_N_TABLE_TREE_ITEM, new Point(100, 100)); - goToCompositeInstanceViewer(E_N_TABLE_FB); + dragAndDropEventsFB(StringNamesHelper.E_N_TABLE_TREE_ITEM, new Point(100, 100)); + goToCompositeInstanceViewer(StringNamesHelper.E_N_TABLE_FB); - final SWTBotGefEditor editor = bot.gefEditor(PROJECT_NAME); + final SWTBotGefEditor editor = bot.gefEditor(StringNamesHelper.PROJECT_NAME); final SWTBot4diacGefViewer viewer = (SWTBot4diacGefViewer) editor.getSWTBotGefViewer(); - final ConnectionEditPart connection = findConnection(EO, REQ); + final ConnectionEditPart connection = findConnection(PinNamesHelper.EO, PinNamesHelper.REQ); final PolylineConnection figure = (PolylineConnection) connection.getFigure(); final PointList points = figure.getPoints(); final org.eclipse.draw2d.geometry.Point firstPoint = points.getFirstPoint(); @@ -218,15 +220,15 @@ public void compositeInstanceViewerDeleteConnection() { final IEditorPart editorPart = editor.getReference().getEditor(false); if (editorPart instanceof final AbstractBreadCrumbEditor breadCrumbEditor) { final String title = breadCrumbEditor.getBreadcrumb().getActiveItem().getText(); - assertEquals(E_N_TABLE_FB, title); + assertEquals(StringNamesHelper.E_N_TABLE_FB, title); assertTrue(breadCrumbEditor.getActiveEditor() instanceof CompositeInstanceViewer); } }); - assertFalse(bot.menu(EDIT).menu(DELETE).isEnabled()); - assertTrue(bot.menu(EDIT).menu(SELECT_ALL).isEnabled()); - bot.menu(EDIT).menu(SELECT_ALL).click(); - assertFalse(bot.menu(EDIT).menu(DELETE).isEnabled()); + assertFalse(bot.menu(StringNamesHelper.EDIT).menu(StringNamesHelper.DELETE).isEnabled()); + assertTrue(bot.menu(StringNamesHelper.EDIT).menu(StringNamesHelper.SELECT_ALL).isEnabled()); + bot.menu(StringNamesHelper.EDIT).menu(StringNamesHelper.SELECT_ALL).click(); + assertFalse(bot.menu(StringNamesHelper.EDIT).menu(StringNamesHelper.DELETE).isEnabled()); returnToEditingArea(); } diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/New4diacProjectTest.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/New4diacProjectTest.java index 116f632bb3..4d81ed38b9 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/New4diacProjectTest.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/New4diacProjectTest.java @@ -18,6 +18,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; +import org.eclipse.fordiac.ide.test.ui.helpers.StringNamesHelper; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Tree; import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; @@ -34,28 +35,6 @@ public class New4diacProjectTest { - private static final String NEW = "New"; //$NON-NLS-1$ - private static final String FILE = "File"; //$NON-NLS-1$ - private static final String CANCEL = "Cancel"; //$NON-NLS-1$ - private static final String OK = "OK"; //$NON-NLS-1$ - private static final String FINISH = "Finish"; //$NON-NLS-1$ - private static final String APP = "App"; //$NON-NLS-1$ - private static final String EDIT = "Edit"; //$NON-NLS-1$ - private static final String DELETE = "Delete"; //$NON-NLS-1$ - private static final String DELETE_PROJECT_WARNING = "Delete project contents on disk (cannot be undone)"; //$NON-NLS-1$ - private static final String DELETE_RESOURCES = "Delete Resources"; //$NON-NLS-1$ - private static final String SYSTEM_EXPLORER_ID = "org.eclipse.fordiac.ide.systemmanagement.ui.systemexplorer"; //$NON-NLS-1$ - private static final String SYSTEM_EXPLORER_LABEL = "System Explorer"; //$NON-NLS-1$ - private static final String INITIAL_APPLICATION_NAME_LABEL = "Initial application name"; //$NON-NLS-1$ - private static final String INITIAL_SYSTEM_NAME_LABEL = "Initial system name"; //$NON-NLS-1$ - private static final String UI_TEST_PROJECT1 = "UiTestProject1"; //$NON-NLS-1$ - private static final String UI_TEST_PROJECT2 = "UiTestProject2"; //$NON-NLS-1$ - private static final String UI_TEST_PROJECT3 = "UiTestProject3"; //$NON-NLS-1$ - private static final String UI_TEST_PROJECT4 = "UiTestProject4"; //$NON-NLS-1$ - private static final String UI_TEST_PROJECT5 = "UiTestProject5"; //$NON-NLS-1$ - private static final String PROJECT_NAME_LABEL = "Project name:"; //$NON-NLS-1$ - private static final String NEW_4DIAC_PROJECT = "New 4diacProject"; //$NON-NLS-1$ - private static final String FORDIAC_IDE_PROJECT = "4diac IDE Project..."; //$NON-NLS-1$ private static SWTWorkbenchBot bot = new SWTWorkbenchBot(); /** @@ -90,13 +69,14 @@ public static void afterClass() { @SuppressWarnings("static-method") @Test public void menuNew4diacProjectExists() { - final SWTBotMenu fileMenu = bot.menu(FILE).menu(NEW).menu(FORDIAC_IDE_PROJECT).click(); + final SWTBotMenu fileMenu = bot.menu(StringNamesHelper.FILE).menu(StringNamesHelper.NEW) + .menu(StringNamesHelper.FORDIAC_IDE_PROJECT).click(); assertNotNull(fileMenu); - final SWTBotShell shell = bot.shell(NEW_4DIAC_PROJECT); + final SWTBotShell shell = bot.shell(StringNamesHelper.NEW_4DIAC_PROJECT); shell.activate(); - assertTrue(bot.button(CANCEL).isEnabled()); - assertFalse(bot.button(FINISH).isEnabled()); - bot.button(CANCEL).click(); + assertTrue(bot.button(StringNamesHelper.CANCEL).isEnabled()); + assertFalse(bot.button(StringNamesHelper.FINISH).isEnabled()); + bot.button(StringNamesHelper.CANCEL).click(); } /** @@ -113,30 +93,33 @@ public void menuNew4diacProjectExists() { @SuppressWarnings("static-method") @Test public void createANew4diacIDEProject() { - final SWTBotMenu fileMenu = bot.menu(FILE).menu(NEW).menu(FORDIAC_IDE_PROJECT).click(); + final SWTBotMenu fileMenu = bot.menu(StringNamesHelper.FILE).menu(StringNamesHelper.NEW) + .menu(StringNamesHelper.FORDIAC_IDE_PROJECT).click(); assertNotNull(fileMenu); - final SWTBotShell shell = bot.shell(NEW_4DIAC_PROJECT); + final SWTBotShell shell = bot.shell(StringNamesHelper.NEW_4DIAC_PROJECT); shell.activate(); - assertTrue(bot.button(CANCEL).isEnabled()); - assertFalse(bot.button(FINISH).isEnabled()); - bot.textWithLabel(PROJECT_NAME_LABEL).setText(UI_TEST_PROJECT1); - assertEquals(bot.textWithLabel(INITIAL_SYSTEM_NAME_LABEL).getText(), UI_TEST_PROJECT1); - assertEquals(bot.textWithLabel(INITIAL_APPLICATION_NAME_LABEL).getText(), UI_TEST_PROJECT1 + APP); - assertTrue(bot.button(CANCEL).isEnabled()); - assertTrue(bot.button(FINISH).isEnabled()); - bot.button(FINISH).click(); + assertTrue(bot.button(StringNamesHelper.CANCEL).isEnabled()); + assertFalse(bot.button(StringNamesHelper.FINISH).isEnabled()); + bot.textWithLabel(StringNamesHelper.PROJECT_NAME_LABEL).setText(StringNamesHelper.PROJECT_NAME1); + assertEquals(bot.textWithLabel(StringNamesHelper.INITIAL_SYSTEM_NAME_LABEL).getText(), + StringNamesHelper.PROJECT_NAME1); + assertEquals(bot.textWithLabel(StringNamesHelper.INITIAL_APPLICATION_NAME_LABEL).getText(), + StringNamesHelper.PROJECT_NAME1 + StringNamesHelper.APP); + assertTrue(bot.button(StringNamesHelper.CANCEL).isEnabled()); + assertTrue(bot.button(StringNamesHelper.FINISH).isEnabled()); + bot.button(StringNamesHelper.FINISH).click(); bot.waitUntil(shellCloses(shell)); - final SWTBotView systemExplorerView = bot.viewByTitle(SYSTEM_EXPLORER_LABEL); + final SWTBotView systemExplorerView = bot.viewByTitle(StringNamesHelper.SYSTEM_EXPLORER_LABEL); systemExplorerView.show(); final Composite systemExplorerComposite = (Composite) systemExplorerView.getWidget(); final Tree swtTree = bot.widget(WidgetMatcherFactory.widgetOfType(Tree.class), systemExplorerComposite); final SWTBotTree tree = new SWTBotTree(swtTree); - final SWTBotTreeItem treeItem = tree.getTreeItem(UI_TEST_PROJECT1); - assertEquals(treeItem.getText(), UI_TEST_PROJECT1); + final SWTBotTreeItem treeItem = tree.getTreeItem(StringNamesHelper.PROJECT_NAME1); + assertEquals(treeItem.getText(), StringNamesHelper.PROJECT_NAME1); - deleteProject(UI_TEST_PROJECT1); + deleteProject(StringNamesHelper.PROJECT_NAME1); } /** @@ -148,14 +131,15 @@ public void createANew4diacIDEProject() { @SuppressWarnings("static-method") @Test public void tryToCreateANew4diacIDEProjectMenuWithExistingName() { - createProject(UI_TEST_PROJECT2); - final SWTBotMenu fileMenu = bot.menu(FILE).menu(NEW).menu(FORDIAC_IDE_PROJECT).click(); + createProject(StringNamesHelper.PROJECT_NAME2); + final SWTBotMenu fileMenu = bot.menu(StringNamesHelper.FILE).menu(StringNamesHelper.NEW) + .menu(StringNamesHelper.FORDIAC_IDE_PROJECT).click(); assertNotNull(fileMenu); - final SWTBotShell shell = bot.shell(NEW_4DIAC_PROJECT); + final SWTBotShell shell = bot.shell(StringNamesHelper.NEW_4DIAC_PROJECT); shell.activate(); - bot.textWithLabel(PROJECT_NAME_LABEL).setText(UI_TEST_PROJECT2); - assertFalse(bot.button(FINISH).isEnabled()); - bot.button(CANCEL).click(); + bot.textWithLabel(StringNamesHelper.PROJECT_NAME_LABEL).setText(StringNamesHelper.PROJECT_NAME2); + assertFalse(bot.button(StringNamesHelper.FINISH).isEnabled()); + bot.button(StringNamesHelper.CANCEL).click(); } /** @@ -164,22 +148,22 @@ public void tryToCreateANew4diacIDEProjectMenuWithExistingName() { @SuppressWarnings("static-method") @Test public void deleteExisting4diacIDEProject() { - createProject(UI_TEST_PROJECT3); - final SWTBotView systemExplorerView = bot.viewById(SYSTEM_EXPLORER_ID); + createProject(StringNamesHelper.PROJECT_NAME3); + final SWTBotView systemExplorerView = bot.viewById(StringNamesHelper.SYSTEM_EXPLORER_ID); systemExplorerView.show(); final Composite systemExplorerComposite = (Composite) systemExplorerView.getWidget(); final Tree swtTree = bot.widget(WidgetMatcherFactory.widgetOfType(Tree.class), systemExplorerComposite); final SWTBotTree tree = new SWTBotTree(swtTree); - final SWTBotTreeItem treeProjectItem = tree.getTreeItem(UI_TEST_PROJECT3); + final SWTBotTreeItem treeProjectItem = tree.getTreeItem(StringNamesHelper.PROJECT_NAME3); treeProjectItem.select(); - bot.menu(EDIT).menu(DELETE).click(); + bot.menu(StringNamesHelper.EDIT).menu(StringNamesHelper.DELETE).click(); // the project deletion confirmation dialog - final SWTBotShell shell = bot.shell(DELETE_RESOURCES); + final SWTBotShell shell = bot.shell(StringNamesHelper.DELETE_RESOURCES); shell.activate(); - bot.checkBox(DELETE_PROJECT_WARNING).select(); - bot.button(OK).click(); + bot.checkBox(StringNamesHelper.DELETE_PROJECT_WARNING).select(); + bot.button(StringNamesHelper.OK).click(); bot.waitUntil(shellCloses(shell)); } @@ -192,18 +176,18 @@ public void deleteExisting4diacIDEProject() { @SuppressWarnings("static-method") @Test public void isProjectNotInSystemExplorerAfterDeletion() { - createProject(UI_TEST_PROJECT4); - createProject(UI_TEST_PROJECT5); - deleteProject(UI_TEST_PROJECT4); - final SWTBotView systemExplorerView = bot.viewById(SYSTEM_EXPLORER_ID); + createProject(StringNamesHelper.PROJECT_NAME4); + createProject(StringNamesHelper.PROJECT_NAME5); + deleteProject(StringNamesHelper.PROJECT_NAME4); + final SWTBotView systemExplorerView = bot.viewById(StringNamesHelper.SYSTEM_EXPLORER_ID); systemExplorerView.show(); final Composite systemExplorerComposite = (Composite) systemExplorerView.getWidget(); final Tree swtTree = bot.widget(WidgetMatcherFactory.widgetOfType(Tree.class), systemExplorerComposite); final SWTBotTree tree = new SWTBotTree(swtTree); assertNotNull(tree); assertEquals(1, tree.getAllItems().length); - assertTrue(tree.getTreeItem(UI_TEST_PROJECT5).isVisible()); - deleteProject(UI_TEST_PROJECT5); + assertTrue(tree.getTreeItem(StringNamesHelper.PROJECT_NAME5).isVisible()); + deleteProject(StringNamesHelper.PROJECT_NAME5); assertEquals(0, tree.getAllItems().length); } @@ -218,13 +202,15 @@ public void isProjectNotInSystemExplorerAfterDeletion() { * @param projectName Name of the new project. */ private static void createProject(final String projectName) { - bot.menu(FILE).menu(NEW).menu(FORDIAC_IDE_PROJECT).click(); - final SWTBotShell shell = bot.shell(NEW_4DIAC_PROJECT); + bot.menu(StringNamesHelper.FILE).menu(StringNamesHelper.NEW).menu(StringNamesHelper.FORDIAC_IDE_PROJECT) + .click(); + final SWTBotShell shell = bot.shell(StringNamesHelper.NEW_4DIAC_PROJECT); shell.activate(); - bot.textWithLabel(PROJECT_NAME_LABEL).setText(projectName); - assertEquals(bot.textWithLabel(INITIAL_SYSTEM_NAME_LABEL).getText(), projectName); - assertEquals(bot.textWithLabel(INITIAL_APPLICATION_NAME_LABEL).getText(), projectName + APP); - bot.button(FINISH).click(); + bot.textWithLabel(StringNamesHelper.PROJECT_NAME_LABEL).setText(projectName); + assertEquals(bot.textWithLabel(StringNamesHelper.INITIAL_SYSTEM_NAME_LABEL).getText(), projectName); + assertEquals(bot.textWithLabel(StringNamesHelper.INITIAL_APPLICATION_NAME_LABEL).getText(), + projectName + StringNamesHelper.APP); + bot.button(StringNamesHelper.FINISH).click(); bot.waitUntil(shellCloses(shell)); } @@ -234,7 +220,7 @@ private static void createProject(final String projectName) { * @param projectName Name of the project to be deleted */ private static void deleteProject(final String projectName) { - final SWTBotView systemExplorerView = bot.viewByTitle(SYSTEM_EXPLORER_LABEL); + final SWTBotView systemExplorerView = bot.viewByTitle(StringNamesHelper.SYSTEM_EXPLORER_LABEL); systemExplorerView.show(); final Composite systemExplorerComposite = (Composite) systemExplorerView.getWidget(); @@ -242,13 +228,13 @@ private static void deleteProject(final String projectName) { final SWTBotTree tree = new SWTBotTree(swtTree); final SWTBotTreeItem treeItem = tree.getTreeItem(projectName); treeItem.select(); - bot.menu(EDIT).menu(DELETE).click(); + bot.menu(StringNamesHelper.EDIT).menu(StringNamesHelper.DELETE).click(); // the project deletion confirmation dialog - final SWTBotShell shell = bot.shell(DELETE_RESOURCES); + final SWTBotShell shell = bot.shell(StringNamesHelper.DELETE_RESOURCES); shell.activate(); - bot.checkBox(DELETE_PROJECT_WARNING).select(); - bot.button(OK).click(); + bot.checkBox(StringNamesHelper.DELETE_PROJECT_WARNING).select(); + bot.button(StringNamesHelper.OK).click(); bot.waitUntil(shellCloses(shell)); } diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/SWTBotContextMenuUITests.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/SWTBotContextMenuUITests.java index 6b1b49ed94..84b45e9d6e 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/SWTBotContextMenuUITests.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/SWTBotContextMenuUITests.java @@ -21,6 +21,7 @@ import java.util.List; import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.fordiac.ide.test.ui.helpers.StringNamesHelper; import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacFigureCanvas; import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefEditor; import org.eclipse.swt.graphics.Point; @@ -41,14 +42,14 @@ public class SWTBotContextMenuUITests extends Abstract4diacUITests { @SuppressWarnings("static-method") @Test public void createSubapplicationViaContextMenu() { - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); - editor.clickContextMenu(NEW_SUBAPPLICATION, 100, 100); + editor.clickContextMenu(StringNamesHelper.NEW_SUBAPPLICATION, 100, 100); final List selectedEditParts = editor.selectedEditParts(); assertEquals(1, selectedEditParts.size()); - assertTrue(isSubappSelected(selectedEditParts, SUBAPP)); + assertTrue(isSubappSelected(selectedEditParts, StringNamesHelper.SUBAPP)); // check App node and SubApp TreeItem in SystemExplorer tree - assertTrue(isElementInApplicationOfSystemInSystemExplorer(SUBAPP)); + assertTrue(isElementInApplicationOfSystemInSystemExplorer(StringNamesHelper.SUBAPP)); assertTrue(isSubAppNodeInSystemExplorerEmpty()); } @@ -63,9 +64,9 @@ public void createSubapplicationViaContextMenu() { @Disabled("until bug in test is found") @Test public void createFBViaContextMenu() { - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); - editor.clickContextMenu(INSERT_FB, 100, 100); + editor.clickContextMenu(StringNamesHelper.INSERT_FB, 100, 100); final SWTBot4diacFigureCanvas canvas = editor.getSWTBotGefViewer().getCanvas(); final List controls = bot.widgets(widgetOfType(Text.class), canvas.widget); @@ -74,12 +75,12 @@ public void createFBViaContextMenu() { // which is modified with an Enter at the end of the written text) and den the // inherited method directEditType. final Text textControl = controls.get(0); - canvas.typeText(textControl, E_CYCLE_FB); + canvas.typeText(textControl, StringNamesHelper.E_CYCLE_FB); - editor.directEditType(E_CYCLE_FB); + editor.directEditType(StringNamesHelper.E_CYCLE_FB); bot.sleep(3000); - assertTrue(isElementInApplicationOfSystemInSystemExplorer(E_CYCLE_FB)); + assertTrue(isElementInApplicationOfSystemInSystemExplorer(StringNamesHelper.E_CYCLE_FB)); } /** @@ -94,20 +95,20 @@ public void createFBViaContextMenu() { @SuppressWarnings("static-method") @Test public void goToParentViaContextMenuEmptySubApp() { - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); - editor.clickContextMenu(NEW_SUBAPPLICATION, 100, 100); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); + editor.clickContextMenu(StringNamesHelper.NEW_SUBAPPLICATION, 100, 100); // check System Explorer tree if SubApp is present - assertTrue(isElementInApplicationOfSystemInSystemExplorer(SUBAPP)); + assertTrue(isElementInApplicationOfSystemInSystemExplorer(StringNamesHelper.SUBAPP)); assertTrue(isSubAppNodeInSystemExplorerEmpty()); - goToCompositeInstanceViewer(SUBAPP); - final SWTBot4diacGefEditor editorSubApp = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + goToCompositeInstanceViewer(StringNamesHelper.SUBAPP); + final SWTBot4diacGefEditor editorSubApp = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editorSubApp); // check System Explorer tree again after entering subapplication - assertTrue(isElementInApplicationOfSystemInSystemExplorer(SUBAPP)); + assertTrue(isElementInApplicationOfSystemInSystemExplorer(StringNamesHelper.SUBAPP)); assertTrue(isSubAppNodeInSystemExplorerEmpty()); - editorSubApp.clickContextMenu(GO_TO_PARENT, 100, 100); + editorSubApp.clickContextMenu(StringNamesHelper.GO_TO_PARENT, 100, 100); // check System Explorer tree after returning - assertTrue(isElementInApplicationOfSystemInSystemExplorer(SUBAPP)); + assertTrue(isElementInApplicationOfSystemInSystemExplorer(StringNamesHelper.SUBAPP)); assertTrue(isSubAppNodeInSystemExplorerEmpty()); } @@ -123,40 +124,40 @@ public void goToParentViaContextMenuEmptySubApp() { @SuppressWarnings("static-method") @Test public void goToParentViaContextMenuSubAppWithFB() { - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, new Point(100, 100)); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, new Point(100, 100)); createSubappWithDragRectangle(50, 50, 400, 400); // check System Explorer tree if SubApp is present - assertTrue(isElementInApplicationOfSystemInSystemExplorer(SUBAPP)); - assertTrue(isFBInSubAppOfSystemInSystemExplorer(E_CYCLE_FB)); - goToCompositeInstanceViewer(SUBAPP); - final SWTBot4diacGefEditor editorSubApp = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + assertTrue(isElementInApplicationOfSystemInSystemExplorer(StringNamesHelper.SUBAPP)); + assertTrue(isFBInSubAppOfSystemInSystemExplorer(StringNamesHelper.E_CYCLE_FB)); + goToCompositeInstanceViewer(StringNamesHelper.SUBAPP); + final SWTBot4diacGefEditor editorSubApp = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editorSubApp); - bot.toolbarButton(TOOLBAR_BUTTON_ZOOM_FIT_PAGE).click(); + bot.toolbarButton(StringNamesHelper.TOOLBAR_BUTTON_ZOOM_FIT_PAGE).click(); // check System Explorer tree again after entering subapplication - assertTrue(isElementInApplicationOfSystemInSystemExplorer(SUBAPP)); - assertTrue(isFBInSubAppOfSystemInSystemExplorer(E_CYCLE_FB)); - editorSubApp.clickContextMenu(GO_TO_PARENT, 100, 100); + assertTrue(isElementInApplicationOfSystemInSystemExplorer(StringNamesHelper.SUBAPP)); + assertTrue(isFBInSubAppOfSystemInSystemExplorer(StringNamesHelper.E_CYCLE_FB)); + editorSubApp.clickContextMenu(StringNamesHelper.GO_TO_PARENT, 100, 100); // check System Explorer tree after returning - assertTrue(isElementInApplicationOfSystemInSystemExplorer(SUBAPP)); - assertTrue(isFBInSubAppOfSystemInSystemExplorer(E_CYCLE_FB)); + assertTrue(isElementInApplicationOfSystemInSystemExplorer(StringNamesHelper.SUBAPP)); + assertTrue(isFBInSubAppOfSystemInSystemExplorer(StringNamesHelper.E_CYCLE_FB)); } @SuppressWarnings("static-method") @Test public void goToChildViaContextMenuSubAppWithACompositeFB() { - dragAndDropEventsFB(E_N_TABLE_TREE_ITEM, new Point(100, 100)); + dragAndDropEventsFB(StringNamesHelper.E_N_TABLE_TREE_ITEM, new Point(100, 100)); createSubappWithDragRectangle(50, 50, 300, 300); - goToCompositeInstanceViewer(SUBAPP); - final SWTBot4diacGefEditor editorSubApp = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + goToCompositeInstanceViewer(StringNamesHelper.SUBAPP); + final SWTBot4diacGefEditor editorSubApp = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editorSubApp); - bot.toolbarButton(TOOLBAR_BUTTON_ZOOM_FIT_PAGE).click(); + bot.toolbarButton(StringNamesHelper.TOOLBAR_BUTTON_ZOOM_FIT_PAGE).click(); // check bounds of FB - final Rectangle fbBounds = getBoundsOfFB(editorSubApp, E_N_TABLE_FB); - selectFBWithFBNameInEditor(editorSubApp, E_N_TABLE_FB); - editorSubApp.clickContextMenu(GO_TO_CHILD, fbBounds.x, fbBounds.y); - assertTrue(isElementInApplicationOfSystemInSystemExplorer(SUBAPP)); - assertTrue(isFBInSubAppOfSystemInSystemExplorer(E_N_TABLE_FB)); + final Rectangle fbBounds = getBoundsOfFB(editorSubApp, StringNamesHelper.E_N_TABLE_FB); + selectFBWithFBNameInEditor(editorSubApp, StringNamesHelper.E_N_TABLE_FB); + editorSubApp.clickContextMenu(StringNamesHelper.GO_TO_CHILD, fbBounds.x, fbBounds.y); + assertTrue(isElementInApplicationOfSystemInSystemExplorer(StringNamesHelper.SUBAPP)); + assertTrue(isFBInSubAppOfSystemInSystemExplorer(StringNamesHelper.E_N_TABLE_FB)); } } diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/SubappSystemExplorerTests.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/SubappSystemExplorerTests.java index aead8aa340..d7fc320375 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/SubappSystemExplorerTests.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/SubappSystemExplorerTests.java @@ -18,6 +18,7 @@ import java.util.List; +import org.eclipse.fordiac.ide.test.ui.helpers.StringNamesHelper; import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefEditor; import org.eclipse.swt.graphics.Point; import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart; @@ -37,19 +38,19 @@ public class SubappSystemExplorerTests extends Abstract4diacUITests { @SuppressWarnings("static-method") @Test public void isSubappInSystemExplorerTree() { - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, new Point(100, 100)); - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, new Point(100, 100)); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); - selectFBWithFBNameInEditor(editor, E_CYCLE_FB); + selectFBWithFBNameInEditor(editor, StringNamesHelper.E_CYCLE_FB); - bot.menu(SOURCE).menu(NEW_SUBAPPLICATION).click(); + bot.menu(StringNamesHelper.SOURCE).menu(StringNamesHelper.NEW_SUBAPPLICATION).click(); final List selectedEditParts = editor.selectedEditParts(); assertEquals(1, selectedEditParts.size()); - assertTrue(isSubappSelected(selectedEditParts, SUBAPP)); + assertTrue(isSubappSelected(selectedEditParts, StringNamesHelper.SUBAPP)); // checks for SystemExplorer tree - assertTrue(isElementInApplicationOfSystemInSystemExplorer(SUBAPP)); - assertTrue(isFBInSubAppOfSystemInSystemExplorer(E_CYCLE_FB)); + assertTrue(isElementInApplicationOfSystemInSystemExplorer(StringNamesHelper.SUBAPP)); + assertTrue(isFBInSubAppOfSystemInSystemExplorer(StringNamesHelper.E_CYCLE_FB)); } /** @@ -67,24 +68,25 @@ public void isSubappInSystemExplorerTree() { @SuppressWarnings("static-method") @Test public void isFbAndSubappInSystemExplorerTree() { - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, new Point(100, 100)); - dragAndDropEventsFB(E_SWITCH_TREE_ITEM, new Point(300, 100)); - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, new Point(100, 100)); + dragAndDropEventsFB(StringNamesHelper.E_SWITCH_TREE_ITEM, new Point(300, 100)); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); - selectFBWithFBNameInEditor(editor, E_CYCLE_FB); + selectFBWithFBNameInEditor(editor, StringNamesHelper.E_CYCLE_FB); - bot.menu(SOURCE).menu(NEW_SUBAPPLICATION).click(); + bot.menu(StringNamesHelper.SOURCE).menu(StringNamesHelper.NEW_SUBAPPLICATION).click(); final List selectedEditParts = editor.selectedEditParts(); assertEquals(1, selectedEditParts.size()); // checks for App node - assertTrue(isSubappSelected(selectedEditParts, SUBAPP)); - assertTrue(isElementInApplicationOfSystemInSystemExplorer(SUBAPP)); - assertTrue(isElementInApplicationOfSystemInSystemExplorer(E_SWITCH_FB)); + assertTrue(isSubappSelected(selectedEditParts, StringNamesHelper.SUBAPP)); + assertTrue(isElementInApplicationOfSystemInSystemExplorer(StringNamesHelper.SUBAPP)); + assertTrue(isElementInApplicationOfSystemInSystemExplorer(StringNamesHelper.E_SWITCH_FB)); // checks for SubApp node - assertTrue(isFBInSubAppOfSystemInSystemExplorer(E_CYCLE_FB)); - assertThrows(WidgetNotFoundException.class, () -> isFBInSubAppOfSystemInSystemExplorer(E_SWITCH_FB)); + assertTrue(isFBInSubAppOfSystemInSystemExplorer(StringNamesHelper.E_CYCLE_FB)); + assertThrows(WidgetNotFoundException.class, + () -> isFBInSubAppOfSystemInSystemExplorer(StringNamesHelper.E_SWITCH_FB)); } } diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/SubapplicationTests.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/SubapplicationTests.java index 5db0a14614..17a5baf4c1 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/SubapplicationTests.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/SubapplicationTests.java @@ -21,6 +21,8 @@ import java.util.List; import org.eclipse.fordiac.ide.model.ui.editors.HandlerHelper; +import org.eclipse.fordiac.ide.test.ui.helpers.PinNamesHelper; +import org.eclipse.fordiac.ide.test.ui.helpers.StringNamesHelper; import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefEditor; import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefViewer; import org.eclipse.swt.graphics.Point; @@ -40,13 +42,13 @@ public class SubapplicationTests extends Abstract4diacUITests { @Disabled("until bug fix") @Test public void createEmptySubappViaMenu() { - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); - bot.menu(SOURCE).menu(NEW_SUBAPPLICATION).click(); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); + bot.menu(StringNamesHelper.SOURCE).menu(StringNamesHelper.NEW_SUBAPPLICATION).click(); editor.drag(10, 10, 500, 500); assertDoesNotThrow(() -> editor.waitForSelectedFBEditPart()); final List selectedEditParts = editor.selectedEditParts(); assertEquals(1, selectedEditParts.size()); - assertTrue(isSubappSelected(selectedEditParts, SUBAPP)); + assertTrue(isSubappSelected(selectedEditParts, StringNamesHelper.SUBAPP)); } /** @@ -60,9 +62,9 @@ public void createEmptySubappViaMenu() { @SuppressWarnings("static-method") @Test public void createSubappViaMenu() { - dragAndDropEventsFB(E_SWITCH_TREE_ITEM, new Point(100, 100)); - dragAndDropEventsFB(E_SR_TREE_ITEM, new Point(300, 100)); - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + dragAndDropEventsFB(StringNamesHelper.E_SWITCH_TREE_ITEM, new Point(100, 100)); + dragAndDropEventsFB(StringNamesHelper.E_SR_TREE_ITEM, new Point(300, 100)); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); // drag rectangle over to FB, therefore FB should be selected editor.drag(50, 50, 400, 400); @@ -70,14 +72,14 @@ public void createSubappViaMenu() { List selectedEditParts = editor.selectedEditParts(); assertFalse(selectedEditParts.isEmpty()); assertEquals(2, selectedEditParts.size()); - assertTrue(isFbSelected(selectedEditParts, E_SWITCH_FB)); - assertTrue(isFbSelected(selectedEditParts, E_SR_FB)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_SWITCH_FB)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_SR_FB)); - bot.menu(SOURCE).menu(NEW_SUBAPPLICATION).click(); + bot.menu(StringNamesHelper.SOURCE).menu(StringNamesHelper.NEW_SUBAPPLICATION).click(); // renew list of selectedEditParts and then check if SubApp was created selectedEditParts = editor.selectedEditParts(); assertEquals(1, selectedEditParts.size()); - assertTrue(isSubappSelected(selectedEditParts, SUBAPP)); + assertTrue(isSubappSelected(selectedEditParts, StringNamesHelper.SUBAPP)); } /** @@ -91,14 +93,14 @@ public void createSubappViaMenu() { @SuppressWarnings("static-method") @Test public void createSubappViaMenuWithConnectionBetweenFBs() { - dragAndDropEventsFB(E_SWITCH_TREE_ITEM, new Point(100, 100)); - dragAndDropEventsFB(E_SR_TREE_ITEM, new Point(300, 100)); - assertNotNull(createConnection(EO0, S)); - assertNotNull(createConnection(EO1, R)); - assertNotNull(createConnection(Q, G)); + dragAndDropEventsFB(StringNamesHelper.E_SWITCH_TREE_ITEM, new Point(100, 100)); + dragAndDropEventsFB(StringNamesHelper.E_SR_TREE_ITEM, new Point(300, 100)); + assertNotNull(createConnection(PinNamesHelper.EO0, PinNamesHelper.S)); + assertNotNull(createConnection(PinNamesHelper.EO1, PinNamesHelper.R)); + assertNotNull(createConnection(PinNamesHelper.Q, PinNamesHelper.G)); // drag rectangle over to FB, therefore FB should be selected - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); editor.drag(50, 50, 500, 300); assertDoesNotThrow(() -> editor.waitForSelectedFBEditPart()); List selectedEditParts = editor.selectedEditParts(); @@ -107,17 +109,17 @@ public void createSubappViaMenuWithConnectionBetweenFBs() { // expected 5 selected EditParts (2 GefEditPart for the FBs and // 3 GefConnectionEditPars for the connections assertEquals(5, selectedEditParts.size()); - assertTrue(isFbSelected(selectedEditParts, E_SWITCH_FB)); - assertTrue(isFbSelected(selectedEditParts, E_SR_FB)); - assertTrue(checkIfConnectionCanBeFound(EO0, S)); - assertTrue(checkIfConnectionCanBeFound(EO1, R)); - assertTrue(checkIfConnectionCanBeFound(Q, G)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_SWITCH_FB)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_SR_FB)); + assertTrue(checkIfConnectionCanBeFound(PinNamesHelper.EO0, PinNamesHelper.S)); + assertTrue(checkIfConnectionCanBeFound(PinNamesHelper.EO1, PinNamesHelper.R)); + assertTrue(checkIfConnectionCanBeFound(PinNamesHelper.Q, PinNamesHelper.G)); - bot.menu(SOURCE).menu(NEW_SUBAPPLICATION).click(); + bot.menu(StringNamesHelper.SOURCE).menu(StringNamesHelper.NEW_SUBAPPLICATION).click(); // renew list of selectedEditParts and then check if SubApp was created selectedEditParts = editor.selectedEditParts(); assertEquals(1, selectedEditParts.size()); - assertTrue(isSubappSelected(selectedEditParts, SUBAPP)); + assertTrue(isSubappSelected(selectedEditParts, StringNamesHelper.SUBAPP)); } /** @@ -132,30 +134,30 @@ public void createSubappViaMenuWithConnectionBetweenFBs() { @SuppressWarnings("static-method") @Test public void createSubappViaMenuWithExistingConnectionOutsideSubapp() { - dragAndDropEventsFB(E_CYCLE_TREE_ITEM, new Point(100, 100)); - dragAndDropEventsFB(E_SWITCH_TREE_ITEM, new Point(300, 100)); - dragAndDropEventsFB(E_SR_TREE_ITEM, new Point(500, 100)); - assertNotNull(createConnection(EO, EI)); + dragAndDropEventsFB(StringNamesHelper.E_CYCLE_TREE_ITEM, new Point(100, 100)); + dragAndDropEventsFB(StringNamesHelper.E_SWITCH_TREE_ITEM, new Point(300, 100)); + dragAndDropEventsFB(StringNamesHelper.E_SR_TREE_ITEM, new Point(500, 100)); + assertNotNull(createConnection(PinNamesHelper.EO, PinNamesHelper.EI)); // drag rectangle over to FBs E_SWITCH and E_SR, therefore FBs should be // selected - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); editor.drag(250, 50, 600, 200); assertDoesNotThrow(() -> editor.waitForSelectedFBEditPart()); List selectedEditParts = editor.selectedEditParts(); assertFalse(selectedEditParts.isEmpty()); assertEquals(2, selectedEditParts.size()); - assertTrue(isFbSelected(selectedEditParts, E_SWITCH_FB)); - assertTrue(isFbSelected(selectedEditParts, E_SR_FB)); - assertFalse(isFbSelected(selectedEditParts, E_CYCLE_TREE_ITEM)); - assertTrue(checkIfConnectionCanBeFound(EO, EI)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_SWITCH_FB)); + assertTrue(isFbSelected(selectedEditParts, StringNamesHelper.E_SR_FB)); + assertFalse(isFbSelected(selectedEditParts, StringNamesHelper.E_CYCLE_TREE_ITEM)); + assertTrue(checkIfConnectionCanBeFound(PinNamesHelper.EO, PinNamesHelper.EI)); - bot.menu(SOURCE).menu(NEW_SUBAPPLICATION).click(); + bot.menu(StringNamesHelper.SOURCE).menu(StringNamesHelper.NEW_SUBAPPLICATION).click(); // renew list of selectedEditParts and then check if SubApp was created selectedEditParts = editor.selectedEditParts(); assertEquals(1, selectedEditParts.size()); - assertTrue(isSubappSelected(selectedEditParts, SUBAPP)); - assertTrue(checkIfConnectionCanBeFound(EO, EO)); + assertTrue(isSubappSelected(selectedEditParts, StringNamesHelper.SUBAPP)); + assertTrue(checkIfConnectionCanBeFound(PinNamesHelper.EO, PinNamesHelper.EO)); } /** @@ -168,27 +170,27 @@ public void createSubappViaMenuWithExistingConnectionOutsideSubapp() { @SuppressWarnings("static-method") @Test public void createSubappViaMenuThenCreatingConnection() { - dragAndDropEventsFB(E_SWITCH_TREE_ITEM, new Point(100, 100)); - dragAndDropEventsFB(E_SR_TREE_ITEM, new Point(300, 100)); - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(PROJECT_NAME); + dragAndDropEventsFB(StringNamesHelper.E_SWITCH_TREE_ITEM, new Point(100, 100)); + dragAndDropEventsFB(StringNamesHelper.E_SR_TREE_ITEM, new Point(300, 100)); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.PROJECT_NAME); editor.drag(50, 50, 400, 400); - bot.menu(SOURCE).menu(NEW_SUBAPPLICATION).click(); + bot.menu(StringNamesHelper.SOURCE).menu(StringNamesHelper.NEW_SUBAPPLICATION).click(); - goToCompositeInstanceViewer(SUBAPP); - final SWTBotGefEditor editorSubApp = bot.gefEditor(PROJECT_NAME); + goToCompositeInstanceViewer(StringNamesHelper.SUBAPP); + final SWTBotGefEditor editorSubApp = bot.gefEditor(StringNamesHelper.PROJECT_NAME); assertNotNull(editorSubApp); final SWTBot4diacGefViewer viewer = (SWTBot4diacGefViewer) editorSubApp.getSWTBotGefViewer(); assertNotNull(viewer); - final SWTBotGefEditPart editPart = editorSubApp.getEditPart(E_SWITCH_FB); + final SWTBotGefEditPart editPart = editorSubApp.getEditPart(StringNamesHelper.E_SWITCH_FB); // syncExec() is needed to update selection of UI and therefore it needs to run // in UI thread. Without this, the connections are not created correctly UIThreadRunnable.syncExec(() -> HandlerHelper.selectEditPart(viewer.getGraphicalViewer(), editPart.part())); - assertNotNull(createConnection(EO0, S)); - assertNotNull(createConnection(EO1, R)); - assertNotNull(createConnection(Q, G)); + assertNotNull(createConnection(PinNamesHelper.EO0, PinNamesHelper.S)); + assertNotNull(createConnection(PinNamesHelper.EO1, PinNamesHelper.R)); + assertNotNull(createConnection(PinNamesHelper.Q, PinNamesHelper.G)); } } diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/BasicFBTOperationTest.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/BasicFBTOperationTest.java index 2728b7c44a..99171e34f1 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/BasicFBTOperationTest.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/BasicFBTOperationTest.java @@ -19,6 +19,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.fordiac.ide.test.ui.Abstract4diacUITests; +import org.eclipse.fordiac.ide.test.ui.helpers.PinNamesHelper; +import org.eclipse.fordiac.ide.test.ui.helpers.StringNamesHelper; import org.eclipse.fordiac.ide.test.ui.swtbot.SWTBot4diacGefEditor; import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart; import org.eclipse.swtbot.swt.finder.SWTBot; @@ -44,8 +46,8 @@ public class BasicFBTOperationTest extends Abstract4diacUITests { @SuppressWarnings("static-method") @BeforeEach public void operationsInitialization() { - createFBType(PROJECT_NAME, FBT_TEST_PROJECT2, ADAPTER); - openFBTypeInEditor(PROJECT_NAME, FBT_TEST_PROJECT2); + createFBType(StringNamesHelper.PROJECT_NAME, StringNamesHelper.FBT_TEST_PROJECT2, StringNamesHelper.ADAPTER); + openFBTypeInEditor(StringNamesHelper.PROJECT_NAME, StringNamesHelper.FBT_TEST_PROJECT2); } /** @@ -59,7 +61,7 @@ public void operationsInitialization() { @SuppressWarnings("static-method") @AfterEach public void resetEnvironment() { - deleteFBType(FBT_TEST_PROJECT2); + deleteFBType(StringNamesHelper.FBT_TEST_PROJECT2); } /** @@ -72,9 +74,9 @@ public void resetEnvironment() { @SuppressWarnings("static-method") @Test public void createNewEventInput() { - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(FBT_TEST_PROJECT2); - editor.clickContextMenu(CREATE_INPUT_EVENT); - assertNotNull(editor.getEditPart(EI1)); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.FBT_TEST_PROJECT2); + editor.clickContextMenu(StringNamesHelper.CREATE_INPUT_EVENT); + assertNotNull(editor.getEditPart(PinNamesHelper.EI1)); } /** @@ -87,9 +89,9 @@ public void createNewEventInput() { @SuppressWarnings("static-method") @Test public void createNewEventOutput() { - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(FBT_TEST_PROJECT2); - editor.clickContextMenu(CREATE_OUTPUT_EVENT); - assertNotNull(editor.getEditPart(EI1)); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.FBT_TEST_PROJECT2); + editor.clickContextMenu(StringNamesHelper.CREATE_OUTPUT_EVENT); + assertNotNull(editor.getEditPart(PinNamesHelper.EI1)); } /** @@ -103,12 +105,12 @@ public void createNewEventOutput() { */ @SuppressWarnings("static-method") @ParameterizedTest - @ValueSource(strings = { INT }) + @ValueSource(strings = { PinNamesHelper.INT }) public void createNewDataInput(final String dataType) { - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(FBT_TEST_PROJECT2); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.FBT_TEST_PROJECT2); assertNotNull(editor); - editor.clickContextMenu(CREATE_DATA_INPUT).clickContextMenu(dataType); - assertNotNull(editor.getEditPart(DI1)); + editor.clickContextMenu(StringNamesHelper.CREATE_DATA_INPUT).clickContextMenu(dataType); + assertNotNull(editor.getEditPart(PinNamesHelper.DI1)); } /** @@ -122,20 +124,20 @@ public void createNewDataInput(final String dataType) { @SuppressWarnings("static-method") @Test public void renamePin() { - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(FBT_TEST_PROJECT2); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.FBT_TEST_PROJECT2); assertNotNull(editor); - editor.clickContextMenu(CREATE_INPUT_EVENT); + editor.clickContextMenu(StringNamesHelper.CREATE_INPUT_EVENT); - assertNotNull(editor.getEditPart(EI1)); + assertNotNull(editor.getEditPart(PinNamesHelper.EI1)); - final SWTBotGefEditPart pin = editor.getEditPart(EI1); + final SWTBotGefEditPart pin = editor.getEditPart(PinNamesHelper.EI1); pin.click(); - final SWTBot propertiesBot = selectTabFromInterfaceProperties(EVENT); - propertiesBot.textWithLabel(NAME_LABEL).setText(EVENT); + final SWTBot propertiesBot = selectTabFromInterfaceProperties(StringNamesHelper.EVENT); + propertiesBot.textWithLabel(StringNamesHelper.NAME_LABEL).setText(StringNamesHelper.EVENT); - assertNull(editor.getEditPart(EI1)); - assertNotNull(editor.getEditPart(EVENT)); + assertNull(editor.getEditPart(PinNamesHelper.EI1)); + assertNotNull(editor.getEditPart(StringNamesHelper.EVENT)); } /** @@ -148,17 +150,17 @@ public void renamePin() { @SuppressWarnings("static-method") @Test public void changeEventPinComment() { - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(FBT_TEST_PROJECT2); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.FBT_TEST_PROJECT2); assertNotNull(editor); - editor.clickContextMenu(CREATE_INPUT_EVENT); + editor.clickContextMenu(StringNamesHelper.CREATE_INPUT_EVENT); - final SWTBotGefEditPart pin = editor.getEditPart(EI1); + final SWTBotGefEditPart pin = editor.getEditPart(PinNamesHelper.EI1); pin.click(); - final SWTBot propertiesBot = selectTabFromInterfaceProperties(EVENT); - propertiesBot.textWithLabel(COMMENT).setText(TEST_COMMENT); + final SWTBot propertiesBot = selectTabFromInterfaceProperties(StringNamesHelper.EVENT); + propertiesBot.textWithLabel(StringNamesHelper.COMMENT).setText(StringNamesHelper.TEST_COMMENT); - assertEquals(propertiesBot.textWithLabel(COMMENT).getText(), TEST_COMMENT); + assertEquals(propertiesBot.textWithLabel(StringNamesHelper.COMMENT).getText(), StringNamesHelper.TEST_COMMENT); } /** @@ -171,17 +173,17 @@ public void changeEventPinComment() { @SuppressWarnings("static-method") @Test public void changeDataPinComment() { - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(FBT_TEST_PROJECT2); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.FBT_TEST_PROJECT2); assertNotNull(editor); - editor.clickContextMenu(CREATE_INPUT_EVENT); + editor.clickContextMenu(StringNamesHelper.CREATE_INPUT_EVENT); - final SWTBotGefEditPart pin = editor.getEditPart(EI1); + final SWTBotGefEditPart pin = editor.getEditPart(PinNamesHelper.EI1); pin.click(); - final SWTBot propertiesBot = selectTabFromInterfaceProperties(DATA); - propertiesBot.textWithLabel(COMMENT).setText(TEST_COMMENT); + final SWTBot propertiesBot = selectTabFromInterfaceProperties(StringNamesHelper.DATA); + propertiesBot.textWithLabel(StringNamesHelper.COMMENT).setText(StringNamesHelper.TEST_COMMENT); - assertEquals(propertiesBot.textWithLabel(COMMENT).getText(), TEST_COMMENT); + assertEquals(propertiesBot.textWithLabel(StringNamesHelper.COMMENT).getText(), StringNamesHelper.TEST_COMMENT); } /** @@ -195,19 +197,19 @@ public void changeDataPinComment() { @SuppressWarnings("static-method") @Test public void addConnection() { - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(FBT_TEST_PROJECT2); - editor.clickContextMenu(CREATE_INPUT_EVENT); - editor.clickContextMenu(CREATE_DATA_INPUT).clickContextMenu(INT); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.FBT_TEST_PROJECT2); + editor.clickContextMenu(StringNamesHelper.CREATE_INPUT_EVENT); + editor.clickContextMenu(StringNamesHelper.CREATE_DATA_INPUT).clickContextMenu(PinNamesHelper.INT); - assertNotNull(editor.getEditPart(DI1)); + assertNotNull(editor.getEditPart(PinNamesHelper.DI1)); - final SWTBotGefEditPart inputPin = editor.getEditPart(EI1); + final SWTBotGefEditPart inputPin = editor.getEditPart(PinNamesHelper.EI1); inputPin.click(); - final SWTBotGefEditPart outputPin = editor.getEditPart(DI1); + final SWTBotGefEditPart outputPin = editor.getEditPart(PinNamesHelper.DI1); outputPin.click(); - createConnectionWithinFBTypeWithPropertySheet(DI1, EI1, editor); + createConnectionWithinFBTypeWithPropertySheet(PinNamesHelper.DI1, PinNamesHelper.EI1, editor); } /** @@ -221,21 +223,21 @@ public void addConnection() { @SuppressWarnings("static-method") @Test public void removeConnection() { - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(FBT_TEST_PROJECT2); - editor.clickContextMenu(CREATE_INPUT_EVENT); - editor.clickContextMenu(CREATE_DATA_INPUT).clickContextMenu(INT); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.FBT_TEST_PROJECT2); + editor.clickContextMenu(StringNamesHelper.CREATE_INPUT_EVENT); + editor.clickContextMenu(StringNamesHelper.CREATE_DATA_INPUT).clickContextMenu(PinNamesHelper.INT); - assertNotNull(editor.getEditPart(DI1)); + assertNotNull(editor.getEditPart(PinNamesHelper.DI1)); - final SWTBotGefEditPart inputPin = editor.getEditPart(EI1); + final SWTBotGefEditPart inputPin = editor.getEditPart(PinNamesHelper.EI1); inputPin.click(); - final SWTBotGefEditPart outputPin = editor.getEditPart(DI1); + final SWTBotGefEditPart outputPin = editor.getEditPart(PinNamesHelper.DI1); outputPin.click(); - createConnectionWithinFBTypeWithPropertySheet(DI1, EI1, editor); + createConnectionWithinFBTypeWithPropertySheet(PinNamesHelper.DI1, PinNamesHelper.EI1, editor); - removeConnectionWithinFBTypeWithPropertySheet(DI1, EI1, editor); + removeConnectionWithinFBTypeWithPropertySheet(PinNamesHelper.DI1, PinNamesHelper.EI1, editor); } /** @@ -250,29 +252,29 @@ public void removeConnection() { @SuppressWarnings("static-method") @Test public void changePinDataType() { - final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(FBT_TEST_PROJECT2); + final SWTBot4diacGefEditor editor = (SWTBot4diacGefEditor) bot.gefEditor(StringNamesHelper.FBT_TEST_PROJECT2); assertNotNull(editor); - editor.clickContextMenu(CREATE_DATA_INPUT).clickContextMenu(INT); + editor.clickContextMenu(StringNamesHelper.CREATE_DATA_INPUT).clickContextMenu(PinNamesHelper.INT); - final SWTBotGefEditPart port = editor.getEditPart(DI1); + final SWTBotGefEditPart port = editor.getEditPart(PinNamesHelper.DI1); port.click(); - SWTBot propertiesBot = selectTabFromInterfaceProperties(DATA); - propertiesBot.table().select(INT); - propertiesBot.button(DOT_BUTTON).click(); + SWTBot propertiesBot = selectTabFromInterfaceProperties(StringNamesHelper.DATA); + propertiesBot.table().select(PinNamesHelper.INT); + propertiesBot.button(StringNamesHelper.DOT_BUTTON).click(); - final SWTBotShell shell = bot.shell(TYPE_SELECTION); + final SWTBotShell shell = bot.shell(StringNamesHelper.TYPE_SELECTION); shell.activate(); final SWTBotTree containerTree = bot.tree(); - final SWTBotTreeItem containerItem = containerTree.getTreeItem(ELEMENTARY_TYPE); - containerItem.expand().select(ANY); + final SWTBotTreeItem containerItem = containerTree.getTreeItem(StringNamesHelper.ELEMENTARY_TYPE); + containerItem.expand().select(PinNamesHelper.ANY); - bot.button(OK).click(); + bot.button(StringNamesHelper.OK).click(); - propertiesBot = selectTabFromInterfaceProperties(DATA); + propertiesBot = selectTabFromInterfaceProperties(StringNamesHelper.DATA); - assertTrue(propertiesBot.tableWithLabel(TYPE_LABEL).containsText(ANY)); + assertTrue(propertiesBot.tableWithLabel(StringNamesHelper.TYPE_LABEL).containsText(PinNamesHelper.ANY)); } } diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/CreateFBTTest.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/CreateFBTTest.java index 78da56abef..b9147fd60d 100644 --- a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/CreateFBTTest.java +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/fbtype/CreateFBTTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2024 Prashantkumar Khatri + * Copyright (c) 2024 Prashantkumar Khatri, Andrea Zoitl * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at @@ -21,6 +21,7 @@ import java.util.List; import org.eclipse.fordiac.ide.test.ui.Abstract4diacUITests; +import org.eclipse.fordiac.ide.test.ui.helpers.StringNamesHelper; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Tree; import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory; @@ -47,43 +48,46 @@ public class CreateFBTTest extends Abstract4diacUITests { @SuppressWarnings("static-method") @Test public void createNewFBTypeWithoutPackage() { - final SWTBotMenu fileMenu = bot.menu(FILE).menu(NEW).menu(TYPE_PROJECT).click(); + final SWTBotMenu fileMenu = bot.menu(StringNamesHelper.FILE).menu(StringNamesHelper.NEW) + .menu(StringNamesHelper.TYPE_PROJECT).click(); assertNotNull(fileMenu); - final SWTBotShell shell = bot.shell(NEW_TYPE); + final SWTBotShell shell = bot.shell(StringNamesHelper.NEW_TYPE); shell.activate(); - assertTrue(bot.button(CANCEL).isEnabled()); - assertFalse(bot.button(FINISH).isEnabled()); + assertTrue(bot.button(StringNamesHelper.CANCEL).isEnabled()); + assertFalse(bot.button(StringNamesHelper.FINISH).isEnabled()); final SWTBotTree containerTree = bot.tree(); - final SWTBotTreeItem containerItem = containerTree.getTreeItem(PROJECT_NAME); + final SWTBotTreeItem containerItem = containerTree.getTreeItem(StringNamesHelper.PROJECT_NAME); containerItem.select(); - assertEquals(PROJECT_NAME, bot.textWithLabel(PARENT_FOLDER_NAME_LABEL).getText()); + assertEquals(StringNamesHelper.PROJECT_NAME, + bot.textWithLabel(StringNamesHelper.PARENT_FOLDER_NAME_LABEL).getText()); // Type Name: - bot.textWithLabel(TYPE_NAME_LABEL).setText(FBT_TEST_PROJECT1); - assertFalse(bot.button(FINISH).isEnabled()); + bot.textWithLabel(StringNamesHelper.TYPE_NAME_LABEL).setText(StringNamesHelper.FBT_TEST_PROJECT1); + assertFalse(bot.button(StringNamesHelper.FINISH).isEnabled()); // Select Type: - bot.table().select(ADAPTER); + bot.table().select(StringNamesHelper.ADAPTER); - assertEquals(bot.textWithLabel(TYPE_NAME_LABEL).getText(), FBT_TEST_PROJECT1); - assertTrue(bot.button(CANCEL).isEnabled()); - assertTrue(bot.button(FINISH).isEnabled()); + assertEquals(bot.textWithLabel(StringNamesHelper.TYPE_NAME_LABEL).getText(), + StringNamesHelper.FBT_TEST_PROJECT1); + assertTrue(bot.button(StringNamesHelper.CANCEL).isEnabled()); + assertTrue(bot.button(StringNamesHelper.FINISH).isEnabled()); - bot.button(FINISH).click(); + bot.button(StringNamesHelper.FINISH).click(); bot.waitUntil(shellCloses(shell)); - final SWTBotView systemExplorerView = bot.viewByTitle(SYSTEM_EXPLORER_LABEL); + final SWTBotView systemExplorerView = bot.viewByTitle(StringNamesHelper.SYSTEM_EXPLORER_LABEL); systemExplorerView.show(); final Composite systemExplorerComposite = (Composite) systemExplorerView.getWidget(); final Tree swtTree = bot.widget(WidgetMatcherFactory.widgetOfType(Tree.class), systemExplorerComposite); final SWTBotTree tree = new SWTBotTree(swtTree); - final SWTBotTreeItem parentItem = tree.getTreeItem(PROJECT_NAME); + final SWTBotTreeItem parentItem = tree.getTreeItem(StringNamesHelper.PROJECT_NAME); parentItem.expand(); - final SWTBotTreeItem projectItem = parentItem.getNode(FBT_TEST_PROJECT1); - assertEquals(projectItem.getText(), FBT_TEST_PROJECT1); - deleteFBType(FBT_TEST_PROJECT1); + final SWTBotTreeItem projectItem = parentItem.getNode(StringNamesHelper.FBT_TEST_PROJECT1); + assertEquals(projectItem.getText(), StringNamesHelper.FBT_TEST_PROJECT1); + deleteFBType(StringNamesHelper.FBT_TEST_PROJECT1); } /** @@ -101,48 +105,51 @@ public void createNewFBTypeWithoutPackage() { @SuppressWarnings("static-method") @Test public void createNewFBTypeWithPackage() { - final SWTBotMenu fileMenu = bot.menu(FILE).menu(NEW).menu(TYPE_PROJECT).click(); + final SWTBotMenu fileMenu = bot.menu(StringNamesHelper.FILE).menu(StringNamesHelper.NEW) + .menu(StringNamesHelper.TYPE_PROJECT).click(); assertNotNull(fileMenu); - final SWTBotShell shell = bot.shell(NEW_TYPE); + final SWTBotShell shell = bot.shell(StringNamesHelper.NEW_TYPE); shell.activate(); - assertTrue(bot.button(CANCEL).isEnabled()); - assertFalse(bot.button(FINISH).isEnabled()); + assertTrue(bot.button(StringNamesHelper.CANCEL).isEnabled()); + assertFalse(bot.button(StringNamesHelper.FINISH).isEnabled()); // Parent folder Name: final SWTBotTree containerTree = bot.tree(); - final SWTBotTreeItem containerItem = containerTree.getTreeItem(PROJECT_NAME); + final SWTBotTreeItem containerItem = containerTree.getTreeItem(StringNamesHelper.PROJECT_NAME); containerItem.select(); - assertEquals(PROJECT_NAME, bot.textWithLabel(PARENT_FOLDER_NAME_LABEL).getText()); + assertEquals(StringNamesHelper.PROJECT_NAME, + bot.textWithLabel(StringNamesHelper.PARENT_FOLDER_NAME_LABEL).getText()); // Type Name: - bot.textWithLabel(TYPE_NAME_LABEL).setText(FBT_TEST_PROJECT2); - assertFalse(bot.button(FINISH).isEnabled()); + bot.textWithLabel(StringNamesHelper.TYPE_NAME_LABEL).setText(StringNamesHelper.FBT_TEST_PROJECT2); + assertFalse(bot.button(StringNamesHelper.FINISH).isEnabled()); // Package: - bot.textWithLabel(PACKAGE_NAME_LABEL).setText(PACKAGE_NAME); - assertFalse(bot.button(FINISH).isEnabled()); + bot.textWithLabel(StringNamesHelper.PACKAGE_NAME_LABEL).setText(StringNamesHelper.PACKAGE_NAME); + assertFalse(bot.button(StringNamesHelper.FINISH).isEnabled()); // Select Type: - bot.table().select(ADAPTER); + bot.table().select(StringNamesHelper.ADAPTER); - assertEquals(bot.textWithLabel(TYPE_NAME_LABEL).getText(), FBT_TEST_PROJECT2); - assertTrue(bot.button(CANCEL).isEnabled()); - assertTrue(bot.button(FINISH).isEnabled()); + assertEquals(bot.textWithLabel(StringNamesHelper.TYPE_NAME_LABEL).getText(), + StringNamesHelper.FBT_TEST_PROJECT2); + assertTrue(bot.button(StringNamesHelper.CANCEL).isEnabled()); + assertTrue(bot.button(StringNamesHelper.FINISH).isEnabled()); - bot.button(FINISH).click(); + bot.button(StringNamesHelper.FINISH).click(); bot.waitUntil(shellCloses(shell)); - final SWTBotView systemExplorerView = bot.viewByTitle(SYSTEM_EXPLORER_LABEL); + final SWTBotView systemExplorerView = bot.viewByTitle(StringNamesHelper.SYSTEM_EXPLORER_LABEL); systemExplorerView.show(); final Composite systemExplorerComposite = (Composite) systemExplorerView.getWidget(); final Tree swtTree = bot.widget(WidgetMatcherFactory.widgetOfType(Tree.class), systemExplorerComposite); final SWTBotTree tree = new SWTBotTree(swtTree); - final SWTBotTreeItem parentItem = tree.getTreeItem(PROJECT_NAME); + final SWTBotTreeItem parentItem = tree.getTreeItem(StringNamesHelper.PROJECT_NAME); parentItem.expand(); - final SWTBotTreeItem projectItem = parentItem.getNode(FBT_TEST_PROJECT2); - assertEquals(projectItem.getText(), FBT_TEST_PROJECT2); - deleteFBType(FBT_TEST_PROJECT2); + final SWTBotTreeItem projectItem = parentItem.getNode(StringNamesHelper.FBT_TEST_PROJECT2); + assertEquals(projectItem.getText(), StringNamesHelper.FBT_TEST_PROJECT2); + deleteFBType(StringNamesHelper.FBT_TEST_PROJECT2); } /** @@ -155,31 +162,34 @@ public void createNewFBTypeWithPackage() { @SuppressWarnings("static-method") @Test public void tryToCreateFBTypeWithForbiddenName() { - final SWTBotMenu fileMenu = bot.menu(FILE).menu(NEW).menu(TYPE_PROJECT).click(); + final SWTBotMenu fileMenu = bot.menu(StringNamesHelper.FILE).menu(StringNamesHelper.NEW) + .menu(StringNamesHelper.TYPE_PROJECT).click(); assertNotNull(fileMenu); - final SWTBotShell shell = bot.shell(NEW_TYPE); + final SWTBotShell shell = bot.shell(StringNamesHelper.NEW_TYPE); shell.activate(); - assertTrue(bot.button(CANCEL).isEnabled()); - assertFalse(bot.button(FINISH).isEnabled()); + assertTrue(bot.button(StringNamesHelper.CANCEL).isEnabled()); + assertFalse(bot.button(StringNamesHelper.FINISH).isEnabled()); final SWTBotTree containerTree = bot.tree(); - final SWTBotTreeItem containerItem = containerTree.getTreeItem(PROJECT_NAME); + final SWTBotTreeItem containerItem = containerTree.getTreeItem(StringNamesHelper.PROJECT_NAME); containerItem.select(); - assertEquals(PROJECT_NAME, bot.textWithLabel(PARENT_FOLDER_NAME_LABEL).getText()); + assertEquals(StringNamesHelper.PROJECT_NAME, + bot.textWithLabel(StringNamesHelper.PARENT_FOLDER_NAME_LABEL).getText()); // Type Name: - bot.textWithLabel(TYPE_NAME_LABEL).setText(FORBIDDEN_TYPE_NAME); - assertFalse(bot.button(FINISH).isEnabled()); + bot.textWithLabel(StringNamesHelper.TYPE_NAME_LABEL).setText(StringNamesHelper.FORBIDDEN_TYPE_NAME); + assertFalse(bot.button(StringNamesHelper.FINISH).isEnabled()); // Select Type: - bot.table().select(ADAPTER); + bot.table().select(StringNamesHelper.ADAPTER); - assertEquals(bot.textWithLabel(TYPE_NAME_LABEL).getText(), FORBIDDEN_TYPE_NAME); - assertTrue(bot.button(CANCEL).isEnabled()); - assertFalse(bot.button(FINISH).isEnabled()); + assertEquals(bot.textWithLabel(StringNamesHelper.TYPE_NAME_LABEL).getText(), + StringNamesHelper.FORBIDDEN_TYPE_NAME); + assertTrue(bot.button(StringNamesHelper.CANCEL).isEnabled()); + assertFalse(bot.button(StringNamesHelper.FINISH).isEnabled()); - bot.button(CANCEL).click(); + bot.button(StringNamesHelper.CANCEL).click(); bot.waitUntil(shellCloses(shell)); } @@ -192,16 +202,17 @@ public void tryToCreateFBTypeWithForbiddenName() { @SuppressWarnings("static-method") @Test public void tryToCreateANewFBTypeWithExistingName() { - createFBType(PROJECT_NAME, FBT_TEST_PROJECT3, ADAPTER); - bot.menu(FILE).menu(NEW).menu(TYPE_PROJECT).click(); - final SWTBotShell shell = bot.shell(NEW_TYPE); + createFBType(StringNamesHelper.PROJECT_NAME, StringNamesHelper.FBT_TEST_PROJECT3, StringNamesHelper.ADAPTER); + bot.menu(StringNamesHelper.FILE).menu(StringNamesHelper.NEW).menu(StringNamesHelper.TYPE_PROJECT).click(); + final SWTBotShell shell = bot.shell(StringNamesHelper.NEW_TYPE); shell.activate(); - bot.textWithLabel(TYPE_NAME_LABEL).setText(FBT_TEST_PROJECT3); - bot.textWithLabel(PARENT_FOLDER_NAME_LABEL).setText(PROJECT_NAME); - assertEquals(bot.textWithLabel(TYPE_NAME_LABEL).getText(), FBT_TEST_PROJECT3); - bot.tableWithLabel(SELECT_TYPE_LABEL).getTableItem(ADAPTER).select(); - assertFalse(bot.button(FINISH).isEnabled()); - bot.button(CANCEL).click(); + bot.textWithLabel(StringNamesHelper.TYPE_NAME_LABEL).setText(StringNamesHelper.FBT_TEST_PROJECT3); + bot.textWithLabel(StringNamesHelper.PARENT_FOLDER_NAME_LABEL).setText(StringNamesHelper.PROJECT_NAME); + assertEquals(bot.textWithLabel(StringNamesHelper.TYPE_NAME_LABEL).getText(), + StringNamesHelper.FBT_TEST_PROJECT3); + bot.tableWithLabel(StringNamesHelper.SELECT_TYPE_LABEL).getTableItem(StringNamesHelper.ADAPTER).select(); + assertFalse(bot.button(StringNamesHelper.FINISH).isEnabled()); + bot.button(StringNamesHelper.CANCEL).click(); bot.waitUntil(shellCloses(shell)); } @@ -211,26 +222,26 @@ public void tryToCreateANewFBTypeWithExistingName() { @SuppressWarnings("static-method") @Test public void deleteExistingFBType() { - createFBType(PROJECT_NAME, FBT_TEST_PROJECT4, ADAPTER); - final SWTBotView systemExplorerView = bot.viewById(SYSTEM_EXPLORER_ID); + createFBType(StringNamesHelper.PROJECT_NAME, StringNamesHelper.FBT_TEST_PROJECT4, StringNamesHelper.ADAPTER); + final SWTBotView systemExplorerView = bot.viewById(StringNamesHelper.SYSTEM_EXPLORER_ID); systemExplorerView.show(); final Composite systemExplorerComposite = (Composite) systemExplorerView.getWidget(); final Tree swtTree = bot.widget(WidgetMatcherFactory.widgetOfType(Tree.class), systemExplorerComposite); final SWTBotTree tree = new SWTBotTree(swtTree); - final SWTBotTreeItem parentItem = tree.getTreeItem(PROJECT_NAME); + final SWTBotTreeItem parentItem = tree.getTreeItem(StringNamesHelper.PROJECT_NAME); parentItem.expand(); - final SWTBotTreeItem projectItem = parentItem.getNode(FBT_TEST_PROJECT4); + final SWTBotTreeItem projectItem = parentItem.getNode(StringNamesHelper.FBT_TEST_PROJECT4); projectItem.select(); - bot.menu(EDIT).menu(DELETE).click(); + bot.menu(StringNamesHelper.EDIT).menu(StringNamesHelper.DELETE).click(); // the project deletion confirmation dialog - final SWTBotShell shell = bot.shell(DELETE_RESOURCES); + final SWTBotShell shell = bot.shell(StringNamesHelper.DELETE_RESOURCES); shell.activate(); - bot.button(OK).click(); + bot.button(StringNamesHelper.OK).click(); bot.waitUntil(shellCloses(shell)); final List nodeList = parentItem.getNodes(); - assertFalse(nodeList.contains(FBT_TEST_PROJECT4)); + assertFalse(nodeList.contains(StringNamesHelper.FBT_TEST_PROJECT4)); } } \ No newline at end of file diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/PinNamesHelper.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/PinNamesHelper.java new file mode 100644 index 0000000000..e354bd73c9 --- /dev/null +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/PinNamesHelper.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2023, 2024 Andrea Zoitl, Prashantkumar Khatri + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Andrea Zoitl - initial API and implementation and/or initial documentation + * - added static final fields for SWTBot tests + * - restructured fields for SWTBot tests in this helper class + * Prashantkumar Khatri - added static final fields for SWTBot tests + *******************************************************************************/ + +package org.eclipse.fordiac.ide.test.ui.helpers; + +public final class PinNamesHelper { + + // FB pins and values in alphabetical order and length + + public static final String D = "D"; //$NON-NLS-1$ + public static final String G = "G"; //$NON-NLS-1$ + public static final String N = "N"; //$NON-NLS-1$ + public static final String Q = "Q"; //$NON-NLS-1$ + public static final String R = "R"; //$NON-NLS-1$ + public static final String S = "S"; //$NON-NLS-1$ + + public static final String CD = "CD"; //$NON-NLS-1$ + public static final String CV = "CV"; //$NON-NLS-1$ + public static final String DT = "DT"; //$NON-NLS-1$ + public static final String EO = "EO"; //$NON-NLS-1$ + public static final String EI = "EI"; //$NON-NLS-1$ + public static final String PV = "PV"; //$NON-NLS-1$ + public static final String QD = "QD"; //$NON-NLS-1$ + public static final String QU = "QU"; //$NON-NLS-1$ + + public static final String ANY = "ANY"; //$NON-NLS-1$ + public static final String CLK = "CLK"; //$NON-NLS-1$ + public static final String DI1 = "DI1"; //$NON-NLS-1$ + public static final String DO1 = "DO1"; //$NON-NLS-1$ + public static final String DTO = "DTO"; //$NON-NLS-1$ + public static final String EO0 = "EO0"; //$NON-NLS-1$ + public static final String EI1 = "EI1"; //$NON-NLS-1$ + public static final String EO1 = "EO1"; //$NON-NLS-1$ + public static final String EO2 = "EO2"; //$NON-NLS-1$ + public static final String IN1 = "IN1"; //$NON-NLS-1$ + public static final String INT = "INT"; //$NON-NLS-1$ + public static final String REQ = "REQ"; //$NON-NLS-1$ + + public static final String CLKO = "CLKO"; //$NON-NLS-1$ + public static final String INIT = "INIT"; //$NON-NLS-1$ + public static final String STOP = "STOP"; //$NON-NLS-1$ + + public static final String START = "START"; //$NON-NLS-1$ + + public static final String DEF_VAL = "T#0s"; //$NON-NLS-1$ + public static final String NEW_VAL = "T#1s"; //$NON-NLS-1$ + +} diff --git a/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/StringNamesHelper.java b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/StringNamesHelper.java new file mode 100644 index 0000000000..4604b49358 --- /dev/null +++ b/tests/org.eclipse.fordiac.ide.test.ui/src/org/eclipse/fordiac/ide/test/ui/helpers/StringNamesHelper.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2023, 2024 Andrea Zoitl, Prashantkumar Khatri + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Andrea Zoitl - initial API and implementation and/or initial documentation + * - added static final fields for SWTBot tests + * - restructured fields for SWTBot tests in this helper class + * Prashantkumar Khatri - added static final fields for SWTBot tests + *******************************************************************************/ + +package org.eclipse.fordiac.ide.test.ui.helpers; + +import org.eclipse.fordiac.ide.ui.FordiacMessages; + +public final class StringNamesHelper { + + // alphabetical order of static variable names + public static final String ADAPTER = "Adapter"; //$NON-NLS-1$ + public static final String APP = "App"; //$NON-NLS-1$ + public static final String COMMENT = "Comment:"; //$NON-NLS-1$ + public static final String CANCEL = "Cancel"; //$NON-NLS-1$ + public static final String CREATE_INPUT_EVENT = "Create Input Event"; //$NON-NLS-1$ + public static final String CREATE_OUTPUT_EVENT = "Create Output Event"; //$NON-NLS-1$ + public static final String CREATE_DATA_INPUT = "Create Data Input"; //$NON-NLS-1$ + public static final String CREATE_DATA_OUTPUT = "Create Data Output"; //$NON-NLS-1$ + public static final String DATA = "Data"; //$NON-NLS-1$ + public static final String DELETE = "Delete"; //$NON-NLS-1$ + public static final String DELETE_PROJECT_WARNING = "Delete project contents on disk (cannot be undone)"; //$NON-NLS-1$ + public static final String DELETE_RESOURCES = "Delete Resources"; //$NON-NLS-1$ + public static final String DOT_BUTTON = "..."; //$NON-NLS-1$ + public static final String EDIT = "Edit"; //$NON-NLS-1$ + public static final String ELEMENTARY_TYPE = "Elementary Types"; //$NON-NLS-1$ + public static final String EVENT = "Event"; //$NON-NLS-1$ + public static final String EVENTS_NODE = "events"; //$NON-NLS-1$ + public static final String E_CTUD_FB = "E_CTUD"; //$NON-NLS-1$ + public static final String E_CTUD_TREE_ITEM = E_CTUD_FB + " [Event-Driven Up-Down Counter]"; //$NON-NLS-1$ + public static final String E_CYCLE_FB = "E_CYCLE"; //$NON-NLS-1$ + public static final String E_CYCLE_TREE_ITEM = "E_CYCLE [Peroidic event generator]"; //$NON-NLS-1$ + public static final String E_DELAY_FB = "E_DELAY"; //$NON-NLS-1$ + public static final String E_DEMUX_FB = "E_DEMUX"; //$NON-NLS-1$ + public static final String E_DEMUX_TREE_ITEM = E_DEMUX_FB + " [Event demultiplexor]"; //$NON-NLS-1$ + public static final String E_D_FF_FB = "E_D_FF"; //$NON-NLS-1$ + public static final String E_D_FF_TREE_ITEM = E_D_FF_FB + " [Data latch (d) flip flop]"; //$NON-NLS-1$ + public static final String E_N_TABLE_FB = "E_N_TABLE"; //$NON-NLS-1$ + public static final String E_N_TABLE_TREE_ITEM = "E_N_TABLE [Generation of a finite train of sperate events]"; //$NON-NLS-1$ + public static final String E_SELECT_FB = "E_SELECT"; //$NON-NLS-1$ + public static final String E_SELECT_TREE_ITEM = E_SELECT_FB + + " [selection between two events based on boolean input G]"; + public static final String E_SR_FB = "E_SR"; //$NON-NLS-1$ + public static final String E_SR_TREE_ITEM = E_SR_FB + " [Event-driven bistable]"; //$NON-NLS-1$ + public static final String E_SWITCH_FB = "E_SWITCH"; //$NON-NLS-1$ + public static final String E_SWITCH_TREE_ITEM = "E_SWITCH [Switching (demultiplexing) an event based on boolean input G]"; //$NON-NLS-1$ + public static final String E_TABLE_CTRL_FB = "E_TABLE_CTRL"; //$NON-NLS-1$ + public static final String E_TABLE_CTRL_TREE_ITEM = "E_TABLE_CTRL [Support function block for E_TABLE]"; //$NON-NLS-1$ + public static final String FBT_TEST_PROJECT1 = "FBTTestProject1"; //$NON-NLS-1$ + public static final String FBT_TEST_PROJECT2 = "FBTTestProject2"; //$NON-NLS-1$ + public static final String FBT_TEST_PROJECT3 = "FBTTestProject3"; //$NON-NLS-1$ + public static final String FBT_TEST_PROJECT4 = "FBTTestProject4"; //$NON-NLS-1$ + public static final String FILE = "File"; //$NON-NLS-1$ + public static final String FINISH = "Finish"; //$NON-NLS-1$ + public static final String FORBIDDEN_TYPE_NAME = "00_fbtype"; //$NON-NLS-1$ + public static final String FORDIAC_IDE_PROJECT = "4diac IDE Project..."; //$NON-NLS-1$ + public static final String F_SUB = "F_SUB"; //$NON-NLS-1$ + public static final String GO_TO_CHILD = "Go To Child"; //$NON-NLS-1$ + public static final String GO_TO_PARENT = "Go To Parent"; //$NON-NLS-1$ + public static final String INITIAL_APPLICATION_NAME_LABEL = "Initial application name"; //$NON-NLS-1$ + public static final String INITIAL_SYSTEM_NAME_LABEL = "Initial system name"; //$NON-NLS-1$ + public static final String INSERT_FB = "Insert FB"; //$NON-NLS-1$ + public static final String INTERFACE = "Interface"; //$NON-NLS-1$ + public static final String NAME_LABEL = "Name:"; //$NON-NLS-1$ + public static final String NAVIGATE = "Navigate"; //$NON-NLS-1$ + public static final String NEW = "New"; //$NON-NLS-1$ + public static final String NEW_4DIAC_PROJECT = "New 4diacProject"; //$NON-NLS-1$ + public static final String NEW_SUBAPPLICATION = "New subapplication"; //$NON-NLS-1$ + public static final String NEW_TYPE = FordiacMessages.NewType; + public static final String OK = "OK"; //$NON-NLS-1$ + public static final String PACKAGE_NAME1 = "pkg1"; //$NON-NLS-1$ + public static final String PACKAGE_NAME2 = "pkg2"; //$NON-NLS-1$ + public static final String PACKAGE_NAME = PACKAGE_NAME1 + "::" + PACKAGE_NAME2; //$NON-NLS-1$ + public static final String PACKAGE_NAME_LABEL = FordiacMessages.Package + ":"; //$NON-NLS-1$ + public static final String PARENT_FOLDER_NAME_LABEL = "Enter or select the parent folder:"; //$NON-NLS-1$ + public static final String PROJECT_NAME = "UiTestProject"; //$NON-NLS-1$ + public static final String PROJECT_NAME1 = "UiTestProject1"; //$NON-NLS-1$ + public static final String PROJECT_NAME2 = "UiTestProject2"; //$NON-NLS-1$ + public static final String PROJECT_NAME3 = "UiTestProject3"; //$NON-NLS-1$ + public static final String PROJECT_NAME4 = "UiTestProject4"; //$NON-NLS-1$ + public static final String PROJECT_NAME5 = "UiTestProject5"; //$NON-NLS-1$ + public static final String PROJECT_NAME_APP = PROJECT_NAME + "App"; //$NON-NLS-1$ + public static final String PROJECT_NAME_TREE_ITEM = PROJECT_NAME + " []"; //$NON-NLS-1$ + public static final String PROJECT_NAME_LABEL = "Project name:"; //$NON-NLS-1$ + public static final String PROPERTIES_TITLE = "Properties"; //$NON-NLS-1$ + public static final String SELECT_ALL = "Select All"; //$NON-NLS-1$ + public static final String SELECT_TYPE_LABEL = FordiacMessages.SelectType + ":"; //$NON-NLS-1$ + public static final String SOURCE = "Source"; //$NON-NLS-1$ + public static final String SUBAPP = "SubApp"; //$NON-NLS-1$ + public static final String STRUCT = "Struct"; //$NON-NLS-1$ + public static final String SYSTEM_EXPLORER_ID = "org.eclipse.fordiac.ide.systemmanagement.ui.systemexplorer"; //$NON-NLS-1$ + public static final String SYSTEM_EXPLORER_LABEL = "System Explorer"; //$NON-NLS-1$ + public static final String TEST_PARENT_FOLDER = "TestParentProject"; //$NON-NLS-1$ + public static final String TOOLBAR_BUTTON_ZOOM_FIT_PAGE = "Zoom fit Page"; //$NON-NLS-1$ + public static final String TEST_COMMENT = "Request from ideal Socket"; //$NON-NLS-1$ + public static final String TYPE_LABEL = "Type:"; //$NON-NLS-1$ + public static final String TYPE_LIBRARY_NODE = "Type Library"; //$NON-NLS-1$ + public static final String TYPE_NAME_LABEL = FordiacMessages.TypeName + ":"; //$NON-NLS-1$ + public static final String TYPE_PROJECT = "Type..."; //$NON-NLS-1$ + public static final String TYPE_SELECTION = "Type Selection"; //$NON-NLS-1$ + public static final String VAR_INOUT = "Var InOuts"; //$NON-NLS-1$ + public static final String WITH = "With"; //$NON-NLS-1$ + +}