diff options
author | sb <sb@openoffice.org> | 2010-04-26 15:35:49 +0200 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-04-26 15:35:49 +0200 |
commit | 487c3b809916ca208251d2cead9b86cb151d1bc0 (patch) | |
tree | 623d9a77ffcb5e120e961254f99b7627305d5545 /qadevOOo/tests/java | |
parent | 5ffa24ef4992b98fc9897b196659432832d40a2b (diff) |
sb120: #i111159# made XMessageBoxFactory test code more robust
Diffstat (limited to 'qadevOOo/tests/java')
-rw-r--r-- | qadevOOo/tests/java/ifc/awt/_XMessageBoxFactory.java | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/qadevOOo/tests/java/ifc/awt/_XMessageBoxFactory.java b/qadevOOo/tests/java/ifc/awt/_XMessageBoxFactory.java index c4e80ee8a1d7..9c96506938da 100644 --- a/qadevOOo/tests/java/ifc/awt/_XMessageBoxFactory.java +++ b/qadevOOo/tests/java/ifc/awt/_XMessageBoxFactory.java @@ -61,48 +61,50 @@ public class _XMessageBoxFactory extends MultiMethodTest { final UITools tools = new UITools( (XMultiServiceFactory) tParam.getMSF(), UnoRuntime.queryInterface(XWindow.class, mb)); - final State[] state = new State[] { State.NONE }; + final boolean[] done = new boolean[] { false }; + final boolean[] good = new boolean[] { false }; XRequestCallback async = AsyncCallback.create( tParam.getComponentContext()); async.addCallback( new XCallback() { public void notify(Object aData) { mb.execute(); + synchronized (done) { + done[0] = true; + done.notifyAll(); + } } }, Any.VOID); async.addCallback( new XCallback() { public void notify(Object aData) { - boolean ok = true; try { tools.clickButton("OK"); } catch (RuntimeException e) { throw e; } catch (Exception e) { - e.printStackTrace(); - ok = false; + throw new RuntimeException(e); } - synchronized (state) { - state[0] = ok ? State.GOOD : State.BAD; - state.notifyAll(); + synchronized (good) { + good[0] = true; } } }, Any.VOID); - boolean ok; - synchronized (state) { - while (state[0] == State.NONE) { + synchronized (done) { + while (!done[0]) { try { - state.wait(); + done.wait(); } catch (InterruptedException e) { throw new RuntimeException(e); } } - ok = state[0] == State.GOOD; + } + boolean ok; + synchronized (good) { + ok = good[0]; } tRes.tested("createMessageBox()", ok); } - - private enum State { NONE, GOOD, BAD }; } |