[Libreoffice-commits] core.git: sc/qa sc/source
Tünde Tóth (via logerrit)
logerrit at kemper.freedesktop.org
Fri Apr 30 13:09:13 UTC 2021
sc/qa/uitest/autofilter/tdf141946.py | 75 +++++++++++++++++++++++++++++++++++
sc/source/core/tool/dbdata.cxx | 10 ++--
2 files changed, 80 insertions(+), 5 deletions(-)
New commits:
commit 4b8459e86c7a411d8f02fc5480033cb031a941f2
Author: Tünde Tóth <toth.tunde at nisz.hu>
AuthorDate: Thu Apr 29 14:46:25 2021 +0200
Commit: Balazs Varga <varga.balazs3 at nisz.hu>
CommitDate: Fri Apr 30 15:08:34 2021 +0200
tdf#141946 sc: fix broken filter criteria when inserting column
The autofilter criteria weren't remain with the filtered column
when we inserted a column left of the filtered column.
Change-Id: If366d9de9518da3d13ec2ba6b1b36e4f98c76019
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114881
Tested-by: Jenkins
Reviewed-by: Balazs Varga <varga.balazs3 at nisz.hu>
diff --git a/sc/qa/uitest/autofilter/tdf141946.py b/sc/qa/uitest/autofilter/tdf141946.py
new file mode 100644
index 000000000000..4e45ecfb7d5a
--- /dev/null
+++ b/sc/qa/uitest/autofilter/tdf141946.py
@@ -0,0 +1,75 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.calc import enter_text_to_cell
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+#Bug 141946 - EDITING Inserting column before autofiltered column empties autofilter
+
+class tdf141946(UITestCase):
+ def test_tdf141946_inserted_column(self):
+ self.ui_test.create_doc_in_start_center("calc")
+ document = self.ui_test.get_component()
+ calcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = calcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ enter_text_to_cell(gridwin, "A1", "A")
+ enter_text_to_cell(gridwin, "A2", "1")
+ enter_text_to_cell(gridwin, "A3", "2")
+ enter_text_to_cell(gridwin, "A4", "3")
+
+ enter_text_to_cell(gridwin, "B1", "B")
+ enter_text_to_cell(gridwin, "B2", "4")
+ enter_text_to_cell(gridwin, "B3", "5")
+ enter_text_to_cell(gridwin, "B4", "6")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B4"}))
+
+ self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+
+ gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xList = xCheckListMenu.getChild("check_list_box")
+ xEntry = xList.getChild("1")
+ xEntry.executeAction("CLICK", tuple())
+
+ xOkButton = xFloatWindow.getChild("ok")
+ xOkButton.executeAction("CLICK", tuple())
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
+
+ self.xUITest.executeCommand(".uno:InsertColumnsBefore")
+
+ gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xList = xCheckListMenu.getChild("check_list_box")
+ self.assertEqual(2, len(xList.getChildren()))
+ xCloseBtn = xFloatWindow.getChild("cancel")
+ xCloseBtn.executeAction("CLICK", tuple())
+
+ gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xList = xCheckListMenu.getChild("check_list_box")
+ self.assertEqual(1, len(xList.getChildren()))
+ xCloseBtn = xFloatWindow.getChild("cancel")
+ xCloseBtn.executeAction("CLICK", tuple())
+
+ gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xList = xCheckListMenu.getChild("check_list_box")
+ self.assertEqual(3, len(xList.getChildren()))
+ xCloseBtn = xFloatWindow.getChild("cancel")
+ xCloseBtn.executeAction("CLICK", tuple())
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index d7a8f4dd5297..ba68d1aa0d8a 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -366,8 +366,8 @@ void ScDBData::MoveTo(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW n
ScQueryEntry& rEntry = mpQueryParam->GetEntry(i);
rEntry.nField += nDifX;
- // tdf#48025 update the column index of the filter criteria,
- // when the deleted columns are inside the data range
+ // tdf#48025, tdf#141946: update the column index of the filter criteria,
+ // when the deleted/inserted columns are inside the data range
if (nUpdateCol != -1)
{
nUpdateCol += nDifX;
@@ -610,9 +610,9 @@ void ScDBData::UpdateReference(const ScDocument* pDoc, UpdateRefMode eUpdateRefM
AdjustTableColumnNames( eUpdateRefMode, nDx, nCol1, nOldCol1, nOldCol2, theCol1, theCol2);
::std::vector<OUString> aNames( maTableColumnNames);
bool bTableColumnNamesDirty = mbTableColumnNamesDirty;
- // tdf#48025 update the column index of the filter criteria,
- // when the deleted columns are inside the data range
- if (HasAutoFilter() && theCol1 - nOldCol1 > theCol2 - nOldCol2)
+ // tdf#48025, tdf#141946: update the column index of the filter criteria,
+ // when the deleted/inserted columns are inside the data range
+ if (HasAutoFilter() && theCol1 - nOldCol1 != theCol2 - nOldCol2)
MoveTo(theTab1, theCol1, theRow1, theCol2, theRow2, nCol1);
else
MoveTo( theTab1, theCol1, theRow1, theCol2, theRow2 );
More information about the Libreoffice-commits
mailing list