summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-01-17 12:45:50 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-01-18 18:12:10 +0100
commit27553fa07e680edcdae68b40eba4fa201b6cdf59 (patch)
treee1f57d2ae94a58d4a9f9a0c964760c8c7d84fccb
parentcorrectly terminate tableautoformatfield (diff)
downloadcore-27553fa07e680edcdae68b40eba4fa201b6cdf59.tar.gz
core-27553fa07e680edcdae68b40eba4fa201b6cdf59.zip
correctly terminate cellproperties
-rw-r--r--sc/qa/extras/cellproperties.cxx41
1 files changed, 39 insertions, 2 deletions
diff --git a/sc/qa/extras/cellproperties.cxx b/sc/qa/extras/cellproperties.cxx
index 2f59002819a1..c86d33ad0c0d 100644
--- a/sc/qa/extras/cellproperties.cxx
+++ b/sc/qa/extras/cellproperties.cxx
@@ -33,12 +33,17 @@
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
namespace ScCellRangeBase {
+#define NUMBER_OF_TESTS 2
+
class ScCellProperties : public UnoApiTest
{
- uno::Reference < beans::XPropertySet > init();
+public:
+ virtual void setUp();
+ virtual void tearDown();
void testVertJustify();
void testRotateReference();
@@ -46,8 +51,18 @@ class ScCellProperties : public UnoApiTest
CPPUNIT_TEST(testVertJustify);
CPPUNIT_TEST(testRotateReference);
CPPUNIT_TEST_SUITE_END();
+
+private:
+ uno::Reference < beans::XPropertySet > init();
+
+ static int nTest;
+ static uno::Reference< lang::XComponent > xComponent;
};
+int ScCellProperties::nTest = 0;
+uno::Reference< lang::XComponent > ScCellProperties::xComponent;
+
+
void ScCellProperties::testVertJustify()
{
uno::Reference< beans::XPropertySet > xCellRangeBase = init();
@@ -89,7 +104,6 @@ uno::Reference< beans::XPropertySet > ScCellProperties::init()
rtl::OUString aFileURL;
const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("xcellrangesquery.ods"));
createFileURL(aFileBase, aFileURL);
- static uno::Reference< lang::XComponent > xComponent;
if( !xComponent.is())
xComponent = loadFromDesktop(aFileURL);
uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW);
@@ -109,6 +123,29 @@ uno::Reference< beans::XPropertySet > ScCellProperties::init()
return xReturn;
}
+void ScCellProperties::setUp()
+{
+ nTest += 1;
+ UnoApiTest::setUp();
+}
+
+void ScCellProperties::tearDown()
+{
+ if (nTest == NUMBER_OF_TESTS)
+ {
+ uno::Reference< util::XCloseable > xCloseable(xComponent, UNO_QUERY_THROW);
+ xCloseable->close( false );
+ }
+
+ UnoApiTest::tearDown();
+
+ if (nTest == NUMBER_OF_TESTS)
+ {
+ mxDesktop->terminate();
+ uno::Reference< lang::XComponent>(m_xContext, UNO_QUERY_THROW)->dispose();
+ }
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScCellProperties);
}