summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2013-11-09 05:54:59 +0100
committerLionel Elie Mamane <lionel@mamane.lu>2013-11-09 06:36:45 +0100
commita071a29d4f7e8065a36a313027a007edac102e20 (patch)
tree3e6495d3988a3efa55f2034ffc194dcedd875d85
parente937995ca3718042efabaf04a5161c0c76107b9c (diff)
UnoApiTest don't require Calc
There is no reason for the generic UnoApiTest to require Calc specifically. Calc tests can/should instantiate a Calc instance. We can create a CalcUnoApiTest for that that inherits from UnoApiTest; however this does not seem necessary, "make sc.clean" succeeds. Anyway, the ScGlobals::ensure mentioned in the comment does not seem to exist. This allows us to eliminate some code duplication in tests that were reimplementing UnoApiTest minus the Calc instantiation. Change-Id: I37bea9df41e3960df0458fe689cf6c046a243617
-rw-r--r--dbaccess/CppunitTest_dbaccess_dialog_save.mk2
-rw-r--r--dbaccess/CppunitTest_dbaccess_macros_test.mk2
-rw-r--r--dbaccess/qa/extras/dialog-save.cxx24
-rw-r--r--dbaccess/qa/extras/macros-test.cxx40
-rw-r--r--include/test/unoapi_test.hxx1
-rw-r--r--sc/qa/extras/regression-test.cxx44
-rw-r--r--test/source/unoapi_test.cxx8
7 files changed, 16 insertions, 105 deletions
diff --git a/dbaccess/CppunitTest_dbaccess_dialog_save.mk b/dbaccess/CppunitTest_dbaccess_dialog_save.mk
index 5e571dcfc2a4..70689a7ee42b 100644
--- a/dbaccess/CppunitTest_dbaccess_dialog_save.mk
+++ b/dbaccess/CppunitTest_dbaccess_dialog_save.mk
@@ -57,8 +57,6 @@ $(eval $(call gb_CppunitTest_use_libraries,dbaccess_dialog_save, \
))
$(eval $(call gb_CppunitTest_set_include,dbaccess_dialog_save,\
- -I$(SRCDIR)/sc/source/ui/inc \
- -I$(SRCDIR)/sc/inc \
$$(INCLUDE) \
))
diff --git a/dbaccess/CppunitTest_dbaccess_macros_test.mk b/dbaccess/CppunitTest_dbaccess_macros_test.mk
index f84405ca7e5f..908600c05f28 100644
--- a/dbaccess/CppunitTest_dbaccess_macros_test.mk
+++ b/dbaccess/CppunitTest_dbaccess_macros_test.mk
@@ -53,8 +53,6 @@ $(eval $(call gb_CppunitTest_use_libraries,dbaccess_macros_test, \
))
$(eval $(call gb_CppunitTest_set_include,dbaccess_macros_test,\
- -I$(SRCDIR)/sc/source/ui/inc \
- -I$(SRCDIR)/sc/inc \
$$(INCLUDE) \
))
diff --git a/dbaccess/qa/extras/dialog-save.cxx b/dbaccess/qa/extras/dialog-save.cxx
index 823ab1d83837..e52fa98d76bc 100644
--- a/dbaccess/qa/extras/dialog-save.cxx
+++ b/dbaccess/qa/extras/dialog-save.cxx
@@ -37,24 +37,25 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
-class DialogSaveTest : public test::BootstrapFixture, public unotest::MacrosTest
+class DialogSaveTest : public UnoApiTest
{
public:
DialogSaveTest();
- virtual void setUp();
- virtual void tearDown();
-
void test();
CPPUNIT_TEST_SUITE(DialogSaveTest);
+// Should we disable this test on MOX and WNT?
+// #if !defined(MACOSX) && !defined(WNT)
CPPUNIT_TEST(test);
+// #endif
CPPUNIT_TEST_SUITE_END();
};
DialogSaveTest::DialogSaveTest()
+ : UnoApiTest("/dbaccess/qa/extras/testdocuments")
{
}
@@ -117,21 +118,6 @@ void DialogSaveTest::test()
}
}
-void DialogSaveTest::setUp()
-{
- test::BootstrapFixture::setUp();
-
- // This is a bit of a fudge, we do this to ensure that ScGlobals::ensure,
- // which is a private symbol to us, gets called
- mxDesktop = com::sun::star::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) );
- CPPUNIT_ASSERT(mxDesktop.is());
-}
-
-void DialogSaveTest::tearDown()
-{
- test::BootstrapFixture::tearDown();
-}
-
CPPUNIT_TEST_SUITE_REGISTRATION(DialogSaveTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/dbaccess/qa/extras/macros-test.cxx b/dbaccess/qa/extras/macros-test.cxx
index bcff5342f3d1..761f24120422 100644
--- a/dbaccess/qa/extras/macros-test.cxx
+++ b/dbaccess/qa/extras/macros-test.cxx
@@ -8,11 +8,9 @@
*/
#include <sal/config.h>
-#include <test/bootstrapfixture.hxx>
-#include <unotest/macros_test.hxx>
+#include <test/unoapi_test.hxx>
#include <rtl/strbuf.hxx>
#include <osl/file.hxx>
-#include <com/sun/star/frame/Desktop.hpp>
#include <sfx2/app.hxx>
#include <sfx2/docfilt.hxx>
@@ -26,16 +24,11 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
-class DBAccessTest : public test::BootstrapFixture, public unotest::MacrosTest
+class DBAccessTest : public UnoApiTest
{
public:
DBAccessTest();
- void createFileURL(const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath);
-
- virtual void setUp();
- virtual void tearDown();
-
void test();
CPPUNIT_TEST_SUITE(DBAccessTest);
@@ -44,46 +37,23 @@ public:
#endif
CPPUNIT_TEST_SUITE_END();
-private:
- OUString m_aBaseString;
};
-void DBAccessTest::createFileURL(const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath)
-{
- rFilePath = getSrcRootURL() + m_aBaseString + "/" + aFileBase + aFileExtension;
-}
-
DBAccessTest::DBAccessTest()
- : m_aBaseString(RTL_CONSTASCII_USTRINGPARAM("/dbaccess/qa/extras/testdocuments"))
+ : UnoApiTest("/dbaccess/qa/extras/testdocuments")
{
}
void DBAccessTest::test()
{
- const OUString aFileNameBase("testdb.");
- const OUString aFileExtension("odb");
+ const OUString aFileNameBase("testdb.odb");
OUString aFileName;
- createFileURL(aFileNameBase, aFileExtension, aFileName);
+ createFileURL(aFileNameBase, aFileName);
uno::Reference< lang::XComponent > xComponent = loadFromDesktop(aFileName);
CPPUNIT_ASSERT(xComponent.is());
}
-void DBAccessTest::setUp()
-{
- test::BootstrapFixture::setUp();
-
- // This is a bit of a fudge, we do this to ensure that ScGlobals::ensure,
- // which is a private symbol to us, gets called
- mxDesktop = com::sun::star::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) );
- CPPUNIT_ASSERT(mxDesktop.is());
-}
-
-void DBAccessTest::tearDown()
-{
- test::BootstrapFixture::tearDown();
-}
-
CPPUNIT_TEST_SUITE_REGISTRATION(DBAccessTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/include/test/unoapi_test.hxx b/include/test/unoapi_test.hxx
index ee83689bc06d..0555472f1778 100644
--- a/include/test/unoapi_test.hxx
+++ b/include/test/unoapi_test.hxx
@@ -30,7 +30,6 @@ protected:
private:
- css::uno::Reference<css::uno::XInterface> m_xCalcComponent;
OUString m_aBaseString;
};
diff --git a/sc/qa/extras/regression-test.cxx b/sc/qa/extras/regression-test.cxx
index f455259de688..b195e913de77 100644
--- a/sc/qa/extras/regression-test.cxx
+++ b/sc/qa/extras/regression-test.cxx
@@ -8,8 +8,7 @@
*/
#include <sal/config.h>
-#include <test/bootstrapfixture.hxx>
-#include <unotest/macros_test.hxx>
+#include <test/unoapi_test.hxx>
#include <rtl/strbuf.hxx>
#include <osl/file.hxx>
@@ -58,41 +57,24 @@ bool checkDumpAgainstFile( const OUString& rDump, const OUString aFilePath, cons
}
-class ScChartRegressionTest : public test::BootstrapFixture, public unotest::MacrosTest
+class ScChartRegressionTest : public UnoApiTest
{
public:
ScChartRegressionTest();
- void createFileURL(const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath);
-
- virtual void setUp();
- virtual void tearDown();
-
void test();
CPPUNIT_TEST_SUITE(ScChartRegressionTest);
CPPUNIT_TEST(test);
CPPUNIT_TEST_SUITE_END();
-private:
- uno::Reference<uno::XInterface> m_xCalcComponent;
- OUString m_aBaseString;
};
-void ScChartRegressionTest::createFileURL(const OUString& aFileBase, const OUString& aFileExtension, OUString& rFilePath)
-{
- OUString aSep("/");
- OUStringBuffer aBuffer( getSrcRootURL() );
- aBuffer.append(m_aBaseString).append(aSep).append(aFileExtension);
- aBuffer.append(aSep).append(aFileBase).append(aFileExtension);
- rFilePath = aBuffer.makeStringAndClear();
-}
-
void ScChartRegressionTest::test()
{
OUString aFileName;
- createFileURL( "testChart.", "ods", aFileName);
+ createFileURL( "testChart.ods", aFileName);
uno::Reference< com::sun::star::lang::XComponent > xComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
CPPUNIT_ASSERT(xComponent.is());
@@ -132,26 +114,8 @@ void ScChartRegressionTest::test()
}
ScChartRegressionTest::ScChartRegressionTest()
- : m_aBaseString(RTL_CONSTASCII_USTRINGPARAM("/chart2/qa/unit/data"))
-{
-}
-
-void ScChartRegressionTest::setUp()
-{
- test::BootstrapFixture::setUp();
-
- // This is a bit of a fudge, we do this to ensure that ScGlobals::ensure,
- // which is a private symbol to us, gets called
- m_xCalcComponent =
- getMultiServiceFactory()->createInstance("com.sun.star.comp.Calc.SpreadsheetDocument");
- CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xCalcComponent.is());
- mxDesktop = com::sun::star::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) );
-}
-
-void ScChartRegressionTest::tearDown()
+ : UnoApiTest("/chart2/qa/unit/data/ods")
{
- uno::Reference< lang::XComponent >( m_xCalcComponent, UNO_QUERY_THROW )->dispose();
- test::BootstrapFixture::tearDown();
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScChartRegressionTest);
diff --git a/test/source/unoapi_test.cxx b/test/source/unoapi_test.cxx
index 214ed174ec2e..256e1f377bdf 100644
--- a/test/source/unoapi_test.cxx
+++ b/test/source/unoapi_test.cxx
@@ -25,17 +25,13 @@ void UnoApiTest::setUp()
{
test::BootstrapFixture::setUp();
- // This is a bit of a fudge, we do this to ensure that ScGlobals::ensure,
- // which is a private symbol to us, gets called
- m_xCalcComponent =
- getMultiServiceFactory()->createInstance("com.sun.star.comp.Calc.SpreadsheetDocument");
- CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xCalcComponent.is());
mxDesktop = com::sun::star::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) );
+ CPPUNIT_ASSERT_MESSAGE("no desktop!", mxDesktop.is());
}
void UnoApiTest::tearDown()
{
- uno::Reference< lang::XComponent >( m_xCalcComponent, UNO_QUERY_THROW )->dispose();
+ uno::Reference< lang::XComponent >( mxDesktop )->dispose();
test::BootstrapFixture::tearDown();
}