diff options
author | Tor Lillqvist <tml@collabora.com> | 2022-01-04 12:03:23 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2022-01-04 17:08:42 +0100 |
commit | 6bfeb2290c585e0e5fe982dde6ac57e4afca2e2f (patch) | |
tree | 70ff6c69e29bbfd312ada6e8d3365c5548a45dce /sw | |
parent | 18444c2822e6561aa302f28f8166042b8dad0fe1 (diff) |
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 <tml@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/htmlexport/xhtmlexport.cxx | 16 | ||||
-rw-r--r-- | sw/qa/extras/odfexport/data/tdf146264.odt | bin | 0 -> 13422 bytes |
2 files changed, 16 insertions, 0 deletions
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 Binary files differnew file mode 100644 index 000000000000..941c7db74fb0 --- /dev/null +++ b/sw/qa/extras/odfexport/data/tdf146264.odt |