sw/qa/extras/rtfexport/rtfexport2.cxx |   21 +++++++++++++++------
 sw/qa/inc/swmodeltestbase.hxx         |    2 --
 sw/qa/unit/swmodeltestbase.cxx        |    2 --
 3 files changed, 15 insertions(+), 10 deletions(-)

New commits:
commit 9d149e296525d0ba8e3f4f60bb1beaaa96d7adaa
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Wed Jan 10 08:10:30 2024 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Jan 10 09:01:56 2024 +0100

    sw: remove deprecated SwModelTestBase::getLength()
    
    Better to check the body text, not just the length.
    
    Change-Id: Ic40f770fff8e27594a6bdb87ce105aeeddf3f14d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161872
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/rtfexport/rtfexport2.cxx 
b/sw/qa/extras/rtfexport/rtfexport2.cxx
index fdf584e942aa..8e82062cfd41 100644
--- a/sw/qa/extras/rtfexport/rtfexport2.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport2.cxx
@@ -93,9 +93,15 @@ DECLARE_RTFEXPORT_TEST(testN192129, "n192129.rtf")
     }
 }
 
-DECLARE_RTFEXPORT_TEST(testFdo45543, "fdo45543.rtf") { CPPUNIT_ASSERT_EQUAL(5, 
getLength()); }
+DECLARE_RTFEXPORT_TEST(testFdo45543, "fdo45543.rtf")
+{
+    CPPUNIT_ASSERT_EQUAL(u"この文書は"_ustr, getBodyText());
+}
 
-DECLARE_RTFEXPORT_TEST(testFdo42465, "fdo42465.rtf") { CPPUNIT_ASSERT_EQUAL(3, 
getLength()); }
+DECLARE_RTFEXPORT_TEST(testFdo42465, "fdo42465.rtf")
+{
+    CPPUNIT_ASSERT_EQUAL(u"kód"_ustr, getBodyText());
+}
 
 DECLARE_RTFEXPORT_TEST(testFdo45187, "fdo45187.rtf")
 {
@@ -185,8 +191,8 @@ DECLARE_RTFEXPORT_TEST(testFdo79384, "fdo79384.rtf")
 
 DECLARE_RTFEXPORT_TEST(testFdo47326, "fdo47326.rtf")
 {
-    // This was 15 only, as \super buffered text, then the contents of it got 
lost.
-    CPPUNIT_ASSERT_EQUAL(19, getLength());
+    // Length was 15 only, as \super buffered text, then the contents of it 
got lost.
+    CPPUNIT_ASSERT_EQUAL(u"Windows®XP: Cartes:"_ustr, getBodyText());
 }
 
 DECLARE_RTFEXPORT_TEST(testFdo46955, "fdo46955.rtf")
@@ -327,7 +333,10 @@ DECLARE_RTFEXPORT_TEST(testFdo48876, "fdo48876.rtf")
         getProperty<style::LineSpacing>(xParaEnum->nextElement(), 
"ParaLineSpacing").Mode);
 }
 
-DECLARE_RTFEXPORT_TEST(testFdo48193, "fdo48193.rtf") { CPPUNIT_ASSERT_EQUAL(7, 
getLength()); }
+DECLARE_RTFEXPORT_TEST(testFdo48193, "fdo48193.rtf")
+{
+    CPPUNIT_ASSERT_EQUAL(OUString("foo1bar"), getBodyText());
+}
 
 CPPUNIT_TEST_FIXTURE(Test, testFdo44211)
 {
@@ -537,7 +546,7 @@ DECLARE_RTFEXPORT_TEST(testAllGapsWord, "all_gaps_word.rtf")
 DECLARE_RTFEXPORT_TEST(testFdo52389, "fdo52389.rtf")
 {
     // The last '!' character at the end of the document was lost
-    CPPUNIT_ASSERT_EQUAL(6, getLength());
+    CPPUNIT_ASSERT_EQUAL(u"dania!"_ustr, getBodyText());
 }
 
 DECLARE_RTFEXPORT_TEST(testFdo49655, "fdo49655.rtf")
diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx
index 950136e66eba..0a72fe4d5c7e 100644
--- a/sw/qa/inc/swmodeltestbase.hxx
+++ b/sw/qa/inc/swmodeltestbase.hxx
@@ -151,8 +151,6 @@ protected:
 
     void calcLayout();
 
-    /// 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;
 
diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx
index d5248bd414fb..99df27cb039d 100644
--- a/sw/qa/unit/swmodeltestbase.cxx
+++ b/sw/qa/unit/swmodeltestbase.cxx
@@ -141,8 +141,6 @@ void SwModelTestBase::calcLayout()
     getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
 }
 
-int SwModelTestBase::getLength() const { return getBodyText().getLength(); }
-
 OUString SwModelTestBase::getBodyText() const
 {
     uno::Reference<text::XTextDocument> xTextDocument(mxComponent, 
uno::UNO_QUERY);

Reply via email to