summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorJens Carl <j.carl43@gmx.de>2017-10-29 06:24:22 +0000
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-10-29 23:45:34 +0100
commitbbfec269bda9906eae66b207987d53bbea969eec (patch)
tree3ec79cc3da81129f9c5b133e62332103c6c6722c /sc/qa
parentba93d6aeb73cba64f037a0bd88d96fedb90f3f2f (diff)
tdf#45904: Move Java _XSheetFilterable test to C++
Change-Id: Ib94aeb98c9c659118800b2dcc327c44a77d5fcc6 Reviewed-on: https://gerrit.libreoffice.org/44019 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/extras/sccellcursorobj.cxx8
-rw-r--r--sc/qa/extras/sccellrangeobj.cxx32
-rw-r--r--sc/qa/extras/sctablesheetobj.cxx8
3 files changed, 41 insertions, 7 deletions
diff --git a/sc/qa/extras/sccellcursorobj.cxx b/sc/qa/extras/sccellcursorobj.cxx
index 517d4ca41131..7bfd2dcc3060 100644
--- a/sc/qa/extras/sccellcursorobj.cxx
+++ b/sc/qa/extras/sccellcursorobj.cxx
@@ -9,6 +9,7 @@
#include <test/calc_unoapi_test.hxx>
#include <test/sheet/xcellseries.hxx>
+#include <test/sheet/xsheetfilterable.hxx>
#include <test/sheet/xsheetoperation.hxx>
#include <test/sheet/xsubtotalcalculatable.hxx>
#include <test/sheet/xusedareacursor.hxx>
@@ -23,9 +24,10 @@ using namespace css::uno;
namespace sc_apitest {
-#define NUMBER_OF_TESTS 9
+#define NUMBER_OF_TESTS 11
class ScCellCursorObj : public CalcUnoApiTest, public apitest::XCellSeries,
+ public apitest::XSheetFilterable,
public apitest::XSheetOperation,
public apitest::XSubTotalCalculatable,
public apitest::XUsedAreaCursor,
@@ -49,6 +51,10 @@ public:
CPPUNIT_TEST(testFillAuto);
CPPUNIT_TEST(testFillSeries);
+ // XSheetFilterable
+ CPPUNIT_TEST(testCreateFilterDescriptor);
+ CPPUNIT_TEST(testFilter);
+
// XSheetOperation
CPPUNIT_TEST(testComputeFunction);
CPPUNIT_TEST(testClearContents);
diff --git a/sc/qa/extras/sccellrangeobj.cxx b/sc/qa/extras/sccellrangeobj.cxx
index ad6df24af046..66489225af1e 100644
--- a/sc/qa/extras/sccellrangeobj.cxx
+++ b/sc/qa/extras/sccellrangeobj.cxx
@@ -12,6 +12,7 @@
#include <test/sheet/xcellrangedata.hxx>
#include <test/sheet/xcellrangesquery.hxx>
#include <test/sheet/xcellseries.hxx>
+#include <test/sheet/xsheetfilterable.hxx>
#include <test/sheet/xsheetoperation.hxx>
#include <test/sheet/xsubtotalcalculatable.hxx>
#include <test/sheet/xuniquecellformatrangessupplier.hxx>
@@ -25,12 +26,22 @@
#include <com/sun/star/util/SortField.hpp>
#include <comphelper/propertysequence.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sheet/FilterOperator.hpp>
+#include <com/sun/star/sheet/TableFilterField.hpp>
+#include <com/sun/star/sheet/XSheetFilterable.hpp>
+#include <com/sun/star/sheet/XSheetFilterDescriptor.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/table/XColumnRowRange.hpp>
+#include <com/sun/star/table/XTableRows.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
using namespace css;
using namespace css::uno;
namespace sc_apitest {
-#define NUMBER_OF_TESTS 22
+#define NUMBER_OF_TESTS 24
class ScCellRangeObj : public CalcUnoApiTest, public apitest::CellProperties,
public apitest::XCellRangeData,
@@ -38,6 +49,7 @@ class ScCellRangeObj : public CalcUnoApiTest, public apitest::CellProperties,
public apitest::XCellSeries,
public apitest::XReplaceable,
public apitest::XSearchable,
+ public apitest::XSheetFilterable,
public apitest::XSheetOperation,
public apitest::XSubTotalCalculatable,
public apitest::XUniqueCellFormatRangesSupplier
@@ -97,6 +109,10 @@ public:
CPPUNIT_TEST(testCreateSubTotalDescriptor);
CPPUNIT_TEST(testApplyRemoveSubTotals);
+ // XSheetFilterable (has to be last tests; otherwise it'll crash)
+ CPPUNIT_TEST(testCreateFilterDescriptor);
+ CPPUNIT_TEST(testFilter);
+
CPPUNIT_TEST_SUITE_END();
private:
@@ -121,9 +137,11 @@ uno::Reference< uno::XInterface > ScCellRangeObj::init()
const OUString aFileBase("xcellrangesquery.ods");
createFileURL(aFileBase, aFileURL);
std::cout << OUStringToOString(aFileURL, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
- if( !mxComponent.is())
+ if (!mxComponent.is())
mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
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(0), UNO_QUERY_THROW);
@@ -141,11 +159,13 @@ uno::Reference< uno::XInterface > ScCellRangeObj::getXSpreadsheet()
const OUString aFileBase("xcellrangesquery.ods");
createFileURL(aFileBase, aFileURL);
std::cout << OUStringToOString(aFileURL, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
- if( !mxComponent.is())
+ if (!mxComponent.is())
mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
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(0), UNO_QUERY_THROW);
+ uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(0), UNO_QUERY_THROW);
return xSheet;
}
@@ -156,9 +176,11 @@ uno::Reference< uno::XInterface > ScCellRangeObj::getXCellRangeData()
const OUString aFileBase("xcellrangesquery.ods");
createFileURL(aFileBase, aFileURL);
std::cout << OUStringToOString(aFileURL, RTL_TEXTENCODING_UTF8).getStr() << std::endl;
- if( !mxComponent.is())
+ if (!mxComponent.is())
mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
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(1), UNO_QUERY_THROW);
diff --git a/sc/qa/extras/sctablesheetobj.cxx b/sc/qa/extras/sctablesheetobj.cxx
index 277cd54cbddf..d13564d137c3 100644
--- a/sc/qa/extras/sctablesheetobj.cxx
+++ b/sc/qa/extras/sctablesheetobj.cxx
@@ -10,6 +10,7 @@
#include <test/calc_unoapi_test.hxx>
#include <test/sheet/xcellseries.hxx>
#include <test/sheet/xprintareas.hxx>
+#include <test/sheet/xsheetfilterable.hxx>
#include <test/sheet/xsheetlinkable.hxx>
#include <test/sheet/xsheetoperation.hxx>
#include <test/sheet/xsheetpagebreak.hxx>
@@ -28,12 +29,13 @@ using namespace css::uno;
namespace sc_apitest
{
-#define NUMBER_OF_TESTS 20
+#define NUMBER_OF_TESTS 22
class ScTableSheetObj : public CalcUnoApiTest, public apitest::XCellSeries,
public apitest::XPrintAreas,
public apitest::XReplaceable,
public apitest::XSearchable,
+ public apitest::XSheetFilterable,
public apitest::XSheetLinkable,
public apitest::XSheetOperation,
public apitest::XSheetPageBreak,
@@ -71,6 +73,10 @@ public:
CPPUNIT_TEST(testFindNext);
CPPUNIT_TEST(testFindFirst);
+ // XSheetFilterable
+ CPPUNIT_TEST(testCreateFilterDescriptor);
+ CPPUNIT_TEST(testFilter);
+
// XSheetLinkable
CPPUNIT_TEST(testSheetLinkable);