diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2013-11-09 05:54:59 +0100 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2013-11-09 06:36:45 +0100 |
commit | a071a29d4f7e8065a36a313027a007edac102e20 (patch) | |
tree | 3e6495d3988a3efa55f2034ffc194dcedd875d85 /sc/qa/extras/regression-test.cxx | |
parent | e937995ca3718042efabaf04a5161c0c76107b9c (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 'sc/qa/extras/regression-test.cxx')
-rw-r--r-- | sc/qa/extras/regression-test.cxx | 44 |
1 files changed, 4 insertions, 40 deletions
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); |