summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.com>2016-03-19 01:23:07 +0530
committerJan Holesovsky <kendy@collabora.com>2016-03-21 09:11:26 +0000
commit3dbcae4df48426ec6115ce4d3b5fa2afad96226b (patch)
tree84094217ceab552f08222d2d058e91bec01217ac /sc/qa
parent4bf2b6b2e6641c82e2b714e394482f1a1620b436 (diff)
sc tiled rendering: Fix a corner case with shift modifier
With shift modifier, all rows/cols should get deselected upto the current cursor position from the last cursor position *if* the last cursor position *with* KEY_MOD1 resulted in a deselection of row or column. Added a unit test to support this. Change-Id: I7b338ca52505d59480209802ee65a6d64b0ac67d Reviewed-on: https://gerrit.libreoffice.org/23364 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx28
1 files changed, 26 insertions, 2 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 539fe188ef99..574723e6a9a3 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -213,8 +213,32 @@ void ScTiledRenderingTest::testRowColumnSelections()
// TODO check that we really selected what we wanted here
- // TODO: Add test for negative selection: .uno:SelectRow/Column on already
- // selected row/column should deselect it.
+ // Test for deselection of already selected rows
+ // First Deselect Row 13 because copy doesn't work for multiple selections
+ aArgs[0].Name = OUString::fromUtf8("Row");
+ aArgs[0].Value <<= static_cast<sal_Int32>(13 - 1);
+ aArgs[1].Name = OUString::fromUtf8("Modifier");
+ aArgs[1].Value <<= static_cast<sal_uInt16>(KEY_MOD1);
+ comphelper::dispatchCommand(".uno:SelectRow", aArgs);
+
+ // Deselect row 10
+ aArgs[0].Name = OUString::fromUtf8("Row");
+ aArgs[0].Value <<= static_cast<sal_Int32>(10 - 1);
+ aArgs[1].Name = OUString::fromUtf8("Modifier");
+ aArgs[1].Value <<= static_cast<sal_uInt16>(KEY_MOD1);
+ comphelper::dispatchCommand(".uno:SelectRow", aArgs);
+
+ // Click at row 6 holding shift
+ aArgs[0].Name = OUString::fromUtf8("Row");
+ aArgs[0].Value <<= static_cast<sal_Int32>(6 - 1);
+ aArgs[1].Name = OUString::fromUtf8("Modifier");
+ aArgs[1].Value <<= static_cast<sal_uInt16>(KEY_SHIFT);
+ comphelper::dispatchCommand(".uno:SelectRow", aArgs);
+
+ // only row 5 should remain selected
+ aResult = pModelObj->getTextSelection("text/plain;charset=utf-8", aUsedMimeType);
+ aExpected = "1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n";
+ CPPUNIT_ASSERT_EQUAL(aExpected, aResult);
comphelper::LibreOfficeKit::setActive(false);
}