[Libreoffice-commits] core.git: Branch 'libreoffice-6-4-7' - sc/qa sc/source vcl/source

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 6 13:56:36 UTC 2020


 sc/qa/uitest/autofilter/autofilter.py |   28 ++++++++++++++++++++++++++++
 sc/source/ui/view/gridwin.cxx         |   19 ++++++++++++-------
 vcl/source/treelist/uiobject.cxx      |    1 +
 3 files changed, 41 insertions(+), 7 deletions(-)

New commits:
commit f68922349ee78a6a64c575e21fe323c442faa5da
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Sep 24 21:16:05 2020 +0200
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Tue Oct 6 15:56:01 2020 +0200

    tdf#134351: do not apply autofilter if all entries are selected
    
    Change-Id: I33cdfe07cc53b579bbe16486f302daf7bd3da841
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103352
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103569
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit 0d7bba4df1ebd80fa033116d73cbe8c6d3807d15)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103806
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
    Tested-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py
index 57504e66e8e9..e1aea9c1e303 100644
--- a/sc/qa/uitest/autofilter/autofilter.py
+++ b/sc/qa/uitest/autofilter/autofilter.py
@@ -8,6 +8,7 @@
 from uitest.framework import UITestCase
 from uitest.path import get_srcdir_url
 
+from uitest.uihelper.common import get_state_as_dict
 from libreoffice.uno.propertyvalue import mkPropertyValues
 from libreoffice.calc.document import get_row
 
@@ -70,4 +71,31 @@ class AutofilterTest(UITestCase):
         self.assertTrue(is_row_hidden(doc, 3))
         self.assertFalse(is_row_hidden(doc, 4))
 
+    def test_tdf134351(self):
+        doc = self.ui_test.load_file(get_url_for_data_file("autofilter.ods"))
+
+        xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+
+        xFloatWindow = self.xUITest.getFloatWindow()
+        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+
+        xTreeList = xCheckListMenu.getChild("check_list_box")
+
+        self.assertEqual(2, len(xTreeList.getChildren()))
+        self.assertTrue(get_state_as_dict(xTreeList.getChild('0'))['IsSelected'])
+        self.assertTrue(get_state_as_dict(xTreeList.getChild('1'))['IsSelected'])
+
+        xOkBtn = xFloatWindow.getChild("ok")
+        xOkBtn.executeAction("CLICK", tuple())
+
+        self.assertFalse(is_row_hidden(doc, 0))
+        # Without the fix in place, this test would have failed here
+        self.assertFalse(is_row_hidden(doc, 1))
+        self.assertFalse(is_row_hidden(doc, 2))
+        self.assertFalse(is_row_hidden(doc, 3))
+        self.assertFalse(is_row_hidden(doc, 4))
+
+        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 efe3054cdaef..6d2c4ea19106 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -804,13 +804,18 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode)
         if (aResult == aSaveAutoFilterResult)
         {
             SAL_INFO("sc.ui", "Apply autofilter to data when entries are the same");
-            // Apply autofilter to data
-            ScQueryEntry* pEntry = aParam.FindEntryByField(rPos.Col(), true);
-            pEntry->bDoQuery = true;
-            pEntry->nField = rPos.Col();
-            pEntry->eConnect = SC_AND;
-            pEntry->eOp = SC_EQUAL;
-            pViewData->GetView()->Query(aParam, nullptr, true);
+
+            if (!mpAutoFilterPopup->isAllSelected())
+            {
+                // Apply autofilter to data
+                ScQueryEntry* pEntry = aParam.FindEntryByField(rPos.Col(), true);
+                pEntry->bDoQuery = true;
+                pEntry->nField = rPos.Col();
+                pEntry->eConnect = SC_AND;
+                pEntry->eOp = SC_EQUAL;
+                pViewData->GetView()->Query(aParam, nullptr, true);
+            }
+
             return;
         }
     }
diff --git a/vcl/source/treelist/uiobject.cxx b/vcl/source/treelist/uiobject.cxx
index e5f166e8f1ce..6c4a4e15bda2 100644
--- a/vcl/source/treelist/uiobject.cxx
+++ b/vcl/source/treelist/uiobject.cxx
@@ -106,6 +106,7 @@ StringMap TreeListEntryUIObject::get_state()
     aMap["Text"] = mxTreeList->GetEntryText(mpEntry);
     aMap["Children"] = OUString::number(mxTreeList->GetLevelChildCount(mpEntry));
     aMap["VisibleChildCount"] = OUString::number(mxTreeList->GetVisibleChildCount(mpEntry));
+    aMap["IsSelected"] = OUString::boolean(mxTreeList->IsSelected(mpEntry));
 
     return aMap;
 }


More information about the Libreoffice-commits mailing list