sw/qa/core/fields/fields.cxx               |    4 ++--
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx |    4 ++--
 sw/qa/extras/rtfexport/rtfexport7.cxx      |    1 +
 3 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 0f9abf6a5f95dd48cb74cc6bbbadf319aab140fe
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Fri Apr 26 21:27:30 2024 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Thu May 9 18:51:38 2024 +0200

    document why GatherFields messes up sorted order
    
    Of course, UNO gets a list of fields through some esoteric
    broadcast system. This answers the big question in qa swfields
    about why the sorting order is stable, but wrong.
    
    An earlier version of the patchset has the code
    that would keep the sorted order for at least comments.
    But it isn't as efficient, and who knows what the implications
    would be, so I have no intention of making such a generic change.
    
    Change-Id: I178fdba7def8522ab5d94bdd61526af77f42c903
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166767
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sw/qa/core/fields/fields.cxx b/sw/qa/core/fields/fields.cxx
index b783dc0cf3e9..36a29551097b 100644
--- a/sw/qa/core/fields/fields.cxx
+++ b/sw/qa/core/fields/fields.cxx
@@ -101,7 +101,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf143424)
         xTextFieldsSupplier->getTextFields());
     uno::Reference<container::XEnumeration> 
xFields(xFieldsAccess->createEnumeration());
 
-    // TODO: I have no idea why fields are enumerated in invalid order, not 
like in document
+    // SwModify::Add() enumerates in invalid (mostly reverse) order, not like 
in document
 
     // Field: Chapter Format: Chapter name
     uno::Reference<text::XTextField> xField(xFields->nextElement(), 
uno::UNO_QUERY);
@@ -129,7 +129,7 @@ CPPUNIT_TEST_FIXTURE(Test, testChapterFieldsFollowedBy)
         xTextFieldsSupplier->getTextFields());
     uno::Reference<container::XEnumeration> 
xFields(xFieldsAccess->createEnumeration());
 
-    // TODO: I have no idea why fields are enumerated in invalid order, not 
like in document
+    // SwModify::Add() enumerates in invalid (mostly reverse) order, not like 
in document
     std::vector<OUString> aFieldValues = {
         "Followed by tab", // #1
         "I.I.I.I", // #16
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 74f83e105c67..ec07fb1124b1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -862,7 +862,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf148111, "tdf148111.docx")
     uno::Reference<container::XEnumeration> 
xFields(xFieldsAccess->createEnumeration());
     std::vector<OUString> aExpectedValues = {
         // These field values are NOT in order in document: getTextFields did 
provide
-        // fields in a strange but fixed order
+        // fields in a strange but fixed order (mostly reversed, thanks to 
SwModify::Add)
         "Title", "Placeholder", "Placeholder", "Placeholder",
         "Placeholder", "Placeholder", "Placeholder", "Placeholder",
         "Placeholder", "Placeholder", "Placeholder", "Placeholder",
@@ -972,7 +972,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf144563, "tdf144563.docx")
 
     std::vector<OUString> aExpectedValues = {
         // These field values are NOT in order in document: getTextFields did 
provide
-        // fields in a strange but fixed order
+        // fields in a strange but fixed order (mostly reversed, thanks to 
SwModify::Add)
         "1", "1", "1", "1", "1/", "1/", "1/", "1)", "1)", "1)", "1.)",
         "1.)", "1.)", "1..", "1..", "1..", "1.", "1.", "1.", "1", "1"
     };
diff --git a/sw/qa/extras/rtfexport/rtfexport7.cxx 
b/sw/qa/extras/rtfexport/rtfexport7.cxx
index 61c06869b9a8..d0803d6bcb74 100644
--- a/sw/qa/extras/rtfexport/rtfexport7.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport7.cxx
@@ -728,6 +728,7 @@ DECLARE_RTFEXPORT_TEST(testTdf156030, "tdf156030.rtf")
     uno::Reference<container::XEnumeration> 
xFields(xFieldsAccess->createEnumeration());
 
     // As usual, fields given by FieldsAccess are not in same order as in the 
document
+    // (mostly in reverse order, thanks to SwModify::Add)
     std::vector<std::vector<OUString>> aExpectedValues = {
         { "1 FORMULA 2", "true value 1", "false value 1" }, // #1, condition 
should be 1 = 2
         { "", "", "" }, // #9, not enough field params

Reply via email to