diff options
| author | Florian Barbin | 2015-08-31 07:56:52 +0000 |
|---|---|---|
| committer | Florian Barbin | 2015-08-31 09:57:32 +0000 |
| commit | 5f9a6586707fa1a349c9494bb7da9628652007a0 (patch) | |
| tree | 7d40af06dc3948be783690a42e305a1e32417b92 | |
| parent | be1728d240339b637e9ff1974d7cdf342df2b5c4 (diff) | |
| download | org.eclipse.sirius-5f9a6586707fa1a349c9494bb7da9628652007a0.tar.gz org.eclipse.sirius-5f9a6586707fa1a349c9494bb7da9628652007a0.tar.xz org.eclipse.sirius-5f9a6586707fa1a349c9494bb7da9628652007a0.zip | |
[460610] Adds a wait condition to stabilize the link with editor test
Bug: 460610
Change-Id: I79b125745b7fc9784693f5726d4ccd06293b8994
Signed-off-by: Florian Barbin <florian.barbin@obeo.fr>
| -rw-r--r-- | plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/modelexplorer/LinkWithEditorFeatureWithModelExplorerViewTest.java | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/modelexplorer/LinkWithEditorFeatureWithModelExplorerViewTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/modelexplorer/LinkWithEditorFeatureWithModelExplorerViewTest.java index ae2eef9dbe..db4d55a6de 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/modelexplorer/LinkWithEditorFeatureWithModelExplorerViewTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/modelexplorer/LinkWithEditorFeatureWithModelExplorerViewTest.java @@ -142,6 +142,7 @@ public class LinkWithEditorFeatureWithModelExplorerViewTest extends AbstractSiri // we deactivate the link with editor modelExplorerView.toolbarToggleButton("Link with Editor").click(); + bot.waitUntil(new LinkWithEditorStateCondition(modelExplorerView, false)); // We next select the "newPackage1" package. editor.click(NEW_PACKAGE1); @@ -215,6 +216,7 @@ public class LinkWithEditorFeatureWithModelExplorerViewTest extends AbstractSiri // we deactivate the link with editor modelExplorerView.toolbarToggleButton("Link with Editor").click(); + bot.waitUntil(new LinkWithEditorStateCondition(modelExplorerView, false)); // We next select the "newPackage1" package. representation.getTreeItem(NEW_PACKAGE1).select(); @@ -275,12 +277,13 @@ public class LinkWithEditorFeatureWithModelExplorerViewTest extends AbstractSiri // we deactivate the link with editor modelExplorerView.toolbarToggleButton("Link with Editor").click(); + bot.waitUntil(new LinkWithEditorStateCondition(modelExplorerView, false)); // We next select the "newPackage1" package. representation.getTreeItem(NEW_PACKAGE1).select(); SWTBotUtils.waitAllUiEvents(); - // The NewPackage2 should still be selected. + // The ECLASS1 should still be selected. bot.waitUntil(new ModelExplorerSelectionCondition(modelExplorerView, ECLASS1)); } finally { @@ -348,4 +351,32 @@ public class LinkWithEditorFeatureWithModelExplorerViewTest extends AbstractSiri } } + /** + * Condition to make sure the link with editor is in the expected state. + * + * @author fbarbin + * + */ + private class LinkWithEditorStateCondition extends DefaultCondition { + + private SWTBotView modelExplorerView; + private boolean activated; + + public LinkWithEditorStateCondition(SWTBotView modelExplorerView, boolean activated) { + this.modelExplorerView = modelExplorerView; + this.activated = activated; + } + + @Override + public boolean test() throws Exception { + ModelExplorerView explorerView = (ModelExplorerView) modelExplorerView.getViewReference().getView(false); + return this.activated == explorerView.getCommonViewer().getCommonNavigator().isLinkingEnabled(); + } + + @Override + public String getFailureMessage() { + return "The link with editor state should be " + this.activated; + } + } + } |
