Search in sources :

Example 1 with SWTWorkbenchBot

use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project xtext-xtend by eclipse.

the class RenameJavaClassSwtBotTest method renameJavaClassXtendReference.

@Test
public void renameJavaClassXtendReference() {
    SWTWorkbenchBot _bot = this.getBot();
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("package test;");
    _builder.newLine();
    _builder.append("public class JavaClass {}");
    _builder.newLine();
    final SWTBotEclipseEditor javaEditor = SwtBotProjectHelper.newJavaEditor(_bot, "JavaClass", "test", _builder);
    SWTWorkbenchBot _bot_1 = this.getBot();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("package test");
    _builder_1.newLine();
    _builder_1.append("class XtendClass extends ?JavaClass? {");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    final SWTBotEclipseEditor xtendEditor = SwtBotProjectHelper.newXtendEditor(_bot_1, "XtendClass", "test", _builder_1);
    this.renameInXtendEditor(xtendEditor, "NewJavaClass", "Rename Type");
    StringConcatenation _builder_2 = new StringConcatenation();
    _builder_2.append("package test");
    _builder_2.newLine();
    _builder_2.append("class XtendClass extends NewJavaClass {");
    _builder_2.newLine();
    _builder_2.append("}");
    _builder_2.newLine();
    this.assertEquals(_builder_2, xtendEditor.getText());
    Assert.assertFalse(xtendEditor.isDirty());
    StringConcatenation _builder_3 = new StringConcatenation();
    _builder_3.append("package test;");
    _builder_3.newLine();
    _builder_3.append("public class NewJavaClass {}");
    _builder_3.newLine();
    this.assertEquals(_builder_3, javaEditor.getText());
    Assert.assertFalse(javaEditor.isDirty());
    this.assertEquals("NewJavaClass.java", javaEditor.getTitle());
}
Also used : SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) SWTBotEclipseEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test) AbstractRefactoringSwtBotTest(org.eclipse.xtend.ide.tests.AbstractRefactoringSwtBotTest)

Example 2 with SWTWorkbenchBot

use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project xtext-xtend by eclipse.

the class RenameXtendClassSwtBotTest method renameXtendClass.

@Test
public void renameXtendClass() {
    SWTWorkbenchBot _bot = this.getBot();
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class Foo extends Bar {");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    final SWTBotEclipseEditor fooEditor = SwtBotProjectHelper.newXtendEditor(_bot, "Foo", _builder);
    SWTWorkbenchBot _bot_1 = this.getBot();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("class ?Bar? {}");
    _builder_1.newLine();
    final SWTBotEclipseEditor barEditor = SwtBotProjectHelper.newXtendEditor(_bot_1, "Bar", _builder_1);
    this.renameInXtendEditor(barEditor, "NewBar", "Rename Element");
    StringConcatenation _builder_2 = new StringConcatenation();
    _builder_2.append("class Foo extends NewBar {");
    _builder_2.newLine();
    _builder_2.append("}");
    _builder_2.newLine();
    this.assertEquals(_builder_2, fooEditor.getText());
    StringConcatenation _builder_3 = new StringConcatenation();
    _builder_3.append("class NewBar {}");
    _builder_3.newLine();
    this.assertEquals(_builder_3, barEditor.getText());
    this.assertEquals("NewBar.xtend", barEditor.getTitle());
}
Also used : SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) SWTBotEclipseEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test) AbstractRefactoringSwtBotTest(org.eclipse.xtend.ide.tests.AbstractRefactoringSwtBotTest)

Example 3 with SWTWorkbenchBot

use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project xtext-xtend by eclipse.

the class RenameXtendClassSwtBotTest method renameXtendClassReference.

@Test
public void renameXtendClassReference() {
    SWTWorkbenchBot _bot = this.getBot();
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class Bar {}");
    _builder.newLine();
    final SWTBotEclipseEditor barEditor = SwtBotProjectHelper.newXtendEditor(_bot, "Bar", _builder);
    SWTWorkbenchBot _bot_1 = this.getBot();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("class Foo extends ?Bar? {");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    final SWTBotEclipseEditor fooEditor = SwtBotProjectHelper.newXtendEditor(_bot_1, "Foo", _builder_1);
    this.renameInXtendEditor(fooEditor, "NewBar", "Rename Element");
    StringConcatenation _builder_2 = new StringConcatenation();
    _builder_2.append("class Foo extends NewBar {");
    _builder_2.newLine();
    _builder_2.append("}");
    _builder_2.newLine();
    this.assertEquals(_builder_2, fooEditor.getText());
    StringConcatenation _builder_3 = new StringConcatenation();
    _builder_3.append("class NewBar {}");
    _builder_3.newLine();
    this.assertEquals(_builder_3, barEditor.getText());
    this.assertEquals("NewBar.xtend", barEditor.getTitle());
}
Also used : SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) SWTBotEclipseEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test) AbstractRefactoringSwtBotTest(org.eclipse.xtend.ide.tests.AbstractRefactoringSwtBotTest)

Example 4 with SWTWorkbenchBot

use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project linuxtools by eclipse.

the class PreferencesTest method testProfileProject.

@Ignore
@Test
public void testProfileProject() throws Exception {
    SWTWorkbenchBot bot = new SWTWorkbenchBot();
    proj = createProjectAndBuild(FrameworkUtil.getBundle(this.getClass()), PROJ_NAME);
    try {
        testProfileProjectActions(bot);
    } finally {
        deleteProject(proj);
    }
}
Also used : SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) Ignore(org.junit.Ignore) Test(org.junit.Test) AbstractTest(org.eclipse.linuxtools.profiling.tests.AbstractTest)

Example 5 with SWTWorkbenchBot

use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot 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)

Aggregations

SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)37 WidgetNotFoundException (org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException)15 BeforeClass (org.junit.BeforeClass)15 Test (org.junit.Test)10 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)8 SWTBotEclipseEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor)5 AbstractRefactoringSwtBotTest (org.eclipse.xtend.ide.tests.AbstractRefactoringSwtBotTest)5 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)5 DockerClient (com.spotify.docker.client.DockerClient)4 DockerConnection (org.eclipse.linuxtools.internal.docker.core.DockerConnection)4 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)4 SWTBotMenu (org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu)4 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)3 SWTUtils (org.eclipse.linuxtools.internal.docker.ui.testutils.swt.SWTUtils)3 Before (org.junit.Before)3 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)2 IWorkspace (org.eclipse.core.resources.IWorkspace)2 IWorkspaceDescription (org.eclipse.core.resources.IWorkspaceDescription)2