[Libreoffice-commits] core.git: sw/qa
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Wed May 6 11:51:01 UTC 2020
sw/qa/extras/uiwriter/uiwriter3.cxx | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
New commits:
commit 7410d53b1b5ae85af7a8f96153ab7ac2b6e346ab
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue May 5 19:27:58 2020 +0200
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Wed May 6 13:50:26 2020 +0200
tdf#132603: sw: Add unittest
Change-Id: I2706ba434034aa4307619cde12f020deb40d669e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93509
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 4d7a43aed5b6..7818a1f9cb0e 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -12,6 +12,7 @@
#include <vcl/scheduler.hxx>
#include <com/sun/star/text/TextContentAnchorType.hpp>
#include <comphelper/propertysequence.hxx>
+#include <boost/property_tree/json_parser.hpp>
namespace
{
@@ -604,6 +605,38 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf87199)
CPPUNIT_ASSERT(xCellA1->getString().endsWith("test1"));
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132603)
+{
+ mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
+
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+
+ uno::Sequence<beans::PropertyValue> aPropertyValues
+ = comphelper::InitPropertySequence({ { "Text", uno::makeAny(OUString("Comment")) } });
+
+ dispatchCommand(mxComponent, ".uno:InsertAnnotation", aPropertyValues);
+ Scheduler::ProcessEventsToIdle();
+
+ dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ Scheduler::ProcessEventsToIdle();
+
+ // Without the fix in place, it would crash here
+ dispatchCommand(mxComponent, ".uno:Copy", {});
+ Scheduler::ProcessEventsToIdle();
+
+ OUString aPostits = pTextDoc->getPostIts();
+ std::stringstream aStream(aPostits.toUtf8().getStr());
+ boost::property_tree::ptree aTree;
+ boost::property_tree::read_json(aStream, aTree);
+ for (const boost::property_tree::ptree::value_type& rValue : aTree.get_child("comments"))
+ {
+ const boost::property_tree::ptree& rComment = rValue.second;
+ OString aText(rComment.get<std::string>("text").c_str());
+ CPPUNIT_ASSERT_EQUAL(OString("Comment"), aText);
+ }
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf117601)
{
mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
More information about the Libreoffice-commits
mailing list