summaryrefslogtreecommitdiffstats
path: root/sc/qa
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-01-14 03:09:26 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-01-15 04:05:21 +0100
commitf7b470f885c8648bb95418c9a6cf46b907066bcb (patch)
tree622f44e4e5631ef2a24d1483bce0c2ceb7968413 /sc/qa
parentdon't create lock files for unit tests (diff)
downloadcore-f7b470f885c8648bb95418c9a6cf46b907066bcb.tar.gz
core-f7b470f885c8648bb95418c9a6cf46b907066bcb.zip
correctly terminate XDataPilotFieldGrouping
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/extras/xdatapilotfieldgrouping.cxx38
1 files changed, 37 insertions, 1 deletions
diff --git a/sc/qa/extras/xdatapilotfieldgrouping.cxx b/sc/qa/extras/xdatapilotfieldgrouping.cxx
index 938f7f2f1b7f..4ee9a1c37028 100644
--- a/sc/qa/extras/xdatapilotfieldgrouping.cxx
+++ b/sc/qa/extras/xdatapilotfieldgrouping.cxx
@@ -34,16 +34,23 @@
#include <com/sun/star/sheet/XDataPilotDescriptor.hpp>
#include <com/sun/star/sheet/XDataPilotFieldGrouping.hpp>
#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
#include <rtl/oustringostreaminserter.hxx>
namespace ScDataPilotFieldObj {
+#define NUMBER_OF_TESTS 1
+
class ScXDataPilotFieldGrouping : public UnoApiTest
{
+public:
void testCreateNameGroup();
void testCreateDateGroup();
+ virtual void setUp();
+ virtual void tearDown();
+
CPPUNIT_TEST_SUITE(ScXDataPilotFieldGrouping);
CPPUNIT_TEST(testCreateNameGroup);
//broken: fdo#43609
@@ -51,8 +58,15 @@ class ScXDataPilotFieldGrouping : public UnoApiTest
CPPUNIT_TEST_SUITE_END();
uno::Reference< sheet::XDataPilotFieldGrouping > init();
+
+private:
+ static int nTest;
+ static uno::Reference< lang::XComponent > xComponent;
};
+int ScXDataPilotFieldGrouping::nTest = 0;
+uno::Reference< lang::XComponent > ScXDataPilotFieldGrouping::xComponent;
+
void ScXDataPilotFieldGrouping::testCreateNameGroup()
{
uno::Reference< sheet::XDataPilotFieldGrouping > xDataPilotFieldGrouping = init();
@@ -79,7 +93,6 @@ uno::Reference< sheet::XDataPilotFieldGrouping> ScXDataPilotFieldGrouping::init(
const rtl::OUString aFileBase(RTL_CONSTASCII_USTRINGPARAM("scdatapilotfieldobj.ods"));
createFileURL(aFileBase, aFileURL);
std::cout << rtl::OUStringToOString(aFileURL, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
- static uno::Reference< lang::XComponent > xComponent;
if( !xComponent.is())
xComponent = loadFromDesktop(aFileURL);
uno::Reference< sheet::XSpreadsheetDocument> xDoc (xComponent, UNO_QUERY_THROW);
@@ -106,6 +119,29 @@ uno::Reference< sheet::XDataPilotFieldGrouping> ScXDataPilotFieldGrouping::init(
return xReturnValue;
}
+void ScXDataPilotFieldGrouping::setUp()
+{
+ nTest += 1;
+ UnoApiTest::setUp();
+}
+
+void ScXDataPilotFieldGrouping::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(ScXDataPilotFieldGrouping);
}