diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-07-03 16:57:50 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-07-03 17:02:19 +0200 |
commit | 2a583603dec40090289ddb5b4b70d800794cf57b (patch) | |
tree | c5af277e171410edd2b8155939ef8fc3be59e728 /qadevOOo | |
parent | a6f5770b4aaaa6506a22eae0d641ad48f9b6d239 (diff) |
Make test code more robust
Change-Id: If3b58c02b289224938b1dfd8074f9802ea6d2474
Diffstat (limited to 'qadevOOo')
-rw-r--r-- | qadevOOo/tests/java/ifc/accessibility/_XAccessibleEventBroadcaster.java | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/qadevOOo/tests/java/ifc/accessibility/_XAccessibleEventBroadcaster.java b/qadevOOo/tests/java/ifc/accessibility/_XAccessibleEventBroadcaster.java index a5d0740deed8..297166988fb3 100644 --- a/qadevOOo/tests/java/ifc/accessibility/_XAccessibleEventBroadcaster.java +++ b/qadevOOo/tests/java/ifc/accessibility/_XAccessibleEventBroadcaster.java @@ -77,7 +77,9 @@ public class _XAccessibleEventBroadcaster extends MultiMethodTest { if (nev instanceof com.sun.star.accessibility.XAccessible) { System.out.println("New: "+((XAccessible)nev).getAccessibleContext().getAccessibleName()); } - notifiedEvent = ev; + synchronized (this) { + notifiedEvent = ev; + } } public void disposing(EventObject ev) {} @@ -118,7 +120,11 @@ public class _XAccessibleEventBroadcaster extends MultiMethodTest { boolean works = true; - if (list.notifiedEvent == null) { + AccessibleEventObject ne; + synchronized (list) { + ne = list.notifiedEvent; + } + if (ne == null) { if (!isTransient) { log.println("listener wasn't called"); works = false; @@ -151,17 +157,23 @@ public class _XAccessibleEventBroadcaster extends MultiMethodTest { public void _removeEventListener() throws Exception { requiredMethod("addEventListener()"); - list.notifiedEvent = null; - log.println("remove listener"); oObj.removeAccessibleEventListener(list); + synchronized (list) { + list.notifiedEvent = null; + } + log.println("fire event"); prod.fireEvent() ; waitForEventIdle(); - if (list.notifiedEvent == null) { + AccessibleEventObject ne; + synchronized (list) { + ne = list.notifiedEvent; + } + if (ne == null) { log.println("listener wasn't called -- OK"); } |