Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/1923
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/23/1923/1
Use a method from UnoApitest instead of implement a new one in calc
In calc, we see a lot of implementations of createFileURL. So get ride
of all it and start to use the UnoAPitest::createFileURL method.
Also, clean the UnoApiRest::createFileURL method, fix the path from UnoApiTest and
moved some testing files to the right dir that the file belongs.
Change-Id: Ic02f13777503729ac70da590f4a42866f17ea9b2
---
M sc/CppunitTest_sc_macros_test.mk
M sc/Module_sc.mk
M sc/qa/extras/macros-test.cxx
M sc/qa/extras/scannotationobj.cxx
M sc/qa/extras/scannotationsobj.cxx
M sc/qa/extras/sccellrangeobj.cxx
M sc/qa/extras/scdatabaserangeobj.cxx
M sc/qa/extras/scdatapilotfieldobj.cxx
M sc/qa/extras/scdatapilottableobj.cxx
M sc/qa/extras/sceditfieldobj-cell.cxx
M sc/qa/extras/sceditfieldobj-header.cxx
M sc/qa/extras/scmodelobj.cxx
M sc/qa/extras/scnamedrangeobj.cxx
M sc/qa/extras/scnamedrangesobj.cxx
M sc/qa/extras/scoutlineobj.cxx
M sc/qa/extras/sctablesheetobj.cxx
M sc/qa/extras/sctablesheetsobj.cxx
D sc/qa/unit/data/ods/StarBasic.ods
D sc/qa/unit/data/xls/TestAddress.xls
M test/inc/test/unoapi_test.hxx
M test/source/unoapi_test.cxx
21 files changed, 57 insertions(+), 41 deletions(-)
diff --git a/sc/CppunitTest_sc_macros_test.mk b/sc/CppunitTest_sc_macros_test.mk
index 362a65e..66dd619 100644
--- a/sc/CppunitTest_sc_macros_test.mk
+++ b/sc/CppunitTest_sc_macros_test.mk
@@ -59,6 +59,7 @@
svx \
svxcore \
test \
+ subsequenttest \
tl \
tk \
ucbhelper \
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 4a4fc41..1b3ba05 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -59,8 +59,6 @@
# CppunitTest_sc_annotationshapeobj \
$(eval $(call gb_Module_add_subsequentcheck_targets,sc,\
- JunitTest_sc_complex \
- JunitTest_sc_unoapi \
CppunitTest_sc_outlineobj \
CppunitTest_sc_annotationobj \
CppunitTest_sc_annotationsobj \
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index 364ca1b..d6ccdb1 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -29,7 +29,7 @@
*/
#include <sal/config.h>
-#include <test/bootstrapfixture.hxx>
+#include <test/unoapi_test.hxx>
#include <unotest/macros_test.hxx>
#include <rtl/strbuf.hxx>
#include <osl/file.hxx>
@@ -53,12 +53,10 @@
/* Implementation of Macros test */
-class ScMacrosTest : public test::BootstrapFixture, public unotest::MacrosTest
+class ScMacrosTest : public UnoApiTest
{
public:
ScMacrosTest();
-
- void createFileURL(const rtl::OUString& aFileBase, const rtl::OUString& aFileExtension,
rtl::OUString& rFilePath);
virtual void setUp();
virtual void tearDown();
@@ -77,25 +75,13 @@
private:
uno::Reference<uno::XInterface> m_xCalcComponent;
- rtl::OUString m_aBaseString;
};
-
-
-void ScMacrosTest::createFileURL(const rtl::OUString& aFileBase, const rtl::OUString&
aFileExtension, rtl::OUString& rFilePath)
-{
- rtl::OUString aSep(RTL_CONSTASCII_USTRINGPARAM("/"));
- rtl::OUStringBuffer aBuffer( getSrcRootURL() );
- aBuffer.append(m_aBaseString).append(aSep).append(aFileExtension);
- aBuffer.append(aSep).append(aFileBase).append(aFileExtension);
- rFilePath = aBuffer.makeStringAndClear();
-}
void ScMacrosTest::testStarBasic()
{
- const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM("StarBasic."));
- rtl::OUString aFileExtension("ods");
+ const OUString aFileNameBase("StarBasic.ods");
rtl::OUString aFileName;
- createFileURL(aFileNameBase, aFileExtension, aFileName);
+ createFileURL(aFileNameBase, aFileName);
std::cout << "StarBasic test" << std::endl;
uno::Reference< com::sun::star::lang::XComponent > xComponent = loadFromDesktop(aFileName);
@@ -136,11 +122,10 @@
}
};
- rtl::OUString aFileExtension("xls");
for ( sal_uInt32 i=0; i<SAL_N_ELEMENTS( testInfo ); ++i )
{
rtl::OUString aFileName;
- createFileURL(testInfo[i].sFileBaseName, aFileExtension, aFileName);
+ createFileURL(testInfo[i].sFileBaseName + "xls", aFileName);
uno::Reference< com::sun::star::lang::XComponent > xComponent = loadFromDesktop(aFileName);
rtl::OUString sMsg( "Failed to load " + aFileName );
CPPUNIT_ASSERT_MESSAGE( rtl::OUStringToOString( sMsg, RTL_TEXTENCODING_UTF8 ).getStr(),
xComponent.is() );
@@ -164,7 +149,7 @@
}
ScMacrosTest::ScMacrosTest()
- : m_aBaseString(RTL_CONSTASCII_USTRINGPARAM("/sc/qa/unit/data"))
+ : UnoApiTest("/sc/qa/extras/testdocuments")
{
}
diff --git a/sc/qa/extras/scannotationobj.cxx b/sc/qa/extras/scannotationobj.cxx
index 29d9cbf..fdbd748 100644
--- a/sc/qa/extras/scannotationobj.cxx
+++ b/sc/qa/extras/scannotationobj.cxx
@@ -70,6 +70,7 @@
uno::Reference< lang::XComponent > ScAnnontationObj::mxComponent;
ScAnnontationObj::ScAnnontationObj()
+ : UnoApiTest("/sc/qa/extras/testdocuments")
{
}
diff --git a/sc/qa/extras/scannotationsobj.cxx b/sc/qa/extras/scannotationsobj.cxx
index ac6e841..2c3694a 100644
--- a/sc/qa/extras/scannotationsobj.cxx
+++ b/sc/qa/extras/scannotationsobj.cxx
@@ -63,6 +63,7 @@
uno::Reference< lang::XComponent > ScAnnontationsObj::mxComponent;
ScAnnontationsObj::ScAnnontationsObj()
+ : UnoApiTest("/sc/qa/extras/testdocuments")
{
}
diff --git a/sc/qa/extras/sccellrangeobj.cxx b/sc/qa/extras/sccellrangeobj.cxx
index 20a5c3a..2d58459 100644
--- a/sc/qa/extras/sccellrangeobj.cxx
+++ b/sc/qa/extras/sccellrangeobj.cxx
@@ -79,10 +79,10 @@
uno::Reference< lang::XComponent > ScCellRangeObj::mxComponent;
ScCellRangeObj::ScCellRangeObj():
+ UnoApiTest("/sc/qa/extras/testdocuments"),
apitest::XSearchable(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("15")), 1),
apitest::XReplaceable(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("15")),
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("35")))
{
-
}
uno::Reference< uno::XInterface > ScCellRangeObj::init()
diff --git a/sc/qa/extras/scdatabaserangeobj.cxx b/sc/qa/extras/scdatabaserangeobj.cxx
index 1f66f50..bd35885 100644
--- a/sc/qa/extras/scdatabaserangeobj.cxx
+++ b/sc/qa/extras/scdatabaserangeobj.cxx
@@ -47,6 +47,8 @@
virtual uno::Reference< uno::XInterface > init( const rtl::OUString& rDBName );
+ ScDatabaseRangeObj();
+
CPPUNIT_TEST_SUITE(ScDatabaseRangeObj);
CPPUNIT_TEST(testDataArea);
CPPUNIT_TEST(testGetSortDescriptor);
@@ -63,10 +65,15 @@
sal_Int32 ScDatabaseRangeObj::nTest = 0;
uno::Reference< lang::XComponent > ScDatabaseRangeObj::mxComponent;
+ScDatabaseRangeObj::ScDatabaseRangeObj()
+ : UnoApiTest("/sc/qa/extras/testdocuments")
+{
+}
+
uno::Reference< uno::XInterface > ScDatabaseRangeObj::init( const rtl::OUString& rDBName )
{
rtl::OUString aFileURL;
- createFileURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScDatabaseRangeObj.ods")), aFileURL);
+ createFileURL("ScDatabaseRangeObj.ods", aFileURL);
if(!mxComponent.is())
mxComponent = loadFromDesktop(aFileURL);
CPPUNIT_ASSERT(mxComponent.is());
diff --git a/sc/qa/extras/scdatapilotfieldobj.cxx b/sc/qa/extras/scdatapilotfieldobj.cxx
index 8e10a16..df41288 100644
--- a/sc/qa/extras/scdatapilotfieldobj.cxx
+++ b/sc/qa/extras/scdatapilotfieldobj.cxx
@@ -48,6 +48,8 @@
virtual void tearDown();
virtual uno::Reference< uno::XInterface > init();
+ ScDataPilotFieldObj();
+
CPPUNIT_TEST_SUITE(ScDataPilotFieldObj);
CPPUNIT_TEST(testSortInfo);
CPPUNIT_TEST(testLayoutInfo);
@@ -66,6 +68,11 @@
sal_Int32 ScDataPilotFieldObj::nTest = 0;
uno::Reference< lang::XComponent > ScDataPilotFieldObj::mxComponent;
+ScDataPilotFieldObj::ScDataPilotFieldObj()
+ : UnoApiTest("/sc/qa/extras/testdocuments")
+{
+}
+
uno::Reference< uno::XInterface > ScDataPilotFieldObj::init()
{
rtl::OUString aFileURL;
diff --git a/sc/qa/extras/scdatapilottableobj.cxx b/sc/qa/extras/scdatapilottableobj.cxx
index 6ab1c33..34128ba 100644
--- a/sc/qa/extras/scdatapilottableobj.cxx
+++ b/sc/qa/extras/scdatapilottableobj.cxx
@@ -83,15 +83,15 @@
uno::Reference< lang::XComponent > ScDataPilotTableObj::mxComponent;
ScDataPilotTableObj::ScDataPilotTableObj()
- : apitest::XNamed(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataPilotTable")))
+ : UnoApiTest("/sc/qa/extras/testdocuments"),
+ apitest::XNamed(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataPilotTable")))
{
-
}
uno::Reference< uno::XInterface > ScDataPilotTableObj::init()
{
rtl::OUString aFileURL;
- createFileURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScDataPilotTableObj.ods")), aFileURL);
+ createFileURL("ScDataPilotTableObj.ods", aFileURL);
if(!mxComponent.is())
mxComponent = loadFromDesktop(aFileURL);
CPPUNIT_ASSERT(mxComponent.is());
diff --git a/sc/qa/extras/sceditfieldobj-cell.cxx b/sc/qa/extras/sceditfieldobj-cell.cxx
index da5fb4f..78d0ac1 100644
--- a/sc/qa/extras/sceditfieldobj-cell.cxx
+++ b/sc/qa/extras/sceditfieldobj-cell.cxx
@@ -86,7 +86,10 @@
uno::Reference<lang::XComponent> ScEditFieldObj_Cell::mxComponent;
uno::Reference<text::XTextField> ScEditFieldObj_Cell::mxField;
-ScEditFieldObj_Cell::ScEditFieldObj_Cell() {}
+ScEditFieldObj_Cell::ScEditFieldObj_Cell()
+ : UnoApiTest("/sc/qa/extras/testdocuments")
+{
+}
void ScEditFieldObj_Cell::setUp()
{
diff --git a/sc/qa/extras/sceditfieldobj-header.cxx b/sc/qa/extras/sceditfieldobj-header.cxx
index 69a62b8..a3f3765 100644
--- a/sc/qa/extras/sceditfieldobj-header.cxx
+++ b/sc/qa/extras/sceditfieldobj-header.cxx
@@ -82,7 +82,10 @@
uno::Reference<text::XTextField> ScEditFieldObj_Header::mxField;
uno::Reference<text::XText> ScEditFieldObj_Header::mxRightText;
-ScEditFieldObj_Header::ScEditFieldObj_Header() {}
+ScEditFieldObj_Header::ScEditFieldObj_Header()
+ : UnoApiTest("/sc/qa/extras/testdocuments")
+{
+}
void ScEditFieldObj_Header::setUp()
{
diff --git a/sc/qa/extras/scmodelobj.cxx b/sc/qa/extras/scmodelobj.cxx
index 93bb0ca..e41f7dd 100644
--- a/sc/qa/extras/scmodelobj.cxx
+++ b/sc/qa/extras/scmodelobj.cxx
@@ -22,6 +22,8 @@
virtual uno::Reference< uno::XInterface > init();
+ ScModelObj();
+
CPPUNIT_TEST_SUITE(ScModelObj);
CPPUNIT_TEST(testSeekGoal);
CPPUNIT_TEST_SUITE_END();
@@ -31,6 +33,10 @@
static uno::Reference< lang::XComponent > mxComponent;
};
+ScModelObj::ScModelObj()
+ : UnoApiTest("/sc/qa/extras/testdocuments")
+{
+}
sal_Int32 ScModelObj::nTest = 0;
uno::Reference< lang::XComponent > ScModelObj::mxComponent;
diff --git a/sc/qa/extras/scnamedrangeobj.cxx b/sc/qa/extras/scnamedrangeobj.cxx
index a9f971f..81882e5 100644
--- a/sc/qa/extras/scnamedrangeobj.cxx
+++ b/sc/qa/extras/scnamedrangeobj.cxx
@@ -73,10 +73,10 @@
uno::Reference< lang::XComponent > ScNamedRangeObj::mxComponent;
ScNamedRangeObj::ScNamedRangeObj():
+ UnoApiTest("/sc/qa/extras/testdocuments"),
apitest::XNamed(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NamedRange"))),
apitest::XCellRangeReferrer(table::CellRangeAddress(0,1,7,1,7))
{
-
}
uno::Reference< sheet::XNamedRanges > ScNamedRangeObj::init_impl()
diff --git a/sc/qa/extras/scnamedrangesobj.cxx b/sc/qa/extras/scnamedrangesobj.cxx
index c118d08..1d1599e 100644
--- a/sc/qa/extras/scnamedrangesobj.cxx
+++ b/sc/qa/extras/scnamedrangesobj.cxx
@@ -45,6 +45,8 @@
virtual uno::Reference< uno::XInterface > init(sal_Int32 nSheet);
+ ScNamedRangesObj();
+
CPPUNIT_TEST_SUITE(ScNamedRangesObj);
CPPUNIT_TEST(testAddNewByName);
CPPUNIT_TEST(testAddNewFromTitles);
@@ -60,6 +62,11 @@
sal_Int32 ScNamedRangesObj::nTest = 0;
uno::Reference< lang::XComponent > ScNamedRangesObj::mxComponent;
+ScNamedRangesObj::ScNamedRangesObj()
+ : UnoApiTest("/sc/qa/extras/testdocuments")
+{
+}
+
uno::Reference< uno::XInterface > ScNamedRangesObj::init(sal_Int32 nSheet)
{
rtl::OUString aFileURL;
diff --git a/sc/qa/extras/scoutlineobj.cxx b/sc/qa/extras/scoutlineobj.cxx
index 3e5e964..74a3bc4 100644
--- a/sc/qa/extras/scoutlineobj.cxx
+++ b/sc/qa/extras/scoutlineobj.cxx
@@ -65,6 +65,7 @@
uno::Reference< lang::XComponent > ScOutlineObj::mxComponent;
ScOutlineObj::ScOutlineObj()
+ : UnoApiTest("/sc/qa/extras/testdocuments")
{
}
diff --git a/sc/qa/extras/sctablesheetobj.cxx b/sc/qa/extras/sctablesheetobj.cxx
index 28b4d2b..aff6a46 100644
--- a/sc/qa/extras/sctablesheetobj.cxx
+++ b/sc/qa/extras/sctablesheetobj.cxx
@@ -64,10 +64,10 @@
uno::Reference< lang::XComponent > ScTableSheetObj::mxComponent;
ScTableSheetObj::ScTableSheetObj():
+ UnoApiTest("/sc/qa/extras/testdocuments"),
apitest::XSearchable(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("test")), 4),
apitest::XReplaceable(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("searchReplaceString")),
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("replaceReplaceString")))
{
-
}
diff --git a/sc/qa/extras/sctablesheetsobj.cxx b/sc/qa/extras/sctablesheetsobj.cxx
index 2d7de74..a1e97d5 100644
--- a/sc/qa/extras/sctablesheetsobj.cxx
+++ b/sc/qa/extras/sctablesheetsobj.cxx
@@ -74,6 +74,7 @@
sal_Int32 ScTableSheetsObj::nTest = 0;
ScTableSheetsObj::ScTableSheetsObj():
+ UnoApiTest("/sc/qa/extras/testdocuments"),
apitest::XNameContainer(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Sheet2")))
{
diff --git a/sc/qa/unit/data/ods/StarBasic.ods b/sc/qa/unit/data/ods/StarBasic.ods
deleted file mode 100644
index a4b74b3..0000000
--- a/sc/qa/unit/data/ods/StarBasic.ods
+++ /dev/null
Binary files differ
diff --git a/sc/qa/unit/data/xls/TestAddress.xls b/sc/qa/unit/data/xls/TestAddress.xls
deleted file mode 100644
index 629645c..0000000
--- a/sc/qa/unit/data/xls/TestAddress.xls
+++ /dev/null
Binary files differ
diff --git a/test/inc/test/unoapi_test.hxx b/test/inc/test/unoapi_test.hxx
index b3e341a..b2ebb37 100644
--- a/test/inc/test/unoapi_test.hxx
+++ b/test/inc/test/unoapi_test.hxx
@@ -41,7 +41,7 @@
class OOO_DLLPUBLIC_TEST UnoApiTest : public test::BootstrapFixture, public unotest::MacrosTest
{
public:
- UnoApiTest();
+ UnoApiTest(const OUString& path);
void createFileURL(const rtl::OUString& aFileBase, rtl::OUString& rFilePath);
diff --git a/test/source/unoapi_test.cxx b/test/source/unoapi_test.cxx
index 81b961c2..922ef2a 100644
--- a/test/source/unoapi_test.cxx
+++ b/test/source/unoapi_test.cxx
@@ -32,8 +32,8 @@
#include <com/sun/star/frame/Desktop.hpp>
#include <comphelper/processfactory.hxx>
-UnoApiTest::UnoApiTest()
- : m_aBaseString(RTL_CONSTASCII_USTRINGPARAM("/sc/qa/extras/testdocuments"))
+UnoApiTest::UnoApiTest(const OUString& path)
+ : m_aBaseString(path)
{
}
@@ -58,12 +58,7 @@
void UnoApiTest::createFileURL(const rtl::OUString& aFileBase, rtl::OUString& rFilePath)
{
- rtl::OUString aSep(RTL_CONSTASCII_USTRINGPARAM("/"));
- rtl::OUStringBuffer aBuffer( getSrcRootURL() );
- rtl::OUString aFileExtension(RTL_CONSTASCII_USTRINGPARAM("ods"));
- aBuffer.append(m_aBaseString).append(aSep);
- aBuffer.append(aFileBase);
- rFilePath = aBuffer.makeStringAndClear();
+ rFilePath = getSrcRootURL() + m_aBaseString + "/" + aFileBase;
}
void UnoApiTest::closeDocument( uno::Reference< lang::XComponent > xDocument )
--
To view, visit https://gerrit.libreoffice.org/1923
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic02f13777503729ac70da590f4a42866f17ea9b2
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Marcos Souza <marcos.souza.org@gmail.com>
Context
- Change in core[master]: Use a method from UnoApitest instead of implement a new one ... · Marcos Souza (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.