Java Code Examples for org.eclipse.swtbot.swt.finder.SWTBot#radio()

The following examples show how to use org.eclipse.swtbot.swt.finder.SWTBot#radio() . 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: SWTBotImportWizardUtils.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * 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 2
Source File: SWTBotImportWizardUtils.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * 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 3
Source File: SDViewTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * 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 4
Source File: TsUIConstants.java    From translationstudio8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @param bot
 * @param radioKey
 * @return ;
 */
public static SWTBotRadio radio(SWTBot bot, String radioKey) {
	return bot.radio(getString(radioKey));
}
 
Example 5
Source File: TsUIConstants.java    From tmxeditor8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @param bot
 * @param radioKey
 * @return ;
 */
public static SWTBotRadio radio(SWTBot bot, String radioKey) {
	return bot.radio(getString(radioKey));
}