Kaydet (Commit) 27553fa0 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

correctly terminate cellproperties

üst 55abb2c6
...@@ -33,12 +33,17 @@ ...@@ -33,12 +33,17 @@
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp> #include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/table/XCellRange.hpp> #include <com/sun/star/table/XCellRange.hpp>
#include <com/sun/star/util/XCloseable.hpp>
namespace ScCellRangeBase { namespace ScCellRangeBase {
#define NUMBER_OF_TESTS 2
class ScCellProperties : public UnoApiTest class ScCellProperties : public UnoApiTest
{ {
uno::Reference < beans::XPropertySet > init(); public:
virtual void setUp();
virtual void tearDown();
void testVertJustify(); void testVertJustify();
void testRotateReference(); void testRotateReference();
...@@ -46,8 +51,18 @@ class ScCellProperties : public UnoApiTest ...@@ -46,8 +51,18 @@ class ScCellProperties : public UnoApiTest
CPPUNIT_TEST(testVertJustify); CPPUNIT_TEST(testVertJustify);
CPPUNIT_TEST(testRotateReference); CPPUNIT_TEST(testRotateReference);
CPPUNIT_TEST_SUITE_END(); 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() void ScCellProperties::testVertJustify()
{ {
uno::Reference< beans::XPropertySet > xCellRangeBase = init(); uno::Reference< beans::XPropertySet > xCellRangeBase = init();
...@@ -89,7 +104,6 @@ uno::Reference< beans::XPropertySet > ScCellProperties::init() ...@@ -89,7 +104,6 @@ uno::Reference< beans::XPropertySet > ScCellProperties::init()
rtl::OUString aFileURL; rtl::OUString aFileURL;
const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("xcellrangesquery.ods")); const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("xcellrangesquery.ods"));
createFileURL(aFileBase, aFileURL); createFileURL(aFileBase, aFileURL);
static uno::Reference< lang::XComponent > xComponent;
if( !xComponent.is()) if( !xComponent.is())
xComponent = loadFromDesktop(aFileURL); xComponent = loadFromDesktop(aFileURL);
uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW); uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW);
...@@ -109,6 +123,29 @@ uno::Reference< beans::XPropertySet > ScCellProperties::init() ...@@ -109,6 +123,29 @@ uno::Reference< beans::XPropertySet > ScCellProperties::init()
return xReturn; 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); CPPUNIT_TEST_SUITE_REGISTRATION(ScCellProperties);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment