diff options
Diffstat (limited to 'org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java')
-rw-r--r-- | org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java index 123b5d4876..c76f346a27 100644 --- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java +++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2012 SAP AG and others. + * Copyright (c) 2010, 2013 SAP AG and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -50,6 +50,7 @@ import org.eclipse.ui.IWorkingSet; import org.eclipse.ui.IWorkingSetManager; import org.eclipse.ui.PlatformUI; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -400,7 +401,7 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase { } @Test - public void testLinkWithSelection() throws Exception { + public void testLinkWithSelectionNavigator() throws Exception { deleteAllProjects(); shareProjects(repositoryFile); SWTBotPerspective perspective = null; @@ -421,9 +422,7 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase { assertTrue(tree.selection().get(0, 0).startsWith(REPO1)); // activate the link with selection - getOrOpenView().toolbarButton( - myUtil.getPluginLocalizedValue("LinkWithSelectionCommand")) - .click(); + toggleLinkWithSelection(); // the selection should be still be root assertTrue(tree.selection().get(0, 0).startsWith(REPO1)); @@ -437,9 +436,7 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase { assertTrue(tree.selection().get(0, 0).equals(PROJ1)); // deactivate the link with selection - getOrOpenView().toolbarButton( - myUtil.getPluginLocalizedValue("LinkWithSelectionCommand")) - .click(); + toggleLinkWithSelection(); } finally { if (perspective != null) @@ -453,7 +450,8 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase { * @throws Exception */ @Test - public void testLinkWithEditor() throws Exception { + @Ignore("'Link with Selection' does not activate editor on selection change (bug 409722).") + public void testLinkWithSelectionEditor() throws Exception { deleteAllProjects(); shareProjects(repositoryFile); SWTBotPerspective perspective = null; @@ -485,7 +483,8 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase { assertTrue(tree.selection().get(0, 0).startsWith(REPO1)); // activate the link with selection - getOrOpenView().toolbarButton("Link with Editor").click(); + toggleLinkWithSelection(); + bot.editorByTitle(FILE2).show(); // the selection should have changed to the latest editor TestUtil.waitUntilTreeHasSelectedNodeWithText(bot, tree, FILE2, 10000); @@ -495,7 +494,7 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase { TestUtil.waitUntilTreeHasSelectedNodeWithText(bot, tree, FILE1, 10000); // deactivate the link with editor - getOrOpenView().toolbarButton("Link with Editor").click(); + toggleLinkWithSelection(); bot.editorByTitle(FILE2).show(); // the selection should be still be test.txt @@ -511,8 +510,8 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase { assertEquals(FILE1, bot.activeEditor().getTitle()); // activate again - SWTBotView repoView = getOrOpenView(); - repoView.toolbarButton("Link with Editor").click(); + toggleLinkWithSelection(); + // make sure focus is here // tried to remove this waitInUI but failed. // tried setting focus, waiting for focus, joining RepositoriesView @@ -529,7 +528,7 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase { TestUtil.waitUntilEditorIsActive(bot, bot.editorByTitle(FILE1), 10000); // deactivate the link with editor - getOrOpenView().toolbarButton("Link with Editor").click(); + toggleLinkWithSelection(); myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand() .getNode(PROJ1).expand().getNode(FOLDER).expand().getNode( @@ -663,6 +662,12 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase { assertThat(folder.getNodes(), hasItem(FILE2)); } + private void toggleLinkWithSelection() throws Exception { + getOrOpenView().toolbarButton( + myUtil.getPluginLocalizedValue("LinkWithSelectionCommand")) + .click(); + } + private SWTBotTreeItem findWorkdirNode(SWTBotTree tree, String... nodes) throws Exception { SWTBotTreeItem item = myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand(); for (String node : nodes) |