diff options
author | László Németh <nemeth@numbertext.org> | 2020-01-08 14:26:40 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-05-19 09:10:33 +0200 |
commit | e73d148cd02a934025f8d2018acf23493a9db3b3 (patch) | |
tree | fe2f8cd03c01ca1ff36c4863d6cb88e376c52d33 /sw | |
parent | ad513aadc9f2330fbe52ce23ce87dc7db14c5307 (diff) |
tdf#90069 DOCX: fix character style of new table rows
DOCX table import didn't set paragraph level
character styles on paragraph level, only on
text portions, resulting default character style
in the newly inserted table rows instead of copying
the style of the previous table row.
(cherry picked from commit 2ab481b038b62b1ff576ac4d49d03c1798cd7f84)
Conflicts:
sw/qa/extras/uiwriter/uiwriter2.cxx
Change-Id: Idb4438c767bdc7e0026fc6e0f0a795d8efdda3c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94315
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/data2/tdf90069.docx | bin | 0 -> 4737 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter2.cxx | 32 |
2 files changed, 32 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data2/tdf90069.docx b/sw/qa/extras/uiwriter/data2/tdf90069.docx Binary files differnew file mode 100644 index 000000000000..719502a67e78 --- /dev/null +++ b/sw/qa/extras/uiwriter/data2/tdf90069.docx diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 22a8b7e85f79..8232c62df189 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -53,6 +53,7 @@ #include <AnnotationWin.hxx> #include <PostItMgr.hxx> #include <postithelper.hxx> +#include <editeng/fontitem.hxx> namespace { @@ -100,6 +101,7 @@ public: #if !defined(_WIN32) void testDateFormFieldCurrentDateInvalidation(); #endif + void testTdf90069(); CPPUNIT_TEST_SUITE(SwUiWriterTest2); CPPUNIT_TEST(testRedlineMoveInsertInDelete); @@ -138,6 +140,7 @@ public: #if !defined(_WIN32) CPPUNIT_TEST(testDateFormFieldCurrentDateInvalidation); #endif + CPPUNIT_TEST(testTdf90069); CPPUNIT_TEST_SUITE_END(); private: @@ -1603,6 +1606,35 @@ void SwUiWriterTest2::testDateFormFieldCurrentDateInvalidation() } #endif +void SwUiWriterTest2::testTdf90069() +{ + SwDoc* pDoc = createDoc("tdf90069.docx"); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + SwDocShell* pDocShell = pTextDoc->GetDocShell(); + CPPUNIT_ASSERT(pDocShell); + + SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + CPPUNIT_ASSERT(pWrtShell); + + sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + + lcl_dispatchCommand(mxComponent, ".uno:InsertRowsAfter", {}); + pWrtShell->Down(false); + pWrtShell->Insert("foo"); + + SwTextNode* pTextNodeA1 = static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex]); + CPPUNIT_ASSERT(pTextNodeA1->GetText().startsWith("Insert")); + nIndex = pWrtShell->GetCursor()->GetNode().GetIndex(); + SwTextNode* pTextNodeA2 = static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex]); + CPPUNIT_ASSERT_EQUAL(OUString("foo"), pTextNodeA2->GetText()); + CPPUNIT_ASSERT_EQUAL(true, pTextNodeA2->GetSwAttrSet().HasItem(RES_CHRATR_FONT)); + OUString sFontName = pTextNodeA2->GetSwAttrSet().GetItem(RES_CHRATR_FONT)->GetFamilyName(); + CPPUNIT_ASSERT_EQUAL(OUString("Lohit Devanagari"), sFontName); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest2); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |