desktop/qa/desktop_lib/test_desktop_lib.cxx | 14 ++++++------ schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng | 5 ++++ xmloff/qa/unit/text.cxx | 6 ++++- 3 files changed, 17 insertions(+), 8 deletions(-)
New commits: commit 18187c3aaf7280c01b7768d51e4588156412f554 Author: Gökay Şatır <gokaysa...@gmail.com> AuthorDate: Fri Sep 1 14:14:37 2023 +0300 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Tue Sep 5 14:21:41 2023 +0200 Added test case to comment property test. Signed-off-by: Gökay Şatır <gokaysa...@gmail.com> Change-Id: I033f6574b4875fcb76b16c8b5b9d9f7d55b52cbe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156406 Tested-by: Miklos Vajna <vmik...@collabora.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 68c86d0c254a..943889faee70 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2451,7 +2451,7 @@ void DesktopLOKTest::testCommentsWriter() // This is a reply comment else if (rComment.second.get<std::string>("text") == "Reply to Comment 2") { - CPPUNIT_ASSERT_EQUAL(nComment2Id, rComment.second.get<int>("parent")); + CPPUNIT_ASSERT_EQUAL(nComment2Id, rComment.second.get<int>("parentId")); } } @@ -2593,8 +2593,8 @@ void DesktopLOKTest::testCommentsCallbacksWriter() // We received a LOK_CALLBACK_COMMENT callback with comment 'Add' action and linked to its parent comment CPPUNIT_ASSERT_EQUAL(std::string("Add"), aView1.m_aCommentCallbackResult.get<std::string>("action")); CPPUNIT_ASSERT_EQUAL(std::string("Add"), aView2.m_aCommentCallbackResult.get<std::string>("action")); - CPPUNIT_ASSERT_EQUAL(nCommentId1, aView1.m_aCommentCallbackResult.get<int>("parent")); - CPPUNIT_ASSERT_EQUAL(nCommentId1, aView2.m_aCommentCallbackResult.get<int>("parent")); + CPPUNIT_ASSERT_EQUAL(nCommentId1, aView1.m_aCommentCallbackResult.get<int>("parentId")); + CPPUNIT_ASSERT_EQUAL(nCommentId1, aView2.m_aCommentCallbackResult.get<int>("parentId")); CPPUNIT_ASSERT_EQUAL(std::string("Reply comment"), aView1.m_aCommentCallbackResult.get<std::string>("text")); CPPUNIT_ASSERT_EQUAL(std::string("Reply comment"), aView2.m_aCommentCallbackResult.get<std::string>("text")); int nCommentId2 = aView1.m_aCommentCallbackResult.get<int>("id"); @@ -2608,8 +2608,8 @@ void DesktopLOKTest::testCommentsCallbacksWriter() CPPUNIT_ASSERT_EQUAL(std::string("Modify"), aView1.m_aCommentCallbackResult.get<std::string>("action")); CPPUNIT_ASSERT_EQUAL(std::string("Modify"), aView2.m_aCommentCallbackResult.get<std::string>("action")); // parent is unchanged still - CPPUNIT_ASSERT_EQUAL(nCommentId1, aView1.m_aCommentCallbackResult.get<int>("parent")); - CPPUNIT_ASSERT_EQUAL(nCommentId1, aView2.m_aCommentCallbackResult.get<int>("parent")); + CPPUNIT_ASSERT_EQUAL(nCommentId1, aView1.m_aCommentCallbackResult.get<int>("parentId")); + CPPUNIT_ASSERT_EQUAL(nCommentId1, aView2.m_aCommentCallbackResult.get<int>("parentId")); CPPUNIT_ASSERT_EQUAL(std::string("Edited comment"), aView1.m_aCommentCallbackResult.get<std::string>("text")); CPPUNIT_ASSERT_EQUAL(std::string("Edited comment"), aView2.m_aCommentCallbackResult.get<std::string>("text")); @@ -2632,8 +2632,8 @@ void DesktopLOKTest::testCommentsCallbacksWriter() // We received a LOK_CALLBACK_COMMENT callback with comment 'Add' action and linked to its parent comment CPPUNIT_ASSERT_EQUAL(std::string("Add"), aView1.m_aCommentCallbackResult.get<std::string>("action")); CPPUNIT_ASSERT_EQUAL(std::string("Add"), aView2.m_aCommentCallbackResult.get<std::string>("action")); - CPPUNIT_ASSERT_EQUAL(nCommentId1, aView1.m_aCommentCallbackResult.get<int>("parent")); - CPPUNIT_ASSERT_EQUAL(nCommentId1, aView2.m_aCommentCallbackResult.get<int>("parent")); + CPPUNIT_ASSERT_EQUAL(nCommentId1, aView1.m_aCommentCallbackResult.get<int>("parentId")); + CPPUNIT_ASSERT_EQUAL(nCommentId1, aView2.m_aCommentCallbackResult.get<int>("parentId")); CPPUNIT_ASSERT_EQUAL(std::string("Reply comment again"), aView1.m_aCommentCallbackResult.get<std::string>("text")); CPPUNIT_ASSERT_EQUAL(std::string("Reply comment again"), aView2.m_aCommentCallbackResult.get<std::string>("text")); diff --git a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng index fb59ee1c2a94..c940b6c231ad 100644 --- a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng +++ b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng @@ -977,6 +977,11 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1. <rng:ref name="boolean"/> </rng:attribute> </rng:optional> + <rng:optional> + <rng:attribute name="loext:parent-name"> + <rng:ref name="string"/> + </rng:attribute> + </rng:optional> </rng:interleave> </rng:define> diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx index ab8a28448701..202a69819bdf 100644 --- a/xmloff/qa/unit/text.cxx +++ b/xmloff/qa/unit/text.cxx @@ -55,7 +55,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMailMergeInEditeng) loadFromURL(u"mail-merge-editeng.odt"); } -CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCommentResolved) +CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCommentProperty) { mxComponent = loadFromDesktop("private:factory/swriter"); uno::Sequence<beans::PropertyValue> aCommentProps = comphelper::InitPropertySequence({ @@ -72,6 +72,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCommentResolved) uno::Reference<beans::XPropertySet> xField(xPortion->getPropertyValue("TextField"), uno::UNO_QUERY); xField->setPropertyValue("Resolved", uno::Any(true)); + xField->setPropertyValue("ParentName", uno::Any(OUString("parent_comment_name"))); saveAndReload("writer8"); xTextDocument.set(mxComponent, uno::UNO_QUERY); @@ -83,6 +84,9 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCommentResolved) xField.set(xPortion->getPropertyValue("TextField"), uno::UNO_QUERY); bool bResolved = false; xField->getPropertyValue("Resolved") >>= bResolved; + OUString parentName; + xField->getPropertyValue("ParentName") >>= parentName; + CPPUNIT_ASSERT_EQUAL(OUString("parent_comment_name"), parentName); // Check if the parent comment name is written and read correctly. // Without the accompanying fix in place, this test would have failed, as the resolved state was // not saved for non-range comments. CPPUNIT_ASSERT(bResolved);