[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-1' - sc/inc sc/qa sc/source uitest/uitest

Balazs Varga (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 19 18:31:51 UTC 2021


 sc/inc/table.hxx                      |    2 -
 sc/qa/uitest/autofilter/autofilter.py |   40 +++++++++++++++++++++++++++++++++-
 sc/source/core/data/documen3.cxx      |    2 -
 sc/source/core/data/table3.cxx        |    4 +--
 sc/source/ui/dbgui/filtdlg.cxx        |    7 +----
 uitest/uitest/uihelper/common.py      |    3 ++
 6 files changed, 48 insertions(+), 10 deletions(-)

New commits:
commit f577f4a24e77920b2de19b72666c187abc8c75aa
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Tue May 25 18:23:16 2021 +0200
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Thu Aug 19 20:31:17 2021 +0200

    tdf#142402 sc UI: store formatted values in standard filter
    
    value list and filter by formatted values later, just like
    we do in the autofilter.
    
    Follow-up to commit 4fd1333ba4bb4f2311e9098291154772bd310429
    "tdf#140968 tdf#140978 XLSX import: fix lost rounded filters".
    
    Change-Id: If26f4c0abd54de05b497861f2c278972bd8072de
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116115
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 1f755525189884e4b2824889a6b9dea8933402db)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120721
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index a2cf2fe81268..561be59701b7 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -950,7 +950,7 @@ public:
     SCSIZE      Query(const ScQueryParam& rQueryParam, bool bKeepSub);
     bool        CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
 
-    void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, ScFilterEntries& rFilterEntries );
+    void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, ScFilterEntries& rFilterEntries, bool bFiltering = false);
     void GetFilteredFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, ScFilterEntries& rFilterEntries, bool bFiltering );
     [[nodiscard]]
     bool GetDataEntries(SCCOL nCol, SCROW nRow, std::set<ScTypedStrData>& rStrings, bool bLimit);
diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py
index b45fa0a5196b..76c1244342ff 100644
--- a/sc/qa/uitest/autofilter/autofilter.py
+++ b/sc/qa/uitest/autofilter/autofilter.py
@@ -6,7 +6,7 @@
 #
 
 from uitest.framework import UITestCase
-from uitest.uihelper.common import get_state_as_dict
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, select_by_text
 from libreoffice.uno.propertyvalue import mkPropertyValues
 from libreoffice.calc.document import get_row
 from uitest.uihelper.calc import enter_text_to_cell
@@ -434,4 +434,42 @@ class AutofilterTest(UITestCase):
         self.assertTrue(is_row_hidden(doc, 7))
         self.assertFalse(is_row_hidden(doc, 8))
 
+        self.ui_test.close_doc()
+
+    def test_tdf142402(self):
+        doc = self.ui_test.load_file(get_url_for_data_file("tdf140968.xlsx"))
+
+        xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+        xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+        xFloatWindow = self.xUITest.getFloatWindow()
+        #Choose Standard Filter... button
+        xMenu = xFloatWindow.getChild("menu")
+
+        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+        xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+
+        xDialog = self.xUITest.getTopFocusWindow()
+        xval1 = xDialog.getChild("val1")
+
+        select_by_text(xval1, "0.365")
+
+        xOKBtn = xDialog.getChild("ok")
+        self.ui_test.close_dialog_through_button(xOKBtn)
+
+        self.assertFalse(is_row_hidden(doc, 0))
+        self.assertFalse(is_row_hidden(doc, 1))
+        self.assertTrue(is_row_hidden(doc, 2))
+        self.assertTrue(is_row_hidden(doc, 3))
+        self.assertTrue(is_row_hidden(doc, 4))
+        self.assertTrue(is_row_hidden(doc, 5))
+        self.assertTrue(is_row_hidden(doc, 6))
+
+        self.ui_test.close_doc()
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 9d9fcc110ed8..32697751d728 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1601,7 +1601,7 @@ void ScDocument::GetFilterEntriesArea(
 {
     if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] )
     {
-        maTabs[nTab]->GetFilterEntries( nCol, nStartRow, nEndRow, rFilterEntries );
+        maTabs[nTab]->GetFilterEntries( nCol, nStartRow, nEndRow, rFilterEntries, true );
         sortAndRemoveDuplicates( rFilterEntries.maStrData, bCaseSens);
     }
 }
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index d94e6bf69703..d1c7b01419aa 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -3509,11 +3509,11 @@ bool ScTable::HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCR
     return false;
 }
 
-void ScTable::GetFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, ScFilterEntries& rFilterEntries )
+void ScTable::GetFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, ScFilterEntries& rFilterEntries, bool bFiltering )
 {
     sc::ColumnBlockConstPosition aBlockPos;
     aCol[nCol].InitBlockPosition(aBlockPos);
-    aCol[nCol].GetFilterEntries(aBlockPos, nRow1, nRow2, rFilterEntries, false);
+    aCol[nCol].GetFilterEntries(aBlockPos, nRow1, nRow2, rFilterEntries, bFiltering);
 }
 
 void ScTable::GetFilteredFilterEntries(
diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index 322c617aa2f9..546a4eab3f34 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -1100,11 +1100,8 @@ IMPL_LINK( ScFilterDlg, ValModifyHdl, weld::ComboBox&, rEd, void )
     {
         rItem.maString = pDoc->GetSharedStringPool().intern(aStrVal);
         rItem.mfVal = 0.0;
-
-        sal_uInt32 nIndex = 0;
-        bool bNumber = pDoc->GetFormatTable()->IsNumberFormat(
-            rItem.maString.getString(), nIndex, rItem.mfVal);
-        rItem.meType = bNumber ? ScQueryEntry::ByValue : ScQueryEntry::ByString;
+        rItem.meType = ScQueryEntry::ByString;
+        rItem.mbFormattedValue = true;
     }
 
     const sal_Int32 nField = pLbField->get_active();
diff --git a/uitest/uitest/uihelper/common.py b/uitest/uitest/uihelper/common.py
index 972452d6de07..32a74b046ab1 100644
--- a/uitest/uitest/uihelper/common.py
+++ b/uitest/uitest/uihelper/common.py
@@ -21,6 +21,9 @@ def select_pos(ui_object, pos):
 def select_text(ui_object, from_pos, to):
     ui_object.executeAction("SELECT", mkPropertyValues({"FROM": from_pos, "TO": to}))
 
+def select_by_text(ui_object, text):
+     ui_object.executeAction("SELECT", mkPropertyValues({"TEXT": text}))
+
 def get_url_for_data_file(file_name):
     return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
 


More information about the Libreoffice-commits mailing list