[Libreoffice-commits] core.git: sc/qa sc/source

Pranav Kant pranavk at collabora.com
Mon Mar 21 09:11:55 UTC 2016


 sc/qa/unit/tiledrendering/tiledrendering.cxx |   28 +++++++++++++++++++++++++--
 sc/source/ui/view/tabview3.cxx               |   18 +++++------------
 2 files changed, 32 insertions(+), 14 deletions(-)

New commits:
commit 3dbcae4df48426ec6115ce4d3b5fa2afad96226b
Author: Pranav Kant <pranavk at collabora.com>
Date:   Sat Mar 19 01:23:07 2016 +0530

    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 at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 539fe18..574723e 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);
 }
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index a5db784..cca5f6c 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1414,17 +1414,14 @@ void ScTabView::MarkColumns(SCCOL nCol, sal_Int16 nModifier)
 {
     SCCOL nStartCol = nCol;
     SCTAB nTab = aViewData.GetTabNo();
-    bool bTestNeg = true;
 
     if ((nModifier & KEY_SHIFT) == KEY_SHIFT)
-    {
-        nStartCol = aViewData.GetCurX();
-        bTestNeg = false;
-    }
+        bMoveIsShift = true;
 
     DoneBlockMode( nModifier != 0 );
-    InitBlockMode( nStartCol, 0, nTab, bTestNeg, true );
+    InitBlockMode( nStartCol, 0, nTab, true, true);
     MarkCursor( nCol, MAXROW, nTab );
+    bMoveIsShift = false;
     SetCursor( nCol, 0 );
     SelectionChanged();
 }
@@ -1433,17 +1430,14 @@ void ScTabView::MarkRows(SCROW nRow, sal_Int16 nModifier)
 {
     SCROW nStartRow = nRow;
     SCTAB nTab = aViewData.GetTabNo();
-    bool bTestNeg = true;
 
     if ((nModifier & KEY_SHIFT) == KEY_SHIFT)
-    {
-        nStartRow = aViewData.GetCurY();
-        bTestNeg = false;
-    }
+        bMoveIsShift = true;
 
     DoneBlockMode( nModifier != 0 );
-    InitBlockMode( 0, nStartRow, nTab, bTestNeg, false, true );
+    InitBlockMode( 0, nStartRow, nTab, true, false, true );
     MarkCursor( MAXCOL, nRow, nTab );
+    bMoveIsShift = false;
     SetCursor( 0, nRow );
     SelectionChanged();
 }


More information about the Libreoffice-commits mailing list