[Libreoffice-commits] .: qadevOOo/tests

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Dec 10 09:27:07 PST 2012


 qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeaderArea.java |   47 ++----------
 1 file changed, 9 insertions(+), 38 deletions(-)

New commits:
commit ee433794558b1a1e31dc8dddb77e117608ea1428
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Dec 10 18:25:09 2012 +0100

    Revert "Use XNotifyingDispatch to avoid races"
    
    This reverts commit 21ea372541a81972aa33cb2226dbc2ee3886e23a.  Looks like
    neither XNotifyingDispatch nor XSynchronousDispatch can be used to avoid this
    race; sigh.

diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeaderArea.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeaderArea.java
index 93dc2e2..e1b5019 100644
--- a/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeaderArea.java
+++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeaderArea.java
@@ -36,13 +36,10 @@ import com.sun.star.accessibility.XAccessibleContext;
 import com.sun.star.accessibility.XAccessibleStateSet;
 import com.sun.star.awt.XWindow;
 import com.sun.star.container.XIndexAccess;
-import com.sun.star.frame.DispatchResultEvent;
 import com.sun.star.frame.XController;
+import com.sun.star.frame.XDispatch;
 import com.sun.star.frame.XDispatchProvider;
-import com.sun.star.frame.XDispatchResultListener;
 import com.sun.star.frame.XModel;
-import com.sun.star.frame.XNotifyingDispatch;
-import com.sun.star.lang.EventObject;
 import com.sun.star.lang.XMultiServiceFactory;
 import com.sun.star.sheet.XSpreadsheet;
 import com.sun.star.sheet.XSpreadsheetDocument;
@@ -127,44 +124,18 @@ public class ScAccessiblePageHeaderArea extends TestCase {
             aParseURL[0].Complete = ".uno:PrintPreview";
             xParser.parseStrict(aParseURL);
             URL aURL = aParseURL[0];
-            XNotifyingDispatch xDispatcher = UnoRuntime.queryInterface(
-                XNotifyingDispatch.class, xDispProv.queryDispatch(aURL, "", 0));
-            final int[] ok = new int[] { 0 };
-            XDispatchResultListener listener = new XDispatchResultListener() {
-                    public void disposing(EventObject Source) {
-                        synchronized (ok) {
-                            if (ok[0] == 0) {
-                                ok[0] = 1;
-                            }
-                            ok.notifyAll();
-                        }
-                    }
-                    public void dispatchFinished(DispatchResultEvent Result) {
-                        synchronized (ok) {
-                            ok[0] = 2;
-                            ok.notifyAll();
-                        }
-                    }
-                };
-            xDispatcher.dispatchWithNotification(
-                aURL, null, listener);
-            synchronized (ok) {
-                while (ok[0] == 0) {
-                    try {
-                        ok.wait();
-                    } catch (InterruptedException e) {
-                        throw new RuntimeException(e);
-                    }
-                }
-                if (ok[0] != 2) {
-                    throw new RuntimeException("missing disptachFinished");
-                }
-            }
+            XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0);
+            if(xDispatcher != null)
+                xDispatcher.dispatch( aURL, null );
         } catch (com.sun.star.uno.Exception e) {
             log.println("Couldn't change mode");
             throw new StatusException(Status.failed("Couldn't change mode"));
         }
 
+        try {
+            Thread.sleep(500);
+        } catch (InterruptedException ex) {}
+
         AccessibilityTools at = new AccessibilityTools();
 
         XWindow xWindow = at.getCurrentContainerWindow( (XMultiServiceFactory) Param.getMSF(), aModel);
@@ -242,4 +213,4 @@ public class ScAccessiblePageHeaderArea extends TestCase {
             throw new StatusException( "Couldn't create document ", e );
         }
     }
-}
+}
\ No newline at end of file


More information about the Libreoffice-commits mailing list