use of org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu in project tracecompass by tracecompass.
the class AddProjectNatureTest method toggleFilters.
private static void toggleFilters(boolean checked) {
SWTBotView viewBot = fBot.viewByTitle(PROJECT_EXPLORER_TITLE);
viewBot.setFocus();
SWTBotRootMenu viewMenu = viewBot.viewMenu();
String title = CUSTOMIZE_VIEW_DIALOG_TITLE_4_7;
try {
viewMenu.menu(CUSTOMIZE_VIEW_MENU_ITEM_4_7).click();
} catch (WidgetNotFoundException e) {
viewMenu.menu(CUSTOMIZE_VIEW_MENU_ITEM_4_6).click();
title = CUSTOMIZE_VIEW_DIALOG_TITLE_4_6;
}
SWTBotShell shell = fBot.shell(title).activate();
// Select first cTabItem which has name 'Filters' in 4.10 or older, and 'Pre-set filters' starting with 4.11
shell.bot().cTabItem(0).activate();
SWTBotTable table = shell.bot().table();
SWTBotTableItem item = table.getTableItem(CUSTOMIZE_VIEW_RESOURCES_FILTER);
item.select();
if (checked != item.isChecked()) {
item.toggleCheck();
}
item = table.getTableItem(CUSTOMIZE_VIEW_SHADOW_FILTER);
item.select();
if (checked != item.isChecked()) {
item.toggleCheck();
}
shell.bot().button(OK_BUTTON).click();
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu in project tracecompass by tracecompass.
the class MarkerSetSwtBotTest method testMenuNoMarkerSet.
/**
* Test the marker set menu items when there is no marker set
*/
@Test
public void testMenuNoMarkerSet() {
SWTBotRootMenu viewMenu = fViewBot.viewMenu();
List<String> menuItems = viewMenu.menu("Marker Set").menuItems();
assertArrayEquals("menu items, no marker set", MENU_ITEMS_NO_MARKERS_SET, menuItems.toArray());
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu in project tracecompass by tracecompass.
the class MarkerSetSwtBotTest method testEditMarkerSet.
/**
* Test the marker set menu Edit... item
*/
@Test
public void testEditMarkerSet() {
insertContent();
SWTBotRootMenu viewMenu = fViewBot.viewMenu();
List<String> menuItems = viewMenu.menu("Marker Set").menuItems();
assertArrayEquals("menu items, two marker sets", MENU_ITEMS_2_MARKERS_SET, menuItems.toArray());
assertTrue("None is checked", viewMenu.menu("Marker Set").menu(MENU_ITEMS_2_MARKERS_SET[0]).isChecked());
// Select Set A
viewMenu.menu("Marker Set", MENU_ITEMS_2_MARKERS_SET[1]).click();
assertTrue("Set A is checked", viewMenu.menu("Marker Set").menu(MENU_ITEMS_2_MARKERS_SET[1]).isChecked());
// Select Set B
viewMenu.menu("Marker Set", MENU_ITEMS_2_MARKERS_SET[2]).click();
assertTrue("set B is checked", viewMenu.menu("Marker Set").menu(MENU_ITEMS_2_MARKERS_SET[2]).isChecked());
// Select None
viewMenu.menu("Marker Set", MENU_ITEMS_2_MARKERS_SET[0]).click();
assertTrue("None is checked", viewMenu.menu("Marker Set").menu(MENU_ITEMS_2_MARKERS_SET[0]).isChecked());
// Remove all markers set
removeContent();
menuItems = viewMenu.menu("Marker Set").menuItems();
assertArrayEquals("menu items, no marker set", MENU_ITEMS_NO_MARKERS_SET, menuItems.toArray());
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu in project tracecompass by tracecompass.
the class ChartMakerDialogTest method openDialog.
private void openDialog() {
// Open the new custom chart dialog
SWTBotView viewBot = fBot.viewById(CustomChartStubView.ID);
SWTBotRootMenu viewMenu = viewBot.viewMenu();
SWTBotMenu menu = viewMenu.menu(CustomChartStubView.MENU_TITLE);
menu.click();
}
use of org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu in project aero.minova.rcp by minova-afis.
the class MenuTest method openPreferencesAndTestMenu.
@Test
public void openPreferencesAndTestMenu() {
if (System.getProperty("os.name").startsWith("Linux")) {
return;
}
// Einstellungen über Command öffnen
Display.getDefault().asyncExec(() -> {
ECommandService commandService = getEclipseContext().get(ECommandService.class);
EHandlerService handlerService = getEclipseContext().get(EHandlerService.class);
ParameterizedCommand cmd = commandService.createCommand("org.eclipse.ui.window.preferences", null);
handlerService.executeHandler(cmd);
});
// Workspace-Ordner auslesen
SWTBotShell shell = bot.shell("Preferences");
assertNotNull(shell);
SWTBot childBot = new SWTBot(shell.widget);
SWTBotText currentWorkspaceText = childBot.text(1);
assertNotNull(currentWorkspaceText);
assertNotNull(currentWorkspaceText.getText());
String pathWorkspace = currentWorkspaceText.getText();
shell.close();
// application.mdi einlesen und Menü überprüfen
try {
Path path = Path.of(pathWorkspace, "application.mdi");
String applicationString = Files.readString(path);
assertNotNull(applicationString);
Main mainMDI = XmlProcessor.get(applicationString, Main.class);
assertNotNull(mainMDI);
// Liste mit Menueinträgen (depth-first)
List<String> menuEntries = new ArrayList<>();
Map<String, Integer> callsToMenu = new HashMap<>();
SWTBotRootMenu menu = bot.menu();
for (String menuEntry : menu.menuItems()) {
int i = callsToMenu.get(menuEntry) == null ? 0 : callsToMenu.get(menuEntry);
callsToMenu.put(menuEntry, i + 1);
SWTBotMenu menu2 = bot.menu().menu(menuEntry, false, i);
// File Menü überspringen (nicht von uns)
if (menu2.getText().equals("File")) {
continue;
}
getMenuEntries(menuEntries, menu2);
}
// TODO Reihenfolge in der mdi beachten (siehe MenuProcessor)
int counter = 0;
for (Object menuOrEntry : mainMDI.getMenu().getMenuOrEntry()) {
counter = checkEntries(menuEntries, counter, menuOrEntry);
}
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
Aggregations