Search in sources :

Example 1 with SWTBotRadio

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio in project linuxtools by eclipse.

the class PreferencesTest method testPreferencesPage.

@Test
public void testPreferencesPage() {
    SWTWorkbenchBot bot = new SWTWorkbenchBot();
    // Set default tool for "timing" profiling.
    checkDefaultPreference(PROFILING_PREFS_CATEGORY, PROFILING_PREFS_TYPE);
    // Open preferences shell.
    // $NON-NLS-1$
    SWTBotMenu windowsMenu = bot.menu("Window");
    // $NON-NLS-1$
    windowsMenu.menu("Preferences").click();
    // $NON-NLS-1$
    SWTBotShell shell = bot.shell("Preferences");
    shell.activate();
    // Go to "Profiling Categories" preferences page.
    bot.text().setText(PROFILING_PREFS_CATEGORY);
    bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), "C/C++", "Profiling", "Categories", // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    PROFILING_PREFS_CATEGORY));
    // Get name of default tool to deselect.
    String defaultToolId = ProviderFramework.getProviderIdToRun(null, PROFILING_PREFS_TYPE);
    // $NON-NLS-1$
    String defaultToolName = ProviderFramework.getToolInformationFromId(defaultToolId, "name");
    // Workaround for BZ #344484.
    deselectSelectionByName(defaultToolName, bot);
    // Assert specified tool to select is what we expect and select it.
    SWTBotRadio stubRadio = bot.radio(STUB_LABEL);
    assertNotNull(stubRadio);
    assertEquals(STUB_TOOLTIP, stubRadio.getToolTipText());
    stubRadio.click();
    // $NON-NLS-1$
    bot.button("Apply").click();
    // $NON-NLS-1$
    bot.button("Apply and Close").click();
}
Also used : SWTBotRadio(org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio) SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) SWTBotMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell) Test(org.junit.Test) AbstractTest(org.eclipse.linuxtools.profiling.tests.AbstractTest)

Example 2 with SWTBotRadio

use of org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio in project linuxtools by eclipse.

the class PreferencesTest method checkDefaultPreference.

private static void checkDefaultPreference(String preferenceCategory, String profilingType) {
    SWTWorkbenchBot bot = new SWTWorkbenchBot();
    // Open preferences shell.
    // $NON-NLS-1$
    SWTBotMenu windowsMenu = bot.menu("Window");
    // $NON-NLS-1$
    windowsMenu.menu("Preferences").click();
    // $NON-NLS-1$
    SWTBotShell shell = bot.shell("Preferences");
    shell.activate();
    // Go to specified tree item in "Profiling Categories" preferences page.
    bot.text().setText(preferenceCategory);
    bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), "C/C++", "Profiling", "Categories", // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    preferenceCategory));
    // Restore defaults.
    // $NON-NLS-1$
    bot.button("Restore Defaults").click();
    // $NON-NLS-1$
    bot.button("Apply").click();
    // Get information for default tool.
    String defaultToolId = ProviderFramework.getProviderIdToRun(null, profilingType);
    // $NON-NLS-1$
    String defaultToolName = ProviderFramework.getToolInformationFromId(defaultToolId, "name");
    // $NON-NLS-1$
    String defaultToolInfo = ProviderFramework.getToolInformationFromId(defaultToolId, "information");
    // $NON-NLS-1$
    String defaultToolDescription = ProviderFramework.getToolInformationFromId(defaultToolId, "description");
    // $NON-NLS-1$ //$NON-NLS-2$
    String defaultToolLabel = defaultToolName + " [" + defaultToolDescription + "]";
    // Assert default radio is as expected.
    SWTBotRadio defaultRadio = bot.radio(defaultToolLabel);
    assertNotNull(defaultRadio);
    assertEquals(defaultToolInfo, defaultRadio.getToolTipText());
    // $NON-NLS-1$
    bot.button("Apply").click();
    // $NON-NLS-1$
    bot.button("Apply and Close").click();
}
Also used : SWTBotRadio(org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio) SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) SWTBotMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)

Aggregations

SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)2 SWTBotMenu (org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu)2 SWTBotRadio (org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio)2 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)2 AbstractTest (org.eclipse.linuxtools.profiling.tests.AbstractTest)1 Test (org.junit.Test)1