Search in sources :

Example 1 with SWTBotMultiPageEditor

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

the class ImportRPMsPageTest method initializeImportPage.

/**
 * Helper method to help setup the test by opening the .repo file.
 */
private void initializeImportPage() {
    SWTBotMultiPageEditor editor = TestUtils.openRepoFile(bot, navigator);
    // activate repository page
    editor.activatePage(Messages.ImportRPMsPage_title);
    // make sure correct page is active
    assertEquals(Messages.ImportRPMsPage_title, editor.getActivePageTitle());
    importPageBot = editor.bot();
}
Also used : SWTBotMultiPageEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotMultiPageEditor)

Example 2 with SWTBotMultiPageEditor

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

the class MetadataPageTest method initializeMetadataPage.

/**
 * Helper method to help setup the test by opening the .repo file.
 */
private void initializeMetadataPage() {
    SWTBotMultiPageEditor editor = TestUtils.openRepoFile(bot, navigator);
    // activate the metadata page
    editor.activatePage(Messages.MetadataPage_title);
    // make sure correct page is active
    assertEquals(Messages.MetadataPage_title, editor.getActivePageTitle());
    metadataPageBot = editor.bot();
}
Also used : SWTBotMultiPageEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotMultiPageEditor)

Example 3 with SWTBotMultiPageEditor

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

the class RepoFormEditorTest method testFormEditorCreation.

/**
 * Test if the multi page editor is properly created. Make sure there are 3
 * pages (Repository, Metadata, repo file), and that all of them can be switched
 * to.
 */
@Test
public void testFormEditorCreation() {
    SWTBotMultiPageEditor editor = TestUtils.openRepoFile(bot, navigator);
    // activate the pages to make sure they exist and work
    editor.activatePage(Messages.MetadataPage_title);
    editor.activatePage(ICreaterepoTestConstants.REPO_NAME);
    editor.activatePage(Messages.ImportRPMsPage_title);
}
Also used : SWTBotMultiPageEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotMultiPageEditor) Test(org.junit.Test)

Example 4 with SWTBotMultiPageEditor

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

the class TestUtils method openRepoFile.

public static SWTBotMultiPageEditor openRepoFile(SWTWorkbenchBot bot, SWTBotView navigator) {
    // open the package explorer view
    SWTBotTree botTree = navigator.bot().tree();
    botTree.select(ICreaterepoTestConstants.REPO_NAME).contextMenu(ICreaterepoTestConstants.OPEN).click();
    // get a handle on the multipage editor that was opened
    SWTBotMultiPageEditor editor = bot.multipageEditorByTitle(ICreaterepoTestConstants.REPO_NAME);
    editor.show();
    // 3 = repository form page, metadata form page, repo file
    assertEquals(3, editor.getPageCount());
    return editor;
}
Also used : SWTBotMultiPageEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotMultiPageEditor) SWTBotTree(org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)

Example 5 with SWTBotMultiPageEditor

use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotMultiPageEditor in project egit by eclipse.

the class CommitEditorTest method openAllEditorPagesOnValidCommit.

@Test
public void openAllEditorPagesOnValidCommit() throws Exception {
    final AtomicReference<IEditorPart> editorRef = new AtomicReference<>();
    PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {

        @Override
        public void run() {
            RepositoryCommit repoCommit = new RepositoryCommit(repository, commit);
            editorRef.set(CommitEditor.openQuiet(repoCommit));
        }
    });
    assertNotNull(editorRef.get());
    IEditorPart editor = editorRef.get();
    assertTrue(editor instanceof CommitEditor);
    RepositoryCommit adaptedCommit = Utils.getAdapter(editor, RepositoryCommit.class);
    assertNotNull(adaptedCommit);
    assertEquals(commit, adaptedCommit.getRevCommit());
    assertEquals(repository.getDirectory(), adaptedCommit.getRepository().getDirectory());
    IEditorInput input = editor.getEditorInput();
    assertNotNull(input);
    SWTBotMultiPageEditor botEditor = bot.multipageEditorByTitle(input.getName());
    assertNotNull(botEditor);
    assertTrue(botEditor.getPageCount() > 1);
    for (String name : botEditor.getPagesTitles()) botEditor.activatePage(name);
    botEditor.close();
}
Also used : SWTBotMultiPageEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotMultiPageEditor) AtomicReference(java.util.concurrent.atomic.AtomicReference) IEditorPart(org.eclipse.ui.IEditorPart) CommitEditor(org.eclipse.egit.ui.internal.commit.CommitEditor) RepositoryCommit(org.eclipse.egit.ui.internal.commit.RepositoryCommit) IEditorInput(org.eclipse.ui.IEditorInput) Test(org.junit.Test)

Aggregations

SWTBotMultiPageEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotMultiPageEditor)5 Test (org.junit.Test)2 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 CommitEditor (org.eclipse.egit.ui.internal.commit.CommitEditor)1 RepositoryCommit (org.eclipse.egit.ui.internal.commit.RepositoryCommit)1 SWTBotTree (org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)1 IEditorInput (org.eclipse.ui.IEditorInput)1 IEditorPart (org.eclipse.ui.IEditorPart)1