diff options
author | Noel Grandin <noel@peralex.com> | 2015-06-09 13:27:06 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-06-11 06:47:23 +0000 |
commit | 754ade38ddb2e96187d00f3e621203cea34961fa (patch) | |
tree | 52bd945487d1a9ce850cba1d091d4f403da0481d /sfx2/qa | |
parent | c82c94b40157c08bbbc524b2dc02714cbe82dc65 (diff) |
speed up Java unit tests by removing sleeps
and replacing them with a call to XToolkitExperimental::
processEventsToIdle
Change-Id: I9fd6cb8af43d902587186310aebe78b5a5ee6932
Reviewed-on: https://gerrit.libreoffice.org/16201
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sfx2/qa')
-rw-r--r-- | sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java | 20 | ||||
-rw-r--r-- | sfx2/qa/complex/sfx2/tools/WriterHelper.java | 2 |
2 files changed, 10 insertions, 12 deletions
diff --git a/sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java b/sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java index 356c59579041..c639ca168a2a 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(); - util.utils.pause(2000); + util.utils.waitForEventIdle(m_xMSF); 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"); - util.utils.pause(2000); + util.utils.waitForEventIdle(m_xMSF); 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); - util.utils.pause(2000); + util.utils.waitForEventIdle(m_xMSF); } expected = new String[] { "OnUnfocus", "OnFocus", "OnViewClosed", "OnUnload" }; @@ -137,7 +137,7 @@ public class GlobalEventBroadcaster { { XTextDocument xTextDoc = wHelper.openFromDialog(".uno:NewWindow", "", false); - util.utils.pause(2000); + util.utils.waitForEventIdle(m_xMSF); 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); - util.utils.pause(2000); + util.utils.waitForEventIdle(m_xMSF); } 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); - util.utils.pause(2000); + util.utils.waitForEventIdle(m_xMSF); XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, wHelper.getToolkit().getActiveTopWindow()); UITools ut = new UITools(xWindow); notifyEvents.clear(); @@ -172,9 +172,7 @@ public class GlobalEventBroadcaster { System.out.println("Couldn't press Button"); } System.out.println("... done"); - util.utils.pause(2000); - util.utils.pause(2000); - util.utils.pause(2000); + util.utils.waitForEventIdle(m_xMSF); expected = new String[] { "OnViewClosed", "OnCreate", "OnFocus", "OnModifyChanged" }; assertTrue("Wrong events fired when starting labels wizard", @@ -182,9 +180,9 @@ public class GlobalEventBroadcaster { System.out.println("Try to close document..."); wHelper.closeDoc(xTextDoc); - util.utils.pause(2000); + util.utils.waitForEventIdle(m_xMSF); wHelper.closeFromDialog(); - util.utils.pause(2000); + util.utils.waitForEventIdle(m_xMSF); xTextDoc = null; } diff --git a/sfx2/qa/complex/sfx2/tools/WriterHelper.java b/sfx2/qa/complex/sfx2/tools/WriterHelper.java index 74b1c3277194..d0d47ce64485 100644 --- a/sfx2/qa/complex/sfx2/tools/WriterHelper.java +++ b/sfx2/qa/complex/sfx2/tools/WriterHelper.java @@ -111,7 +111,7 @@ public class WriterHelper { System.out.println("Couldn't press button"); } - util.utils.pause(4000); + util.utils.waitForEventIdle(m_xMSF); } XDesktop xDesktop = getDesktop(); |