summaryrefslogtreecommitdiff
path: root/sc/qa/extras
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2016-11-10 19:11:07 +0000
committerMichael Meeks <michael.meeks@collabora.com>2016-11-11 15:41:33 +0000
commit99316fc0c830ae6c827d9b7f56bf057ff7731ed5 (patch)
tree5d47fc824f56e5521155edec2f6b1fea577b5992 /sc/qa/extras
parentb8fa4d1b2d135cabc9eb5162ca0c5af649f1cdaf (diff)
tdf#103632 - sc: OOB sort fields unit test.
Change-Id: I6734d51c8f9c4ca5a01c3e54a71f83ba15db508d Reviewed-on: https://gerrit.libreoffice.org/30761 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc/qa/extras')
-rw-r--r--sc/qa/extras/sccellrangeobj.cxx33
1 files changed, 32 insertions, 1 deletions
diff --git a/sc/qa/extras/sccellrangeobj.cxx b/sc/qa/extras/sccellrangeobj.cxx
index a81377e48eeb..12e2864212a5 100644
--- a/sc/qa/extras/sccellrangeobj.cxx
+++ b/sc/qa/extras/sccellrangeobj.cxx
@@ -17,13 +17,15 @@
#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/XSortable.hpp>
+#include <com/sun/star/util/SortField.hpp>
using namespace css;
using namespace css::uno;
namespace sc_apitest {
-#define NUMBER_OF_TESTS 14
+#define NUMBER_OF_TESTS 15
class ScCellRangeObj : public CalcUnoApiTest, public apitest::XCellRangesQuery, public apitest::CellProperties,
public apitest::XSearchable, public apitest::XReplaceable, public apitest::XCellRangeData
@@ -35,6 +37,8 @@ public:
virtual void tearDown() override;
virtual uno::Reference< uno::XInterface > init() override;
virtual uno::Reference< uno::XInterface > getXCellRangeData() override;
+ void testSortOOB();
+
CPPUNIT_TEST_SUITE(ScCellRangeObj);
CPPUNIT_TEST(testQueryColumnDifference);
@@ -52,6 +56,7 @@ public:
CPPUNIT_TEST(testCreateReplaceDescriptor);
CPPUNIT_TEST(testGetDataArray);
CPPUNIT_TEST(testSetDataArray);
+ CPPUNIT_TEST(testSortOOB);
CPPUNIT_TEST_SUITE_END();
private:
@@ -109,6 +114,32 @@ uno::Reference< uno::XInterface > ScCellRangeObj::getXCellRangeData()
return xReturn;
}
+void ScCellRangeObj::testSortOOB()
+{
+ uno::Reference<util::XSortable> xSortable(init(),UNO_QUERY_THROW);
+ try {
+ uno::Sequence<beans::PropertyValue> aEmptyDescriptor;
+ xSortable->sort(aEmptyDescriptor);
+ } catch (const uno::Exception &) {
+ CPPUNIT_FAIL("exception thrown during empty sort");
+ }
+
+ try {
+ uno::Sequence<beans::PropertyValue> aProps(1);
+ uno::Sequence<util::SortField> aSort(1);
+
+ aSort[0].Field = 0xffffff;
+ aSort[0].SortAscending = true;
+
+ aProps[0].Name = "SortFields";
+ aProps[0].Value = uno::makeAny(aSort);
+
+ xSortable->sort(aProps);
+ } catch (const uno::Exception &) {
+ CPPUNIT_FAIL("exception thrown during OOB sort");
+ }
+}
+
void ScCellRangeObj::setUp()
{
nTest++;