summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-06-11 13:10:09 +0200
committerNoel Grandin <noel@peralex.com>2015-06-15 10:44:42 +0200
commit8b85838611ed448ef18a9e4982849bbd702981aa (patch)
tree4aa539ec21817884133f27deb0512769509a2304
parentFix indentation (diff)
downloadcore-8b85838611ed448ef18a9e4982849bbd702981aa.tar.gz
core-8b85838611ed448ef18a9e4982849bbd702981aa.zip
java: remove unnecessary threading
there is no point in spawning a thread to load a document and then waiting for the thread to finish Change-Id: Icd5d5452471b0a50a8e3525ab2b5f32a500ebdf4
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAccessibleCsvCell.java33
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAccessibleCsvGrid.java32
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAccessibleCsvRuler.java32
-rw-r--r--qadevOOo/tests/java/mod/_toolkit/AccessibleButton.java153
-rw-r--r--qadevOOo/tests/java/mod/_toolkit/AccessibleCheckBox.java154
-rw-r--r--qadevOOo/tests/java/mod/_toolkit/AccessibleComboBox.java158
-rw-r--r--sfx2/JunitTest_sfx2_complex.mk1
-rw-r--r--sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java4
-rw-r--r--sfx2/qa/complex/sfx2/tools/DialogThread.java79
-rw-r--r--sfx2/qa/complex/sfx2/tools/WriterHelper.java126
10 files changed, 286 insertions, 486 deletions
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvCell.java b/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvCell.java
index d9403aae8eb4..3e4be0a8fb5d 100644
--- a/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvCell.java
+++ b/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvCell.java
@@ -20,7 +20,6 @@ package mod._sc;
import java.io.PrintWriter;
-import lib.StatusException;
import lib.TestCase;
import lib.TestEnvironment;
import lib.TestParameters;
@@ -40,7 +39,6 @@ import com.sun.star.uno.XInterface;
public class ScAccessibleCsvCell extends TestCase {
- Thread lThread = null;
static XAccessibleAction accAction = null;
/**
@@ -140,33 +138,8 @@ public class ScAccessibleCsvCell extends TestCase {
} catch(com.sun.star.uno.Exception e) {
}
- lThread = new loadThread(SOF, args);
- lThread.start();
- util.utils.pause(2000);
+ String url= utils.getFullTestURL("10test.csv");
+ log.println("loading "+url);
+ SOF.loadDocument(url,args);
}
-
- private class loadThread extends Thread {
-
- private final SOfficeFactory SOF;
- private final PropertyValue[] args;
-
- private loadThread(SOfficeFactory SOF, PropertyValue[] Args) {
- this.SOF = SOF;
- this.args = Args;
- }
-
- @Override
- public void run() {
- try {
- String url= utils.getFullTestURL("10test.csv");
- log.println("loading "+url);
- SOF.loadDocument(url,args);
- } catch (com.sun.star.uno.Exception e) {
- e.printStackTrace();
- throw new StatusException( "Couldn't create document ", e );
- }
- }
- }
-
-
}
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvGrid.java b/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvGrid.java
index cfb372413721..0e7aefc2bfaf 100644
--- a/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvGrid.java
+++ b/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvGrid.java
@@ -20,7 +20,6 @@ package mod._sc;
import java.io.PrintWriter;
-import lib.StatusException;
import lib.TestCase;
import lib.TestEnvironment;
import lib.TestParameters;
@@ -39,7 +38,6 @@ import com.sun.star.uno.XInterface;
public class ScAccessibleCsvGrid extends TestCase {
- Thread lThread = null;
static XAccessibleAction accAction = null;
/**
@@ -123,33 +121,9 @@ public class ScAccessibleCsvGrid extends TestCase {
} catch(com.sun.star.uno.Exception e) {
}
- lThread = new loadThread(SOF, args);
- lThread.start();
- util.utils.pause(2000);
-
- }
-
- private class loadThread extends Thread {
-
- private final SOfficeFactory SOF;
- private final PropertyValue[] args;
-
- private loadThread(SOfficeFactory SOF, PropertyValue[] Args) {
- this.SOF = SOF;
- this.args = Args;
- }
-
- @Override
- public void run() {
- try {
- String url= utils.getFullTestURL("10test.csv");
- log.println("loading "+url);
- SOF.loadDocument(url,args);
- } catch (com.sun.star.uno.Exception e) {
- e.printStackTrace();
- throw new StatusException( "Couldn't create document ", e );
- }
- }
+ String url= utils.getFullTestURL("10test.csv");
+ log.println("loading "+url);
+ SOF.loadDocument(url,args);
}
}
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvRuler.java b/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvRuler.java
index fb35f9236e02..d3cd924643bf 100644
--- a/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvRuler.java
+++ b/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvRuler.java
@@ -20,7 +20,6 @@ package mod._sc;
import java.io.PrintWriter;
-import lib.StatusException;
import lib.TestCase;
import lib.TestEnvironment;
import lib.TestParameters;
@@ -42,7 +41,6 @@ import com.sun.star.uno.XInterface;
public class ScAccessibleCsvRuler extends TestCase {
- Thread lThread = null;
static XAccessibleAction accAction = null;
/**
@@ -160,33 +158,9 @@ public class ScAccessibleCsvRuler extends TestCase {
} catch(com.sun.star.uno.Exception e) {
}
- lThread = new loadThread(SOF, args);
- lThread.start();
- util.utils.pause(2000);
-
- }
-
- private class loadThread extends Thread {
-
- private final SOfficeFactory SOF;
- private final PropertyValue[] args;
-
- private loadThread(SOfficeFactory SOF, PropertyValue[] Args) {
- this.SOF = SOF;
- this.args = Args;
- }
-
- @Override
- public void run() {
- try {
- String url= utils.getFullTestURL("10test.csv");
- log.println("loading "+url);
- SOF.loadDocument(url,args);
- } catch (com.sun.star.uno.Exception e) {
- e.printStackTrace();
- throw new StatusException( "Couldn't create document ", e );
- }
- }
+ String url= utils.getFullTestURL("10test.csv");
+ log.println("loading "+url);
+ SOF.loadDocument(url,args);
}
}
diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleButton.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleButton.java
index be06bc819e96..299e366dcd78 100644
--- a/qadevOOo/tests/java/mod/_toolkit/AccessibleButton.java
+++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleButton.java
@@ -43,18 +43,20 @@ import util.AccessibilityTools;
import util.SOfficeFactory;
import util.utils;
-
/**
* Object implements the following interfaces :
* <ul>
- * <li> <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li>
- * <li> <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li>
- * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li>
- * <li> <code>::com::sun::star::accessibility::XAccessibleValue</code></li>
- * <li> <code>::com::sun::star::accessibility::XAccessibleAction</code></li>
- * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li>
- * <li> <code>::com::sun::star::accessibility::XAccessibleText</code></li>
- * </ul> <p>
+ * <li>
+ * <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li>
+ * <li>
+ * <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleValue</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleAction</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleText</code></li>
+ * </ul>
+ * <p>
*
* @see com.sun.star.accessibility.XAccessibleExtendedComponent
* @see com.sun.star.accessibility.XAccessibleEventBroadcaster
@@ -76,69 +78,85 @@ public class AccessibleButton extends lib.TestCase {
private static XAccessibleAction action = null;
/**
- * Opens 'Printer Settings' dialog using document dispatch provider
- * running in a separate thread. Finds active top window (the dialog
- * window) and finds accessible button 'OK' walking through the
- * accessible component tree.
+ * Opens 'Printer Settings' dialog using document dispatch provider running
+ * in a separate thread. Finds active top window (the dialog window) and
+ * finds accessible button 'OK' walking through the accessible component
+ * tree.
*/
@Override
protected TestEnvironment createTestEnvironment(TestParameters Param,
- PrintWriter log) throws Exception {
+ PrintWriter log) throws Exception {
XInterface oObj = null;
XMultiServiceFactory msf = Param.getMSF();
oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit");
- XExtendedToolkit tk = UnoRuntime.queryInterface(
- XExtendedToolkit.class, oObj);
+ XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class,
+ oObj);
util.utils.waitForEventIdle(Param.getMSF());
- DiagThread psDiag = new DiagThread(xTextDoc, msf);
- psDiag.start();
+ XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc);
+
+ XController xController = aModel.getCurrentController();
- util.utils.pause(Param.getInt("ShortWait"));
+ // Opening PrinterSetupDialog
+ String aSlotID = ".uno:Zoom";
+ XDispatchProvider xDispProv = UnoRuntime.queryInterface(
+ XDispatchProvider.class, xController);
+ XURLTransformer xParser = UnoRuntime.queryInterface(
+ XURLTransformer.class,
+ msf.createInstance("com.sun.star.util.URLTransformer"));
- util.utils.pause(Param.getInt("ShortWait"));
+ // Because it's an in/out parameter
+ // we must use an array of URL objects.
+ URL[] aParseURL = new URL[] { new URL() };
+ aParseURL[0].Complete = aSlotID;
+ xParser.parseStrict(aParseURL);
+
+ XDispatch xDispatcher = xDispProv.queryDispatch(aParseURL[0], "", 0);
+ if (xDispatcher != null) {
+ xDispatcher.dispatch(aParseURL[0], null);
+ }
+
+ util.utils.waitForEventIdle(msf);
Object atw = tk.getActiveTopWindow();
- XWindow xWindow = UnoRuntime.queryInterface(XWindow.class,
- atw);
+ XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, atw);
XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
-
- AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
- oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PUSH_BUTTON,
- "Cancel");
+ AccessibilityTools.printAccessibleTree(log, xRoot,
+ Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+ oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot,
+ AccessibleRole.PUSH_BUTTON, "Cancel");
log.println("ImplementationName " + utils.getImplName(oObj));
TestEnvironment tEnv = new TestEnvironment(oObj);
- action = UnoRuntime.queryInterface(
- XAccessibleAction.class, oObj);
+ action = UnoRuntime.queryInterface(XAccessibleAction.class, oObj);
final XAccessibleComponent acomp = UnoRuntime.queryInterface(
- XAccessibleComponent.class,
- oObj);
+ XAccessibleComponent.class, oObj);
- tEnv.addObjRelation("EventProducer",
- new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
- public void fireEvent() {
- System.out.println("Grabbing focus ... ");
- acomp.grabFocus();
- }
- });
+ tEnv.addObjRelation(
+ "EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+ public void fireEvent() {
+ System.out.println("Grabbing focus ... ");
+ acomp.grabFocus();
+ }
+ });
- XAccessibleText text = UnoRuntime.queryInterface(
- XAccessibleText.class, oObj);
+ XAccessibleText text = UnoRuntime.queryInterface(XAccessibleText.class,
+ oObj);
tEnv.addObjRelation("XAccessibleText.Text", text.getText());
tEnv.addObjRelation("EditOnly",
- "This method isn't supported in this component");
+ "This method isn't supported in this component");
tEnv.addObjRelation("LimitedBounds", "yes");
@@ -168,59 +186,10 @@ public class AccessibleButton extends lib.TestCase {
* Opens new writer document.
*/
@Override
- protected void initialize(TestParameters Param, PrintWriter log) throws Exception {
- SOfficeFactory SOF = SOfficeFactory.getFactory(
- Param.getMSF());
+ protected void initialize(TestParameters Param, PrintWriter log)
+ throws Exception {
+ SOfficeFactory SOF = SOfficeFactory.getFactory(Param.getMSF());
xTextDoc = SOF.createTextDoc(null);
}
-
- /**
- * Thread for opening modal dialog 'Print Settings'.
- */
- private class DiagThread extends Thread {
- private XTextDocument xTextDoc = null;
- private XMultiServiceFactory msf = null;
-
- private DiagThread(XTextDocument xTextDoc, XMultiServiceFactory msf) {
- this.xTextDoc = xTextDoc;
- this.msf = msf;
- }
-
- @Override
- public void run() {
- XModel aModel = UnoRuntime.queryInterface(XModel.class,
- xTextDoc);
-
- XController xController = aModel.getCurrentController();
-
- //Opening PrinterSetupDialog
- try {
- String aSlotID = ".uno:Zoom";
- XDispatchProvider xDispProv = UnoRuntime.queryInterface(
- XDispatchProvider.class,
- xController);
- XURLTransformer xParser = UnoRuntime.queryInterface(
- XURLTransformer.class,
- msf.createInstance(
- "com.sun.star.util.URLTransformer"));
-
- // Because it's an in/out parameter
- // we must use an array of URL objects.
- URL[] aParseURL = new URL[1];
- aParseURL[0] = new URL();
- aParseURL[0].Complete = aSlotID;
- xParser.parseStrict(aParseURL);
-
- URL aURL = aParseURL[0];
- XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0);
-
- if (xDispatcher != null) {
- xDispatcher.dispatch(aURL, null);
- }
- } catch (com.sun.star.uno.Exception e) {
- log.println("Couldn't open dialog");
- }
- }
- }
} \ No newline at end of file
diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleCheckBox.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleCheckBox.java
index 343953e8e542..da6faa32e029 100644
--- a/qadevOOo/tests/java/mod/_toolkit/AccessibleCheckBox.java
+++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleCheckBox.java
@@ -44,21 +44,24 @@ import util.AccessibilityTools;
import util.SOfficeFactory;
import util.utils;
-
/**
- * Test for object which is represented by accessible compoent of
- * check box in 'InsertTable' dialog. <p>
+ * Test for object which is represented by accessible compoent of check box in
+ * 'InsertTable' dialog.
+ * <p>
*
* Object implements the following interfaces :
* <ul>
- * <li> <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li>
- * <li> <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li>
- * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li>
- * <li> <code>::com::sun::star::accessibility::XAccessibleValue</code></li>
- * <li> <code>::com::sun::star::accessibility::XAccessibleAction</code></li>
- * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li>
- * <li> <code>::com::sun::star::accessibility::XAccessibleText</code></li>
- * </ul> <p>
+ * <li>
+ * <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li>
+ * <li>
+ * <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleValue</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleAction</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleText</code></li>
+ * </ul>
+ * <p>
*
* @see com.sun.star.accessibility.XAccessibleExtendedComponent
* @see com.sun.star.accessibility.XAccessibleEventBroadcaster
@@ -78,17 +81,15 @@ import util.utils;
public class AccessibleCheckBox extends TestCase {
private static XTextDocument xTextDoc = null;
private static XAccessibleAction action = null;
- private static DiagThread psDiag = null;
/**
- * Opens 'Insert Table' dialog using document dispatch provider
- * running in a separate thread. Finds active top window (the dialog
- * window) and finds first accessible check box walking through the
- * accessible component tree.
+ * Opens 'Insert Table' dialog using document dispatch provider running in a
+ * separate thread. Finds active top window (the dialog window) and finds
+ * first accessible check box walking through the accessible component tree.
*/
@Override
protected TestEnvironment createTestEnvironment(TestParameters Param,
- PrintWriter log) throws Exception {
+ PrintWriter log) throws Exception {
XMultiServiceFactory msf = Param.getMSF();
log.println("Creating text document");
@@ -105,60 +106,78 @@ public class AccessibleCheckBox extends TestCase {
oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit");
- XExtendedToolkit tk = UnoRuntime.queryInterface(
- XExtendedToolkit.class, oObj);
+ XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class,
+ oObj);
util.utils.waitForEventIdle(Param.getMSF());
log.println("Opening Dialog in second thread");
- psDiag = new DiagThread(xTextDoc, msf);
- psDiag.start();
+ XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc);
+
+ XController xController = aModel.getCurrentController();
- util.utils.pause(Param.getInt("ShortWait"));
+ // Opening PrinterSetupDialog
+ String aSlotID = ".uno:InsertTable";
+ XDispatchProvider xDispProv = UnoRuntime.queryInterface(
+ XDispatchProvider.class, xController);
+ XURLTransformer xParser = UnoRuntime.queryInterface(
+ XURLTransformer.class,
+ msf.createInstance("com.sun.star.util.URLTransformer"));
- util.utils.pause(Param.getInt("ShortWait"));
+ // Because it's an in/out parameter we must use an array of URL
+ // objects.
+ URL[] aParseURL = new URL[] { new URL() };
+ aParseURL[0].Complete = aSlotID;
+ xParser.parseStrict(aParseURL);
+
+ XDispatch xDispatcher = xDispProv.queryDispatch(aParseURL[0], "", 0);
+ if (xDispatcher != null) {
+ xDispatcher.dispatch(aParseURL[0], null);
+ }
+
+ util.utils.waitForEventIdle(msf);
log.println("Getting the active TopWindow");
XWindow xWindow = UnoRuntime.queryInterface(XWindow.class,
- tk.getActiveTopWindow());
+ tk.getActiveTopWindow());
XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
+ AccessibilityTools.printAccessibleTree(log, xRoot,
+ Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+ oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot,
+ AccessibleRole.PUSH_BUTTON, "Cancel");
- AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
- oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PUSH_BUTTON,
- "Cancel");
-
- action = UnoRuntime.queryInterface(
- XAccessibleAction.class, oObj);
+ action = UnoRuntime.queryInterface(XAccessibleAction.class, oObj);
- oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.CHECK_BOX);
+ oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot,
+ AccessibleRole.CHECK_BOX);
log.println("ImplementationName " + utils.getImplName(oObj));
TestEnvironment tEnv = new TestEnvironment(oObj);
final XAccessibleComponent acomp = UnoRuntime.queryInterface(
- XAccessibleComponent.class,
- oObj);
+ XAccessibleComponent.class, oObj);
- tEnv.addObjRelation("EventProducer",
- new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
- public void fireEvent() {
- System.out.println("Grabbing focus ... ");
- acomp.grabFocus();
- }
- });
+ tEnv.addObjRelation(
+ "EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+ public void fireEvent() {
+ System.out.println("Grabbing focus ... ");
+ acomp.grabFocus();
+ }
+ });
- XAccessibleText text = UnoRuntime.queryInterface(
- XAccessibleText.class, oObj);
+ XAccessibleText text = UnoRuntime.queryInterface(XAccessibleText.class,
+ oObj);
tEnv.addObjRelation("XAccessibleText.Text", text.getText());
tEnv.addObjRelation("EditOnly",
- "This method isn't supported in this component");
+ "This method isn't supported in this component");
tEnv.addObjRelation("LimitedBounds", "yes");
@@ -174,8 +193,6 @@ public class AccessibleCheckBox extends TestCase {
try {
log.println("closing dialog");
action.doAccessibleAction(0);
- log.println("interrupting corresponding Thread");
- psDiag.interrupt();
log.println("closing the document");
util.DesktopTools.closeDoc(xTextDoc);
log.println("reinitialize the variable");
@@ -187,51 +204,4 @@ public class AccessibleCheckBox extends TestCase {
}
}
- /**
- * Thread for opening modal dialog 'Insert Table'.
- */
- private class DiagThread extends Thread {
- private XTextDocument xTextDoc = null;
- private XMultiServiceFactory msf = null;
-
- private DiagThread(XTextDocument xTextDoc, XMultiServiceFactory msf) {
- this.xTextDoc = xTextDoc;
- this.msf = msf;
- }
-
- @Override
- public void run() {
- XModel aModel = UnoRuntime.queryInterface(XModel.class,
- xTextDoc);
-
- XController xController = aModel.getCurrentController();
-
- //Opening PrinterSetupDialog
- try {
- String aSlotID = ".uno:InsertTable";
- XDispatchProvider xDispProv = UnoRuntime.queryInterface(
- XDispatchProvider.class,
- xController);
- XURLTransformer xParser = UnoRuntime.queryInterface(
- XURLTransformer.class,
- msf.createInstance(
- "com.sun.star.util.URLTransformer"));
-
- // Because it's an in/out parameter we must use an array of URL objects.
- URL[] aParseURL = new URL[1];
- aParseURL[0] = new URL();
- aParseURL[0].Complete = aSlotID;
- xParser.parseStrict(aParseURL);
-
- URL aURL = aParseURL[0];
- XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0);
-
- if (xDispatcher != null) {
- xDispatcher.dispatch(aURL, null);
- }
- } catch (com.sun.star.uno.Exception e) {
- log.println("Couldn't open dialog");
- }
- }
- }
} \ No newline at end of file
diff --git a/qadevOOo/tests/java/mod/_toolkit/AccessibleComboBox.java b/qadevOOo/tests/java/mod/_toolkit/AccessibleComboBox.java
index da256abbbd25..621ad5c5d3ff 100644
--- a/qadevOOo/tests/java/mod/_toolkit/AccessibleComboBox.java
+++ b/qadevOOo/tests/java/mod/_toolkit/AccessibleComboBox.java
@@ -28,7 +28,6 @@ import com.sun.star.frame.XController;
import com.sun.star.frame.XDispatch;
import com.sun.star.frame.XDispatchProvider;
import com.sun.star.frame.XModel;
-import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.text.XTextDocument;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XInterface;
@@ -44,18 +43,21 @@ import util.AccessibilityTools;
import util.SOfficeFactory;
import util.utils;
-
/**
- * Test for object which is represented by accessible component
- * of the 'Font' combo box in Format->Character... dislog box. <p>
+ * Test for object which is represented by accessible component of the 'Font'
+ * combo box in Format->Character... dislog box.
+ * <p>
*
* Object implements the following interfaces :
* <ul>
- * <li> <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li>
- * <li> <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li>
- * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li>
- * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li>
- * </ul> <p>
+ * <li>
+ * <code>::com::sun::star::accessibility::XAccessibleExtendedComponent</code></li>
+ * <li>
+ * <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li>
+ * </ul>
+ * <p>
*
* @see com.sun.star.accessibility.XAccessibleExtendedComponent
* @see com.sun.star.accessibility.XAccessibleEventBroadcaster
@@ -71,45 +73,61 @@ public class AccessibleComboBox extends TestCase {
private static XAccessibleAction action = null;
/**
- * Opens CharacterStyle dialog and
- * finds AccessibleComboBox walking through the
- * accessible component tree.
+ * Opens CharacterStyle dialog and finds AccessibleComboBox walking through
+ * the accessible component tree.
*/
@Override
protected TestEnvironment createTestEnvironment(TestParameters Param,
- PrintWriter log) throws Exception {
+ PrintWriter log) throws Exception {
XInterface oObj = null;
oObj = (XInterface) Param.getMSF().createInstance(
- "com.sun.star.awt.Toolkit");
+ "com.sun.star.awt.Toolkit");
+
+ XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class,
+ oObj);
+
+ XModel aModel = UnoRuntime.queryInterface(XModel.class, xTextDoc);
- XExtendedToolkit tk = UnoRuntime.queryInterface(
- XExtendedToolkit.class, oObj);
+ XController xController = aModel.getCurrentController();
- DiagThread psDiag = new DiagThread(xTextDoc,
- Param.getMSF());
- psDiag.start();
+ // Opening PrinterSetupDialog
+ String aSlotID = ".uno:FontDialog";
+ XDispatchProvider xDispProv = UnoRuntime.queryInterface(
+ XDispatchProvider.class, xController);
+ XURLTransformer xParser = UnoRuntime.queryInterface(
+ XURLTransformer.class,
+ Param.getMSF().createInstance(
+ "com.sun.star.util.URLTransformer"));
- util.utils.pause(Param.getInt("ShortWait"));
+ // Because it's an in/out parameter we must use an array of URL
+ // objects.
+ URL[] aParseURL = new URL[] { new URL() };
+ aParseURL[0].Complete = aSlotID;
+ xParser.parseStrict(aParseURL);
+
+ XDispatch xDispatcher = xDispProv.queryDispatch(aParseURL[0], "", 0);
+ if (xDispatcher != null) {
+ xDispatcher.dispatch(aParseURL[0], null);
+ }
+
+ util.utils.waitForEventIdle(Param.getMSF());
Object atw = tk.getActiveTopWindow();
- XWindow xWindow = UnoRuntime.queryInterface(XWindow.class,
- atw);
+ XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, atw);
XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
- oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PUSH_BUTTON,
- "Cancel");
- action = UnoRuntime.queryInterface(
- XAccessibleAction.class, oObj);
+ oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot,
+ AccessibleRole.PUSH_BUTTON, "Cancel");
+ action = UnoRuntime.queryInterface(XAccessibleAction.class, oObj);
oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot,
- AccessibleRole.PAGE_TAB_LIST);
+ AccessibleRole.PAGE_TAB_LIST);
XAccessibleSelection xAccSel = UnoRuntime.queryInterface(
- XAccessibleSelection.class,
- oObj);
+ XAccessibleSelection.class, oObj);
try {
xAccSel.selectAccessibleChild(0);
@@ -118,28 +136,28 @@ public class AccessibleComboBox extends TestCase {
}
util.utils.waitForEventIdle(Param.getMSF());
- AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
- oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PANEL, "",
- "AccessibleComboBox");
+ AccessibilityTools.printAccessibleTree(log, xRoot,
+ Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+ oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot,
+ AccessibleRole.PANEL, "", "AccessibleComboBox");
log.println("ImplementationName " + utils.getImplName(oObj));
TestEnvironment tEnv = new TestEnvironment(oObj);
final XAccessibleComponent acomp = UnoRuntime.queryInterface(
- XAccessibleComponent.class,
- oObj);
+ XAccessibleComponent.class, oObj);
final XAccessibleComponent acomp1 = UnoRuntime.queryInterface(
- XAccessibleComponent.class,
- action);
+ XAccessibleComponent.class, action);
- tEnv.addObjRelation("EventProducer",
- new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
- public void fireEvent() {
- acomp1.grabFocus();
- acomp.grabFocus();
- }
- });
+ tEnv.addObjRelation(
+ "EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+ public void fireEvent() {
+ acomp1.grabFocus();
+ acomp.grabFocus();
+ }
+ });
return tEnv;
}
@@ -167,58 +185,10 @@ public class AccessibleComboBox extends TestCase {
* Creates writer doc
*/
@Override
- protected void initialize(TestParameters Param, PrintWriter log) throws Exception {
- SOfficeFactory SOF = SOfficeFactory.getFactory(
- Param.getMSF());
+ protected void initialize(TestParameters Param, PrintWriter log)
+ throws Exception {
+ SOfficeFactory SOF = SOfficeFactory.getFactory(Param.getMSF());
xTextDoc = SOF.createTextDoc(null);
}
-
- /**
- * Thread for opening modal dialog 'Character style'.
- */
- private class DiagThread extends Thread {
- private XTextDocument xTextDoc = null;
- private XMultiServiceFactory msf = null;
-
- private DiagThread(XTextDocument xTextDoc, XMultiServiceFactory msf) {
- this.xTextDoc = xTextDoc;
- this.msf = msf;
- }
-
- @Override
- public void run() {
- XModel aModel = UnoRuntime.queryInterface(XModel.class,
- xTextDoc);
-
- XController xController = aModel.getCurrentController();
-
- //Opening PrinterSetupDialog
- try {
- String aSlotID = ".uno:FontDialog";
- XDispatchProvider xDispProv = UnoRuntime.queryInterface(
- XDispatchProvider.class,
- xController);
- XURLTransformer xParser = UnoRuntime.queryInterface(
- XURLTransformer.class,
- msf.createInstance(
- "com.sun.star.util.URLTransformer"));
-
- // Because it's an in/out parameter we must use an array of URL objects.
- URL[] aParseURL = new URL[1];
- aParseURL[0] = new URL();
- aParseURL[0].Complete = aSlotID;
- xParser.parseStrict(aParseURL);
-
- URL aURL = aParseURL[0];
- XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0);
-
- if (xDispatcher != null) {
- xDispatcher.dispatch(aURL, null);
- }
- } catch (com.sun.star.uno.Exception e) {
- log.println("Couldn't open dialog");
- }
- }
- }
} \ No newline at end of file
diff --git a/sfx2/JunitTest_sfx2_complex.mk b/sfx2/JunitTest_sfx2_complex.mk
index 1f11298dc925..ee1029e70abb 100644
--- a/sfx2/JunitTest_sfx2_complex.mk
+++ b/sfx2/JunitTest_sfx2_complex.mk
@@ -39,7 +39,6 @@ $(eval $(call gb_JunitTest_add_sourcefiles,sfx2_complex,\
sfx2/qa/complex/sfx2/GlobalEventBroadcaster \
sfx2/qa/complex/sfx2/UndoManager \
sfx2/qa/complex/sfx2/DocumentEvents \
- sfx2/qa/complex/sfx2/tools/DialogThread \
sfx2/qa/complex/sfx2/tools/TestDocument \
sfx2/qa/complex/sfx2/tools/WriterHelper \
sfx2/qa/complex/sfx2/undo/CalcDocumentTest \
diff --git a/sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java b/sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java
index c639ca168a2a..e4154db87220 100644
--- a/sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java
+++ b/sfx2/qa/complex/sfx2/GlobalEventBroadcaster.java
@@ -95,7 +95,7 @@ public class GlobalEventBroadcaster {
System.out.println("... done");
}
- @Test public void checkWriter() {
+ @Test public void checkWriter() throws Exception {
System.out.println("-- Checking Writer --");
WriterHelper wHelper = new WriterHelper(m_xMSF);
@@ -156,7 +156,7 @@ public class GlobalEventBroadcaster {
proveExpectation(expected));
System.out.println("... done");
- // TODO: It seems not possible to close the document without interactiv question
+ // TODO: It seems not possible to close the document without interactive question
// there the follow test will not be execute
if (false) {
System.out.println("Opening document with label wizard");
diff --git a/sfx2/qa/complex/sfx2/tools/DialogThread.java b/sfx2/qa/complex/sfx2/tools/DialogThread.java
deleted file mode 100644
index b4a8ddae3e1a..000000000000
--- a/sfx2/qa/complex/sfx2/tools/DialogThread.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package complex.sfx2.tools;
-
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.frame.XController;
-import com.sun.star.frame.XDispatch;
-import com.sun.star.frame.XDispatchProvider;
-import com.sun.star.frame.XModel;
-import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.util.URL;
-import com.sun.star.util.XURLTransformer;
-
-/**
- * This class opens a given dialog in a separate Thread by dispatching an url
- *
- */
-public class DialogThread extends Thread {
- private XComponent m_xDoc = null;
- private XMultiServiceFactory m_xMSF = null;
- private String m_url = "";
-
- public DialogThread(XComponent xDoc, XMultiServiceFactory msf, String url) {
- this.m_xDoc = xDoc;
- this.m_xMSF = msf;
- this.m_url = url;
- }
-
- @Override
- public void run() {
- XModel aModel = UnoRuntime.queryInterface( XModel.class, m_xDoc );
-
- XController xController = aModel.getCurrentController();
-
- //Opening Dialog
- try {
- XDispatchProvider xDispProv = UnoRuntime.queryInterface( XDispatchProvider.class, xController.getFrame() );
- XURLTransformer xParser = UnoRuntime.queryInterface( XURLTransformer.class,
- m_xMSF.createInstance( "com.sun.star.util.URLTransformer" ) );
-
- // Because it's an in/out parameter
- // we must use an array of URL objects.
- URL[] aParseURL = new URL[1];
- aParseURL[0] = new URL();
- aParseURL[0].Complete = m_url;
- xParser.parseStrict(aParseURL);
-
- URL aURL = aParseURL[0];
- XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", com.sun.star.frame.FrameSearchFlag.SELF |
- com.sun.star.frame.FrameSearchFlag.CHILDREN);
- PropertyValue[] dispatchArguments = new PropertyValue[0];
-
- if (xDispatcher != null) {
- xDispatcher.dispatch(aURL, dispatchArguments);
- } else {
- System.out.println("xDispatcher is null");
- }
- } catch (com.sun.star.uno.Exception e) {
- System.out.println("Couldn't open dialog");
- }
- }
-} \ No newline at end of file
diff --git a/sfx2/qa/complex/sfx2/tools/WriterHelper.java b/sfx2/qa/complex/sfx2/tools/WriterHelper.java
index d0d47ce64485..382aebca5449 100644
--- a/sfx2/qa/complex/sfx2/tools/WriterHelper.java
+++ b/sfx2/qa/complex/sfx2/tools/WriterHelper.java
@@ -23,17 +23,23 @@ import com.sun.star.accessibility.XAccessibleAction;
import com.sun.star.accessibility.XAccessibleContext;
import com.sun.star.awt.XExtendedToolkit;
import com.sun.star.awt.XWindow;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.frame.XController;
import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XModel;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.text.XTextDocument;
import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.URL;
import com.sun.star.util.XCloseable;
+import com.sun.star.util.XURLTransformer;
import util.AccessibilityTools;
import util.WriterTools;
-
/**
* Methods to open Writer docs
*
@@ -41,26 +47,36 @@ import util.WriterTools;
public class WriterHelper {
private XMultiServiceFactory m_xMSF = null;
- /** Creates a new instance of WriterHelper
- * @param xMSF The MultiServiceFactory gained from the office
+ /**
+ * Creates a new instance of WriterHelper
+ *
+ * @param xMSF
+ * The MultiServiceFactory gained from the office
*/
public WriterHelper(XMultiServiceFactory xMSF) {
this.m_xMSF = xMSF;
}
- /** Opens an empty document
+ /**
+ * Opens an empty document
+ *
* @return a reference to the opened document is returned
*/
public XTextDocument openEmptyDoc() {
return WriterTools.createTextDoc(m_xMSF);
}
- /** Closes a given XTextDocument
- * @param xTextDoc the text document to be closed
- * @return if an error occurs the errormessage is returned and an empty String if not
+ /**
+ * Closes a given XTextDocument
+ *
+ * @param xTextDoc
+ * the text document to be closed
+ * @return if an error occurs the errormessage is returned and an empty
+ * String if not
*/
public String closeDoc(XTextDocument xTextDoc) {
- XCloseable closer = UnoRuntime.queryInterface(XCloseable.class, xTextDoc);
+ XCloseable closer = UnoRuntime.queryInterface(XCloseable.class,
+ xTextDoc);
String err = "";
try {
@@ -74,20 +90,51 @@ public class WriterHelper {
}
private XTextDocument xLocalDoc = null;
- /** a TextDocument is opened by pressing a button in a dialog given by uno-URL
- * @param url the uno-URL of the dialog to be opened
- * @param createButton the language dependent label of the button to be pressed
- * @param destroyLocal if true the document that has been opened to dispatch the dialog is closed before the method returns,
- * otherwise this document remains open
+
+ /**
+ * a TextDocument is opened by pressing a button in a dialog given by
+ * uno-URL
+ *
+ * @param url
+ * the uno-URL of the dialog to be opened
+ * @param createButton
+ * the language dependent label of the button to be pressed
+ * @param destroyLocal
+ * if true the document that has been opened to dispatch the
+ * dialog is closed before the method returns, otherwise this
+ * document remains open
* @return returns the created Textdocument
*/
public XTextDocument openFromDialog(String url, String createButton,
- boolean destroyLocal) {
+ boolean destroyLocal) throws Exception {
xLocalDoc = WriterTools.createTextDoc(m_xMSF);
- XComponent comp = UnoRuntime.queryInterface(XComponent.class, xLocalDoc);
- DialogThread diagThread = new DialogThread(comp, m_xMSF, url);
- diagThread.start();
- util.utils.pause(4000);
+ XComponent comp = UnoRuntime
+ .queryInterface(XComponent.class, xLocalDoc);
+
+ XModel aModel = UnoRuntime.queryInterface(XModel.class, comp);
+
+ XController xController = aModel.getCurrentController();
+
+ // Opening Dialog
+ XDispatchProvider xDispProv = UnoRuntime.queryInterface(
+ XDispatchProvider.class, xController.getFrame());
+ XURLTransformer xParser = UnoRuntime.queryInterface(
+ XURLTransformer.class,
+ m_xMSF.createInstance("com.sun.star.util.URLTransformer"));
+
+ // Because it's an in/out parameter
+ // we must use an array of URL objects.
+ URL[] aParseURL = new URL[] { new URL() };
+ aParseURL[0].Complete = url;
+ xParser.parseStrict(aParseURL);
+
+ XDispatch xDispatcher = xDispProv.queryDispatch(aParseURL[0], "",
+ com.sun.star.frame.FrameSearchFlag.SELF
+ | com.sun.star.frame.FrameSearchFlag.CHILDREN);
+ if (xDispatcher != null) {
+ PropertyValue[] dispatchArguments = new PropertyValue[0];
+ xDispatcher.dispatch(aParseURL[0], dispatchArguments);
+ }
if (createButton.length() > 1) {
XExtendedToolkit tk = getToolkit();
@@ -96,16 +143,16 @@ public class WriterHelper {
XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, atw);
XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
- XAccessibleContext buttonContext = AccessibilityTools.getAccessibleObjectForRole(
- xRoot,
- AccessibleRole.PUSH_BUTTON,
- createButton);
+ XAccessibleContext buttonContext = AccessibilityTools
+ .getAccessibleObjectForRole(xRoot,
+ AccessibleRole.PUSH_BUTTON, createButton);
- XAccessibleAction buttonAction = UnoRuntime.queryInterface(XAccessibleAction.class, buttonContext);
+ XAccessibleAction buttonAction = UnoRuntime.queryInterface(
+ XAccessibleAction.class, buttonContext);
try {
- System.out.println("Name: " +
- buttonContext.getAccessibleName());
+ System.out
+ .println("Name: " + buttonContext.getAccessibleName());
buttonAction.doAccessibleAction(0);
} catch (com.sun.star.lang.IndexOutOfBoundsException e) {
System.out.println("Couldn't press button");
@@ -116,7 +163,8 @@ public class WriterHelper {
XDesktop xDesktop = getDesktop();
- XTextDocument returnDoc = UnoRuntime.queryInterface(XTextDocument.class, xDesktop.getCurrentComponent());
+ XTextDocument returnDoc = UnoRuntime.queryInterface(
+ XTextDocument.class, xDesktop.getCurrentComponent());
if (destroyLocal) {
closeDoc(xLocalDoc);
@@ -125,18 +173,16 @@ public class WriterHelper {
return returnDoc;
}
- public void closeFromDialog()
- {
+
+ public void closeFromDialog() {
closeDoc(xLocalDoc);
xLocalDoc = null;
}
-
-
-
-
- /** creates an instance of com.sun.star.awt.Toolkit to query the XExtendedToolkit
- * interface
+ /**
+ * creates an instance of com.sun.star.awt.Toolkit to query the
+ * XExtendedToolkit interface
+ *
* @return returns the gained XExtendedToolkit Interface
*/
public XExtendedToolkit getToolkit() {
@@ -146,15 +192,19 @@ public class WriterHelper {
toolkit = m_xMSF.createInstance("com.sun.star.awt.Toolkit");
} catch (com.sun.star.uno.Exception e) {
System.out.println("Couldn't get toolkit");
- e.printStackTrace( System.err );
+ e.printStackTrace(System.err);
}
- XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, toolkit);
+ XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class,
+ toolkit);
return tk;
}
- /** creates an instance of com.sun.star.frame.Desktop to query the XDesktop interface
+ /**
+ * creates an instance of com.sun.star.frame.Desktop to query the XDesktop
+ * interface
+ *
* @return returns the gained XDesktop interface
*/
private XDesktop getDesktop() {
@@ -164,7 +214,7 @@ public class WriterHelper {
desk = m_xMSF.createInstance("com.sun.star.frame.Desktop");
} catch (com.sun.star.uno.Exception e) {
System.out.println("Couldn't get desktop");
- e.printStackTrace( System.err );
+ e.printStackTrace(System.err);
}
XDesktop xDesktop = UnoRuntime.queryInterface(XDesktop.class, desk);