sw/qa/extras/htmlexport/xhtmlexport.cxx   |   16 ++++++++++++++++
 sw/qa/extras/odfexport/data/tdf146264.odt |binary
 2 files changed, 16 insertions(+)

New commits:
commit 6bfeb2290c585e0e5fe982dde6ac57e4afca2e2f
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Tue Jan 4 12:03:23 2022 +0200
Commit:     Tor Lillqvist <t...@collabora.com>
CommitDate: Tue Jan 4 17:08:42 2022 +0100

    tdf#146264: Add unit test
    
    Make sure the text is not duplicated in the output.
    
    Change-Id: I1600d18f0921d2ab2cb67898bc02b68f0f9b36c4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127935
    Tested-by: Jenkins
    Reviewed-by: Tor Lillqvist <t...@collabora.com>

diff --git a/sw/qa/extras/htmlexport/xhtmlexport.cxx 
b/sw/qa/extras/htmlexport/xhtmlexport.cxx
index b03f184818fd..9f5b26745f5b 100644
--- a/sw/qa/extras/htmlexport/xhtmlexport.cxx
+++ b/sw/qa/extras/htmlexport/xhtmlexport.cxx
@@ -54,6 +54,22 @@ DECLARE_HTMLEXPORT_TEST(testTdf131812, "tdf131812.odt")
         != -1);
 }
 
+DECLARE_HTMLEXPORT_TEST(testTdf146264, "tdf146264.odt")
+{
+    SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
+    CPPUNIT_ASSERT(pStream);
+    sal_uInt64 nLength = pStream->TellEnd();
+    OString aStream(read_uInt8s_ToOString(*pStream, nLength));
+    sal_Int32 nFirstHello = aStream.indexOf("Hello");
+    CPPUNIT_ASSERT(nFirstHello > 0);
+    if (nFirstHello > 0)
+    {
+        sal_Int32 nSecondHello = aStream.indexOf("Hello", nFirstHello + 1);
+        constexpr sal_Int32 nMinusOne = -1;
+        CPPUNIT_ASSERT_EQUAL(nMinusOne, nSecondHello);
+    }
+}
+
 DECLARE_HTMLEXPORT_TEST(testTdf118637, "tdf118637.odt")
 {
     SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
diff --git a/sw/qa/extras/odfexport/data/tdf146264.odt 
b/sw/qa/extras/odfexport/data/tdf146264.odt
new file mode 100644
index 000000000000..941c7db74fb0
Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf146264.odt differ

Reply via email to