summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/complex/accessibility/AccessibleRelationSet.java255
-rw-r--r--sw/qa/complex/accessibility/makefile.mk61
-rwxr-xr-xsw/qa/complex/checkColor/CheckChangeColor.java90
-rwxr-xr-xsw/qa/complex/checkColor/makefile.mk79
-rwxr-xr-xsw/qa/complex/indeterminateState/CheckIndeterminateState.java139
-rwxr-xr-xsw/qa/complex/indeterminateState/makefile.mk86
-rw-r--r--sw/qa/complex/writer/CheckBookmarks.java280
-rw-r--r--sw/qa/complex/writer/CheckCrossReferences.java369
-rwxr-xr-xsw/qa/complex/writer/CheckIndexedPropertyValues.java185
-rwxr-xr-xsw/qa/complex/writer/CheckNamedPropertyValues.java199
-rwxr-xr-xsw/qa/complex/writer/makefile.mk103
-rw-r--r--sw/qa/complex/writer/testdocuments/CheckCrossReferences.odtbin0 -> 11628 bytes
-rw-r--r--sw/qa/core/Test-BigPtrArray.cxx880
-rw-r--r--sw/qa/core/bigpointerarray-new.cxx113
-rw-r--r--sw/qa/core/bigpointerarray-new.hxx162
-rw-r--r--sw/qa/core/export.exp1
-rw-r--r--sw/qa/core/export.map38
-rw-r--r--sw/qa/core/makefile.mk81
-rw-r--r--sw/qa/core/performance-jobfile9
-rw-r--r--sw/qa/unoapi/knownissues.xcl153
-rw-r--r--sw/qa/unoapi/lastCheck.txt1
-rw-r--r--sw/qa/unoapi/makefile.mk43
-rw-r--r--sw/qa/unoapi/sw.sce94
-rw-r--r--sw/qa/unoapi/testdocuments/MailMerge.sxwbin0 -> 5391 bytes
-rw-r--r--sw/qa/unoapi/testdocuments/SwXTextEmbeddedObject.sdwbin0 -> 180736 bytes
-rw-r--r--sw/qa/unoapi/testdocuments/SwXTextEmbeddedObject.sxwbin0 -> 24763 bytes
-rw-r--r--sw/qa/unoapi/testdocuments/XDocumentInsertable.sxwbin0 -> 4914 bytes
-rw-r--r--sw/qa/unoapi/testdocuments/sForm.sxwbin0 -> 5568 bytes
28 files changed, 3421 insertions, 0 deletions
diff --git a/sw/qa/complex/accessibility/AccessibleRelationSet.java b/sw/qa/complex/accessibility/AccessibleRelationSet.java
new file mode 100644
index 000000000000..b5a763041645
--- /dev/null
+++ b/sw/qa/complex/accessibility/AccessibleRelationSet.java
@@ -0,0 +1,255 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleRelationSet.java,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.accessibility;
+
+import com.sun.star.accessibility.AccessibleRelation;
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleText;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleRelationSet;
+import com.sun.star.awt.XWindow;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.IndexOutOfBoundsException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.text.ControlCharacter;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import complexlib.ComplexTestCase;
+import java.io.PrintWriter;
+import lib.StatusException;
+import util.AccessibilityTools;
+import util.WriterTools;
+import util.utils;
+
+public class AccessibleRelationSet extends ComplexTestCase {
+
+ private static XAccessible para1 = null;
+ private static XAccessible para2 = null;
+ private static XAccessible para3 = null;
+ private static XTextDocument xTextDoc = null;
+ private final static String[] types = {"INVALID","CONTENT_FLOWS_FROM","CONTENT_FLOWS_TO","CONTROLLED_BY","CONTROLLER_FOR","LABEL_FOR","LABELED_BY","MEMBER_OF","SUB_WINDOW_OF"};
+
+ public String[] getTestMethodNames() {
+ return new String[]{"contents_flows_to","contents_flows_from"};
+ }
+
+ public void contents_flows_to() {
+ XAccessibleRelationSet set = getAccessibleRelation(para1);
+
+ boolean res = true;
+ short firstrelation=-1;
+ XAccessibleText atarget=null;
+ if (set != null) {
+ log.println("Count of relations "+set.getRelationCount());
+ assure("didn't gain correct count of relations",
+ set.getRelationCount() == 1);
+ try {
+ firstrelation = set.getRelation(0).RelationType;
+ Object oTmp = set.getRelation(0).TargetSet[0];
+ atarget = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, oTmp);
+ } catch (IndexOutOfBoundsException e) {
+ log.println("Exception when getting relations "+e);
+ res = false;
+ }
+ }
+
+ log.println("Expected for paragraph 0 "+types[2]);
+ log.println("gained for paragraph 0 "+types[firstrelation]);
+ res = types[2].equals(types[firstrelation]);
+ assure("didn't gain correct relation type",res);
+
+ log.println("Text of target paragraph "+atarget.getText());
+ XAccessibleText paraTxt2 =
+ (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, para2);
+ assure("didn't gain correct target paragraph",
+ atarget.getText().equals(paraTxt2.getText()) );
+ }
+
+ public void contents_flows_from() {
+ XAccessibleRelationSet set = getAccessibleRelation(para2);
+
+ boolean res = true;
+ short[] relationtypes = new short[2];
+ XAccessibleText[] atargets = new XAccessibleText[2];
+ if (set != null) {
+ log.println("Count of relations "+set.getRelationCount());
+ assure("didn't gain correct count of relations",
+ set.getRelationCount() == 2);
+ try {
+ short tmprelation = set.getRelation(0).RelationType;
+ if ( tmprelation == 1 )
+ {
+ Object oTmp = set.getRelation(0).TargetSet[0];
+ atargets[0] = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, oTmp);
+ relationtypes[0] = tmprelation;
+ }
+ else if ( tmprelation == 2 )
+ {
+ Object oTmp = set.getRelation(0).TargetSet[0];
+ atargets[1] = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, oTmp);
+ relationtypes[1] = tmprelation;
+ }
+ else
+ {
+ assure("didn't gain correct relation type", false);
+ }
+ tmprelation = set.getRelation(1).RelationType;
+ if ( tmprelation == 1 )
+ {
+ Object oTmp = set.getRelation(1).TargetSet[0];
+ atargets[0] = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, oTmp);
+ relationtypes[0] = tmprelation;
+ }
+ else if ( tmprelation == 2 )
+ {
+ Object oTmp = set.getRelation(1).TargetSet[0];
+ atargets[1] = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, oTmp);
+ relationtypes[1] = tmprelation;
+ }
+ else
+ {
+ assure("didn't gain correct relation type", false);
+ }
+ } catch (IndexOutOfBoundsException e) {
+ log.println("Exception when getting relations "+e);
+ res = false;
+ }
+ }
+
+ log.println("### Checking "+types[1]+" for paragraph 1");
+ log.println("Expected for paragraph 1 "+types[1]);
+ log.println("gained for paragraph 1 "+types[relationtypes[0]]);
+ res = types[1].equals(types[relationtypes[0]]);
+ assure("didn't gain correct relation type",res);
+
+ log.println("Text of target paragraph "+atargets[0].getText());
+ XAccessibleText paraTxt1 =
+ (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, para1);
+ assure("didn't gain correct target paragraph",
+ atargets[0].getText().equals(paraTxt1.getText()) );
+
+ log.println("### Checking "+types[2]+" for paragraph 1");
+ log.println("Expected for paragraph 1 "+types[2]);
+ log.println("gained for paragraph 1 "+types[relationtypes[1]]);
+ res = types[2].equals(types[relationtypes[1]]);
+ assure("didn't gain correct relation type",res);
+
+ log.println("Text of target paragraph "+atargets[1].getText());
+ XAccessibleText paraTxt3 =
+ (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class, para3);
+ assure("didn't gain correct target paragraph",
+ atargets[1].getText().equals(paraTxt3.getText()) );
+ }
+
+ private boolean getResult(XAccessible aPara, short index, int nr) {
+ XAccessibleRelationSet set = getAccessibleRelation(aPara);
+
+ boolean res = true;
+ short firstrelation=-1;
+ if (set != null) {
+ log.println("Count of relations "+set.getRelationCount());
+ try {
+ firstrelation = set.getRelation(0).RelationType;
+ } catch (IndexOutOfBoundsException e) {
+ log.println("Exception when getting relations "+e);
+ res = false;
+ }
+ }
+
+
+ log.println("Expected for paragraph "+nr+" "+types[index]);
+ log.println("gained for paragraph "+nr+" "+types[firstrelation]);
+ res = types[index].equals(types[firstrelation]);
+ return res;
+ }
+
+
+ public void before() {
+ log.println( "creating a text document" );
+ xTextDoc = WriterTools.createTextDoc( (XMultiServiceFactory) param.getMSF());
+
+ XText oText = xTextDoc.getText();
+ XTextCursor oCursor = oText.createTextCursor();
+
+ log.println( "inserting some lines" );
+ try {
+ for (int i=0; i<5; i++){
+ oText.insertString( oCursor,"Paragraph Number: " + i, false);
+ oText.insertControlCharacter(
+ oCursor, ControlCharacter.PARAGRAPH_BREAK, false );
+ }
+ } catch ( com.sun.star.lang.IllegalArgumentException e ){
+ e.printStackTrace((PrintWriter)log);
+ throw new StatusException( "Couldn't insert lines", e );
+ }
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xTextDoc);
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = at.getCurrentWindow( (XMultiServiceFactory) param.getMSF(), aModel);
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ at.getAccessibleObjectForRole(xRoot, AccessibleRole.DOCUMENT);
+
+ try {
+ para1 = at.SearchedContext.getAccessibleChild(0);
+ para2 = at.SearchedContext.getAccessibleChild(1);
+ para3 = at.SearchedContext.getAccessibleChild(2);
+ } catch(IndexOutOfBoundsException e) {
+ e.printStackTrace((PrintWriter)log);
+ throw new StatusException( "Couldn't insert lines", e );
+ }
+
+ log.println("ImplementationName (para1)" + utils.getImplName(para1));
+ log.println("ImplementationName (para2)" + utils.getImplName(para2));
+ }
+
+ public void after() {
+ log.println("close text document");
+ util.DesktopTools.closeDoc(xTextDoc);
+ }
+
+ public XAccessibleRelationSet getAccessibleRelation(XAccessible xAcc) {
+ XAccessibleContext oObj = (XAccessibleContext)
+ UnoRuntime.queryInterface(XAccessibleContext.class, xAcc);
+
+ XAccessibleRelationSet set = oObj.getAccessibleRelationSet();
+ return set;
+ }
+
+
+}
diff --git a/sw/qa/complex/accessibility/makefile.mk b/sw/qa/complex/accessibility/makefile.mk
new file mode 100644
index 000000000000..696a72d545e3
--- /dev/null
+++ b/sw/qa/complex/accessibility/makefile.mk
@@ -0,0 +1,61 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.5.198.1 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..
+TARGET = AccessibleRelationSet
+PRJNAME = sw
+PACKAGE = complex$/accessibility
+
+# --- Settings -----------------------------------------------------
+.INCLUDE: settings.mk
+
+
+#----- compile .java files -----------------------------------------
+
+JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
+JAVAFILES = AccessibleRelationSet.java
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+#----- make a jar from compiled files ------------------------------
+
+MAXLINELENGTH = 100000
+
+JARCLASSDIRS = $(PACKAGE)
+JARTARGET = $(TARGET).jar
+JARCOMPRESS = TRUE
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+
+run:
+ +java -cp $(CLASSPATH) org.openoffice.Runner -TimeOut 0 -tb java_complex -o $(PACKAGE:s#$/#.#).$(JAVAFILES:b)
diff --git a/sw/qa/complex/checkColor/CheckChangeColor.java b/sw/qa/complex/checkColor/CheckChangeColor.java
new file mode 100755
index 000000000000..8a8c563c7eea
--- /dev/null
+++ b/sw/qa/complex/checkColor/CheckChangeColor.java
@@ -0,0 +1,90 @@
+package complex.checkColor;
+
+import com.sun.star.awt.Rectangle;
+import com.sun.star.awt.Size;
+import com.sun.star.awt.WindowDescriptor;
+import com.sun.star.awt.XControlModel;
+import com.sun.star.awt.XToolkit;
+import com.sun.star.awt.XWindow;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.drawing.XControlShape;
+import com.sun.star.drawing.XShape;
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.frame.XController;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.view.XControlAccess;
+import complexlib.ComplexTestCase;
+import java.io.PrintWriter;
+import util.FormTools;
+import util.SOfficeFactory;
+import util.WriterTools;
+
+/**
+ * Created because of complaint on dev@openoffice.org: check the changing of
+ * BackColor and IsLandscape properties on the PageStyle service.
+ */
+public class CheckChangeColor extends ComplexTestCase {
+
+ private XToolkit xToolkit = null;
+ private XWindowPeer xWinPeer = null;
+
+ /**
+ * Get all test method names.
+ * @return The test methods.
+ */
+ public String[] getTestMethodNames() {
+ return new String[] {"checkChangeColor"};
+ }
+
+
+ /**
+ * Check BackColor and IsLandscape properties, wait for an exception: test
+ * is ok if no exception happened.
+ */
+ public void checkChangeColor() {
+ try {
+ XMultiServiceFactory m_xMSF_ = (XMultiServiceFactory)param.getMSF();
+ XComponentLoader aLoader = (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class,m_xMSF_.createInstance( "com.sun.star.frame.Desktop" ));
+ XComponent xDocument = (XComponent)UnoRuntime.queryInterface(XComponent.class, aLoader.loadComponentFromURL( "private:factory/swriter", "_blank", 0, new PropertyValue[ 0 ] ) );
+ // xDocument.addEventListener( this );
+
+ XTextDocument oDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xDocument);
+ XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc );
+
+ // XInterface xInterface = (XInterface) oDocMSF.createInstance( "com.sun.star.style.PageStyle" );
+
+ // create a supplier to get the Style family collection
+ XStyleFamiliesSupplier xSupplier = ( XStyleFamiliesSupplier ) UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, oDoc );
+
+ // get the NameAccess interface from the Style family collection
+ XNameAccess xNameAccess = xSupplier.getStyleFamilies();
+
+ XNameContainer xPageStyleCollection = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, xNameAccess.getByName( "PageStyles" ));
+
+ // create a PropertySet to set the properties for the new Pagestyle
+ XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xPageStyleCollection.getByName("Standard") );
+
+ log.println("BackColor @ "+xPropertySet.getPropertyValue("BackColor").toString());
+ log.println("IsLandscape @ "+xPropertySet.getPropertyValue("IsLandscape").toString());
+ log.println("Size @ H:"+((Size)xPropertySet.getPropertyValue("Size")).Height+" W:"+((Size)xPropertySet.getPropertyValue("Size")).Width);
+
+ log.println("Set Landscape");
+ xPropertySet.setPropertyValue("IsLandscape",new Boolean(true) );
+ log.println("Set BackColor");
+ xPropertySet.setPropertyValue("BackColor",new Integer((int)255000000) );
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ failed("Exception.");
+ }
+ }
+}
diff --git a/sw/qa/complex/checkColor/makefile.mk b/sw/qa/complex/checkColor/makefile.mk
new file mode 100755
index 000000000000..0541b44e1d44
--- /dev/null
+++ b/sw/qa/complex/checkColor/makefile.mk
@@ -0,0 +1,79 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.4.198.1 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..
+TARGET = CheckChangeColor
+PRJNAME = $(TARGET)
+PACKAGE = complex$/checkColor
+
+# --- Settings -----------------------------------------------------
+.INCLUDE: settings.mk
+
+
+#----- compile .java files -----------------------------------------
+
+JARFILES = mysql.jar sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar mysql.jar
+JAVAFILES = CheckChangeColor.java
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+#----- make a jar from compiled files ------------------------------
+
+MAXLINELENGTH = 100000
+
+JARCLASSDIRS = $(PACKAGE)
+JARTARGET = $(TARGET).jar
+JARCOMPRESS = TRUE
+
+# --- Parameters for the test --------------------------------------
+
+# test base is java complex
+CT_TESTBASE = -TestBase java_complex
+
+# test looks something like the.full.package.TestName
+CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b)
+
+# start the runner application
+CT_APP = org.openoffice.Runner
+
+# --- Targets ------------------------------------------------------
+
+.IF "$(depend)" == ""
+ALL : ALLTAR
+.ELSE
+ALL: ALLDEP
+.ENDIF
+
+.INCLUDE : target.mk
+
+RUN: run
+
+run:
+ +java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_NOOFFICE) $(CT_TEST)
diff --git a/sw/qa/complex/indeterminateState/CheckIndeterminateState.java b/sw/qa/complex/indeterminateState/CheckIndeterminateState.java
new file mode 100755
index 000000000000..bd7a9b35efdc
--- /dev/null
+++ b/sw/qa/complex/indeterminateState/CheckIndeterminateState.java
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: CheckIndeterminateState.java,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.indeterminateState;
+
+import complexlib.ComplexTestCase;
+import helper.OfficeProvider;
+import util.SOfficeFactory;
+import util.AccessibilityTools;
+import com.sun.star.awt.XWindow;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XModel;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleValue;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleStateSet;
+import com.sun.star.accessibility.AccessibleStateType;
+import com.sun.star.accessibility.XAccessibleAction;
+import com.sun.star.awt.XTopWindow;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.util.URL;
+import com.sun.star.util.XURLTransformer;
+
+import java.io.PrintWriter;
+
+/**
+ */
+public class CheckIndeterminateState extends ComplexTestCase {
+
+ /**
+ * Return all test methods.
+ * @return The test methods.
+ */
+ public String[] getTestMethodNames() {
+ return new String[]{"checkToolBoxItem"};
+ }
+
+ /*
+ * Test the indeterminate state of AccessibleToolBarItem
+ * The used tools are in project qadevOOo/runner
+ */
+ public void checkToolBoxItem() {
+ log.println( "creating a test environment" );
+ XTextDocument xTextDoc = null;
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory((XMultiServiceFactory) param.getMSF());
+
+ try {
+ log.println( "creating a text document" );
+ xTextDoc = SOF.createTextDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( (java.io.PrintWriter)log );
+ failed (e.getMessage());
+ }
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xTextDoc);
+
+ XController xController = aModel.getCurrentController();
+
+ XInterface oObj = null;
+
+ System.out.println("Press any key after making 'Bold' indeterminate.");
+ try{
+ byte[]b = new byte[16];
+ System.in.read(b);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ AccessibilityTools at = new AccessibilityTools();
+ XWindow xWindow = at.getCurrentContainerWindow((XMultiServiceFactory)param.getMSF(), aModel);
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ // uncomment to print the whole accessible tree.
+// at.printAccessibleTree((java.io.PrintWriter)log,xRoot);
+
+ oObj = at.getAccessibleObjectForRole(xRoot,
+ AccessibleRole.PUSH_BUTTON, "Bold");
+ System.out.println("Found a PUSH_BUTTON: " + (oObj != null));
+
+ oObj = at.getAccessibleObjectForRole(xRoot,
+ AccessibleRole.TOGGLE_BUTTON, "Bold");
+ System.out.println("Found a TOGGLE_BUTTON: " + (oObj != null));
+
+ log.println("ImplementationName: "+ util.utils.getImplName(oObj));
+
+ XAccessibleContext oContext = (XAccessibleContext)
+ UnoRuntime.queryInterface(XAccessibleContext.class, oObj);
+
+ XAccessibleStateSet oSet = oContext.getAccessibleStateSet();
+
+ short[]states = oSet.getStates();
+ for(int i=0; i<states.length; i++)
+ System.out.println("State "+i+": "+states[i]);
+
+ assure("The 'INDETERMINATE' state is not set.",oSet.contains(AccessibleStateType.INDETERMINATE));
+ }
+
+}
+
+
diff --git a/sw/qa/complex/indeterminateState/makefile.mk b/sw/qa/complex/indeterminateState/makefile.mk
new file mode 100755
index 000000000000..5261e70667be
--- /dev/null
+++ b/sw/qa/complex/indeterminateState/makefile.mk
@@ -0,0 +1,86 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.4.198.1 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..
+TARGET = CheckIndexedPropertyValue
+PRJNAME = $(TARGET)
+PACKAGE = complex$/indeterminateState
+
+# --- Settings -----------------------------------------------------
+.INCLUDE: settings.mk
+
+
+#----- compile .java files -----------------------------------------
+
+JARFILES = mysql.jar sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
+JAVAFILES = CheckIndeterminateState.java
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+#----- make a jar from compiled files ------------------------------
+
+MAXLINELENGTH = 100000
+
+JARCLASSDIRS = $(PACKAGE)
+JARTARGET = $(TARGET).jar
+JARCOMPRESS = TRUE
+
+# --- Parameters for the test --------------------------------------
+
+# start an office if the parameter is set for the makefile
+.IF "$(OFFICE)" == ""
+CT_APPEXECCOMMAND =
+.ELSE
+CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;"
+.ENDIF
+
+# test base is java complex
+CT_TESTBASE = -TestBase java_complex
+
+# test looks something like the.full.package.TestName
+CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b)
+
+# start the runner application
+CT_APP = org.openoffice.Runner
+
+# --- Targets ------------------------------------------------------
+
+.IF "$(depend)" == ""
+ALL: ALLTAR
+.ELSE
+ALL: ALLDEP
+.ENDIF
+
+.INCLUDE : target.mk
+
+RUN:
+ +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_TEST)
+
+run: RUN
diff --git a/sw/qa/complex/writer/CheckBookmarks.java b/sw/qa/complex/writer/CheckBookmarks.java
new file mode 100644
index 000000000000..c8f4a0355428
--- /dev/null
+++ b/sw/qa/complex/writer/CheckBookmarks.java
@@ -0,0 +1,280 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.writer;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.container.XNamed;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.frame.XStorable;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.text.XBookmarksSupplier;
+import com.sun.star.text.XSimpleText;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextContent;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextRange;
+import com.sun.star.uno.UnoRuntime;
+import complexlib.ComplexTestCase;
+import java.math.BigInteger;
+
+class BookmarkHashes {
+ public String m_sName;
+ public BigInteger m_nSetupHash;
+ public BigInteger m_nInsertRandomHash;
+ public BigInteger m_nDeleteRandomHash;
+ public BigInteger m_nLinebreakHash;
+ public BigInteger m_nOdfReloadHash;
+ public BigInteger m_nMsWordReloadHash;
+
+ public BookmarkHashes(String sName) {
+ m_sName = sName;
+ }
+
+ public String checkExpectationString(BookmarkHashes aExpectation) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Comparing " + m_sName + " to expectations from " + aExpectation.m_sName + "\n");
+ buffer.append(compareHashString("after setup", m_nSetupHash, aExpectation.m_nSetupHash));
+ buffer.append(compareHashString("after insert random", m_nInsertRandomHash, aExpectation.m_nInsertRandomHash));
+ buffer.append(compareHashString("after delete random", m_nDeleteRandomHash, aExpectation.m_nDeleteRandomHash));
+ buffer.append(compareHashString("after line breaks", m_nLinebreakHash, aExpectation.m_nLinebreakHash));
+ buffer.append(compareHashString("after ODF roundtrip", m_nOdfReloadHash, aExpectation.m_nOdfReloadHash));
+ buffer.append(compareHashString("after MsWord roundtrip", m_nMsWordReloadHash, aExpectation.m_nMsWordReloadHash));
+ return buffer.toString();
+ };
+
+ public boolean meetsExpectation(BookmarkHashes aExpectation) {
+ return m_nSetupHash.equals(aExpectation.m_nSetupHash)
+ && m_nInsertRandomHash.equals(aExpectation.m_nInsertRandomHash)
+ && m_nDeleteRandomHash.equals(aExpectation.m_nDeleteRandomHash)
+ && m_nLinebreakHash.equals(aExpectation.m_nLinebreakHash)
+ && m_nOdfReloadHash.equals(aExpectation.m_nOdfReloadHash)
+ && m_nMsWordReloadHash.equals(aExpectation.m_nMsWordReloadHash);
+ }
+
+ private String compareHashString(String sCheckName, BigInteger nActual, BigInteger nExpectation) {
+ StringBuffer buffer = new StringBuffer(sCheckName);
+ buffer.append(": ");
+ if(nActual.equals(nExpectation))
+ buffer.append("good (" + nActual.toString(16) + ")");
+ else
+ buffer.append("bad (actual:" + nActual.toString(16) + ", expected: " + nExpectation.toString(16) + ")");
+ buffer.append("\n");
+ return buffer.toString();
+ }
+
+ static public java.math.BigInteger getBookmarksHash(XTextDocument xDoc)
+ throws com.sun.star.uno.Exception, java.security.NoSuchAlgorithmException
+ {
+ StringBuffer buffer = new StringBuffer("");
+ XBookmarksSupplier xBookmarksSupplier = (XBookmarksSupplier)UnoRuntime.queryInterface(
+ XBookmarksSupplier.class,
+ xDoc);
+ XNameAccess xBookmarks = xBookmarksSupplier.getBookmarks();
+ for(String sBookmarkname : xBookmarks.getElementNames()) {
+ Object xBookmark = xBookmarks.getByName(sBookmarkname);
+ XTextContent xBookmarkAsContent = (XTextContent)UnoRuntime.queryInterface(
+ XTextContent.class,
+ xBookmark);
+ buffer.append(sBookmarkname);
+ buffer.append(":");
+ buffer.append(xBookmarkAsContent.getAnchor().getString());
+ buffer.append(";");
+ }
+ java.security.MessageDigest sha1 = java.security.MessageDigest.getInstance("SHA-1");
+ sha1.reset();
+ sha1.update(buffer.toString().getBytes());
+ return new java.math.BigInteger(sha1.digest());
+ }
+}
+
+public class CheckBookmarks extends ComplexTestCase {
+ private XMultiServiceFactory m_xMsf = null;
+ private XTextDocument m_xDoc = null;
+ private XTextDocument m_xOdfReloadedDoc = null;
+ private XTextDocument m_xMsWordReloadedDoc = null;
+
+ public String[] getTestMethodNames() {
+ return new String[]{"checkBookmarks"};
+ }
+
+ private BookmarkHashes getDEV300m41Expectations() {
+ BookmarkHashes result = new BookmarkHashes("DEV300m41");
+ result.m_nSetupHash = new BigInteger("-4b0706744e8452fe1ae9d5e1c28cf70fb6194795",16);
+ result.m_nInsertRandomHash = new BigInteger("25aa0fad3f4881832dcdfe658ec2efa8a1a02bc5",16);
+ result.m_nDeleteRandomHash = new BigInteger("-3ec87e810b46d734677c351ad893bbbf9ea10f55",16);
+ result.m_nLinebreakHash = new BigInteger("3ae08c284ea0d6e738cb43c0a8105e718a633550",16);
+ result.m_nOdfReloadHash = new BigInteger("3ae08c284ea0d6e738cb43c0a8105e718a633550",16);
+ result.m_nMsWordReloadHash = new BigInteger("3ae08c284ea0d6e738cb43c0a8105e718a633550",16);
+ return result;
+ }
+
+ public void checkBookmarks()
+ throws com.sun.star.uno.Exception,
+ com.sun.star.io.IOException,
+ java.security.NoSuchAlgorithmException
+ {
+ try {
+ m_xMsf = (XMultiServiceFactory)param.getMSF();
+ m_xDoc = util.WriterTools.createTextDoc(m_xMsf);
+ BookmarkHashes actualHashes = new BookmarkHashes("actual");
+ BookmarkHashes expectedHashes = getDEV300m41Expectations();
+ setupBookmarks();
+ actualHashes.m_nSetupHash = BookmarkHashes.getBookmarksHash(m_xDoc);
+ insertRandomParts(200177);
+ actualHashes.m_nInsertRandomHash = BookmarkHashes.getBookmarksHash(m_xDoc);
+ deleteRandomParts(4711);
+ actualHashes.m_nDeleteRandomHash = BookmarkHashes.getBookmarksHash(m_xDoc);
+ insertLinebreaks(007);
+ actualHashes.m_nLinebreakHash = BookmarkHashes.getBookmarksHash(m_xDoc);
+ m_xOdfReloadedDoc = reloadFrom("StarOffice XML (Writer)", "odf");
+ actualHashes.m_nOdfReloadHash = BookmarkHashes.getBookmarksHash(m_xOdfReloadedDoc);
+ m_xMsWordReloadedDoc = reloadFrom("MS Word 97", "doc");
+ actualHashes.m_nMsWordReloadHash = BookmarkHashes.getBookmarksHash(m_xMsWordReloadedDoc);
+ log.println(actualHashes.checkExpectationString(expectedHashes));
+ if(!actualHashes.meetsExpectation(expectedHashes))
+ failed("CheckBookmark did not meet expectations (" + expectedHashes.m_sName + ").");
+ } finally {
+ // closing test document
+ if(m_xDoc != null)
+ util.DesktopTools.closeDoc(m_xDoc);
+ if(m_xOdfReloadedDoc!= null)
+ util.DesktopTools.closeDoc(m_xOdfReloadedDoc);
+ if(m_xMsWordReloadedDoc!= null)
+ util.DesktopTools.closeDoc(m_xMsWordReloadedDoc);
+ }
+ }
+
+ private void setupBookmarks()
+ throws com.sun.star.uno.Exception
+ {
+ XText xText = m_xDoc.getText();
+ XSimpleText xSimpleText = (XSimpleText)UnoRuntime.queryInterface(
+ XSimpleText.class,
+ xText);
+ for(int nPara=0; nPara<10; ++nPara) {
+ for(int nBookmark=0; nBookmark<100; ++nBookmark){
+ insertBookmark(
+ xText.createTextCursor(),
+ "P" + nPara + "word" + nBookmark,
+ "P" + nPara + "word" + nBookmark);
+ XTextCursor xWordCrsr = xText.createTextCursor();
+ xWordCrsr.setString(" ");
+ }
+ XTextCursor xParaCrsr = xText.createTextCursor();
+ XTextRange xParaCrsrAsRange = (XTextRange)UnoRuntime.queryInterface(
+ XTextRange.class,
+ xParaCrsr);
+ xText.insertControlCharacter(xParaCrsrAsRange, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false);
+ }
+ }
+
+ private void insertRandomParts(long seed)
+ throws com.sun.star.uno.Exception
+ {
+ java.util.Random rnd = new java.util.Random(seed);
+ XTextCursor xCrsr = m_xDoc.getText().createTextCursor();
+ for(int i=0; i<600; i++) {
+ xCrsr.goRight((short)rnd.nextInt(100), false);
+ xCrsr.setString(Long.toString(rnd.nextLong()));
+ }
+ }
+
+ private void deleteRandomParts(long seed)
+ throws com.sun.star.uno.Exception
+ {
+ java.util.Random rnd = new java.util.Random(seed);
+ XTextCursor xCrsr = m_xDoc.getText().createTextCursor();
+ for(int i=0; i<600; i++) {
+ xCrsr.goRight((short)rnd.nextInt(100), false);
+ xCrsr.goRight((short)rnd.nextInt(20), true);
+ xCrsr.setString("");
+ }
+ }
+
+ private void insertLinebreaks(long seed)
+ throws com.sun.star.uno.Exception
+ {
+ XText xText = m_xDoc.getText();
+ java.util.Random rnd = new java.util.Random(seed);
+ XTextCursor xCrsr = m_xDoc.getText().createTextCursor();
+ for(int i=0; i<30; i++) {
+ xCrsr.goRight((short)rnd.nextInt(300), false);
+ XTextRange xCrsrAsRange = (XTextRange)UnoRuntime.queryInterface(
+ XTextRange.class,
+ xCrsr);
+ xText.insertControlCharacter(xCrsrAsRange, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, false);
+ }
+ }
+
+ private void insertBookmark(XTextCursor crsr, String name, String content)
+ throws com.sun.star.uno.Exception
+ {
+ XMultiServiceFactory xDocFactory = (XMultiServiceFactory)UnoRuntime.queryInterface(
+ XMultiServiceFactory.class,
+ m_xDoc);
+
+ Object xBookmark = xDocFactory.createInstance("com.sun.star.text.Bookmark");
+ XTextContent xBookmarkAsTextContent = (XTextContent)UnoRuntime.queryInterface(
+ XTextContent.class,
+ xBookmark);
+ crsr.setString(content);
+ XNamed xBookmarkAsNamed = (XNamed)UnoRuntime.queryInterface(
+ XNamed.class,
+ xBookmark);
+ xBookmarkAsNamed.setName(name);
+ m_xDoc.getText().insertTextContent(crsr, xBookmarkAsTextContent, true);
+ }
+
+ private XTextDocument reloadFrom(String sFilter, String sExtension)
+ throws com.sun.star.io.IOException
+ {
+ String sFileUrl = util.utils.getOfficeTemp(m_xMsf) + "/Bookmarktest." + sExtension;
+ try {
+ PropertyValue[] aStoreProperties = new PropertyValue[2];
+ aStoreProperties[0] = new PropertyValue();
+ aStoreProperties[1] = new PropertyValue();
+ aStoreProperties[0].Name = "Override";
+ aStoreProperties[0].Value = true;
+ aStoreProperties[1].Name = "FilterName";
+ aStoreProperties[1].Value = sFilter;
+ XStorable xStorable = (XStorable)UnoRuntime.queryInterface(
+ XStorable.class,
+ m_xDoc);
+ xStorable.storeToURL(sFileUrl, aStoreProperties);
+ return util.WriterTools.loadTextDoc(m_xMsf, sFileUrl);
+ } finally {
+ if(util.utils.fileExists(m_xMsf, sFileUrl))
+ util.utils.deleteFile(m_xMsf, sFileUrl);
+ }
+ }
+}
diff --git a/sw/qa/complex/writer/CheckCrossReferences.java b/sw/qa/complex/writer/CheckCrossReferences.java
new file mode 100644
index 000000000000..7b469c0a4afc
--- /dev/null
+++ b/sw/qa/complex/writer/CheckCrossReferences.java
@@ -0,0 +1,369 @@
+/*
+ * CheckCrossReferences.java
+ *
+ * Created on November 1, 2007, 1:49 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package complex.writer;
+
+import complexlib.ComplexTestCase;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+
+/**
+ *
+ * @author od138299
+ */
+public class CheckCrossReferences extends ComplexTestCase {
+
+ private com.sun.star.text.XTextDocument xDoc;
+ private com.sun.star.container.XEnumeration xParaEnum;
+ private com.sun.star.container.XEnumeration xPortionEnum;
+ private com.sun.star.util.XRefreshable xFldsRefresh;
+
+ public String[] getTestMethodNames() {
+ return new String[]{"checkCrossReferences"};
+ }
+
+ public com.sun.star.text.XTextField getNextField() {
+
+ com.sun.star.text.XTextField xField = null;
+ if ( xPortionEnum != null ) {
+ try {
+ while ( xPortionEnum.hasMoreElements() ) {
+ com.sun.star.beans.XPropertySet xPortionProps =
+ (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface(
+ com.sun.star.beans.XPropertySet.class , xPortionEnum.nextElement());
+ final String sPortionType =
+ xPortionProps.getPropertyValue( "TextPortionType" ).toString();
+ if ( sPortionType.equals( "TextField") ) {
+ xField = (com.sun.star.text.XTextField)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextField.class,
+ xPortionProps.getPropertyValue( "TextField" ) );
+ if ( xField == null ) {
+ System.out.println("Cannot retrieve next field.");
+ failed("Cannot retrieve next field.");
+ return null;
+ }
+ return xField;
+ }
+ }
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ System.out.println("Cannot retrieve next field.");
+ e.printStackTrace();
+ failed(e.getMessage());
+ return null;
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ System.out.println("Cannot retrieve next field.");
+ e.printStackTrace();
+ failed(e.getMessage());
+ return null;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ System.out.println("Cannot retrieve next field.");
+ e.printStackTrace();
+ failed(e.getMessage());
+ return null;
+ }
+ }
+
+ while ( xParaEnum.hasMoreElements() ) {
+ try {
+ com.sun.star.container.XEnumerationAccess aPara =
+ (com.sun.star.container.XEnumerationAccess)UnoRuntime.queryInterface(
+ com.sun.star.container.XEnumerationAccess.class, xParaEnum.nextElement());
+ xPortionEnum = aPara.createEnumeration();
+ while ( xPortionEnum.hasMoreElements() ) {
+ com.sun.star.beans.XPropertySet xPortionProps =
+ (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface(
+ com.sun.star.beans.XPropertySet.class , xPortionEnum.nextElement());
+ final String sPortionType =
+ xPortionProps.getPropertyValue( "TextPortionType" ).toString();
+ if ( sPortionType.equals( "TextField") ) {
+ xField = (com.sun.star.text.XTextField)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextField.class,
+ xPortionProps.getPropertyValue( "TextField" ) );
+ if ( xField == null ) {
+ System.out.println("Cannot retrieve next field.");
+ failed("Cannot retrieve next field.");
+ return null;
+ }
+ return xField;
+ }
+ }
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ System.out.println("Cannot retrieve next field.");
+ e.printStackTrace();
+ failed(e.getMessage());
+ return null;
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ System.out.println("Cannot retrieve next field.");
+ e.printStackTrace();
+ failed(e.getMessage());
+ return null;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ System.out.println("Cannot retrieve next field.");
+ e.printStackTrace();
+ failed(e.getMessage());
+ return null;
+ }
+ }
+
+ if ( xField == null ) {
+ System.out.println("Cannot retrieve next field.");
+ failed("Cannot retrieve next field.");
+ return null;
+ }
+
+ return xField;
+ }
+
+ public com.sun.star.beans.XPropertySet getFieldProps(
+ com.sun.star.text.XTextField xField ) {
+ com.sun.star.beans.XPropertySet xProps =
+ (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface(
+ com.sun.star.beans.XPropertySet.class, xField );
+
+ if ( xProps == null ) {
+ System.out.println("Cannot retrieve field properties.");
+ failed("Cannot retrieve field properties.");
+ return null;
+ }
+
+ return xProps;
+ }
+
+ public void checkField( com.sun.star.text.XTextField xField,
+ com.sun.star.beans.XPropertySet xProps,
+ short nFormat,
+ String aExpectedFldResult ) {
+ // set requested format
+ try {
+ xProps.setPropertyValue("ReferenceFieldPart", new Short(nFormat));
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ System.out.println("Cannot set ReferenceFieldPart property at field.");
+ e.printStackTrace();
+ failed(e.getMessage());
+ return;
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ System.out.println("Cannot set ReferenceFieldPart property at field.");
+ e.printStackTrace();
+ failed(e.getMessage());
+ return;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ System.out.println("Cannot set ReferenceFieldPart property at field.");
+ e.printStackTrace();
+ failed(e.getMessage());
+ return;
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ System.out.println("Cannot set ReferenceFieldPart property at field.");
+ e.printStackTrace();
+ failed(e.getMessage());
+ return;
+ }
+ // refresh fields in order to get new format applied
+ xFldsRefresh.refresh();
+
+ String aFldResult = xField.getPresentation( false );
+ assure( "set reference field format doesn't result in correct field result",
+ aFldResult.equals(aExpectedFldResult), true );
+ }
+
+ public void checkCrossReferences() throws com.sun.star.uno.Exception {
+ // load test document
+ try {
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)param.getMSF();
+ xDoc = util.WriterTools.loadTextDoc( xMSF, util.utils.getFullTestURL("CheckCrossReferences.odt"));
+ } catch(com.sun.star.uno.RuntimeException e) {
+ System.out.println("Cannot load test document.");
+ e.printStackTrace();
+ failed(e.getMessage());
+ return;
+ }
+
+ // setup paragraph enumeration
+ {
+ com.sun.star.container.XEnumerationAccess xParaEnumAccess =
+ (com.sun.star.container.XEnumerationAccess)UnoRuntime.queryInterface(
+ com.sun.star.container.XEnumerationAccess.class, xDoc.getText());
+ xParaEnum = xParaEnumAccess.createEnumeration();
+ }
+
+ // get field refresher
+ {
+ com.sun.star.text.XTextFieldsSupplier xFieldSupp =
+ (com.sun.star.text.XTextFieldsSupplier)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextFieldsSupplier.class, xDoc);
+ xFldsRefresh = (com.sun.star.util.XRefreshable)UnoRuntime.queryInterface(
+ com.sun.star.util.XRefreshable.class, xFieldSupp.getTextFields());
+ }
+
+ // check first reference field
+ {
+ // strings for checking
+ final String FldResult1 = "*i*";
+ final String FldResult2 = "+b+*i*";
+ final String FldResult3 = "-1-+b+*i*";
+ final String FldResult4 = "1.";
+ final String FldResult5 = " 1.";
+ final String FldResult6 = "A. 1.";
+
+ // variables for current field
+ com.sun.star.text.XTextField xField = null;
+ com.sun.star.beans.XPropertySet xProps = null;
+
+ log.println( "Checking field reference formats NUMBER, NUMBER_NO_CONTEXT and NUMBER_FULL_CONTEXT for existing fields" );
+ xField = getNextField();
+ xProps = getFieldProps( xField );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER, FldResult2 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_NO_CONTEXT, FldResult1 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_FULL_CONTEXT, FldResult3 );
+
+ xField = getNextField();
+ xProps = getFieldProps( xField );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER, FldResult1 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_NO_CONTEXT, FldResult1 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_FULL_CONTEXT, FldResult3 );
+
+ xField = getNextField();
+ xProps = getFieldProps( xField );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER, FldResult3 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_NO_CONTEXT, FldResult1 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_FULL_CONTEXT, FldResult3 );
+
+ xField = getNextField();
+ xProps = getFieldProps( xField );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER, FldResult5 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_NO_CONTEXT, FldResult4 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_FULL_CONTEXT, FldResult6 );
+
+ xField = getNextField();
+ xProps = getFieldProps( xField );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER, FldResult4 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_NO_CONTEXT, FldResult4 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_FULL_CONTEXT, FldResult6 );
+
+ xField = getNextField();
+ xProps = getFieldProps( xField );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER, FldResult6 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_NO_CONTEXT, FldResult4 );
+ checkField( xField, xProps, com.sun.star.text.ReferenceFieldPart.NUMBER_FULL_CONTEXT, FldResult6 );
+ }
+
+ // insert a certain cross-reference bookmark and a reference field to this bookmark
+ {
+ log.println("Checking insert of cross-reference bookmark and corresponding reference field");
+ // restart paragraph enumeration
+ com.sun.star.container.XEnumerationAccess xParaEnumAccess =
+ (com.sun.star.container.XEnumerationAccess)UnoRuntime.queryInterface(
+ com.sun.star.container.XEnumerationAccess.class, xDoc.getText());
+ xParaEnum = xParaEnumAccess.createEnumeration();
+
+ // iterate on the paragraphs to find certain paragraph to insert the bookmark
+ com.sun.star.text.XTextRange xParaTextRange = null;
+ while ( xParaEnum.hasMoreElements() ) {
+ try {
+ xParaTextRange = (com.sun.star.text.XTextRange)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextRange.class, xParaEnum.nextElement());
+ if ( xParaTextRange.getString().equals( "J" ) ) {
+ break;
+ }
+ else {
+ xParaTextRange = null;
+ }
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ System.out.println("Cannot find paragraph to insert cross-reference bookmark.");
+ e.printStackTrace();
+ failed(e.getMessage());
+ return;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ System.out.println("Cannot find paragraph to insert cross-reference bookmark.");
+ e.printStackTrace();
+ failed(e.getMessage());
+ return;
+ }
+ }
+ if ( xParaTextRange == null ) {
+ System.out.println("Cannot find paragraph to insert cross-reference bookmark.");
+ failed("Cannot find paragraph to insert cross-reference bookmark.");
+ return;
+ }
+
+ // insert bookmark
+ XMultiServiceFactory xFac = (XMultiServiceFactory)UnoRuntime.queryInterface(
+ XMultiServiceFactory.class, xDoc);
+ final String cBookmarkName = "__RefNumPara__47114711";
+ com.sun.star.text.XTextContent xBookmark = null;
+ try {
+ xBookmark = (com.sun.star.text.XTextContent)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextContent.class,
+ xFac.createInstance( "com.sun.star.text.Bookmark" ) );
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ System.out.println("Cannot create bookmark.");
+ e.printStackTrace();
+ failed(e.getMessage());
+ return;
+ } catch (com.sun.star.uno.Exception e) {
+ System.out.println("Cannot create bookmark.");
+ e.printStackTrace();
+ failed(e.getMessage());
+ return;
+ }
+ if ( xBookmark != null ) {
+ com.sun.star.container.XNamed xName =
+ (com.sun.star.container.XNamed)UnoRuntime.queryInterface(
+ com.sun.star.container.XNamed.class, xBookmark );
+ xName.setName( cBookmarkName );
+ xBookmark.attach(xParaTextRange.getStart());
+ }
+
+ // insert reference field, which references the inserted bookmark
+ com.sun.star.text.XTextContent xNewField = null;
+ try {
+ xNewField = (com.sun.star.text.XTextContent)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextContent.class,
+ xFac.createInstance( "com.sun.star.text.TextField.GetReference" ) );
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ System.out.println("Cannot create new field.");
+ e.printStackTrace();
+ failed(e.getMessage());
+ return;
+ } catch (com.sun.star.uno.Exception e) {
+ System.out.println("Cannot create new field.");
+ e.printStackTrace();
+ failed(e.getMessage());
+ return;
+ }
+ if ( xNewField != null ) {
+ com.sun.star.beans.XPropertySet xFieldProps =
+ (com.sun.star.beans.XPropertySet)UnoRuntime.queryInterface(
+ com.sun.star.beans.XPropertySet.class, xNewField );
+ xFieldProps.setPropertyValue( "ReferenceFieldPart", new Short(com.sun.star.text.ReferenceFieldPart.TEXT) );
+ xFieldProps.setPropertyValue( "ReferenceFieldSource", new Short(com.sun.star.text.ReferenceFieldSource.BOOKMARK) );
+ xFieldProps.setPropertyValue( "SourceName", cBookmarkName );
+ com.sun.star.text.XTextRange xFieldTextRange =
+ (com.sun.star.text.XTextRange)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextRange.class, xParaEnum.nextElement());
+ xNewField.attach(xFieldTextRange.getEnd());
+ xFldsRefresh.refresh();
+ }
+
+ // check inserted reference field
+ com.sun.star.text.XTextField xField =
+ (com.sun.star.text.XTextField)UnoRuntime.queryInterface(
+ com.sun.star.text.XTextField.class, xNewField );
+ assure( "inserted reference field doesn't has correct field result",
+ xField.getPresentation( false ).equals("J"), true );
+
+ xParaTextRange.getStart().setString( "Hallo new bookmark: " );
+ xFldsRefresh.refresh();
+ assure( "inserted reference field doesn't has correct field result. Instead it's: "+xField.getPresentation( false ),
+ xField.getPresentation( false ).equals("Hallo new bookmark: J"), true );
+ }
+
+ // closing test document
+ util.DesktopTools.closeDoc( xDoc );
+ }
+}
diff --git a/sw/qa/complex/writer/CheckIndexedPropertyValues.java b/sw/qa/complex/writer/CheckIndexedPropertyValues.java
new file mode 100755
index 000000000000..1cd91ed0f8d8
--- /dev/null
+++ b/sw/qa/complex/writer/CheckIndexedPropertyValues.java
@@ -0,0 +1,185 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: CheckIndexedPropertyValues.java,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.writer;
+
+import complexlib.ComplexTestCase;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.container.XIndexContainer;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.Type;
+
+/**
+ * Test the com.sun.star.document.IndexedPropertyValues service
+ */
+public class CheckIndexedPropertyValues extends ComplexTestCase {
+
+ private final String testedServiceName =
+ "com.sun.star.document.IndexedPropertyValues";
+ public String[] getTestMethodNames() {
+ return new String[]{"checkIndexedPropertyValues"};
+ }
+
+/* public String getTestObjectName() {
+ return testedServiceName;
+ }
+*/
+ public void checkIndexedPropertyValues() {
+ Object oObj = null;
+ try {
+ // print information about the service
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)param.getMSF();
+ oObj = xMSF.createInstance(testedServiceName);
+ System.out.println("****************");
+ System.out.println("Service Name:");
+ util.dbg.getSuppServices(oObj);
+ System.out.println("****************");
+ System.out.println("Interfaces:");
+ util.dbg.printInterfaces((XInterface)oObj, true);
+ }
+ catch(com.sun.star.uno.Exception e) {
+ System.out.println("Cannot create object.");
+ e.printStackTrace();
+ failed(e.getMessage());
+ return;
+ }
+ XIndexContainer xCont = (XIndexContainer)UnoRuntime.queryInterface(
+ XIndexContainer.class, oObj);
+
+ assure("XIndexContainer was queried but returned null.",
+ (xCont != null));
+ PropertyValue[] prop1 = new PropertyValue[1];
+ prop1[0] = new PropertyValue();
+ prop1[0].Name = "Jupp";
+ prop1[0].Value = "GoodGuy";
+
+ PropertyValue[] prop2 = new PropertyValue[1];
+ prop2[0] = new PropertyValue();
+ prop2[0].Name = "Horst";
+ prop2[0].Value = "BadGuy";
+
+ try {
+ Type t = xCont.getElementType();
+ log.println("Insertable Type: " + t.getTypeName());
+ assure("Initial container is not empty: " + xCont.getCount(), xCont.getCount()==0);
+ log.println("Inserting a PropertyValue.");
+ xCont.insertByIndex(0, prop1);
+ PropertyValue[]ret = (PropertyValue[])xCont.getByIndex(0);
+ assure("Got the wrong PropertyValue: " +
+ ret[0].Name + " " +(String)ret[0].Value,
+ ret[0].Name.equals(prop1[0].Name) &&
+ ret[0].Value.equals(prop1[0].Value));
+ log.println("Replace the PropertyValue.");
+ xCont.replaceByIndex(0, prop2);
+ ret = (PropertyValue[])xCont.getByIndex(0);
+ assure("Got the wrong PropertyValue: " +
+ ret[0].Name + " " +(String)ret[0].Value,
+ ret[0].Name.equals(prop2[0].Name) &&
+ ret[0].Value.equals(prop2[0].Value));
+ log.println("Remove the PropertyValue.");
+ xCont.removeByIndex(0);
+ assure("Could not remove PropertyValue.",
+ !xCont.hasElements() && xCont.getCount()==0);
+ log.println("Insert again.");
+ xCont.insertByIndex(0, prop1);
+ xCont.insertByIndex(1, prop2);
+ assure("Did not insert PropertyValue.",
+ xCont.hasElements() && xCont.getCount()==2);
+
+ try {
+ log.println("Insert with wrong index.");
+ xCont.insertByIndex(25, prop2);
+ failed("IllegalArgumentException was not thrown.");
+ }
+ catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Wrong exception thrown.");
+ failed(e.getMessage());
+ e.printStackTrace();
+ }
+ catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception thrown: "+e);
+ }
+ catch(com.sun.star.lang.WrappedTargetException e) {
+ log.println("Wrong exception thrown.");
+ failed(e.getMessage());
+ e.printStackTrace();
+ }
+
+ try {
+ log.println("Remove non-existing index.");
+ xCont.removeByIndex(25);
+ failed("IndexOutOfBoundsException was not thrown.");
+ }
+ catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception thrown: "+e);
+ }
+ catch(com.sun.star.lang.WrappedTargetException e) {
+ log.println("Wrong exception thrown.");
+ failed(e.getMessage());
+ e.printStackTrace();
+ }
+
+ try {
+ log.println("Insert wrong argument.");
+ xCont.insertByIndex(2, "Example String");
+ failed("IllegalArgumentException was not thrown.");
+ }
+ catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Expected exception thrown: " + e);
+ }
+ catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Wrong exception thrown.");
+ failed(e.getMessage());
+ e.printStackTrace();
+ }
+ catch(com.sun.star.lang.WrappedTargetException e) {
+ log.println("Wrong exception thrown.");
+ failed(e.getMessage());
+ e.printStackTrace();
+ }
+
+ }
+ catch(com.sun.star.lang.IllegalArgumentException e) {
+ failed(e.getMessage());
+ e.printStackTrace();
+ }
+ catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ failed(e.getMessage());
+ e.printStackTrace();
+ }
+ catch(com.sun.star.lang.WrappedTargetException e) {
+ failed(e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/sw/qa/complex/writer/CheckNamedPropertyValues.java b/sw/qa/complex/writer/CheckNamedPropertyValues.java
new file mode 100755
index 000000000000..a85b56014aa2
--- /dev/null
+++ b/sw/qa/complex/writer/CheckNamedPropertyValues.java
@@ -0,0 +1,199 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: CheckNamedPropertyValues.java,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.writer;
+
+
+import complexlib.ComplexTestCase;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.Type;
+
+/**
+ *
+ */
+public class CheckNamedPropertyValues extends ComplexTestCase {
+
+ private final String testedServiceName =
+ "com.sun.star.document.NamedPropertyValues";
+
+ public String[] getTestMethodNames() {
+ return new String[]{"checkNamedPropertyValues"};
+ }
+
+/* public String getTestObjectName() {
+ return "complex.writer.CheckNamedPropertyValues";
+ } */
+
+ public void checkNamedPropertyValues() {
+ Object oObj = null;
+ try {
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)param.getMSF();
+ oObj = xMSF.createInstance(testedServiceName);
+ System.out.println("****************");
+ System.out.println("Service Name:");
+ util.dbg.getSuppServices(oObj);
+ System.out.println("****************");
+ System.out.println("Interfaces:");
+ util.dbg.printInterfaces((XInterface)oObj, true);
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ failed(e.getMessage());
+ return;
+ }
+ XNameContainer xCont = (XNameContainer)UnoRuntime.queryInterface(
+ XNameContainer.class, oObj);
+
+ assure("XNameContainer was queried but returned null.",
+ (xCont != null));
+ PropertyValue[] prop1 = new PropertyValue[1];
+ prop1[0] = new PropertyValue();
+ prop1[0].Name = "Jupp";
+ prop1[0].Value = "GoodGuy";
+
+ PropertyValue[] prop2 = new PropertyValue[1];
+ prop2[0] = new PropertyValue();
+ prop2[0].Name = "Horst";
+ prop2[0].Value = "BadGuy";
+
+ try {
+ Type t = xCont.getElementType();
+ log.println("Insertable Type: " + t.getTypeName());
+ assure("Initial container is not empty.", !xCont.hasElements());
+
+ log.println("Insert a PropertyValue.");
+ xCont.insertByName("prop1", prop1);
+ PropertyValue[]ret = (PropertyValue[])xCont.getByName("prop1");
+ assure("Got the wrong PropertyValue: " +
+ ret[0].Name + " " +(String)ret[0].Value,
+ ret[0].Name.equals(prop1[0].Name) &&
+ ret[0].Value.equals(prop1[0].Value));
+ log.println("Replace the PropertyValue.");
+ xCont.replaceByName("prop1", prop2);
+ ret = (PropertyValue[])xCont.getByName("prop1");
+ assure("Got the wrong PropertyValue: " +
+ ret[0].Name + " " +(String)ret[0].Value,
+ ret[0].Name.equals(prop2[0].Name) &&
+ ret[0].Value.equals(prop2[0].Value));
+ log.println("Remove the PropertyValue.");
+ xCont.removeByName("prop1");
+ assure("Could not remove PropertyValue.", !xCont.hasElements());
+ log.println("Insert again.");
+ xCont.insertByName("prop1", prop1);
+ xCont.insertByName("prop2", prop2);
+ assure("Did not insert PropertyValue.", xCont.hasElements());
+ String[] names = xCont.getElementNames();
+ int count = 0;
+ for (int i=0; i<names.length; i++) {
+ if (names[i].equals("prop1") || names[i].equals("prop2"))
+ count++;
+ else
+ failed("Got a wrong element name: "+names[i]);
+ }
+ if (count != 2)
+ failed("Not all element names were returned.");
+
+ try {
+ log.println("Insert PropertyValue with an existing name.");
+ xCont.insertByName("prop2", prop1);
+ failed("ElementExistException was not thrown.");
+ }
+ catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Wrong exception thrown.");
+ failed(e.getMessage());
+ e.printStackTrace();
+ }
+ catch(com.sun.star.container.ElementExistException e) {
+ log.println("Expected exception thrown: "+e);
+ }
+ catch(com.sun.star.lang.WrappedTargetException e) {
+ log.println("Wrong exception thrown.");
+ failed(e.getMessage());
+ e.printStackTrace();
+ }
+
+ try {
+ log.println("Inserting a wrong argument.");
+ xCont.insertByName("prop3", "Example String");
+ failed("IllegalArgumentException was not thrown.");
+ }
+ catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Expected exception thrown: "+e);
+ }
+ catch(com.sun.star.container.ElementExistException e) {
+ log.println("Wrong exception thrown.");
+ failed(e.getMessage());
+ e.printStackTrace();
+ }
+ catch(com.sun.star.lang.WrappedTargetException e) {
+ log.println("Wrong exception thrown.");
+ failed(e.getMessage());
+ e.printStackTrace();
+ }
+
+ try {
+ log.println("Remove a non-existing element.");
+ xCont.removeByName("prop3");
+ failed("NoSuchElementException was not thrown.");
+ }
+ catch(com.sun.star.container.NoSuchElementException e) {
+ log.println("Expected exception thrown: "+e);
+ }
+ catch(com.sun.star.lang.WrappedTargetException e) {
+ log.println("Wrong exception thrown.");
+ failed(e.getMessage());
+ e.printStackTrace();
+ }
+
+ }
+ catch(com.sun.star.lang.IllegalArgumentException e) {
+ failed(e.getMessage());
+ e.printStackTrace();
+ }
+ catch(com.sun.star.container.ElementExistException e) {
+ failed(e.getMessage());
+ e.printStackTrace();
+ }
+ catch(com.sun.star.container.NoSuchElementException e) {
+ failed(e.getMessage());
+ e.printStackTrace();
+ }
+ catch(com.sun.star.lang.WrappedTargetException e) {
+ failed(e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+
+}
diff --git a/sw/qa/complex/writer/makefile.mk b/sw/qa/complex/writer/makefile.mk
new file mode 100755
index 000000000000..88ceec08dcd7
--- /dev/null
+++ b/sw/qa/complex/writer/makefile.mk
@@ -0,0 +1,103 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.5.198.1 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..
+TARGET = PropertyValues
+PRJNAME = $(TARGET)
+PACKAGE = complex$/writer
+
+# --- Settings -----------------------------------------------------
+.INCLUDE: settings.mk
+
+
+#----- compile .java files -----------------------------------------
+
+JARFILES = mysql.jar sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
+JAVAFILES = CheckIndexedPropertyValues.java CheckNamedPropertyValues.java CheckCrossReferences.java CheckBookmarks.java
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+#----- make a jar from compiled files ------------------------------
+
+MAXLINELENGTH = 100000
+
+JARCLASSDIRS = $(PACKAGE)
+JARTARGET = $(TARGET).jar
+JARCOMPRESS = TRUE
+
+# --- Parameters for the test --------------------------------------
+
+# start an office if the parameter is set for the makefile
+.IF "$(OFFICE)" == ""
+CT_APPEXECCOMMAND =
+.ELSE
+CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;"
+.ENDIF
+
+# test base is java complex
+CT_TESTBASE = -TestBase java_complex
+
+# build package name with "." instead of $/
+CT_PACKAGE = -o $(PACKAGE:s\$/\.\)
+
+# start the runner application
+CT_APP = org.openoffice.Runner
+
+# --- Targets ------------------------------------------------------
+
+.IF "$(depend)" == ""
+ALL: ALLTAR
+.ELSE
+ALL: ALLDEP
+.ENDIF
+
+.INCLUDE : target.mk
+
+run: \
+ CheckBookmarks \
+ CheckCrossReferences \
+ CheckIndexedPropertyValues \
+ CheckNamedPropertyValues \
+
+RUN: run
+
+CheckIndexedPropertyValues:
+ +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_PACKAGE).CheckIndexedPropertyValues
+
+
+CheckNamedPropertyValues:
+ +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_PACKAGE).CheckNamedPropertyValues
+
+CheckCrossReferences:
+ +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) -tdoc $(PWD)$/testdocuments $(CT_PACKAGE).CheckCrossReferences
+
+CheckBookmarks:
+ +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) -tdoc $(PWD)$/testdocuments $(CT_PACKAGE).CheckBookmarks
+
diff --git a/sw/qa/complex/writer/testdocuments/CheckCrossReferences.odt b/sw/qa/complex/writer/testdocuments/CheckCrossReferences.odt
new file mode 100644
index 000000000000..d8102f0356f8
--- /dev/null
+++ b/sw/qa/complex/writer/testdocuments/CheckCrossReferences.odt
Binary files differ
diff --git a/sw/qa/core/Test-BigPtrArray.cxx b/sw/qa/core/Test-BigPtrArray.cxx
new file mode 100644
index 000000000000..ad069407b669
--- /dev/null
+++ b/sw/qa/core/Test-BigPtrArray.cxx
@@ -0,0 +1,880 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: Test-BigPtrArray.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#define TIMELOG
+
+#include <cppunit/simpleheader.hxx>
+#include <bparr.hxx>
+#include <string>
+#include <stdlib.h>
+#include <rtl/logfile.hxx>
+
+#undef ENABLE_DEBUG_OUTPUT
+
+using namespace std;
+
+
+namespace /* private */
+{
+ const int NUM_ENTRIES = 100000;
+
+ class BigPtrEntryMock : public BigPtrEntry
+ {
+ public:
+ BigPtrEntryMock(int count) : count_(count)
+ {
+ }
+
+ ~BigPtrEntryMock()
+ {
+ #ifdef ENABLE_DEBUG_OUTPUT
+ printf("Destructor called (%i)\n", count_);
+ #endif
+ }
+
+ int getCount() const
+ {
+ return count_;
+ }
+
+ void setCount(int newCount)
+ {
+ count_ = newCount;
+ }
+
+ ULONG Position() const
+ {
+ return GetPos();
+ }
+
+ private:
+ int count_;
+ };
+
+ BOOL AddToCount(const ElementPtr& rElem, void* pArgs)
+ {
+ BigPtrEntryMock* const pbem = static_cast<BigPtrEntryMock* const>(rElem);
+ pbem->setCount(pbem->getCount() + *((int*)pArgs));
+ return true;
+ }
+
+ void dumpBigPtrArray(const BigPtrArray& bparr)
+ {
+ #ifdef ENABLE_DEBUG_OUTPUT
+ for (int i = 0; i < bparr.Count(); i++)
+ printf("bparr[%i,%i]: %i\n", i, static_cast<BigPtrEntryMock*>(bparr[i])->Position(), static_cast<BigPtrEntryMock*>(bparr[i])->getCount());
+
+ printf("\n");
+ #endif
+ }
+
+ void fillBigPtrArray(BigPtrArray& bparr, ULONG numEntries)
+ {
+ for (int i = 0; i < numEntries; i++)
+ bparr.Insert(new BigPtrEntryMock(i), bparr.Count());
+ }
+
+ void printMethodName(const char* name)
+ {
+ #ifdef ENABLE_DEBUG_OUTPUT
+ printf(name);
+ #endif
+ }
+
+ bool checkElementPositions(const BigPtrArray& bparr)
+ {
+ for (int i = 0; i < bparr.Count(); i++)
+ {
+ if (static_cast<BigPtrEntryMock*>(bparr[i])->Position() != i)
+ return false;
+ }
+ return true;
+ }
+
+ void releaseBigPtrArrayContent(BigPtrArray& bparr)
+ {
+ for (int i = 0; i < bparr.Count(); i++)
+ delete bparr[i];
+ }
+
+ RTL_LOGFILE_CONTEXT(logFile, "BigPtrArray performance measures" );
+}
+
+class BigPtrArrayUnittest : public CppUnit::TestFixture
+{
+public:
+
+ BigPtrArrayUnittest()
+ {
+ }
+
+ /** Test constructor/destructor
+ The size of the BigPtrArray
+ aka the 'Count' should be 0
+ initially.
+ */
+ void test_ctor()
+ {
+ printMethodName("test_ctor\n");
+
+ BigPtrArray bparr;
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "BigPtrArray ctor failed",
+ bparr.Count() == 0
+ );
+ }
+
+ void test_insert_entries_at_front()
+ {
+ printMethodName("test_insert_entries_at_front\n");
+
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "START: test_insert_entries_at_front");
+
+ BigPtrArray bparr;
+
+ for (int i = 0; i < NUM_ENTRIES; i++)
+ {
+ ULONG oldCount = bparr.Count();
+ bparr.Insert(new BigPtrEntryMock(i), 0);
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_entries_at_front failed",
+ (bparr.Count() == oldCount + 1)
+ )
+ }
+
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "END: test_insert_entries_at_front");
+
+ for (int i = 0, j = NUM_ENTRIES - 1; i < NUM_ENTRIES; i++, j--)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_entries_at_front failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == j
+ )
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_entries_at_front failed",
+ checkElementPositions(bparr)
+ )
+
+ releaseBigPtrArrayContent(bparr);
+ dumpBigPtrArray(bparr);
+ }
+
+ void test_insert_entries_in_the_middle()
+ {
+ printMethodName("test_insert_entries_in_the_middle\n");
+
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "START: test_insert_entries_in_the_middle");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ ULONG oldCount = bparr.Count();
+
+ bparr.Insert(new BigPtrEntryMock(NUM_ENTRIES), bparr.Count() / 2);
+
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "END: test_insert_entries_in_the_middle");
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_entries_in_the_middle failed",
+ (oldCount + 1 == bparr.Count() && static_cast<BigPtrEntryMock*>(bparr[bparr.Count() / 2])->getCount() == NUM_ENTRIES)
+ )
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_entries_in_the_middle failed",
+ checkElementPositions(bparr)
+ )
+
+ releaseBigPtrArrayContent(bparr);
+ dumpBigPtrArray(bparr);
+ }
+
+ void test_insert_at_already_used_index()
+ {
+ printMethodName("test_insert_at_already_used_index\n");
+
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "START: test_insert_at_already_used_index");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ int oldCount = bparr.Count();
+
+ for (int i = 0, j = -5; i < 5; i++, j++)
+ bparr.Insert(new BigPtrEntryMock(j), i);
+
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "END: test_insert_at_already_used_index");
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_at_already_used_index failed",
+ (oldCount + 5 == bparr.Count())
+ )
+
+ for (int i = 0, j = -5; i < bparr.Count(); i++, j++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_at_already_used_index failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == j
+ )
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_at_already_used_index failed",
+ checkElementPositions(bparr)
+ )
+
+ releaseBigPtrArrayContent(bparr);
+ dumpBigPtrArray(bparr);
+ }
+
+ void test_insert_at_end()
+ {
+ printMethodName("test_insert_at_end\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ ULONG oldCount = bparr.Count();
+ bparr.Insert(new BigPtrEntryMock(NUM_ENTRIES), bparr.Count());
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_at_end failed",
+ (oldCount + 1 == bparr.Count() && static_cast<BigPtrEntryMock*>(bparr[bparr.Count()-1])->getCount() == NUM_ENTRIES)
+ )
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_insert_at_end failed",
+ checkElementPositions(bparr)
+ )
+
+ releaseBigPtrArrayContent(bparr);
+ dumpBigPtrArray(bparr);
+ }
+
+ void test_remove_at_front()
+ {
+ printMethodName("test_remove_at_front\n");
+
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "START: test_remove_at_front");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ for (int i = 0; i < NUM_ENTRIES; i++)
+ {
+ ULONG oldCount = bparr.Count();
+
+ delete bparr[0]; // release content
+ bparr.Remove(0); // remove item from container
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_at_front failed (wrong count)",
+ (oldCount - 1 == bparr.Count())
+ )
+
+ for (int j = 0, k = i + 1; j < bparr.Count(); j++, k++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_at_front failed",
+ static_cast<BigPtrEntryMock*>(bparr[j])->getCount() == k
+ )
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_at_front failed",
+ checkElementPositions(bparr)
+ )
+
+ dumpBigPtrArray(bparr);
+ }
+
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "END: test_remove_at_front");
+ }
+
+ void test_remove_at_back()
+ {
+ printMethodName("test_remove_at_back\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ for (int i = NUM_ENTRIES - 1; i >= 0; i--)
+ {
+ ULONG oldCount = bparr.Count();
+ delete bparr[i];
+ bparr.Remove(i);
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_at_back failed (wrong count)",
+ (oldCount - 1 == bparr.Count())
+ )
+
+ for (int j = 0; j < bparr.Count(); j++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_at_back failed",
+ static_cast<BigPtrEntryMock*>(bparr[j])->getCount() == j
+ )
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_at_back failed",
+ checkElementPositions(bparr)
+ )
+
+ dumpBigPtrArray(bparr);
+ }
+ }
+
+ void test_remove_in_the_middle()
+ {
+ printMethodName("test_remove_in_the_middle\n");
+
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "START: test_remove_in_the_middle");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ while (bparr.Count())
+ {
+ ULONG oldCount = bparr.Count();
+ int oldElement = static_cast<BigPtrEntryMock*>(bparr[bparr.Count() / 2])->getCount();
+
+ delete bparr[bparr.Count() / 2];
+ bparr.Remove(bparr.Count() / 2);
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_in_the_middle failed (wrong count)",
+ (oldCount - 1 == bparr.Count())
+ )
+
+ for (int i = 0; i < bparr.Count(); i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_in_the_middle failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() != oldElement
+ )
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_in_the_middle failed",
+ checkElementPositions(bparr)
+ )
+
+ dumpBigPtrArray(bparr);
+ }
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, "END: test_remove_in_the_middle");
+ }
+
+ void test_remove_multiple_elements_at_once()
+ {
+ printMethodName("test_remove_multiple_elements_at_once\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ while(bparr.Count())
+ {
+ ULONG nRemove = (bparr.Count() > 3) ? 3 : bparr.Count();
+ ULONG oldCount = bparr.Count();
+
+ for (int i = 0; i < nRemove; i++)
+ delete bparr[i];
+
+ bparr.Remove(0, nRemove);
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_multiple_elements_at_once failed",
+ (oldCount - nRemove == bparr.Count())
+ )
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_multiple_elements_at_once failed",
+ checkElementPositions(bparr)
+ )
+
+ dumpBigPtrArray(bparr);
+ }
+ }
+
+ void test_remove_all_elements_at_once()
+ {
+ printMethodName("test_remove_all_elements_at_once\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ releaseBigPtrArrayContent(bparr);
+ bparr.Remove(0, bparr.Count());
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_remove_all_elements_at_once failed",
+ bparr.Count() == 0
+ )
+
+ dumpBigPtrArray(bparr);
+ }
+
+ void test_move_elements_from_lower_to_higher_pos()
+ {
+ printMethodName("test_move_elements_from_lower_to_higher_pos\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ for (int i = 0; i < NUM_ENTRIES - 1; i++)
+ {
+ bparr.Move(i, i + 2);
+ dumpBigPtrArray(bparr);
+ }
+
+ for (int i = 0; i < (NUM_ENTRIES - 1); i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_move_elements_from_lower_to_higher_pos failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i + 1)
+ )
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_move_elements_from_lower_to_higher_pos failed",
+ static_cast<BigPtrEntryMock*>(bparr[NUM_ENTRIES -1])->getCount() == 0
+ )
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_move_elements_from_lower_to_higher_pos failed",
+ checkElementPositions(bparr)
+ )
+
+ releaseBigPtrArrayContent(bparr);
+ }
+
+ void test_move_elements_from_higher_to_lower_pos()
+ {
+ printMethodName("test_move_elements_from_higher_to_lower_pos\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ for (int i = NUM_ENTRIES - 1; i >= 1; i--)
+ {
+ bparr.Move(i, i - 1);
+ dumpBigPtrArray(bparr);
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_move_elements_from_higher_to_lower_pos failed",
+ static_cast<BigPtrEntryMock*>(bparr[0])->getCount() == (NUM_ENTRIES - 1)
+ )
+
+ for (int i = 1; i < NUM_ENTRIES; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_move_elements_from_higher_to_lower_pos failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i - 1)
+ )
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_move_elements_from_higher_to_lower_pos failed",
+ checkElementPositions(bparr)
+ )
+
+ releaseBigPtrArrayContent(bparr);
+ }
+
+ void test_move_to_same_position()
+ {
+ printMethodName("test_move_to_same_position\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ for (int i = 0; i < NUM_ENTRIES; i++)
+ {
+ bparr.Move(i, i);
+ }
+
+ dumpBigPtrArray(bparr);
+
+ for (int i = 0; i < NUM_ENTRIES; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_move_to_same_position failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == i
+ )
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_move_to_same_position failed",
+ checkElementPositions(bparr)
+ )
+
+ releaseBigPtrArrayContent(bparr);
+ dumpBigPtrArray(bparr);
+ }
+
+ void test_replace_elements()
+ {
+ printMethodName("test_replace_elements\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ for (int i = 0, j = NUM_ENTRIES - 1; i < NUM_ENTRIES; i++, j--)
+ {
+ delete bparr[i];
+ bparr.Replace(i, new BigPtrEntryMock(j));
+ dumpBigPtrArray(bparr);
+ }
+
+ for (int i = 0; i < NUM_ENTRIES; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_replace_elements failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (NUM_ENTRIES - i - 1)
+ )
+ }
+
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_replace_elements failed",
+ checkElementPositions(bparr)
+ )
+
+ releaseBigPtrArrayContent(bparr);
+ }
+
+ void test_for_each()
+ {
+ printMethodName("test_for_each\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ int addCount = 1;
+ bparr.ForEach(AddToCount, &addCount);
+
+ for (int i = 0; i < NUM_ENTRIES; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_for_each failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i+1)
+ )
+ }
+
+ releaseBigPtrArrayContent(bparr);
+ dumpBigPtrArray(bparr);
+ }
+
+ void test_for_some1()
+ {
+ printMethodName("test_for_some1\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ int addCount = 1;
+ bparr.ForEach(0, NUM_ENTRIES / 2, AddToCount, &addCount);
+
+ int i = 0;
+ for (/* */; i < NUM_ENTRIES / 2; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_for_some1 failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i+1)
+ )
+ }
+
+ for (/* */; i < NUM_ENTRIES; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_for_some1 failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i)
+ )
+ }
+
+ releaseBigPtrArrayContent(bparr);
+ dumpBigPtrArray(bparr);
+ }
+
+ void test_for_some2()
+ {
+ printMethodName("test_for_some2\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ int addCount = 1;
+ bparr.ForEach(NUM_ENTRIES / 2, NUM_ENTRIES, AddToCount, &addCount);
+
+ int i = 0;
+ for (/* */; i < NUM_ENTRIES / 2; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_for_some2 failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i)
+ )
+ }
+
+ for (/* */; i < NUM_ENTRIES; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_for_some2 failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == (i+1)
+ )
+ }
+
+ releaseBigPtrArrayContent(bparr);
+ dumpBigPtrArray(bparr);
+ }
+
+ void test_for_some3()
+ {
+ printMethodName("test_for_some3\n");
+
+ BigPtrArray bparr;
+
+ fillBigPtrArray(bparr, NUM_ENTRIES);
+ dumpBigPtrArray(bparr);
+
+ int addCount = 1;
+ bparr.ForEach(0, 0, AddToCount, &addCount);
+
+ for (int i = 0; i < NUM_ENTRIES; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE
+ (
+ "test_for_some3 failed",
+ static_cast<BigPtrEntryMock*>(bparr[i])->getCount() == i
+ )
+ }
+ releaseBigPtrArrayContent(bparr);
+ }
+
+ CPPUNIT_TEST_SUITE(BigPtrArrayUnittest);
+ CPPUNIT_TEST(test_ctor);
+ CPPUNIT_TEST(test_insert_entries_at_front);
+ CPPUNIT_TEST(test_insert_entries_in_the_middle);
+ CPPUNIT_TEST(test_insert_at_already_used_index);
+ CPPUNIT_TEST(test_insert_at_end);
+ CPPUNIT_TEST(test_remove_at_front);
+ CPPUNIT_TEST(test_remove_at_back);
+ CPPUNIT_TEST(test_remove_in_the_middle);
+ CPPUNIT_TEST(test_remove_multiple_elements_at_once);
+ CPPUNIT_TEST(test_remove_all_elements_at_once);
+ CPPUNIT_TEST(test_move_elements_from_lower_to_higher_pos);
+ CPPUNIT_TEST(test_move_elements_from_higher_to_lower_pos);
+ CPPUNIT_TEST(test_replace_elements);
+ CPPUNIT_TEST(test_for_each);
+ CPPUNIT_TEST(test_for_some1);
+ CPPUNIT_TEST(test_for_some2);
+ CPPUNIT_TEST(test_for_some3);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+const char* START = "START: ";
+const char* END = "END: ";
+
+class PerformanceTracer
+{
+public:
+
+public:
+ PerformanceTracer(const string& methodName) :
+ startString_(START),
+ endString_(END)
+ {
+ startString_ += methodName;
+ endString_ += methodName;
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, startString_.c_str());
+ }
+
+ ~PerformanceTracer()
+ {
+ RTL_LOGFILE_CONTEXT_TRACE(logFile, endString_.c_str());
+ }
+
+private:
+ string startString_;
+ string endString_;
+};
+
+class BigPtrArrayPerformanceTest : public CppUnit::TestFixture
+{
+public:
+ BigPtrArrayPerformanceTest()
+ {
+ }
+
+ void test_insert_at_end_1000()
+ { test_insert_at_end("1000"); }
+
+ void test_insert_at_end_10000()
+ { test_insert_at_end("10000"); }
+
+ void test_insert_at_end_100000()
+ { test_insert_at_end("100000"); }
+
+ void test_insert_at_end_1000000()
+ { test_insert_at_end("1000000"); }
+
+ void test_insert_at_front_1000()
+ { test_insert_at_front("1000"); }
+
+ void test_insert_at_front_10000()
+ { test_insert_at_front("10000"); }
+
+ void test_insert_at_front_100000()
+ { test_insert_at_front("100000"); }
+
+ void test_insert_at_front_1000000()
+ { test_insert_at_front("1000000"); }
+
+ CPPUNIT_TEST_SUITE(BigPtrArrayPerformanceTest);
+ CPPUNIT_TEST(test_insert_at_end_1000);
+ CPPUNIT_TEST(test_insert_at_end_10000);
+ CPPUNIT_TEST(test_insert_at_end_100000);
+ CPPUNIT_TEST(test_insert_at_end_1000000);
+ CPPUNIT_TEST(test_insert_at_front_1000);
+ CPPUNIT_TEST(test_insert_at_front_10000);
+ CPPUNIT_TEST(test_insert_at_front_100000);
+ CPPUNIT_TEST(test_insert_at_front_1000000);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ void test_insert_at_end(const char* numElements)
+ {
+ char buff[100] = { 0 };
+ strcat(buff, "test_insert_at_end ");
+ strcat(buff, numElements);
+ int n = atoi(numElements);
+ PerformanceTracer tracer(buff);
+ BigPtrArray bparr;
+ for (int i = 0; i < n; i++)
+ bparr.Insert(new BigPtrEntryMock(i), bparr.Count());
+
+ releaseBigPtrArrayContent(bparr);
+ }
+
+ void test_insert_at_front(const char* numElements)
+ {
+ char buff[100] = { 0 };
+ strcat(buff, "test_insert_at_front ");
+ strcat(buff, numElements);
+ int n = atoi(numElements);
+ PerformanceTracer tracer(buff);
+ BigPtrArray bparr;
+ for (int i = 0; i < n; i++)
+ bparr.Insert(new BigPtrEntryMock(i), 0);
+
+ releaseBigPtrArrayContent(bparr);
+ }
+};
+
+
+//#####################################
+// register test suites
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(BigPtrArrayUnittest, "BigPtrArrayUnittest");
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(BigPtrArrayPerformanceTest, "BigPtrArrayPerformanceTest");
+
+NOADDITIONAL;
+
diff --git a/sw/qa/core/bigpointerarray-new.cxx b/sw/qa/core/bigpointerarray-new.cxx
new file mode 100644
index 000000000000..c476aab6a92d
--- /dev/null
+++ b/sw/qa/core/bigpointerarray-new.cxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: bigpointerarray-new.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include "bparr.hxx"
+#include <algorithm>
+
+BigPtrArray::BigPtrArray()
+{
+ //container_.reserve(1000);
+}
+
+ULONG BigPtrArray::Count() const
+{
+ return container_.size();
+}
+
+void BigPtrArray::Move(ULONG fromPos, ULONG toPos)
+{
+ DBG_ASSERT(fromPos < container_.size() && toPos < container_.size(), "BigPtrArray.Move precondition violation");
+ Insert(container_[fromPos], toPos);
+ Remove(toPos < fromPos ? fromPos + 1 : fromPos, 1);
+}
+
+void BigPtrArray::ForEach(ULONG fromPos, ULONG toPos, FnForEach fn, void* pArgs)
+{
+ DBG_ASSERT(fromPos < toPos && fromPos < container_.size() && toPos < container_.size(), "BigPtrArray::ForEach precondition violation");
+ Container_t::const_iterator iter = container_.begin() + fromPos;
+ Container_t::const_iterator iter_end = container_.begin() + toPos;
+ for (/*no init*/; iter != iter_end; ++iter)
+ fn(*iter, pArgs);
+}
+
+void BigPtrArray::ForEach(FnForEach fn, void* pArgs)
+{
+ Container_t::const_iterator iter = container_.begin();
+ Container_t::const_iterator iter_end = container_.end();
+ for ( /*no init*/; iter != iter_end; ++iter)
+ fn(*iter, pArgs);
+}
+
+ElementPtr BigPtrArray::operator[](ULONG pos) const
+{
+ DBG_ASSERT(pos < container_.size(), "BigPtrArray::operator[] precondition violation");
+ return container_[pos];
+}
+
+void BigPtrArray::Insert(const ElementPtr& rElem, ULONG pos)
+{
+ DBG_ASSERT(pos <= container_.size(), "BigPtrArray::Insert precondition violation");
+
+ rElem->pBigPtrArray_ = this;
+ rElem->pos_ = pos;
+
+ if (pos == container_.size())
+ container_.push_back(rElem);
+ else
+ {
+ container_.insert(container_.begin() + pos, rElem);
+ FixElementIndizes(container_.begin(), container_.end());
+ }
+}
+
+void BigPtrArray::Remove( ULONG pos, ULONG n )
+{
+ DBG_ASSERT((pos < container_.size()) && ((container_.begin() + pos + n) < container_.end()), "BigPtrArray.Remove precondition violation")
+ container_.erase(container_.begin() + pos, container_.begin() + pos + n);
+ FixElementIndizes(container_.begin(), container_.end());
+}
+
+void BigPtrArray::Replace(ULONG pos, const ElementPtr& rElem)
+{
+ DBG_ASSERT(pos < container_.size(), "BigPtrArray::Replace precondition violation");
+ rElem->pBigPtrArray_ = this;
+ rElem->pos_ = pos;
+ container_[pos] = rElem;
+}
+
+void BigPtrArray::FixElementIndizes(Container_t::const_iterator begin, Container_t::const_iterator end) const
+{
+ Container_t::const_iterator iter = begin;
+ for (int i = 0; iter != end; ++iter, i++)
+ (*iter)->pos_ = i;
+}
diff --git a/sw/qa/core/bigpointerarray-new.hxx b/sw/qa/core/bigpointerarray-new.hxx
new file mode 100644
index 000000000000..1388c6459c20
--- /dev/null
+++ b/sw/qa/core/bigpointerarray-new.hxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: bigpointerarray-new.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _BPARR_HXX
+#define _BPARR_HXX
+
+#include <tools/solar.h>
+#include <tools/debug.hxx>
+
+#include <deque>
+
+class BigPtrArray;
+
+/** Base class for container entries
+*/
+class BigPtrEntry
+{
+ friend class BigPtrArray;
+ BigPtrArray* pBigPtrArray_;
+ ULONG pos_;
+
+protected:
+ BigPtrEntry() : pBigPtrArray_(0), pos_(0)
+ {}
+
+ virtual ~BigPtrEntry()
+ {}
+
+ ULONG GetPos() const
+ {
+ return pos_;
+ }
+
+ BigPtrArray& GetArray() const
+ {
+ return *pBigPtrArray_;
+ }
+};
+
+typedef BigPtrEntry* ElementPtr;
+typedef BOOL (*FnForEach)(const ElementPtr&, void* pArgs);
+
+/** A container abstraction
+*/
+class BigPtrArray
+{
+public:
+ typedef std::deque<ElementPtr> Container_t;
+
+public:
+ /**
+ */
+ BigPtrArray();
+
+ /** Return the number of entries inserted
+ into the array
+ */
+ ULONG Count() const;
+
+ /** Insert an Element into the array at a certain
+ position
+
+ @param rElem
+ [in] the element
+
+ @param pos
+ [in] the position where to insert the element.
+
+ @pre (pos >= 0 && pos <= BigPtrArray.Count())
+ @post (((oldCount + 1) == BigPtrArray.Count()) && BigPtrArray[pos] == rElem)
+ */
+ void Insert(const ElementPtr& rElem, ULONG pos);
+
+ /** Remove a specified number of elements starting at a certain position.
+
+ @param pos
+ [in] the position where to start removing elements
+
+ @param n
+ [in] the number of elements to remove
+
+ @pre (pos < BigPtrArray.Count() && n <= BigPtrArray.Count())
+ @post ((oldCount - n) == BigPtrArray.Count())
+ */
+ void Remove(ULONG pos, ULONG n = 1);
+
+ /** Move an entry from a certain position to another on.
+
+ @param from
+ [in]
+
+ @param to
+ [in]
+ */
+ void Move(ULONG fromPos, ULONG toPos);
+
+ /** Replace an entry at a certain position
+
+ @param pos
+ [in] the position of the entry
+
+ @param rElem
+ [in] the new entry
+
+ @pre pos < BigPtrArray.Count()
+ @post (oldCount == BigPtrArray.Count() && BigPtrArray[pos] == rElem)
+ */
+ void Replace(ULONG pos, const ElementPtr& rElem);
+
+ /** Get the entry at a certain index
+
+ @param pos
+ [in] the position of the entry
+
+ @pre pos < BigPtrArray.Count()
+ */
+ ElementPtr operator[](ULONG pos) const;
+
+ /**
+ */
+ void ForEach(FnForEach fn, void* pArgs = NULL);
+
+ /**
+ */
+ void ForEach(ULONG fromPos, ULONG toPos, FnForEach fn, void* pArgs = NULL);
+
+private:
+
+ void FixElementIndizes(Container_t::const_iterator begin, Container_t::const_iterator end) const;
+
+private:
+ Container_t container_;
+};
+
+#endif
diff --git a/sw/qa/core/export.exp b/sw/qa/core/export.exp
new file mode 100644
index 000000000000..a13529da5876
--- /dev/null
+++ b/sw/qa/core/export.exp
@@ -0,0 +1 @@
+registerAllTestFunction
diff --git a/sw/qa/core/export.map b/sw/qa/core/export.map
new file mode 100644
index 000000000000..ab2e7cd007b0
--- /dev/null
+++ b/sw/qa/core/export.map
@@ -0,0 +1,38 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: export.map,v $
+#
+# $Revision: 1.3 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+UDK_3.0 {
+ global:
+ registerAllTestFunction;
+
+ local:
+ *;
+};
diff --git a/sw/qa/core/makefile.mk b/sw/qa/core/makefile.mk
new file mode 100644
index 000000000000..66308d1eed33
--- /dev/null
+++ b/sw/qa/core/makefile.mk
@@ -0,0 +1,81 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.3 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=sw
+TARGET=test-bigptrarray
+# this is removed at the moment because we need some enhancements
+# TESTDIR=TRUE
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# BEGIN ----------------------------------------------------------------
+# auto generated Target:testjob by codegen.pl
+
+.IF "$(GUI)" == "WNT"
+ CFLAGS+=/Ob1
+.ENDIF
+
+SHL1OBJS=$(SLO)$/Test-BigPtrArray.obj \
+ $(SLO)$/bparr.obj
+
+SHL1TARGET=$(TARGET)
+SHL1STDLIBS=$(SALLIB) $(TOOLSLIB)
+
+.IF "$(GUI)" == "WNT"
+SHL1STDLIBS+= $(SOLARLIBDIR)$/cppunit.lib
+.ENDIF
+.IF "$(GUI)" == "UNX"
+SHL1STDLIBS+=$(SOLARLIBDIR)$/libcppunit$(DLLPOSTFIX).a
+# .IF "$(OS)" == "SOLARIS"
+# SHL1STDLIBS += -lrt -laio
+# .ENDIF
+.ENDIF
+
+SHL1IMPLIB= i$(SHL1TARGET)
+
+# SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+
+DEF1NAME =$(SHL1TARGET)
+
+# DEF1EXPORTFILE= export.exp
+SHL1VERSIONMAP = export.map
+
+# END ------------------------------------------------------------------
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+.INCLUDE : _cppunit.mk
diff --git a/sw/qa/core/performance-jobfile b/sw/qa/core/performance-jobfile
new file mode 100644
index 000000000000..9e33d3c858ba
--- /dev/null
+++ b/sw/qa/core/performance-jobfile
@@ -0,0 +1,9 @@
+BigPtrArrayPerformanceTest.BigPtrArrayPerformanceTest.test_insert_at_end_1000
+BigPtrArrayPerformanceTest.BigPtrArrayPerformanceTest.test_insert_at_end_10000
+BigPtrArrayPerformanceTest.BigPtrArrayPerformanceTest.test_insert_at_end_100000
+BigPtrArrayPerformanceTest.BigPtrArrayPerformanceTest.test_insert_at_end_1000000
+BigPtrArrayPerformanceTest.BigPtrArrayPerformanceTest.test_insert_at_front_1000
+BigPtrArrayPerformanceTest.BigPtrArrayPerformanceTest.test_insert_at_front_10000
+BigPtrArrayPerformanceTest.BigPtrArrayPerformanceTest.test_insert_at_front_100000
+BigPtrArrayPerformanceTest.BigPtrArrayPerformanceTest.test_insert_at_front_1000000
+
diff --git a/sw/qa/unoapi/knownissues.xcl b/sw/qa/unoapi/knownissues.xcl
new file mode 100644
index 000000000000..ee20559798a6
--- /dev/null
+++ b/sw/qa/unoapi/knownissues.xcl
@@ -0,0 +1,153 @@
+### i85576 ###
+sw.SwXCellRange::com::sun::star::text::CellRange
+
+### i21166 ###
+sw.SwXCell::com::sun::star::text::CellProperties
+sw.SwXCell::com::sun::star::beans::XPropertySet
+
+### i59143 ###
+sw.SwXTableColumns::com::sun::star::table::XTableColumns
+
+### i85580 ###
+sw.SwXTextView::com::sun::star::view::XSelectionSupplier
+#-> disabled in sw.scw
+
+### i23394 ###
+sw.XMLContentImporter::com::sun::star::xml::sax::XDocumentHandler
+sw.XMLMetaImporter::com::sun::star::xml::sax::XDocumentHandler
+sw.XMLStylesImporter::com::sun::star::xml::sax::XDocumentHandler
+# -> disables in sw.sce
+
+### i23422 ###
+sw.SwXTextViewCursor::com::sun::star::beans::XMultiPropertyStates
+
+### i23623 ###
+sw.SwXStyleFamily::com::sun::star::container::XNameReplace
+
+### i85583 ###
+sw.PageStyle::com::sun::star::style::PageProperties
+
+### i25408 ###
+sw.PageStyle::com::sun::star::style::XStyle
+
+### i85584 ###
+sw.CharacterStyle::com::sun::star::style::CharacterPropertiesAsian
+
+### i25473 ###
+sw.ConditionalParagraphStyle::com::sun::star::beans::XMultiPropertyStates
+sw.ParagraphStyle::com::sun::star::beans::XMultiPropertyStates
+
+### i34456 ###
+sw.SwXTextDocument::com::sun::star::view::XPrintJobBroadcaster
+
+### i37272 ###
+sw.SwXDrawPage::com::sun::star::drawing::XShapeGrouper
+
+### i38584 ###
+sw.SwXParagraph::com::sun::star::beans::XPropertySet
+sw.SwXTextPortion::com::sun::star::beans::XPropertySet
+sw.SwXTextRange::com::sun::star::beans::XPropertySet
+sw.SwXTextViewCursor::com::sun::star::beans::XPropertySet
+sw.SwXTextCursor::com::sun::star::beans::XPropertySet
+
+### i85585 ###
+sw.SwXTextSection::com::sun::star::text::TextSection
+
+### i85586 ###
+sw.SwAccessibleDocumentView::com::sun::star::accessibility::XAccessibleEventBroadcaster
+
+### i58374 ###
+sw.DocumentSettings::com::sun::star::document::Settings
+
+### i85586 ###
+sw.SwXAutoTextGroup::com::sun::star::container::XElementAccess
+
+### i72029 ###
+sw.SwXChapterNumbering::com::sun::star::text::NumberingRules
+
+### i38586 ###
+sw.SwXParagraph::com::sun::star::style::ParagraphProperties
+sw.SwXTextCursor::com::sun::star::style::ParagraphProperties
+sw.SwXTextPortion::com::sun::star::style::ParagraphProperties
+sw.SwXTextRange::com::sun::star::style::ParagraphProperties
+sw.SwXTextViewCursor::com::sun::star::style::ParagraphProperties
+sw.ConditionalParagraphStyle::com::sun::star::style::ParagraphProperties
+sw.ParagraphStyle::com::sun::star::style::ParagraphProperties
+sw.SwXCellRange::com::sun::star::style::ParagraphProperties
+sw.SwXTextDefaults::com::sun::star::style::ParagraphProperties
+sw.SwXTextTableCursor::com::sun::star::style::ParagraphProperties
+
+### i85575 ###
+sw.SwXParagraph::com::sun::star::style::CharacterProperties
+sw.SwXTextCursor::com::sun::star::style::CharacterProperties
+
+### i77882 ###
+sw.SwXTextCursor::com::sun::star::document::XDocumentInsertable
+
+### i85595 ###
+sw.ParagraphStyle::com::sun::star::beans::XMultiPropertySet
+sw.ParagraphStyle::com::sun::star::beans::XPropertySet
+
+### i85596 ###
+sw.SwXFieldMaster::com::sun::star::text::TextFieldMaster
+
+### i85634 ###
+sw.SwAccessibleTableView
+# -> disabled in sw.sce
+
+### i85635 ###
+sw.DocumentSettings::com::sun::star::text::PrintPreviewSettings
+
+### i85638 ###
+sw.SwXTextDocument::com::sun::star::frame::XStorable
+
+### i85640 ###
+sw.SwXMailMerge
+#-> disabled in sw.sce
+
+### i86656 ###
+sw.SwAccessibleDocumentView::com::sun::star::accessibility::XAccessibleComponent
+
+### i86751 ###
+sw.SwAccessibleDocumentPageView::com::sun::star::accessibility::XAccessibleEventBroadcaster
+#-> disabled in sw.sce
+
+### i87978 ###
+sw.DocumentSettings::com::sun::star::beans::XPropertySet
+sw.ConditionalParagraphStyle::com::sun::star::beans::XPropertySet
+
+### i88242 ###
+sw.SwXTextDocument::com::sun::star::view::XPrintable
+sw.SwXTextDocument::com::sun::star::text::XPagePrintable
+
+### i88257 ###
+sw.SwAccessibleTextGraphicObject::com::sun::star::accessibility::XAccessibleImage
+
+### i88262 ###
+sw.SwXTextFrame::com::sun::star::text::BaseFrameProperties
+
+### i88374 ###
+sw.SwXTextTable::com::sun::star::table::XAutoFormattable
+
+### i88310 ###
+sw.SwAccessibleTextGraphicObject::com::sun::star::accessibility::XAccessibleComponent
+
+### i88606 ###
+sw.SwAccessibleTextGraphicObject::com::sun::star::accessibility::XAccessibleContext
+
+### i89021 ###
+sw.SwXTextDefaults
+#-> disabled in sw.sce
+
+### i89022 ###
+sw.SwAccessiblePageView
+#-> disabled in sw.sce
+
+### i89419 ###
+sw.SwXTextEmbeddedObject::com::sun::star::text::BaseFrameProperties
+
+### i91530 ###
+sw.SwXTextPortion::com::sun::star::style::CharacterProperties
+
+### i94977 ###
+sw.SwXTextGraphicObject::com::sun::star::text::BaseFrameProperties \ No newline at end of file
diff --git a/sw/qa/unoapi/lastCheck.txt b/sw/qa/unoapi/lastCheck.txt
new file mode 100644
index 000000000000..b222cd4719d7
--- /dev/null
+++ b/sw/qa/unoapi/lastCheck.txt
@@ -0,0 +1 @@
+sw: checked with cws_tleamisc that is based on src680_m47
diff --git a/sw/qa/unoapi/makefile.mk b/sw/qa/unoapi/makefile.mk
new file mode 100644
index 000000000000..7e01e4819dab
--- /dev/null
+++ b/sw/qa/unoapi/makefile.mk
@@ -0,0 +1,43 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.7 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=sw
+TARGET=qa_unoapi
+
+.INCLUDE: settings.mk
+
+.INCLUDE: target.mk
+
+ALLTAR : UNOAPI_TEST
+
+UNOAPI_TEST:
+ +$(SOLARENV)$/bin$/checkapi -sce sw.sce -xcl knownissues.xcl -tdoc $(PWD)$/testdocuments
diff --git a/sw/qa/unoapi/sw.sce b/sw/qa/unoapi/sw.sce
new file mode 100644
index 000000000000..e9739711ae42
--- /dev/null
+++ b/sw/qa/unoapi/sw.sce
@@ -0,0 +1,94 @@
+-o sw.CharacterStyle
+-o sw.ConditionalParagraphStyle
+-o sw.PageStyle
+-o sw.ParagraphStyle
+-o sw.SwAccessibleDocumentPageView
+#i86751 -o sw.SwAccessibleDocumentView
+-o sw.SwAccessibleEndnoteView
+-o sw.SwAccessibleFooterView
+-o sw.SwAccessibleFootnoteView
+-o sw.SwAccessibleHeaderView
+#i89022 -o sw.SwAccessiblePageView
+-o sw.SwAccessibleParagraphView
+-o sw.SwAccessibleTableCellView
+#i85634 -o sw.SwAccessibleTableView
+-o sw.SwAccessibleTextEmbeddedObject
+-o sw.SwAccessibleTextFrameView
+-o sw.SwAccessibleTextGraphicObject
+-o sw.SwXAutoTextContainer
+-o sw.SwXAutoTextEntry
+-o sw.SwXAutoTextGroup
+-o sw.SwXBodyText
+-o sw.SwXBookmark
+-o sw.SwXBookmarks
+-o sw.SwXCell
+-o sw.SwXCellRange
+-o sw.SwXChapterNumbering
+-o sw.SwXDocumentIndex
+-o sw.SwXDocumentIndexMark
+-o sw.SwXDocumentIndexes
+-o sw.SwXDrawPage
+-o sw.SwXEndnoteProperties
+-o sw.SwXFieldEnumeration
+-o sw.SwXFieldMaster
+-o sw.SwXFootnote
+-o sw.SwXFootnoteProperties
+-o sw.SwXFootnoteText
+-o sw.SwXFootnotes
+-o sw.SwXFrames
+-o sw.SwXHeadFootText
+-o sw.SwXLineNumberingProperties
+#i85640 -o sw.SwXMailMerge
+-o sw.SwXModule
+-o sw.SwXNumberingRules
+-o sw.SwXParagraph
+-o sw.SwXParagraphEnumeration
+-o sw.SwXPrintSettings
+-o sw.SwXPropertySet
+-o sw.SwXPropertySetInfo
+-o sw.SwXReferenceMark
+-o sw.SwXReferenceMarks
+-o sw.SwXShape
+-o sw.SwXStyleFamilies
+-o sw.SwXStyleFamily
+-o sw.SwXTableCellText
+-o sw.SwXTableColumns
+-o sw.SwXTableRows
+-o sw.SwXTextColumns
+-o sw.SwXTextCursor
+#i89021 -o sw.SwXTextDefaults
+-o sw.SwXTextDocument
+-o sw.SwXTextEmbeddedObject
+-o sw.SwXTextEmbeddedObjects
+-o sw.SwXTextField
+-o sw.SwXTextFieldMasters
+-o sw.SwXTextFieldTypes
+-o sw.SwXTextFrame
+-o sw.SwXTextFrameText
+-o sw.SwXTextGraphicObject
+-o sw.SwXTextGraphicObjects
+-o sw.SwXTextPortion
+-o sw.SwXTextPortionEnumeration
+-o sw.SwXTextRange
+-o sw.SwXTextRanges
+-o sw.SwXTextSearch
+-o sw.SwXTextSection
+-o sw.SwXTextSections
+-o sw.SwXTextTable
+-o sw.SwXTextTableCursor
+-o sw.SwXTextTableRow
+-o sw.SwXTextTables
+#i85580 -o sw.SwXTextView
+-o sw.SwXTextViewCursor
+-o sw.SwXViewSettings
+-o sw.XMLContentExporter
+#i23394 -o sw.XMLContentImporter
+-o sw.XMLExporter
+-o sw.XMLImporter
+#i23394 -o sw.XMLMetaExporter
+-o sw.XMLMetaImporter
+-o sw.XMLSettingsExporter
+-o sw.XMLSettingsImporter
+-o sw.XMLStylesExporter
+#i23394 -o sw.XMLStylesImporter
+-o sw.DocumentSettings
diff --git a/sw/qa/unoapi/testdocuments/MailMerge.sxw b/sw/qa/unoapi/testdocuments/MailMerge.sxw
new file mode 100644
index 000000000000..108840535093
--- /dev/null
+++ b/sw/qa/unoapi/testdocuments/MailMerge.sxw
Binary files differ
diff --git a/sw/qa/unoapi/testdocuments/SwXTextEmbeddedObject.sdw b/sw/qa/unoapi/testdocuments/SwXTextEmbeddedObject.sdw
new file mode 100644
index 000000000000..4f5c2e39c030
--- /dev/null
+++ b/sw/qa/unoapi/testdocuments/SwXTextEmbeddedObject.sdw
Binary files differ
diff --git a/sw/qa/unoapi/testdocuments/SwXTextEmbeddedObject.sxw b/sw/qa/unoapi/testdocuments/SwXTextEmbeddedObject.sxw
new file mode 100644
index 000000000000..75c6242f5070
--- /dev/null
+++ b/sw/qa/unoapi/testdocuments/SwXTextEmbeddedObject.sxw
Binary files differ
diff --git a/sw/qa/unoapi/testdocuments/XDocumentInsertable.sxw b/sw/qa/unoapi/testdocuments/XDocumentInsertable.sxw
new file mode 100644
index 000000000000..b1398769d7ac
--- /dev/null
+++ b/sw/qa/unoapi/testdocuments/XDocumentInsertable.sxw
Binary files differ
diff --git a/sw/qa/unoapi/testdocuments/sForm.sxw b/sw/qa/unoapi/testdocuments/sForm.sxw
new file mode 100644
index 000000000000..a4958930c348
--- /dev/null
+++ b/sw/qa/unoapi/testdocuments/sForm.sxw
Binary files differ