aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Stocker2011-05-14 13:20:06 (EDT)
committerRobin Stocker2011-05-14 13:24:09 (EDT)
commitadb254494679a50cfd4c6e5413b59ebe5596ec34 (patch)
tree992141d97f1fb8cbba08bf260a0b96a40b79c9f0
parente5913363268a73685a1570e1f085ce889815a667 (diff)
downloadegit-adb254494679a50cfd4c6e5413b59ebe5596ec34.zip
egit-adb254494679a50cfd4c6e5413b59ebe5596ec34.tar.gz
egit-adb254494679a50cfd4c6e5413b59ebe5596ec34.tar.bz2
Fix unstable SynchronizeViewGitChangeSetModelTest without setFocusrefs/changes/20/3420/1
In 19a693daeb5c3894c3d8ab624d70932dc40aa093, Mathias removed the calls to setFocus, in order to not bring the window to the front. Because we just want to make sure that the StyledText is enabled, we can also use waitUntil(Conditions.widgetIsEnabled(styledText)). Change-Id: I72769affd6d87689f3d58fe0c17439da6b4226f0 Signed-off-by: Robin Stocker <robin@nibor.org>
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/AbstractSynchronizeViewTest.java41
1 files changed, 18 insertions, 23 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/AbstractSynchronizeViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/AbstractSynchronizeViewTest.java
index 5a919c1..d4ce399 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/AbstractSynchronizeViewTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/AbstractSynchronizeViewTest.java
@@ -48,6 +48,8 @@ import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotStyledText;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarDropDownButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
@@ -248,13 +250,7 @@ public abstract class AbstractSynchronizeViewTest extends
rootTree = waitForNodeWithText(syncViewTree, TEST_COMMIT_MSG);
SWTBotTreeItem projNode = waitForNodeWithText(rootTree, PROJ1);
- SWTBotTreeItem folderNode = waitForNodeWithText(projNode, FOLDER);
- waitForNodeWithText(folderNode, fileName).doubleClick();
-
- SWTBotEditor editor = bot.editorByTitle(fileName);
- // Ensure that both StyledText widgets are enabled
- editor.toTextEditor().setFocus();
- return editor;
+ return getCompareEditor(projNode, fileName);
}
protected SWTBotTreeItem waitForNodeWithText(SWTBotTree tree, String name) {
@@ -272,10 +268,7 @@ public abstract class AbstractSynchronizeViewTest extends
throws Exception {
SWTBotTree syncViewTree = setPresentationModel("Workspace").tree();
SWTBotTreeItem projectTree = waitForNodeWithText(syncViewTree, PROJ1);
- SWTBotTreeItem folderTree = waitForNodeWithText(projectTree, FOLDER);
- waitForNodeWithText(folderTree, FILE1).doubleClick();
-
- return bot.editorByTitle(FILE1);
+ return getCompareEditor(projectTree, FILE1);
}
protected SWTBotEditor getCompareEditorForFileInGitChangeSetModel()
@@ -285,13 +278,7 @@ public abstract class AbstractSynchronizeViewTest extends
SWTBotTreeItem commitNode = syncViewTree.getAllItems()[0];
commitNode.expand();
SWTBotTreeItem projectTree = waitForNodeWithText(commitNode, PROJ1);
- SWTBotTreeItem folderTree = waitForNodeWithText(projectTree, FOLDER);
- waitForNodeWithText(folderTree, FILE1).doubleClick();
-
- SWTBotEditor editor = bot.editorByTitle(FILE1);
- editor.toTextEditor().setFocus();
-
- return editor;
+ return getCompareEditor(projectTree, FILE1);
}
protected SWTBotEditor getCompareEditorForFileInWorspaceModel(
@@ -299,11 +286,7 @@ public abstract class AbstractSynchronizeViewTest extends
SWTBotTree syncViewTree = bot.viewByTitle("Synchronize").bot().tree();
SWTBotTreeItem projNode = waitForNodeWithText(syncViewTree, PROJ1);
- SWTBotTreeItem folderNode = waitForNodeWithText(projNode, FOLDER);
- waitForNodeWithText(folderNode, fileName).doubleClick();
-
- SWTBotEditor editor = bot.editorByTitle(fileName);
- editor.toTextEditor().setFocus();
+ SWTBotEditor editor = getCompareEditor(projNode, fileName);
return editor;
}
@@ -318,6 +301,18 @@ public abstract class AbstractSynchronizeViewTest extends
TestUtil.joinJobs(JobFamilies.COMMIT);
}
+ private SWTBotEditor getCompareEditor(SWTBotTreeItem projectNode,
+ String fileName) {
+ SWTBotTreeItem folderNode = waitForNodeWithText(projectNode, FOLDER);
+ waitForNodeWithText(folderNode, fileName).doubleClick();
+
+ SWTBotEditor editor = bot.editorByTitle(fileName);
+ // Ensure that both StyledText widgets are enabled
+ SWTBotStyledText styledText = editor.toTextEditor().getStyledText();
+ bot.waitUntil(Conditions.widgetIsEnabled(styledText));
+ return editor;
+ }
+
private static void showDialog(String projectName, String... cmd) {
SWTBot packageExplorerBot = bot.viewByTitle("Package Explorer").bot();
packageExplorerBot.activeShell();