Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-06-06 19:16:15 +0000
committerChristian W. Damus2014-06-06 19:16:15 +0000
commit55b357623dc16e2a6b7c21f56c545a18ccf30efc (patch)
treedcc6b690444101d6870fc117ecee9cb882610bee /tests/junit
parent2cbe5a7c64dd0bd916c7eb0962bb8cb2ffad6101 (diff)
downloadorg.eclipse.papyrus-55b357623dc16e2a6b7c21f56c545a18ccf30efc.tar.gz
org.eclipse.papyrus-55b357623dc16e2a6b7c21f56c545a18ccf30efc.tar.xz
org.eclipse.papyrus-55b357623dc16e2a6b7c21f56c545a18ccf30efc.zip
[Tests] Fix SWT filter leaks in Sequence Diagram tests
The sequence diagram tests neglect to remove the SWT filters installed by the PopupUtil helper API, interfering with subsequent tests in the same and other suites. This is now refactored to ensure that these filters are removed after each test completes that needs them.
Diffstat (limited to 'tests/junit')
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/AbstractHouseKeeperRule.java4
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/PopupUtil.java69
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestCombinedFragmentDeletion_364804.java5
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestCombinedFragmentGates_364816.java9
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestDecompositionCombinedFragment_364813.java3
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestDecompositionMove_364812.java2
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestSynchronousMessageCreation_364827.java7
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestGuardVisibility_402966.java32
8 files changed, 74 insertions, 57 deletions
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/AbstractHouseKeeperRule.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/AbstractHouseKeeperRule.java
index fc7a9c76de0..acacb3f0d33 100644
--- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/AbstractHouseKeeperRule.java
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/AbstractHouseKeeperRule.java
@@ -599,7 +599,7 @@ public abstract class AbstractHouseKeeperRule {
private static final class ReflectiveDisposer implements Disposer<Object> {
- static final ReflectiveDisposer INSTANCE = new ReflectiveDisposer("dispose");
+ static final ReflectiveDisposer INSTANCE = new ReflectiveDisposer("dispose"); //$NON-NLS-1$
private final String disposeMethod;
@@ -622,7 +622,7 @@ public abstract class AbstractHouseKeeperRule {
}
public void dispose(Object object) throws Exception {
- new Duck(object).quack("dispose", arguments);
+ new Duck(object).quack(disposeMethod, arguments);
}
}
}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/PopupUtil.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/PopupUtil.java
index 17abec95063..25dc7632579 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/PopupUtil.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/PopupUtil.java
@@ -17,6 +17,7 @@ package org.eclipse.papyrus.uml.diagram.sequence.tests.bug;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.papyrus.junit.utils.rules.AbstractHouseKeeperRule;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
@@ -30,41 +31,57 @@ import org.eclipse.swt.widgets.Widget;
public class PopupUtil {
- static boolean menuPopup = false;
+ private final AbstractHouseKeeperRule houseKeeper;
- static int clickMenuIndex = 0;
+ private boolean menuPopup = false;
- public static boolean isMenuPopup() {
+ private int clickMenuIndex = 0;
+
+ private volatile boolean menuListenerEngaged;
+
+ public PopupUtil(AbstractHouseKeeperRule houseKeeper) {
+ this.houseKeeper = houseKeeper;
+ }
+
+ public boolean isMenuPopup() {
return menuPopup;
}
- public static void addMenuListener(int clickIndex) {
- menuPopup = false;
- clickMenuIndex = clickIndex;
- Display.getDefault().syncExec(new Runnable() {
+ public void addMenuListener(int clickIndex) {
+ if(!menuListenerEngaged) {
+ menuPopup = false;
+ clickMenuIndex = clickIndex;
+ Display.getDefault().syncExec(new Runnable() {
- public void run() {
- Display.getDefault().addFilter(SWT.Show, menuListener);
- Display.getDefault().addFilter(SWT.Hide, menuListener);
- }
- });
+ public void run() {
+ Display.getDefault().addFilter(SWT.Show, menuListener);
+ Display.getDefault().addFilter(SWT.Hide, menuListener);
+ }
+ });
+
+ menuListenerEngaged = true;
+
+ houseKeeper.cleanUpLater(this, "removeMenuListener"); //$NON-NLS-1$
+ }
}
- public static void removeMenuListener() {
+ public void removeMenuListener() {
Display.getDefault().syncExec(new Runnable() {
public void run() {
Display.getDefault().removeFilter(SWT.Show, menuListener);
Display.getDefault().removeFilter(SWT.Hide, menuListener);
+ menuListenerEngaged = false;
+ menuPopup = false;
}
});
}
- public static void click(final Menu bar) {
+ public void click(final Menu bar) {
click(bar, 0);
}
- public static void click(final Menu bar, int index) {
+ public void click(final Menu bar, int index) {
MenuItem[] items = bar.getItems();
if(items != null && index < items.length) {
notifyEvent(items[index], SWT.Selection);
@@ -75,7 +92,7 @@ public class PopupUtil {
waitForComplete();
}
- protected static void waitForComplete() {
+ protected void waitForComplete() {
boolean run = true;
while(run) {
try {
@@ -86,7 +103,7 @@ public class PopupUtil {
}
}
- public static void notifyEvent(final Widget menuItem, final int eventType) {
+ public void notifyEvent(final Widget menuItem, final int eventType) {
final Event event = new Event();
event.time = (int)System.currentTimeMillis();
event.widget = menuItem;
@@ -106,7 +123,7 @@ public class PopupUtil {
/**
* A private class to listen for the show/hide events.
*/
- static class ShowHideListener implements Listener {
+ private class ShowHideListener implements Listener {
/**
* Handles the event by checking if it is the proper event. If it is a show, then the current context menu is
@@ -162,11 +179,11 @@ public class PopupUtil {
return list.get(0);
}
- private static Menu currentContextMenu;
+ private Menu currentContextMenu;
- private static Listener menuListener = new ShowHideListener();
+ private Listener menuListener = new ShowHideListener();
- private static Listener dialogCloseHandler = new Listener() {
+ private Listener dialogCloseHandler = new Listener() {
public void handleEvent(Event event) {
if(event.widget instanceof Shell) {
@@ -181,9 +198,9 @@ public class PopupUtil {
}
};
- private static volatile boolean dialogCloseHandlerEngaged = false;
+ private volatile boolean dialogCloseHandlerEngaged = false;
- public static void addDialogCloseHandler() {
+ public void addDialogCloseHandler() {
if(!dialogCloseHandlerEngaged) {
Display.getDefault().syncExec(new Runnable() {
@@ -192,10 +209,12 @@ public class PopupUtil {
dialogCloseHandlerEngaged = true;
}
});
+
+ houseKeeper.cleanUpLater(this, "removeDialogCloseHandler"); //$NON-NLS-1$
}
}
- public static void removeDialogCloseHandler() {
+ public void removeDialogCloseHandler() {
Display.getDefault().syncExec(new Runnable() {
public void run() {
@@ -212,7 +231,7 @@ public class PopupUtil {
* @param runnable
* a runnable that deliberately opens and manages dialogs
*/
- public static void runWithDialogs(Runnable runnable) {
+ public void runWithDialogs(Runnable runnable) {
if(!dialogCloseHandlerEngaged) {
// Just run it
runnable.run();
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestCombinedFragmentDeletion_364804.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestCombinedFragmentDeletion_364804.java
index 5299105e9e4..1e157599dfe 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestCombinedFragmentDeletion_364804.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestCombinedFragmentDeletion_364804.java
@@ -10,6 +10,7 @@
* Contributors:
* CEA LIST - Initial API and implementation
* Christian W. Damus (CEA) - bug 434993
+ * Christian W. Damus (CEA) - fixing issues in sequence diagram test execution
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.tests.bug;
@@ -107,7 +108,7 @@ public class TestCombinedFragmentDeletion_364804 extends TestTopNode {
waitForComplete();
assertTrue(CREATION + TEST_THE_EXECUTION, lifelineEP.getChildren().size() == 2);
- PopupUtil.addMenuListener(0);
+ new PopupUtil(houseKeeper).addMenuListener(0);
{ // destroy semantic
Request deleteViewRequest = new EditCommandRequestWrapper(new DestroyElementRequest(false));
@@ -171,7 +172,7 @@ public class TestCombinedFragmentDeletion_364804 extends TestTopNode {
waitForComplete();
assertTrue(CREATION + TEST_THE_EXECUTION, lifelineEP.getChildren().size() == 2);
- PopupUtil.addMenuListener(1);
+ new PopupUtil(houseKeeper).addMenuListener(1);
{ // destroy semantic
Request deleteViewRequest = new EditCommandRequestWrapper(new DestroyElementRequest(false));
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestCombinedFragmentGates_364816.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestCombinedFragmentGates_364816.java
index a01851360d1..d71380ff540 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestCombinedFragmentGates_364816.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestCombinedFragmentGates_364816.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - fixing issues in sequence diagram test execution
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.tests.bug;
@@ -81,7 +82,7 @@ public class TestCombinedFragmentGates_364816 extends TestLink {
assertTrue(CREATION + INITIALIZATION_TEST, cf.getCfragmentGates().size() == 1);
// check reuse of gate
- PopupUtil.addDialogCloseHandler();
+ new PopupUtil(houseKeeper).addDialogCloseHandler();
createLink(UMLElementTypes.Message_4004, source, target, getAbsoluteCenter(source).translate(0, 40), getLeft(target).translate(0, 40));
waitForComplete();
assertTrue(CREATION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 2);
@@ -117,7 +118,7 @@ public class TestCombinedFragmentGates_364816 extends TestLink {
assertTrue(CREATION + INITIALIZATION_TEST, cf.getCfragmentGates().size() == 1);
// check reuse of gate
- PopupUtil.addDialogCloseHandler();
+ new PopupUtil(houseKeeper).addDialogCloseHandler();
createLink(UMLElementTypes.Message_4009, source, target, new Point(0, 20), getLeft(target).translate(0, 40));
waitForComplete();
assertTrue(CREATION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 2);
@@ -153,7 +154,7 @@ public class TestCombinedFragmentGates_364816 extends TestLink {
assertTrue(CREATION + INITIALIZATION_TEST, cf.getCfragmentGates().size() == 1);
// check reuse of gate
- PopupUtil.addDialogCloseHandler();
+ new PopupUtil(houseKeeper).addDialogCloseHandler();
createLink(UMLElementTypes.Message_4008, source, target, getLeft(source), new Point(0, 200));
waitForComplete();
assertTrue(CREATION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 2);
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestDecompositionCombinedFragment_364813.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestDecompositionCombinedFragment_364813.java
index 516fc757c9e..c213e92ba18 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestDecompositionCombinedFragment_364813.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestDecompositionCombinedFragment_364813.java
@@ -11,6 +11,7 @@
* CEA LIST - Initial API and implementation
* Christian W. Damus (CEA) - bug 434993
* Christian W. Damus (CEA) - bug 436047
+ * Christian W. Damus (CEA) - fixing issues in sequence diagram test execution
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.tests.bug;
@@ -151,7 +152,7 @@ public class TestDecompositionCombinedFragment_364813 extends TestTopNode {
assertTrue(CREATION + INITIALIZATION_TEST, lifeline1.getChildren().size() == 1);
waitForComplete();
- PopupUtil.addDialogCloseHandler();
+ new PopupUtil(houseKeeper).addDialogCloseHandler();
createNode(UMLElementTypes.Lifeline_3001, lifeline1, new Point(100, 120), new Dimension(62, 200));
createNode(UMLElementTypes.Lifeline_3001, lifeline1, new Point(200, 120), new Dimension(62, 200));
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestDecompositionMove_364812.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestDecompositionMove_364812.java
index 85dc07a5ebd..36ba80e11e7 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestDecompositionMove_364812.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestDecompositionMove_364812.java
@@ -233,7 +233,7 @@ public class TestDecompositionMove_364812 extends TestTopNode {
assertTrue(CREATION + INITIALIZATION_TEST, lifeline1.getChildren().size() == 1);
waitForComplete();
- PopupUtil.addDialogCloseHandler();
+ new PopupUtil(houseKeeper).addDialogCloseHandler();
createNode(UMLElementTypes.Lifeline_3001, lifeline1, new Point(100, 120), new Dimension(62, 200));
createNode(UMLElementTypes.Lifeline_3001, lifeline1, new Point(250, 120), new Dimension(62, 200));
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestSynchronousMessageCreation_364827.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestSynchronousMessageCreation_364827.java
index 3655f97782d..903c7fc99c1 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestSynchronousMessageCreation_364827.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestSynchronousMessageCreation_364827.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - fixing issues in sequence diagram test execution
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.tests.bug;
@@ -72,7 +73,7 @@ public class TestSynchronousMessageCreation_364827 extends TestLink {
// assertTrue(CREATION + INITIALIZATION_TEST, target.getChildren().size() == 1);
waitForComplete();
- PopupUtil.addMenuListener(0);
+ new PopupUtil(houseKeeper).addMenuListener(0);
createLink(linkType, source, target, getAbsoluteCenter(source), getAbsoluteCenter(target).translate(0, 60));
assertTrue(CREATION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 1);
@@ -99,7 +100,7 @@ public class TestSynchronousMessageCreation_364827 extends TestLink {
// assertTrue(CREATION + INITIALIZATION_TEST, target.getChildren().size() == 1);
waitForComplete();
- PopupUtil.addMenuListener(1);
+ new PopupUtil(houseKeeper).addMenuListener(1);
createLink(linkType, source, target, getAbsoluteCenter(source), getAbsoluteCenter(target).translate(0, 60));
assertTrue(CREATION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 1);
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestGuardVisibility_402966.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestGuardVisibility_402966.java
index bef75e4b036..89c8647896c 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestGuardVisibility_402966.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestGuardVisibility_402966.java
@@ -34,7 +34,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomInteractionOper
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
import org.eclipse.papyrus.uml.diagram.sequence.tests.ISequenceDiagramTestsConstants;
-import org.eclipse.papyrus.uml.diagram.sequence.tests.bug.PopupUtil;
import org.eclipse.papyrus.uml.diagram.sequence.util.InteractionOperandModelElementFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
@@ -75,25 +74,20 @@ public class TestGuardVisibility_402966 extends AbstractNodeTest {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
final PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(shell, "org.eclipse.papyrus.uml.diagram.sequence.preferences.InteractionOperandPreferencePage", null, null);
- PopupUtil.runWithDialogs(new Runnable() {
+ dialog.setBlockOnOpen(false);
+ dialog.open();
- public void run() {
- dialog.setBlockOnOpen(false);
- dialog.open();
-
- try {
- IPreferencePage page = (IPreferencePage)dialog.getSelectedPage();
- Control control = page.getControl();
- Control group = getControl((Composite)control, Group.class, "Guard", SWT.NONE);
- assertNotNull("Preference Item Guard Group: ", group);
- Button checkbox = (Button)getControl((Composite)group, Button.class, "Show", SWT.CHECK);
- assertNotNull("Preference Item Visibility CheckBox: ", checkbox);
- assertEquals("Default value of Guard Visibility: ", true, checkbox.getSelection());
- } finally {
- dialog.close();
- }
- }
- });
+ try {
+ IPreferencePage page = (IPreferencePage)dialog.getSelectedPage();
+ Control control = page.getControl();
+ Control group = getControl((Composite)control, Group.class, "Guard", SWT.NONE);
+ assertNotNull("Preference Item Guard Group: ", group);
+ Button checkbox = (Button)getControl((Composite)group, Button.class, "Show", SWT.CHECK);
+ assertNotNull("Preference Item Visibility CheckBox: ", checkbox);
+ assertEquals("Default value of Guard Visibility: ", true, checkbox.getSelection());
+ } finally {
+ dialog.close();
+ }
}
private Control getControl(Composite parent, Class<?> controlType, String name, int style) {

Back to the top