Java Code Examples for org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio#click()
The following examples show how to use
org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio#click() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GuiUtils.java From CodeCheckerEclipsePlugin with Eclipse Public License 1.0 | 6 votes |
/** * You MUST navigate to the correct preferences page, or the method fails and * possibly throws widget not found exception. Sets The CodeChecker Directory on * the preferences pages. * * @param method * The associated radio button to the {@link ResolutionMethodTypes} * will be clicked on the preferences/properties page. * @param ccDir * Path to the CodeChecker Root directory. * @param bot * The bot to be guided. * @param root * TODO */ public static void setCCBinDir(ResolutionMethodTypes method, Path ccDir, SWTWorkbenchBot bot, boolean root) { SWTBotRadio radio = null; switch (method) { case PATH: radio = bot.radio("Search in PATH"); break; case PRE: radio = bot.radio("Pre built package"); break; default: break; } radio.click(); if (method != ResolutionMethodTypes.PATH || ccDir != null) { SWTBotText text = bot.textWithLabel(GuiUtils.CC_DIR_WIDGET); // if the given path is the package root, extend it to the concrete binary else // it could be used directly. text.setText(root ? ccDir.resolve(Paths.get(BIN, CODECHECKER)).toString() : ccDir.toString()); bot.sleep(SHORT_WAIT_TIME); } }
Example 2
Source File: SWTBotImportWizardUtils.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * While in the import wizard, select the specified directory as a source. * * @param bot * the SWTBot * @param directoryPath * the directory path to set as a source */ public static void selectImportFromDirectory(SWTBot bot, String directoryPath) { SWTBotRadio button = bot.radio("Select roo&t directory:"); button.click(); SWTBotCombo sourceCombo = bot.comboBox(); File traceFolderParent = new File(directoryPath); sourceCombo.setFocus(); sourceCombo.setText(traceFolderParent.getAbsolutePath()); /* the resource tree gets updated when the combo loses focus */ SWTBotTree tree = bot.tree(); tree.setFocus(); }
Example 3
Source File: SWTBotImportWizardUtils.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * While in the import wizard, select the specified archive as a source. * * @param bot * the SWTBot * @param archivePath * the archive path to set as a source */ public static void selectImportFromArchive(SWTBot bot, String archivePath) { SWTBotRadio button = bot.radio("Select &archive file:"); button.click(); SWTBotCombo sourceCombo = bot.comboBox(1); sourceCombo.setFocus(); sourceCombo.setText(new File(archivePath).getAbsolutePath()); /* the resource tree gets updated when the combo loses focus */ SWTBotTree tree = bot.tree(); tree.setFocus(); }
Example 4
Source File: ControlViewProfileTest.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Test load session */ private void testLoadSession() { SWTBotTreeItem nodeItem = SWTBotUtils.getTreeItem(fBot, fTree, getNodeName()); SWTBotTreeItem sessionGroupItem = nodeItem.getNode(ControlViewSwtBotUtil.SESSION_GROUP_NAME); sessionGroupItem.select(); SWTBotMenu menuBot = sessionGroupItem.contextMenu(ControlViewSwtBotUtil.LOAD_MENU_ITEM); menuBot.click(); SWTBotShell shell = fBot.shell(ControlViewSwtBotUtil.LOAD_DIALOG_TITLE).activate(); SWTBotRadio button = shell.bot().radio(ControlViewSwtBotUtil.REMOTE_RADIO_BUTTON_LABEL); button.click(); SWTBotTree shellTree = shell.bot().tree(); SWTBotTreeItem profileItem = shellTree.getTreeItem(SESSION_NAME + ControlViewSwtBotUtil.PROFILE_SUFFIX); profileItem.select(); profileItem.click(); shell.bot().button(ControlViewSwtBotUtil.CONFIRM_DIALOG_OK_BUTTON).click(); WaitUtils.waitForJobs(); sessionGroupItem = SWTBotUtils.getTreeItem(fBot, fTree, getNodeName(), ControlViewSwtBotUtil.SESSION_GROUP_NAME); fBot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable(SESSION_NAME, sessionGroupItem)); assertEquals(1, sessionGroupItem.getNodes().size()); }
Example 5
Source File: SDViewTest.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
/** * Test Sequence diagram print dialog */ @Test public void testSDPrintUi() { SWTBotView viewBot = fBot.viewById(UML2DVIEW_ID); assertNotNull(viewBot); viewBot.setFocus(); WaitUtils.waitForJobs(); // Test print dialog SWTBotCanvas canvas = viewBot.bot().canvas(1); canvas.setFocus(); canvas.pressShortcut(Keystrokes.CTRL, KeyStroke.getInstance('P')); SWTBotShell printShell = fBot.shell("Print"); assertNotNull(printShell); SWTBot printBot = printShell.bot(); printBot.radio("Use current zoom").click(); SWTBotRadio allPages = printBot.radio("All pages"); SWTBotRadio currentView = printBot.radio("Current view"); // 'All pages' and 'Current view' buttons will be enabled allPages.click(); currentView.click(); // Test 'Number of horizontal pages' button printBot.radio("Number of horizontal pages:").click(); SWTBotText horizontalPagesText = printBot.text(0); SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(1)), horizontalPagesText, "Number of horizontal pages should be 1"); horizontalPagesText.setText("2"); SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(2)), horizontalPagesText, "Number of horizontal pages should be 2"); assertFalse(currentView.isEnabled()); // Test 'Number of vertical pages' button SWTBotText totalPagesText = printBot.textWithLabel("Total number of pages:"); printBot.radio("Number of vertical pages:").click(); SWTBotText verticalPagesText = printBot.text(1); SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(1)), verticalPagesText, "Number of vertical pages should be 1"); SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(1)), totalPagesText, "Total number of pages should be 1"); verticalPagesText.setText("2"); SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(2)), verticalPagesText, "Number of vertical pages should be 2"); assertFalse(currentView.isEnabled()); // Test 'selected pages' button printBot.radio("Selected pages").click(); assertFalse(currentView.isEnabled()); // Test 'From pages' buttons printBot.radio("From page").click(); SWTBotText fromText = printBot.text(3); SWTBotText toText = printBot.text(4); SWTBotUtils.waitUntil(t -> t.getText().isEmpty(), fromText, "From text is not empty"); SWTBotUtils.waitUntil(t -> t.getText().isEmpty(), toText, "To text is not empty"); fromText.setText("2"); toText.setText("3"); SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(2)), fromText, "From text is not 2"); SWTBotUtils.waitUntil(t -> t.getText().equals(String.valueOf(3)), toText, "To text is not 3"); assertFalse(currentView.isEnabled()); // Don't actually print printBot.button("Cancel").click(); printBot.waitUntil(Conditions.shellCloses(printShell)); }
Example 6
Source File: ControlFlowViewTest.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
/** * Test dynamic filters dialog on CPU */ @Test public void testDynamicFilteringCpu() { /* Change window range to 10 ms */ TmfTimeRange range = new TmfTimeRange(START_TIME, START_TIME.normalize(10000000L, ITmfTimestamp.NANOSECOND_SCALE)); TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range)); TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, range.getStartTime(), range.getEndTime())); timeGraphIsReadyCondition(range); SWTBotTimeGraph timeGraph = new SWTBotTimeGraph(getViewBot().bot()); SWTBotTimeGraphEntry traceEntry = timeGraph.getEntry(LttngTraceGenerator.getName()); SWTBotUtils.waitUntil(entry -> entry.getEntries().length == 225, traceEntry, () -> "Entries size expected:225 actual:" + traceEntry.getEntries().length); getViewBot().viewMenu(DYNAMIC_FILTER_CONFIGURE_LABEL).click(); SWTBotShell shell = fBot.shell(DYNAMIC_FILTERS_SHELL_TEXT).activate(); /* Make sure nothing is checked and radio buttons are disabled */ SWTBotCheckBox activeThreadsCheckbox = shell.bot().checkBox(DYNAMIC_FILTERS_SHOW_ACTIVE_THREADS_ONLY_CHECKBOX); assertFalse(activeThreadsCheckbox.isChecked()); SWTBotRadio onCpuRadio = shell.bot().radio(DYNAMIC_FILTERS_ON_CPU_RADIO); SWTBotText onCpuField = shell.bot().textWithMessage(DYNAMIC_FILTER_ON_CPU_FIELD_MESSAGE); /* Toggle active thread filter button */ activeThreadsCheckbox.click(); assertTrue(activeThreadsCheckbox.isChecked()); /* Filter on selected CPUs */ onCpuRadio.click(); onCpuField.setText("0"); shell.bot().button(DIALOG_OK).click(); /* * A zoom thread is started after applying the filter. Make sure that the time graph * is ready before continuing with the test */ timeGraphIsReadyCondition(range); /* Change window range to 50 us */ range = new TmfTimeRange(START_TIME, START_TIME.normalize(50000L, ITmfTimestamp.NANOSECOND_SCALE)); TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, range)); TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, range.getStartTime(), range.getEndTime())); timeGraphIsReadyCondition(range); /* Verify that number active entries changed */ SWTBotUtils.waitUntil(entry -> entry.getEntries().length == 1, traceEntry, () -> "Entries size expected:1 actual:" + traceEntry.getEntries().length); getViewBot().viewMenu(DYNAMIC_FILTER_CONFIGURE_LABEL).click(); shell = fBot.shell(DYNAMIC_FILTERS_SHELL_TEXT).activate(); activeThreadsCheckbox = shell.bot().checkBox(DYNAMIC_FILTERS_SHOW_ACTIVE_THREADS_ONLY_CHECKBOX); assertTrue(activeThreadsCheckbox.isChecked()); /* * Test Active Filter buttons toggle */ activeThreadsCheckbox.click(); /* All objects should be enabled except for the CPU ranges field */ assertFalse(activeThreadsCheckbox.isChecked()); }