diff options
author | Jens Carl <j.carl43@gmx.de> | 2018-01-26 01:29:52 +0000 |
---|---|---|
committer | Jens Carl <j.carl43@gmx.de> | 2018-01-26 21:19:05 +0100 |
commit | 5236b8d72dba28cc23aad05e18741abe92f72f72 (patch) | |
tree | 6fb5298ccca8526196cbaaaa0f11b51075b59daf /sc | |
parent | 876164d2ebb654b525e4dcb49c61cf477d494ef5 (diff) |
Remove shared mxComponent in scannotationsobj
Change-Id: I630b0eb1eebd022588961546313da78ad642c630
Reviewed-on: https://gerrit.libreoffice.org/48649
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jens Carl <j.carl43@gmx.de>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/extras/scannotationsobj.cxx | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/sc/qa/extras/scannotationsobj.cxx b/sc/qa/extras/scannotationsobj.cxx index f4cb9c853fd7..b9f230316b71 100644 --- a/sc/qa/extras/scannotationsobj.cxx +++ b/sc/qa/extras/scannotationsobj.cxx @@ -20,8 +20,6 @@ using namespace css::uno; namespace sc_apitest { -#define NUMBER_OF_TESTS 4 - class ScAnnontationsObj : public CalcUnoApiTest, public apitest::XSheetAnnotations { public: @@ -34,19 +32,20 @@ public: virtual uno::Reference< sheet::XSheetAnnotations > getAnnotations(long nIndex) override; CPPUNIT_TEST_SUITE(ScAnnontationsObj); + + // XSheetAnnotations CPPUNIT_TEST(testInsertNew); CPPUNIT_TEST(testRemoveByIndex); CPPUNIT_TEST(testCount); CPPUNIT_TEST(testGetByIndex); + CPPUNIT_TEST_SUITE_END(); + private: - static sal_Int32 nTest; - static uno::Reference< lang::XComponent > mxComponent; + uno::Reference< lang::XComponent > mxComponent; }; -sal_Int32 ScAnnontationsObj::nTest = 0; -uno::Reference< lang::XComponent > ScAnnontationsObj::mxComponent; ScAnnontationsObj::ScAnnontationsObj() : CalcUnoApiTest("/sc/qa/extras/testdocuments") @@ -57,6 +56,8 @@ uno::Reference< sheet::XSheetAnnotations> ScAnnontationsObj::getAnnotations(long { // get the sheet uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc.is()); + uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW); uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(nIndex), UNO_QUERY_THROW); @@ -71,30 +72,22 @@ uno::Reference< sheet::XSheetAnnotations> ScAnnontationsObj::getAnnotations(long uno::Reference< uno::XInterface > ScAnnontationsObj::init() { - // get the test file - OUString aFileURL; - createFileURL("ScAnnotationObj.ods", aFileURL); - if(!mxComponent.is()) - mxComponent = loadFromDesktop(aFileURL); - CPPUNIT_ASSERT_MESSAGE("Component not loaded",mxComponent.is()); - return getAnnotations(0); } + void ScAnnontationsObj::setUp() { - nTest++; - CPPUNIT_ASSERT(nTest <= NUMBER_OF_TESTS); CalcUnoApiTest::setUp(); + + // get the test file + OUString aFileURL; + createFileURL("ScAnnotationObj.ods", aFileURL); + mxComponent = loadFromDesktop(aFileURL); } void ScAnnontationsObj::tearDown() { - if (nTest == NUMBER_OF_TESTS) - { - closeDocument(mxComponent); - mxComponent.clear(); - } - + closeDocument(mxComponent); CalcUnoApiTest::tearDown(); } |