diff options
Diffstat (limited to 'desktop/qa/desktop_lib/test_desktop_lib.cxx')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index d57ae546c7de..280e0336f8bb 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -586,6 +586,24 @@ void DesktopLOKTest::testPasteWriter() CPPUNIT_ASSERT(!pDocument->pClass->paste(pDocument, "textt/plain;charset=utf-8", aText.getStr(), aText.getLength())); // Writer is expected to support text/html. CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "text/html", aText.getStr(), aText.getLength())); + + // Overwrite doc contents with a HTML paste. + pDocument->pClass->postUnoCommand(pDocument, ".uno:SelectAll", nullptr, false); + Scheduler::ProcessEventsToIdle(); + OString aComment("foo <!-- bar --> baz"); + CPPUNIT_ASSERT(pDocument->pClass->paste(pDocument, "text/html", aComment.getStr(), aComment.getLength())); + + // Check if we have a comment. + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xParagraphEnumerationAccess(xTextDocument->getText(), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xParagraphEnumeration = xParagraphEnumerationAccess->createEnumeration(); + uno::Reference<container::XEnumerationAccess> xParagraph(xParagraphEnumeration->nextElement(), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xTextPortionEnumeration = xParagraph->createEnumeration(); + uno::Reference<beans::XPropertySet> xTextPortion(xTextPortionEnumeration->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Text"), xTextPortion->getPropertyValue("TextPortionType").get<OUString>()); + // Without the accompanying fix in place, this test would have failed, as we had a comment + // between "foo" and "baz". + CPPUNIT_ASSERT(!xTextPortionEnumeration->hasMoreElements()); } void DesktopLOKTest::testPasteWriterJPEG() |