diff options
Diffstat (limited to 'org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToggleButtonTest.java')
-rw-r--r-- | org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToggleButtonTest.java | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToggleButtonTest.java b/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToggleButtonTest.java index 22016157..4f947602 100644 --- a/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToggleButtonTest.java +++ b/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToggleButtonTest.java @@ -21,35 +21,47 @@ import static org.junit.Assert.fail; import java.util.List; import org.eclipse.swt.widgets.Text; -import org.eclipse.swtbot.swt.finder.SWTBot; import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; -import org.eclipse.swtbot.swt.finder.finders.AbstractSWTTestCase; import org.eclipse.swtbot.swt.finder.finders.ControlFinder; +import org.eclipse.swtbot.swt.finder.test.AbstractControlExampleTest; +import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; +import org.junit.After; +import org.junit.Before; import org.junit.Test; /** * @author Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com> * @version $Id$ */ -public class SWTBotToggleButtonTest extends AbstractSWTTestCase { +public class SWTBotToggleButtonTest extends AbstractControlExampleTest { - private SWTBot bot; + private long oldTimeout; + + @Before + public void lowerTimeout() { + this.oldTimeout = SWTBotPreferences.TIMEOUT; + SWTBotPreferences.TIMEOUT = 2000; + } + + @After + public void resetTimeout() { + SWTBotPreferences.TIMEOUT = oldTimeout; + } @Test public void clicksToggleButton() throws Exception { try { List<Text> findControls = new ControlFinder().findControls(widgetOfType(Text.class)); SWTBotText text = new SWTBotText(findControls.get(0)); + bot.checkBox("Listen").select(); text.setText(""); - assertFalse(bot.checkBox("Listen").isChecked()); - bot.checkBox("Listen").click(); assertFalse(bot.toggleButton("One").isPressed()); bot.toggleButton("One").click(); assertTrue(bot.toggleButton("One").isPressed()); assertTextContains("Selection [13]: SelectionEvent{Button {One}", text); } finally { - bot.checkBox("Listen").click(); + bot.checkBox("Listen").deselect(); bot.button("Clear").click(); } } @@ -86,15 +98,10 @@ public class SWTBotToggleButtonTest extends AbstractSWTTestCase { } } - public void setUp() throws Exception { - super.setUp(); - bot = new SWTBot(); + @Before + public void prepareExample() throws Exception { bot.tabItem("Button").activate(); bot.radio("SWT.TOGGLE").click(); } - public void tearDown() throws Exception { - super.tearDown(); - bot.radio("SWT.PUSH").click(); - } } |