summaryrefslogtreecommitdiff
path: root/dbaccess/qa
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 /dbaccess/qa
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
Diffstat (limited to 'dbaccess/qa')
-rw-r--r--dbaccess/qa/extras/dialog-save.cxx24
-rw-r--r--dbaccess/qa/extras/macros-test.cxx40
2 files changed, 10 insertions, 54 deletions
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();