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

Tünde Tóth (via logerrit) logerrit at kemper.freedesktop.org
Fri May 21 16:04:59 UTC 2021


 sc/qa/uitest/autofilter/autofilter.py |   43 ++++++++++++++++++++++++++++++++++
 sc/source/ui/view/gridwin.cxx         |    9 ++++++-
 2 files changed, 51 insertions(+), 1 deletion(-)

New commits:
commit 45a49b7a1b552f204e7b417cfbe2d86e4b169993
Author:     Tünde Tóth <toth.tunde at nisz.hu>
AuthorDate: Tue May 18 15:41:51 2021 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Fri May 21 18:04:20 2021 +0200

    tdf#142350 sc AutoFilter: fix (empty) entry checking
    
    When a column was filtered for values that included 0,
    but not the (empty) entry, the (empty) entry also
    was checked in the Autofilter dropdown.
    
    Regression from commit 4fd1333ba4bb4f2311e9098291154772bd310429
    "tdf#140968 tdf#140978 XLSX import: fix lost rounded filters".
    
    Change-Id: Ic2595c707bd43f1a19c86d2ee796f06d9b1af1e3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115755
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py
index 7b1c043c67e2..00cfa6fbd9ba 100644
--- a/sc/qa/uitest/autofilter/autofilter.py
+++ b/sc/qa/uitest/autofilter/autofilter.py
@@ -366,5 +366,48 @@ class AutofilterTest(UITestCase):
         self.assertFalse(is_row_hidden(doc, 5))
         self.assertFalse(is_row_hidden(doc, 6))
 
+        self.ui_test.close_doc()
+
+    def test_tdf142350(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", "0")
+        enter_text_to_cell(gridwin, "A3", "")
+        enter_text_to_cell(gridwin, "A4", "1")
+
+        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
+
+        self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+
+        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")
+        xEntry = xList.getChild("2")
+        xEntry.executeAction("CLICK", tuple())
+
+        xOkButton = xFloatWindow.getChild("ok")
+        xOkButton.executeAction("CLICK", tuple())
+
+        self.assertFalse(is_row_hidden(document, 1))
+        self.assertTrue(is_row_hidden(document, 2))
+        self.assertFalse(is_row_hidden(document, 3))
+
+        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(3, len(xList.getChildren()))
+        self.assertEqual('true', get_state_as_dict(xList.getChild('0'))['IsChecked'])
+        self.assertEqual('true', get_state_as_dict(xList.getChild('1'))['IsChecked'])
+        self.assertEqual('false', get_state_as_dict(xList.getChild('2'))['IsChecked'])
+        xCloseButton = xFloatWindow.getChild("cancel")
+        xCloseButton.executeAction("CLICK", tuple())
+
         self.ui_test.close_doc()
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 0cd90461a37c..644feab4b654 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -684,7 +684,14 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow)
         const double aDoubleVal = rEntry.GetValue();
         bool bSelected = true;
         if (!aSelectedValue.empty() || !aSelectedString.empty())
-            bSelected = aSelectedValue.count(aDoubleVal) > 0 || aSelectedString.count(aStringVal) > 0;
+        {
+            if (aStringVal.isEmpty())
+                bSelected = aSelectedString.count(aStringVal) > 0;
+            else
+                bSelected
+                    = aSelectedValue.count(aDoubleVal) > 0 || aSelectedString.count(aStringVal) > 0;
+        }
+
         if ( rEntry.IsDate() )
             rControl.addDateMember( aStringVal, rEntry.GetValue(), bSelected );
         else


More information about the Libreoffice-commits mailing list