sc/qa/uitest/autofilter2/tdf157476.py      |   54 +++++++++++++++++++++++++++++
 sc/qa/uitest/data/autofilter/tdf157476.ods |binary
 sc/source/core/data/documen4.cxx           |    6 ---
 sw/source/core/unocore/unostyle.cxx        |    4 +-
 4 files changed, 57 insertions(+), 7 deletions(-)

New commits:
commit a20cf841d0217e7a75e306ed97ac54da56c19bfd
Author:     Balazs Varga <[email protected]>
AuthorDate: Tue Dec 17 17:39:43 2024 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Thu Dec 19 17:16:38 2024 +0100

    tdf#157476 tdf#150861 - sc fix autoFilter is filtering incorrectly
    
    caused by rounding problem with duplicated values.
    
    We need to store the rounded values, based on the numberformat
    precision, otherwise later can cause problems at removing the duplicated
    values.
    
    Regression from: f6b143a57d9bd8f5d7b29febcb4e01ee1eb2ff1d
    
    Change-Id: I19f5248122ffca1e52adb96714df79dd9c64b23c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178683
    Tested-by: Gabor Kelemen <[email protected]>
    Reviewed-by: Balazs Varga <[email protected]>
    Tested-by: Jenkins
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178737
    (cherry picked from commit 97bab05d04393bf4f04ff4df17aac8b6843f1a85)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178793

diff --git a/sc/qa/uitest/autofilter2/tdf157476.py 
b/sc/qa/uitest/autofilter2/tdf157476.py
new file mode 100644
index 000000000000..557d9a73ab83
--- /dev/null
+++ b/sc/qa/uitest/autofilter2/tdf157476.py
@@ -0,0 +1,54 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# 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.common import get_state_as_dict, get_url_for_data_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import is_row_hidden
+
+class tdf157476(UITestCase):
+
+    def test_tdf157476(self):
+
+        with self.ui_test.load_file(get_url_for_data_file("tdf157476.ods")) as 
doc:
+
+            xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+            xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "0", "ROW": "0"}))
+            xFloatWindow = self.xUITest.getFloatWindow()
+
+            xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
+            xTreeList = xCheckListMenu.getChild("check_list_box")
+            self.assertEqual(6, len(xTreeList.getChildren()))
+
+            self.assertEqual("(empty)", 
get_state_as_dict(xTreeList.getChild('0'))['Text'])
+            self.assertEqual("0.32", 
get_state_as_dict(xTreeList.getChild('1'))['Text'])
+            self.assertEqual("0.65", 
get_state_as_dict(xTreeList.getChild('2'))['Text'])
+            self.assertEqual("1.33", 
get_state_as_dict(xTreeList.getChild('3'))['Text'])
+            self.assertEqual("2.00", 
get_state_as_dict(xTreeList.getChild('4'))['Text'])
+            self.assertEqual("3.00", 
get_state_as_dict(xTreeList.getChild('5'))['Text'])
+
+            xFirstEntry = xTreeList.getChild("0")
+            xFirstEntry.executeAction("CLICK", tuple())
+            xFirstEntry = xTreeList.getChild("2")
+            xFirstEntry.executeAction("CLICK", tuple())
+
+            xOkBtn = xFloatWindow.getChild("ok")
+            xOkBtn.executeAction("CLICK", tuple())
+
+            self.assertFalse(is_row_hidden(doc, 0))
+            self.assertFalse(is_row_hidden(doc, 1))
+            self.assertFalse(is_row_hidden(doc, 2))
+            self.assertFalse(is_row_hidden(doc, 3))
+            self.assertTrue(is_row_hidden(doc, 4))
+            self.assertFalse(is_row_hidden(doc, 5))
+            self.assertFalse(is_row_hidden(doc, 6))
+            self.assertTrue(is_row_hidden(doc, 7))
+            self.assertTrue(is_row_hidden(doc, 8))
+            self.assertTrue(is_row_hidden(doc, 9))
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/autofilter/tdf157476.ods 
b/sc/qa/uitest/data/autofilter/tdf157476.ods
new file mode 100644
index 000000000000..5b0a62a3fba2
Binary files /dev/null and b/sc/qa/uitest/data/autofilter/tdf157476.ods differ
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 077af2b64ecd..d161492e6538 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -686,11 +686,7 @@ double ScDocument::RoundValueAsShown( double fVal, 
sal_uInt32 nFormat, const ScI
             if (nPrecision == 
static_cast<short>(SvNumberFormatter::UNLIMITED_PRECISION))
                 return fVal;
         }
-        double fRound = ::rtl::math::round( fVal, nPrecision );
-        if ( ::rtl::math::approxEqual( fVal, fRound ) )
-            return fVal;        // rounding might introduce some error
-        else
-            return fRound;
+        return ::rtl::math::round( fVal, nPrecision );
     }
     else
         return fVal;
commit 0e3caf174a6a926d4780ac8abbad6f871c8faa75
Author:     Noel Grandin <[email protected]>
AuthorDate: Wed Dec 11 20:00:33 2024 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Thu Dec 19 17:16:26 2024 +0100

    fix ruby style name handling in SwXStyle::SetPropertyValue
    
    code dates back to
      commit 023a58b5fbbf3b30692f4b66d5f5b07c28270934
      Author: Oliver Specht <[email protected]>
      Date:   Mon Feb 19 07:04:57 2001 +0000
      ruby properties added
    Both the other places in sw/ that CharFormatName from
    SwFormatRuby expect it to be a UIName not a programmatic name.
    
    Change-Id: Ic02670f6c7ca7bacc6cd30cd48642f32eb9beb29
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178331
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>
    Reviewed-by: Noel Grandin <[email protected]>
    (cherry picked from commit f15c86221b41739a578c8a9b15046b20b43cb8c1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178342
    (cherry picked from commit baa997a412f1f87e4fe55af3927a685934dbcaba)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178803
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sw/source/core/unocore/unostyle.cxx 
b/sw/source/core/unocore/unostyle.cxx
index a6efe66e988a..45ba12a4e6fe 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1831,11 +1831,11 @@ void 
SwXStyle::SetPropertyValue<sal_uInt16(RES_TXTATR_CJK_RUBY)>(const SfxItemPr
         pRuby.reset(new SwFormatRuby(OUString()));
     OUString sStyle;
     SwStyleNameMapper::FillUIName(sValue, sStyle, SwGetPoolIdFromName::ChrFmt);
-    pRuby->SetCharFormatName(sValue);
+    pRuby->SetCharFormatName(sStyle);
     pRuby->SetCharFormatId(0);
     if(!sValue.isEmpty())
     {
-        const sal_uInt16 nId(SwStyleNameMapper::GetPoolIdFromUIName(sValue, 
SwGetPoolIdFromName::ChrFmt));
+        const sal_uInt16 nId(SwStyleNameMapper::GetPoolIdFromUIName(sStyle, 
SwGetPoolIdFromName::ChrFmt));
         pRuby->SetCharFormatId(nId);
     }
     rStyleSet.Put(std::move(pRuby));

Reply via email to