sw/qa/extras/ooxmlimport/ooxmlimport2.cxx |    3 ++-
 sw/qa/inc/swmodeltestbase.hxx             |    4 +++-
 sw/qa/unit/swmodeltestbase.cxx            |    6 ++++--
 sw/source/core/inc/bookmark.hxx           |    4 ++++
 4 files changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 3eac118b31ed569dbcec845fc32386ebd0022f73
Author:     Michael Stahl <[email protected]>
AuthorDate: Tue Feb 1 13:32:43 2022 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Tue Feb 1 21:40:21 2022 +0100

    sw: add note to DateFieldmark
    
    Change-Id: I50cc5fcc46e200116745cdfa1c3588436ac0aa46
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129288
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/sw/source/core/inc/bookmark.hxx b/sw/source/core/inc/bookmark.hxx
index ed7d5ad82180..f352eebadf77 100644
--- a/sw/source/core/inc/bookmark.hxx
+++ b/sw/source/core/inc/bookmark.hxx
@@ -301,6 +301,10 @@ namespace sw::mark {
         };
 
         /// Fieldmark representing a date form field.
+        /// TODO: this was an SDT in DOCX, which is modelled suboptimally here
+        /// as a fieldmark; as it cannot contain paragraph breaks, must be
+        /// well-formed XML element, and does not have field separator, it
+        /// should be a nesting text attribute similar to SwTextMeta.
         class DateFieldmark final
             : virtual public IDateFieldmark
             , public FieldmarkWithDropDownButton
commit b72fcad54b7346615f8b8e703e243b72e5cca9f9
Author:     Michael Stahl <[email protected]>
AuthorDate: Tue Feb 1 13:31:04 2022 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Tue Feb 1 21:40:05 2022 +0100

    sw: change test to check the text content instead of just the length
    
    Change-Id: I7a0abd1c7520b441b80ed4da11d3b50c2367cd69
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129287
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index bb677a125beb..f3eb3d4aad34 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -761,7 +761,8 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf126114)
     load(mpTestDocumentPath, "tdf126114.docx");
     // The problem was that after the drop-down form field, also the 
placeholder string
     // was imported as text. Beside the duplication of the field, it also 
caused a crash.
-    CPPUNIT_ASSERT_EQUAL(7, getLength());
+    // the word is from replacement of the drop-down field in ModelToViewHelper
+    CPPUNIT_ASSERT_EQUAL(OUString("gehuwd\n"), getBodyText());
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf127825)
diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx
index fc194c87c2a9..329a9a60b4d8 100644
--- a/sw/qa/inc/swmodeltestbase.hxx
+++ b/sw/qa/inc/swmodeltestbase.hxx
@@ -213,8 +213,10 @@ protected:
 
     void calcLayout();
 
-    /// Get the length of the whole document.
+    /// Get the length of the whole document. @deprecated why use this?
     int getLength() const;
+    /// Get the body text of the whole document.
+    OUString getBodyText() const;
 
     /// Get a family of styles, see com.sun.star.style.StyleFamilies for 
possible values.
     css::uno::Reference<css::container::XNameAccess> getStyles(const OUString& 
aFamily);
diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx
index ee35a1cc7259..e1b28153110f 100644
--- a/sw/qa/unit/swmodeltestbase.cxx
+++ b/sw/qa/unit/swmodeltestbase.cxx
@@ -172,7 +172,9 @@ void SwModelTestBase::calcLayout()
     pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
 }
 
-int SwModelTestBase::getLength() const
+int SwModelTestBase::getLength() const { return getBodyText().getLength(); }
+
+OUString SwModelTestBase::getBodyText() const
 {
     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, 
uno::UNO_QUERY);
     uno::Reference<container::XEnumerationAccess> 
xParaEnumAccess(xTextDocument->getText(),
@@ -190,7 +192,7 @@ int SwModelTestBase::getLength() const
             aBuf.append(xRange->getString());
         }
     }
-    return aBuf.getLength();
+    return aBuf.makeStringAndClear();
 }
 
 uno::Reference<container::XNameAccess> SwModelTestBase::getStyles(const 
OUString& aFamily)

Reply via email to