diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-02-10 17:51:33 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-02-10 19:19:30 +0100 |
commit | 82e349fd80671f7dabe9dd7a22e4711696300082 (patch) | |
tree | 2514e7d38b5e3707028b78a4787698258e84e19b | |
parent | c1589dbd450426928077694346b773b718e6ff78 (diff) |
add XDataPilotTable2 test to ScDatPilotTableObj
-rw-r--r-- | sc/qa/extras/scdatapilottableobj.cxx | 37 | ||||
-rw-r--r-- | test/inc/test/sheet/xdatapilottable2.hxx | 4 | ||||
-rw-r--r-- | test/source/sheet/xdatapilottable2.cxx | 1 |
3 files changed, 39 insertions, 3 deletions
diff --git a/sc/qa/extras/scdatapilottableobj.cxx b/sc/qa/extras/scdatapilottableobj.cxx index 0d1cf40a37f7..6fedec073c6f 100644 --- a/sc/qa/extras/scdatapilottableobj.cxx +++ b/sc/qa/extras/scdatapilottableobj.cxx @@ -28,6 +28,7 @@ #include <test/unoapi_test.hxx> #include <test/sheet/xdatapilottable.hxx> +#include <test/sheet/xdatapilottable2.hxx> #include <test/sheet/xdatapilotdescriptor.hxx> #include <test/container/xnamed.hxx> @@ -39,10 +40,10 @@ namespace sc_apitest { -#define NUMBER_OF_TESTS 12 +#define NUMBER_OF_TESTS 13 class ScDataPilotTableObj : public UnoApiTest, apitest::XDataPilotDescriptor, apitest::XDataPilotTable, - apitest::XNamed + apitest::XNamed, apitest::XDataPilotTable2 { public: ScDataPilotTableObj(); @@ -50,6 +51,7 @@ public: virtual void setUp(); virtual void tearDown(); virtual uno::Reference< uno::XInterface > init(); + virtual uno::Reference< uno::XInterface > initDP2(); CPPUNIT_TEST_SUITE(ScDataPilotTableObj); CPPUNIT_TEST(testRefresh); @@ -65,6 +67,7 @@ public: CPPUNIT_TEST(testGetDataFields); CPPUNIT_TEST(testGetName); CPPUNIT_TEST(testSetName); + CPPUNIT_TEST(testGetDrillDownData); CPPUNIT_TEST_SUITE_END(); private: @@ -111,6 +114,36 @@ uno::Reference< uno::XInterface > ScDataPilotTableObj::init() return xDPTable; } +uno::Reference< uno::XInterface > ScDataPilotTableObj::initDP2() +{ + rtl::OUString aFileURL; + createFileURL(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScDataPilotTableObj.ods")), aFileURL); + if(!mxComponent.is()) + mxComponent = loadFromDesktop(aFileURL); + CPPUNIT_ASSERT(mxComponent.is()); + + uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW); + uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW); + uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW); + + // set variables from xdatapilottable.[ch]xx + xCellForChange = xSheet->getCellByPosition( 1, 5 ); + xCellForCheck = xSheet->getCellByPosition( 7, 11 ); + CPPUNIT_ASSERT(xCellForCheck.is()); + CPPUNIT_ASSERT(xCellForChange.is()); + + CPPUNIT_ASSERT_MESSAGE("Could not create interface of type XSpreadsheet", xSheet.is()); + uno::Reference< sheet::XDataPilotTablesSupplier > xDPTS(xSheet, UNO_QUERY_THROW); + CPPUNIT_ASSERT(xDPTS.is()); + uno::Reference< sheet::XDataPilotTables > xDPT = xDPTS->getDataPilotTables(); + CPPUNIT_ASSERT(xDPT.is()); + + uno::Reference< sheet::XDataPilotTable > xDPTable(xDPT->getByName(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DataPilotTable2"))),UNO_QUERY_THROW); + + CPPUNIT_ASSERT(xDPTable.is()); + return xDPTable; +} + void ScDataPilotTableObj::setUp() { nTest++; diff --git a/test/inc/test/sheet/xdatapilottable2.hxx b/test/inc/test/sheet/xdatapilottable2.hxx index 436376bdf558..e81de869c382 100644 --- a/test/inc/test/sheet/xdatapilottable2.hxx +++ b/test/inc/test/sheet/xdatapilottable2.hxx @@ -31,6 +31,8 @@ #include <com/sun/star/table/CellAddress.hpp> #include <com/sun/star/sheet/XDataPilotTable2.hpp> +#include "test/testdllapi.hxx" + using namespace com::sun::star; #include <vector> @@ -39,7 +41,7 @@ using namespace com::sun::star; namespace apitest { -class XDataPilotTable2 +class OOO_DLLPUBLIC_TEST XDataPilotTable2 { public: void testGetPositionData(); diff --git a/test/source/sheet/xdatapilottable2.cxx b/test/source/sheet/xdatapilottable2.cxx index 57b111de885a..b707146950a0 100644 --- a/test/source/sheet/xdatapilottable2.cxx +++ b/test/source/sheet/xdatapilottable2.cxx @@ -80,6 +80,7 @@ void XDataPilotTable2::testGetDrillDownData() } } + std::cout << "Sum: " << sum << "; nVal: " << nVal << std::endl; CPPUNIT_ASSERT(sum == nVal); } |