include/svl/zforlist.hxx               |    6 +++++-
 sc/qa/uitest/calc_tests/formatCells.py |    8 ++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

New commits:
commit db28a0cc2e11e1319509e13172fadf4b54d50ecf
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Jan 16 13:43:13 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Jan 17 21:06:59 2023 +0000

    tdf#153006 ordering of date/time formats in report builder
    
    regression from
        commit 17d2247a66b6a9e3105b0a8b8e6d6b5bea5e3ed4
        Author: Noel Grandin <noelgran...@gmail.com>
        Date:   Fri Aug 13 19:03:23 2021 +0200
        formatter maps can use unordered_map
    
    Change-Id: Ibc4bc71776a48c61fb9b651672404f9507c1f082
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145566
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
index 0020d8fde6a3..4159ce0fbebc 100644
--- a/include/svl/zforlist.hxx
+++ b/include/svl/zforlist.hxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/util/NumberFormat.hpp>
 #include <unotools/localedatawrapper.hxx>
 
+#include <map>
 #include <unordered_map>
 
 namespace com::sun::star::i18n { struct Currency; }
@@ -279,7 +280,10 @@ enum NfEvalDateFormat
 };
 
 
-typedef std::unordered_map<sal_uInt32, SvNumberformat*> SvNumberFormatTable;
+/// This table is std::map because it needs to preserve insertion order,
+/// because the formats are roughly ordered from most to least common, and some
+/// parts of the UI want to show them in that order.
+typedef std::map<sal_uInt32, SvNumberformat*> SvNumberFormatTable;
 typedef std::unordered_map<sal_uInt16, sal_uInt32> SvNumberFormatterIndexTable;
 typedef std::unordered_map< sal_uInt32, sal_uInt32> SvNumberFormatterMergeMap;
 
diff --git a/sc/qa/uitest/calc_tests/formatCells.py 
b/sc/qa/uitest/calc_tests/formatCells.py
index 2d9f369c3b59..16fb19c8cc18 100644
--- a/sc/qa/uitest/calc_tests/formatCells.py
+++ b/sc/qa/uitest/calc_tests/formatCells.py
@@ -420,22 +420,22 @@ class formatCell(UITestCase):
 
                 # NatNum12 number formats
 
-                entry = formatlb.getChild("6")
+                entry = formatlb.getChild("11")
                 self.assertEqual(get_state_as_dict(entry)["Text"], "ONE 
HUNDRED")
                 entry.executeAction("SELECT", tuple())
                 self.assertEqual(get_state_as_dict(xformatted)["Text"], 
"[NatNum12 upper cardinal]0")
 
-                entry = formatlb.getChild("7")
+                entry = formatlb.getChild("10")
                 self.assertEqual(get_state_as_dict(entry)["Text"], "One 
Hundred")
                 entry.executeAction("SELECT", tuple())
                 self.assertEqual(get_state_as_dict(xformatted)["Text"], 
"[NatNum12 title cardinal]0")
 
-                entry = formatlb.getChild("8")
+                entry = formatlb.getChild("9")
                 self.assertEqual(get_state_as_dict(entry)["Text"], "One 
hundred")
                 entry.executeAction("SELECT", tuple())
                 self.assertEqual(get_state_as_dict(xformatted)["Text"], 
"[NatNum12 capitalize cardinal]0")
 
-                entry = formatlb.getChild("9")
+                entry = formatlb.getChild("8")
                 self.assertEqual(get_state_as_dict(entry)["Text"], "one 
hundred")
                 entry.executeAction("SELECT", tuple())
                 self.assertEqual(get_state_as_dict(xformatted)["Text"], 
"[NatNum12 cardinal]0")

Reply via email to