summaryrefslogtreecommitdiff
path: root/sw/qa/extras/uiwriter
diff options
context:
space:
mode:
authorSerge Krot <Serge.Krot@cib.de>2018-01-29 12:17:06 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-01-31 01:30:39 +0100
commitdeaa16bd24fba4a3a6b072ab2b94542a7dbd41c6 (patch)
treee7692bd7aca0f4ac0ae041aaf82eddb8dc7cafcd /sw/qa/extras/uiwriter
parentd88e9c4be7110c9cbafb98dffa7a3b7c4126459e (diff)
tdf#72942 Do not overwrite styles from the inserted doc
During inserting of the text from the external document we should not change original default styles in currently opened document. Added unit test. Change-Id: Ida754a0da5efaaa043464cd807c0b52cfb0d5670 Reviewed-on: https://gerrit.libreoffice.org/48826 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sw/qa/extras/uiwriter')
-rwxr-xr-xsw/qa/extras/uiwriter/data/fdo72942-insert.docxbin0 -> 11830 bytes
-rwxr-xr-xsw/qa/extras/uiwriter/data/fdo72942.docxbin0 -> 4980 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx35
3 files changed, 35 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data/fdo72942-insert.docx b/sw/qa/extras/uiwriter/data/fdo72942-insert.docx
new file mode 100755
index 000000000000..fb1f80c4ae09
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/fdo72942-insert.docx
Binary files differ
diff --git a/sw/qa/extras/uiwriter/data/fdo72942.docx b/sw/qa/extras/uiwriter/data/fdo72942.docx
new file mode 100755
index 000000000000..0906ec464271
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/fdo72942.docx
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 4789d2d39829..a87abf1d4bff 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -264,6 +264,7 @@ public:
void testTdf106736();
void testTdf58604();
void testTdf112025();
+ void testTdf72942();
void testTdf113877();
void testTdf113877NoMerge();
void testMsWordCompTrailingBlanks();
@@ -442,6 +443,7 @@ public:
CPPUNIT_TEST(testTdf106736);
CPPUNIT_TEST(testTdf58604);
CPPUNIT_TEST(testTdf112025);
+ CPPUNIT_TEST(testTdf72942);
CPPUNIT_TEST(testTdf113877);
CPPUNIT_TEST(testTdf113877NoMerge);
CPPUNIT_TEST(testMsWordCompTrailingBlanks);
@@ -5279,6 +5281,39 @@ void SwUiWriterTest::testTdf112025()
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xStyle, "IsLandscape"));
}
+void SwUiWriterTest::testTdf72942()
+{
+ load(DATA_DIRECTORY, "fdo72942.docx");
+
+ // get a page cursor
+ uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
+ uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
+ xCursor->jumpToEndOfPage();
+
+ OUString insertFileid = m_directories.getURLFromSrc(DATA_DIRECTORY) + "fdo72942-insert.docx";
+ uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({{ "Name", uno::makeAny(insertFileid) }}));
+ lcl_dispatchCommand(mxComponent, ".uno:InsertDoc", aPropertyValues);
+
+ // check styles of paragraphs added from [fdo72942.docx]
+ const uno::Reference< text::XTextRange > xRun1 = getRun(getParagraph(1), 1);
+ CPPUNIT_ASSERT_EQUAL(OUString("Default English (Liberation serif) text with "), xRun1->getString());
+ CPPUNIT_ASSERT_EQUAL(OUString("Liberation Serif"), getProperty<OUString>(xRun1, "CharFontName"));
+
+ const uno::Reference< text::XTextRange > xRun2 = getRun(getParagraph(2), 1);
+ CPPUNIT_ASSERT_EQUAL(OUString("Header 1 English text (Liberation sans) with "), xRun2->getString());
+ CPPUNIT_ASSERT_EQUAL(OUString("Liberation Sans"), getProperty<OUString>(xRun2, "CharFontName"));
+
+ // check styles of paragraphs added from [fdo72942-insert.docx]
+ const uno::Reference< text::XTextRange > xRun3 = getRun(getParagraph(4), 1);
+ CPPUNIT_ASSERT_EQUAL(OUString("Default German text (Calibri) with "), xRun3->getString());
+ CPPUNIT_ASSERT_EQUAL(OUString("Liberation Serif"), getProperty<OUString>(xRun3, "CharFontName"));
+
+ const uno::Reference< text::XTextRange > xRun4 = getRun(getParagraph(5), 1);
+ CPPUNIT_ASSERT_EQUAL(OUString("Header 1 German text (Calibri Light) with "), xRun4->getString());
+ CPPUNIT_ASSERT_EQUAL(OUString("Liberation Sans"), getProperty<OUString>(xRun4, "CharFontName"));
+}
+
void SwUiWriterTest::testTdf114306()
{
load(DATA_DIRECTORY, "fdo114306.odt");