[Libreoffice-commits] core.git: qadevOOo/tests

Stephan Bergmann sbergman at redhat.com
Fri Jul 3 08:02:45 PDT 2015


 qadevOOo/tests/java/ifc/accessibility/_XAccessibleEventBroadcaster.java |   22 +++++++---
 1 file changed, 17 insertions(+), 5 deletions(-)

New commits:
commit 2a583603dec40090289ddb5b4b70d800794cf57b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Jul 3 16:57:50 2015 +0200

    Make test code more robust
    
    Change-Id: If3b58c02b289224938b1dfd8074f9802ea6d2474

diff --git a/qadevOOo/tests/java/ifc/accessibility/_XAccessibleEventBroadcaster.java b/qadevOOo/tests/java/ifc/accessibility/_XAccessibleEventBroadcaster.java
index a5d0740..2971669 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");
         }
 


More information about the Libreoffice-commits mailing list