diff options
author | Noel Grandin <noel@peralex.com> | 2014-12-22 10:02:49 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-01-12 08:36:17 +0200 |
commit | 09330056a01a4b5c3d16e3ffb6c1bff36099eb83 (patch) | |
tree | efa793bee83eed4081edd52737e73216a3048b89 /sfx2 | |
parent | 4bf4e3d40778051f1f886c47dd2b2bef82acf1e5 (diff) |
java: simplify sleeping and waiting in tests
- remove the SHORT_WAIT test parameter, no-one is using it
- inline the various independent shortWait() methods
- use the util.utils.shortWait() utility method everywhere
Change-Id: I93cd4a2580172a1441d2ff3d390f52b9505e2721
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java | 34 | ||||
-rw-r--r-- | sfx2/qa/complex/sfx2/tools/WriterHelper.java | 15 |
2 files changed, 13 insertions, 36 deletions
diff --git a/sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java b/sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java index 3f7574c590b7..356c59579041 100644 --- a/sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java +++ b/sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java @@ -104,7 +104,7 @@ public class GlobalEventBroadcaster { notifyEvents.clear(); { XTextDocument xTextDoc = wHelper.openEmptyDoc(); - shortWait(); + util.utils.pause(2000); expected = new String[] { "OnUnfocus", "OnCreate", "OnViewCreated", "OnFocus" }; assertTrue("Wrong events fired when opening empty doc", @@ -114,7 +114,7 @@ public class GlobalEventBroadcaster { System.out.println("changing the writer doc"); notifyEvents.clear(); xTextDoc.getText().setString("GlobalEventBroadcaster"); - shortWait(); + util.utils.pause(2000); expected = new String[] { "OnModifyChanged" }; assertTrue("Wrong events fired when changing doc", @@ -124,7 +124,7 @@ public class GlobalEventBroadcaster { System.out.println("closing the empty writer doc"); notifyEvents.clear(); wHelper.closeDoc(xTextDoc); - shortWait(); + util.utils.pause(2000); } expected = new String[] { "OnUnfocus", "OnFocus", "OnViewClosed", "OnUnload" }; @@ -137,7 +137,7 @@ public class GlobalEventBroadcaster { { XTextDocument xTextDoc = wHelper.openFromDialog(".uno:NewWindow", "", false); - shortWait(); + util.utils.pause(2000); expected = new String[] { "OnUnfocus", "OnCreate", "OnViewCreated", "OnFocus", "OnUnfocus", "OnViewCreated", "OnFocus", }; assertTrue("Wrong events fired when opening an writer doc via Window-New Window", @@ -148,7 +148,7 @@ public class GlobalEventBroadcaster { notifyEvents.clear(); wHelper.closeDoc(xTextDoc); - shortWait(); + util.utils.pause(2000); } expected = new String[] { "OnViewClosed", "OnUnfocus", "OnFocus", "OnViewClosed", "OnUnload" }; @@ -161,7 +161,7 @@ public class GlobalEventBroadcaster { if (false) { System.out.println("Opening document with label wizard"); XTextDocument xTextDoc = wHelper.openFromDialog("private:factory/swriter?slot=21051", "", false); - shortWait(); + util.utils.pause(2000); XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, wHelper.getToolkit().getActiveTopWindow()); UITools ut = new UITools(xWindow); notifyEvents.clear(); @@ -172,9 +172,9 @@ public class GlobalEventBroadcaster { System.out.println("Couldn't press Button"); } System.out.println("... done"); - shortWait(); - shortWait(); - shortWait(); + util.utils.pause(2000); + util.utils.pause(2000); + util.utils.pause(2000); expected = new String[] { "OnViewClosed", "OnCreate", "OnFocus", "OnModifyChanged" }; assertTrue("Wrong events fired when starting labels wizard", @@ -182,9 +182,9 @@ public class GlobalEventBroadcaster { System.out.println("Try to close document..."); wHelper.closeDoc(xTextDoc); - shortWait(); + util.utils.pause(2000); wHelper.closeFromDialog(); - shortWait(); + util.utils.pause(2000); xTextDoc = null; } @@ -197,18 +197,6 @@ public class GlobalEventBroadcaster { System.out.println("... done"); } - /** - * Sleeps for 0.5 sec. to allow StarOffice to react on <code> - * reset</code> call. - */ - private void shortWait() { - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - System.out.println("While waiting :" + e); - } - } - private boolean proveExpectation(String[] expected) { boolean locRes = true; boolean failure = false; diff --git a/sfx2/qa/complex/sfx2/tools/WriterHelper.java b/sfx2/qa/complex/sfx2/tools/WriterHelper.java index 2dd6fad055a8..74b1c3277194 100644 --- a/sfx2/qa/complex/sfx2/tools/WriterHelper.java +++ b/sfx2/qa/complex/sfx2/tools/WriterHelper.java @@ -87,7 +87,7 @@ public class WriterHelper { XComponent comp = UnoRuntime.queryInterface(XComponent.class, xLocalDoc); DialogThread diagThread = new DialogThread(comp, m_xMSF, url); diagThread.start(); - shortWait(); + util.utils.pause(4000); if (createButton.length() > 1) { XExtendedToolkit tk = getToolkit(); @@ -111,7 +111,7 @@ public class WriterHelper { System.out.println("Couldn't press button"); } - shortWait(); + util.utils.pause(4000); } XDesktop xDesktop = getDesktop(); @@ -135,17 +135,6 @@ public class WriterHelper { - /** - * Sleeps for 2 sec. to allow StarOffice to react - */ - private void shortWait() { - try { - Thread.sleep(4000); - } catch (InterruptedException e) { - System.out.println("While waiting :" + e); - } - } - /** creates an instance of com.sun.star.awt.Toolkit to query the XExtendedToolkit * interface * @return returns the gained XExtendedToolkit Interface |