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

The following examples show how to use org.eclipse.swtbot.swt.finder.SWTBot#button() . 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: TimeGraphViewTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Clean up after a test, reset the views and reset the states of the
 * timegraph by pressing reset on all the resets of the legend
 */
@After
public void after() {

    // reset all
    fViewBot.toolbarButton(SHOW_LEGEND).click();
    SWTBotShell legendShell = fBot.shell(LEGEND_NAME);
    SWTBot legendBot = legendShell.bot();

    for (int i = 0; i < StubPresentationProvider.STATES.length; i++) {
        SWTBotButton resetButton = legendBot.button(i);
        if (resetButton.isEnabled()) {
            resetButton.click();
        }
    }
    legendBot.button(OK_BUTTON).click();
    TmfTraceStub trace = fTrace;
    assertNotNull(trace);
    UIThreadRunnable.syncExec(() -> TmfSignalManager.dispatchSignal(new TmfTraceClosedSignal(this, trace)));
    fBot.waitUntil(Conditions.shellCloses(legendShell));
    fViewBot.close();
    fBot.waitUntil(ConditionHelpers.viewIsClosed(fViewBot));
    fTrace.dispose();
}
 
Example 2
Source File: FindDialogTestBase.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test wrap search option
 */
@Test
public void testWrapSearch() {
    SWTBot bot = getDialogBot();
    SWTBotButton findButton = bot.button("Find");

    SearchOptions options = getOptions(false, false, true, false, false);
    search(fFindText, options, findButton, bot);
    assertTrue(isWrapped(bot));
    verifySelection(fFindText, options, fViewBot, isWrapped(bot));
    options = getOptions(true, false, true, false, false);
    search(fFindText, options, findButton, bot);
    assertTrue(isWrapped(bot));
}
 
Example 3
Source File: FindDialogTestBase.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test the direction search option
 */
@Test
public void testDirection() {
    SWTBot bot = getDialogBot();
    SWTBotButton findButton = bot.button("Find");

    // forward
    testDirectionSearch(true, fFindText, bot, findButton, fViewBot);
    testDirectionSearch(false, fFindText, bot, findButton, fViewBot);
}
 
Example 4
Source File: FindDialogTestBase.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test the case sensitive search option
 */
@Test
public void testCaseSensitive() {
    SWTBot bot = getDialogBot();
    SWTBotButton findButton = bot.button("Find");
    String upper = fFindText.toUpperCase();
    String lower = fFindText.toLowerCase();

    SearchOptions options = getOptions(true, true, false, false, false);
    search(fFindText, options, findButton, bot);
    verifyStatusLabel(bot, true);
    search(fFindText.equals(upper) ? lower : upper, options, findButton, bot);
    verifyStatusLabel(bot, false);
}
 
Example 5
Source File: FindDialogTestBase.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test the whole word search option
 */
@Test
public void testWholeWord() {
    SWTBot bot = getDialogBot();
    SWTBotButton findButton = bot.button("Find");

    @NonNull
    String text = fFindText.split(SPACE)[0];
    SearchOptions options = getOptions(true, false, false, true, false);
    search(text, options, findButton, bot);
    verifyStatusLabel(bot, true);
    search(text.substring(0, text.length() - 1), options, findButton, bot);
    verifyStatusLabel(bot, false);
}
 
Example 6
Source File: FindDialogTestBase.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Test the regular expression search option
 */
@Test
public void testRegEx() {
    SWTBot bot = getDialogBot();
    SWTBotButton findButton = bot.button("Find");

    final String text = REGEX_PREFIX + fFindText.split(SPACE)[0];
    SearchOptions options = getOptions(true, false, false, false, true);
    search(text, options, findButton, bot);
    verifyStatusLabel(bot, true);
    options = getOptions(true, false, false, false, false);
    search(text, options, findButton, bot);
    verifyStatusLabel(bot, false);
}
 
Example 7
Source File: ControlViewTest.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
private static void checkFinishButton(SWTBot bot, boolean isEnabled) {
    final SWTBotButton finishButton = bot.button(ControlViewSwtBotUtil.FINISH_BUTTON);
    assertTrue(finishButton.isEnabled() == isEnabled);
}
 
Example 8
Source File: SWTBotImportWizardUtils.java    From tracecompass with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Checks finish button enablement
 *
 * @param bot
 *            SWTBot
 *
 * @param isEnabled
 *            state to check against
 *
 */
public static void checkFinishButton(SWTBot bot, boolean isEnabled) {
    SWTBotButton finishButton = bot.button("Finish");
    assertTrue(finishButton.isEnabled() == isEnabled);
}
 
Example 9
Source File: TsUIConstants.java    From translationstudio8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @param bot
 *            对话框的 SWTBot 对象
 * @param buttonKey
 *            按钮上的文字标签
 * @param index
 *            索引号
 * @return
 */
public static SWTBotButton button(SWTBot bot, String buttonKey, int index) {
	return bot.button(getString(buttonKey), index);
}
 
Example 10
Source File: TsUIConstants.java    From translationstudio8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @param bot
 *            对话框的 SWTBot 对象
 * @param buttonKey
 *            按钮上的文字标签
 * @return
 */
public static SWTBotButton button(SWTBot bot, String buttonKey) {
	return bot.button(getString(buttonKey));
}
 
Example 11
Source File: TsUIConstants.java    From tmxeditor8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @param bot
 *            对话框的 SWTBot 对象
 * @param buttonKey
 *            按钮上的文字标签
 * @param index
 *            索引号
 * @return
 */
public static SWTBotButton button(SWTBot bot, String buttonKey, int index) {
	return bot.button(getString(buttonKey), index);
}
 
Example 12
Source File: TsUIConstants.java    From tmxeditor8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @param bot
 *            对话框的 SWTBot 对象
 * @param buttonKey
 *            按钮上的文字标签
 * @return
 */
public static SWTBotButton button(SWTBot bot, String buttonKey) {
	return bot.button(getString(buttonKey));
}