sw/qa/filter/md/data/tdf168572.odt |binary sw/qa/filter/md/md.cxx | 22 ++++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-)
New commits: commit 5bb8ca7febe07af77e88e0b028c77829777d005e Author: Xisco Fauli <[email protected]> AuthorDate: Mon Sep 29 12:41:44 2025 +0200 Commit: Xisco Fauli <[email protected]> CommitDate: Mon Sep 29 14:58:46 2025 +0200 tdf#168572: sw: Add test Change-Id: Ib6de5968558ed64f8cb81509ecfba1b26f96ab2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191615 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sw/qa/filter/md/data/tdf168572.odt b/sw/qa/filter/md/data/tdf168572.odt new file mode 100644 index 000000000000..964cc02526c7 Binary files /dev/null and b/sw/qa/filter/md/data/tdf168572.odt differ diff --git a/sw/qa/filter/md/md.cxx b/sw/qa/filter/md/md.cxx index 21c96dbf9dc9..157c03235316 100644 --- a/sw/qa/filter/md/md.cxx +++ b/sw/qa/filter/md/md.cxx @@ -57,16 +57,26 @@ public: }; } +CPPUNIT_TEST_FIXTURE(Test, testExportFormula) +{ + createSwDoc("tdf168572.odt"); + + // Without the fix in place, this test would have crashed here + save(mpFilter); + + std::string aActual = TempFileToString(); + std::string aExpected("![]()" SAL_NEWLINE_STRING); + + CPPUNIT_ASSERT_EQUAL(aExpected, aActual); +} + CPPUNIT_TEST_FIXTURE(Test, testExportingBasicElements) { createSwDoc("basic-elements.fodt"); save(mpFilter); - SvFileStream fileStream(maTempFile.GetURL(), StreamMode::READ); - std::vector<char> buffer(fileStream.remainingSize()); - fileStream.ReadBytes(buffer.data(), buffer.size()); - std::string_view md_content(buffer.data(), buffer.size()); - std::string_view expected( + std::string aActual = TempFileToString(); + std::string aExpected( // clang-format off "# Heading 1" SAL_NEWLINE_STRING SAL_NEWLINE_STRING @@ -93,7 +103,7 @@ CPPUNIT_TEST_FIXTURE(Test, testExportingBasicElements) // clang-format on ); - CPPUNIT_ASSERT_EQUAL(expected, md_content); + CPPUNIT_ASSERT_EQUAL(aExpected, aActual); } CPPUNIT_TEST_FIXTURE(Test, testHeading)
