summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/qa/complex/api_internal/api.lst1
-rw-r--r--qadevOOo/Jar_OOoRunner.mk1
-rw-r--r--qadevOOo/objdsc/sc/com.sun.star.comp.office.ScHeaderFieldsObj.csv2
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java158
-rw-r--r--sc/qa/extras/scheaderfieldsobj.cxx22
-rw-r--r--sc/qa/unoapi/sc_4.sce1
6 files changed, 19 insertions, 166 deletions
diff --git a/framework/qa/complex/api_internal/api.lst b/framework/qa/complex/api_internal/api.lst
index f19edba01394..b588cfd18b4b 100644
--- a/framework/qa/complex/api_internal/api.lst
+++ b/framework/qa/complex/api_internal/api.lst
@@ -75,7 +75,6 @@ job78=sc.ScAutoFormatFieldObj
job81=sc.ScCellFieldObj
job88=sc.ScDatabaseRangeObj
job98=sc.ScHeaderFieldObj
-job99=sc.ScHeaderFieldsObj
job126=sc.ScSheetLinkObj
job132=sc.ScStyleObj
job140=sc.XMLContentExporter
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index a526ad0ca163..4b91eee49fd4 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -953,7 +953,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/mod/_sc/ScDataPilotItemObj \
qadevOOo/tests/java/mod/_sc/ScDocumentConfiguration \
qadevOOo/tests/java/mod/_sc/ScHeaderFieldObj \
- qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj \
qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextCursor \
qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextObj \
qadevOOo/tests/java/mod/_sc/ScModelObj \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScHeaderFieldsObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScHeaderFieldsObj.csv
deleted file mode 100644
index 1d68820a8b35..000000000000
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScHeaderFieldsObj.csv
+++ /dev/null
@@ -1,2 +0,0 @@
-"ScHeaderFieldsObj";"com::sun::star::container::XElementAccess";"getElementType()"
-"ScHeaderFieldsObj";"com::sun::star::container::XElementAccess";"hasElements()"
diff --git a/qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java b/qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java
deleted file mode 100644
index 945b607cde79..000000000000
--- a/qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package mod._sc;
-
-import java.io.PrintWriter;
-
-import lib.TestCase;
-import lib.TestEnvironment;
-import lib.TestParameters;
-import util.SOfficeFactory;
-
-import com.sun.star.beans.XPropertySet;
-import com.sun.star.container.XNameAccess;
-import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.sheet.XHeaderFooterContent;
-import com.sun.star.sheet.XSpreadsheetDocument;
-import com.sun.star.style.XStyle;
-import com.sun.star.style.XStyleFamiliesSupplier;
-import com.sun.star.text.XText;
-import com.sun.star.text.XTextContent;
-import com.sun.star.text.XTextCursor;
-import com.sun.star.text.XTextFieldsSupplier;
-import com.sun.star.uno.AnyConverter;
-import com.sun.star.uno.Type;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XInterface;
-
-/**
- * Test for object which is represented by collection of
- * text fields contained in the text of a page header. <p>
- *
- * Object implements the following interfaces :
- * <ul>
- * <li> <code>com::sun::star::container::XEnumerationAccess</code></li>
- * <li> <code>com::sun::star::util::XRefreshable</code></li>
- * <li> <code>com::sun::star::container::XElementAccess</code></li>
- * </ul> <p>
- *
- * @see com.sun.star.container.XEnumerationAccess
- * @see com.sun.star.util.XRefreshable
- * @see com.sun.star.container.XElementAccess
- * @see ifc.container._XEnumerationAccess
- * @see ifc.util._XRefreshable
- * @see ifc.container._XElementAccess
- */
-public class ScHeaderFieldsObj extends TestCase {
- private XSpreadsheetDocument xSpreadsheetDoc;
-
- /**
- * Creates Spreadsheet document.
- */
- @Override
- protected void initialize( TestParameters tParam, PrintWriter log ) throws Exception {
- SOfficeFactory SOF = SOfficeFactory.getFactory( tParam.getMSF() );
- log.println( "creating a Spreadsheet document" );
- xSpreadsheetDoc = SOF.createCalcDoc(null);
- }
-
- /**
- * Disposes Spreadsheet document.
- */
- @Override
- protected void cleanup( TestParameters tParam, PrintWriter log ) {
- log.println( " disposing xSheetDoc " );
- XComponent oComp = UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc);
- util.DesktopTools.closeDoc(oComp);
- }
-
- /**
- * Creating a TestEnvironment for the interfaces to be tested.
- * Retrieves the collection of style families available in the document
- * using the interface <code>XStyleFamiliesSupplier</code>.
- * Obtains default style from the style family <code>'PageStyles'</code>.
- * Retrieves the interface <code>XHeaderFooterContent</code> from the style
- * using the property <code>'RightPageHeaderContent'</code>. Creates the
- * instance of the service <code>com.sun.star.text.TextField.Time</code> .
- * Obtains the text (the interface <code>XText</code>) which is printed in
- * the left part of the header or footer and inserts in its content
- * the created field instance. Then the tested component is obtained
- * through <code>XTextFieldsSupplier</code> interface of a text.
- *
- * @see com.sun.star.style.XStyleFamiliesSupplier
- * @see com.sun.star.sheet.XHeaderFooterContent
- * @see com.sun.star.text.XText
- * @see com.sun.star.text.XTextContent
- */
- @Override
- protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) throws Exception {
-
- XInterface oObj = null;
- XPropertySet PropSet;
- XNameAccess PageStyles = null;
- XStyle StdStyle = null;
-
- XStyleFamiliesSupplier StyleFam = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class,
- xSpreadsheetDoc );
-
- XNameAccess StyleFamNames = StyleFam.getStyleFamilies();
- PageStyles = (XNameAccess) AnyConverter.toObject(
- new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles"));
- StdStyle = (XStyle) AnyConverter.toObject(
- new Type(XStyle.class),PageStyles.getByName("Default"));
-
- //get the property-set
- PropSet = UnoRuntime.queryInterface(XPropertySet.class, StdStyle);
-
- XHeaderFooterContent RPHC = null;
- // creation of testobject here
- // first we write what we are intend to do to log file
- log.println( "creating a test environment" );
- RPHC = (XHeaderFooterContent) AnyConverter.toObject(
- new Type(XHeaderFooterContent.class),
- PropSet.getPropertyValue("RightPageHeaderContent"));
-
- XText left = RPHC.getLeftText();
-
- XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface(
- XMultiServiceFactory.class,
- xSpreadsheetDoc );
-
- XTextContent the_Field = null;
- oObj = (XInterface)
- oDocMSF.createInstance( "com.sun.star.text.TextField.Time" );
-
- the_Field = UnoRuntime.queryInterface(XTextContent.class,oObj);
-
- XTextCursor the_Cursor = left.createTextCursor();
-
- left.insertTextContent(the_Cursor,the_Field, false);
- PropSet.setPropertyValue("RightPageHeaderContent", RPHC);
-
- XTextFieldsSupplier xTFSupp = UnoRuntime.queryInterface(XTextFieldsSupplier.class, left);
-
- oObj = xTFSupp.getTextFields();
-
- TestEnvironment tEnv = new TestEnvironment(oObj);
-
- return tEnv;
- } // finish method getTestEnvironment
-}
-
diff --git a/sc/qa/extras/scheaderfieldsobj.cxx b/sc/qa/extras/scheaderfieldsobj.cxx
index 2265fb795d83..a03e00329104 100644
--- a/sc/qa/extras/scheaderfieldsobj.cxx
+++ b/sc/qa/extras/scheaderfieldsobj.cxx
@@ -8,6 +8,7 @@
*/
#include <test/calc_unoapi_test.hxx>
+#include <test/container/xelementaccess.hxx>
#include <test/container/xenumerationaccess.hxx>
#include <test/util/xrefreshable.hxx>
@@ -21,6 +22,7 @@
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/text/XText.hpp>
#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XTextField.hpp>
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
#include <com/sun/star/uno/XInterface.hpp>
@@ -31,6 +33,7 @@ using namespace css;
namespace sc_apitest
{
class ScHeaderFieldsObj : public CalcUnoApiTest,
+ public apitest::XElementAccess,
public apitest::XEnumerationAccess,
public apitest::XRefreshable
{
@@ -43,6 +46,10 @@ public:
CPPUNIT_TEST_SUITE(ScHeaderFieldsObj);
+ // XElementAccess
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+
// XEnumerationAccess
CPPUNIT_TEST(testCreateEnumeration);
@@ -53,10 +60,17 @@ public:
private:
uno::Reference<lang::XComponent> m_xComponent;
+ // We need a long living reference to css::text::XText to make the
+ // XElementAccess::hasElements() test work as ScHeaderFooterEditSource holds
+ // only (weak) references and they sometimes are gone.
+ static uno::Reference<text::XText> m_xText;
};
+uno::Reference<text::XText> ScHeaderFieldsObj::m_xText;
+
ScHeaderFieldsObj::ScHeaderFieldsObj()
: CalcUnoApiTest("/sc/qa/extras/testdocuments")
+ , ::apitest::XElementAccess(cppu::UnoType<text::XTextField>::get())
{
}
@@ -72,15 +86,15 @@ uno::Reference<uno::XInterface> ScHeaderFieldsObj::init()
uno::Reference<beans::XPropertySet> xPropertySet(xStyle, uno::UNO_QUERY_THROW);
uno::Reference<sheet::XHeaderFooterContent> xHFC(
xPropertySet->getPropertyValue("RightPageHeaderContent"), uno::UNO_QUERY_THROW);
- uno::Reference<text::XText> xText(xHFC->getLeftText(), uno::UNO_SET_THROW);
+ m_xText = xHFC->getLeftText();
uno::Reference<lang::XMultiServiceFactory> xMSF(xDoc, uno::UNO_QUERY_THROW);
uno::Reference<text::XTextContent> xTC(xMSF->createInstance("com.sun.star.text.TextField.Time"),
uno::UNO_QUERY_THROW);
- xText->insertTextContent(xText->createTextCursor(), xTC, false);
+ m_xText->insertTextContent(m_xText->createTextCursor(), xTC, false);
xPropertySet->setPropertyValue("RightPageHeaderContent", uno::makeAny(xHFC));
- uno::Reference<text::XTextFieldsSupplier> xTFS(xText, uno::UNO_QUERY_THROW);
+ uno::Reference<text::XTextFieldsSupplier> xTFS(m_xText, uno::UNO_QUERY_THROW);
return xTFS->getTextFields();
}
@@ -93,6 +107,8 @@ void ScHeaderFieldsObj::setUp()
void ScHeaderFieldsObj::tearDown()
{
+ m_xText.clear();
+
closeDocument(m_xComponent);
CalcUnoApiTest::tearDown();
}
diff --git a/sc/qa/unoapi/sc_4.sce b/sc/qa/unoapi/sc_4.sce
index 50727b8425fa..2d221d1bad3a 100644
--- a/sc/qa/unoapi/sc_4.sce
+++ b/sc/qa/unoapi/sc_4.sce
@@ -19,7 +19,6 @@
-o sc.ScDatabaseRangeObj
-o sc.ScDocumentConfiguration
# ported to cppunit -o sc.ScHeaderFieldObj
--o sc.ScHeaderFieldsObj
# The two HeaderFooter tests seem to fail randomly
# -o sc.ScHeaderFooterTextCursor
# SHF_TextObj is composed of SHF_TextData, which has a weak reference to