tdf#138879: sw_odfimport: Add unittest
Change-Id: Idbe6775dd00f985fbbf6d102e88e768edf2ad525
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108667
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sw/qa/extras/odfimport/data/tdf138879.odt b/sw/qa/extras/odfimport/data/tdf138879.odt
new file mode 100644
index 0000000..801fe32
--- /dev/null
+++ b/sw/qa/extras/odfimport/data/tdf138879.odt
Binary files differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index 71046fe..6ab87d0 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -1112,6 +1112,26 @@ DECLARE_ODFIMPORT_TEST(testTdf134971, "tdf134971a.odt")
CPPUNIT_ASSERT_EQUAL(OUString("Arial"), sString);
}
CPPUNIT_TEST_FIXTURE(Test, testTdf138879)
{
// Create a new document.
mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
uno::Sequence<beans::PropertyValue> aPropertyValues = comphelper::InitPropertySequence(
{
{"Name", uno::makeAny(
m_directories.getURLFromSrc(mpTestDocumentPath) + "tdf138879.odt")},
{"Filter", uno::makeAny(OUString("writer8"))},
});
dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
// Without the fix in place, this test would have failed with
// - Expected: Heading 1
// - Actual : Standard
CPPUNIT_ASSERT_EQUAL(OUString("Heading 1"),
getProperty<OUString>(getParagraph(1), "ParaStyleName"));
}
CPPUNIT_TEST_FIXTURE(Test, testPasteFirstParaDirectFormat)
{
// Create a new document.