|
 |
135360 |
From a779115ee56769b7691b02e4b8739c5c8f81258e Mon Sep 17 00:00:00 2001
|
|
 |
135360 |
From: Miklos Vajna <vmiklos@collabora.co.uk>
|
|
 |
135360 |
Date: Sat, 14 Nov 2015 16:59:01 +0100
|
|
 |
135360 |
Subject: [PATCH 335/398] CppunitTest_desktop_lib: add Writer comments textcase
|
|
 |
135360 |
|
|
 |
135360 |
Fails without e.g. the last hunk of commit
|
|
 |
135360 |
1ba9d7fd2a7a3e2b4f52ed0f5efdf7df867b9db3 (sw lok: forward key events to
|
|
 |
135360 |
annotation window if necessary, 2015-11-12).
|
|
 |
135360 |
|
|
 |
135360 |
Change-Id: I7f39530881f6141fea956b751aa57eb2bdcadcb2
|
|
 |
135360 |
(cherry picked from commit 1118689e70ed49604ded6e1ae83a22bdc995b2fb)
|
|
 |
135360 |
---
|
|
 |
135360 |
desktop/CppunitTest_desktop_lib.mk | 1 +
|
|
 |
135360 |
desktop/qa/desktop_lib/test_desktop_lib.cxx | 46 +++++++++++++++++++++++++++++
|
|
 |
135360 |
2 files changed, 47 insertions(+)
|
|
 |
135360 |
|
|
 |
135360 |
diff --git a/desktop/CppunitTest_desktop_lib.mk b/desktop/CppunitTest_desktop_lib.mk
|
|
 |
135360 |
index ca9d8db32c9f..bbedfdc8348e 100644
|
|
 |
135360 |
--- a/desktop/CppunitTest_desktop_lib.mk
|
|
 |
135360 |
+++ b/desktop/CppunitTest_desktop_lib.mk
|
|
 |
135360 |
@@ -67,6 +67,7 @@ $(eval $(call gb_CppunitTest_use_components,desktop_lib,\
|
|
 |
135360 |
xmloff/util/xo \
|
|
 |
135360 |
i18npool/source/search/i18nsearch \
|
|
 |
135360 |
filter/source/graphic/graphicfilter \
|
|
 |
135360 |
+ linguistic/source/lng \
|
|
 |
135360 |
))
|
|
 |
135360 |
|
|
 |
135360 |
$(eval $(call gb_CppunitTest_use_configuration,desktop_lib))
|
|
 |
135360 |
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
|
|
 |
135360 |
index 7d94daea0fbc..930dd21ec081 100644
|
|
 |
135360 |
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
|
|
 |
135360 |
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
|
|
 |
135360 |
@@ -10,6 +10,10 @@
|
|
 |
135360 |
#include <com/sun/star/frame/Desktop.hpp>
|
|
 |
135360 |
#include <com/sun/star/lang/XComponent.hpp>
|
|
 |
135360 |
#include <com/sun/star/frame/XComponentLoader.hpp>
|
|
 |
135360 |
+#include <com/sun/star/text/XTextDocument.hpp>
|
|
 |
135360 |
+#include <com/sun/star/awt/Key.hpp>
|
|
 |
135360 |
+#include <com/sun/star/awt/XReschedule.hpp>
|
|
 |
135360 |
+#include <com/sun/star/awt/Toolkit.hpp>
|
|
 |
135360 |
|
|
 |
135360 |
#include <boost/property_tree/json_parser.hpp>
|
|
 |
135360 |
#include <comphelper/processfactory.hxx>
|
|
 |
135360 |
@@ -70,6 +74,7 @@ public:
|
|
 |
135360 |
void testRowColumnHeaders();
|
|
 |
135360 |
void testCellCursor();
|
|
 |
135360 |
void testCommandResult();
|
|
 |
135360 |
+ void testWriterComments();
|
|
 |
135360 |
|
|
 |
135360 |
CPPUNIT_TEST_SUITE(DesktopLOKTest);
|
|
 |
135360 |
CPPUNIT_TEST(testGetStyles);
|
|
 |
135360 |
@@ -85,6 +90,7 @@ public:
|
|
 |
135360 |
CPPUNIT_TEST(testRowColumnHeaders);
|
|
 |
135360 |
CPPUNIT_TEST(testCellCursor);
|
|
 |
135360 |
CPPUNIT_TEST(testCommandResult);
|
|
 |
135360 |
+ CPPUNIT_TEST(testWriterComments);
|
|
 |
135360 |
CPPUNIT_TEST_SUITE_END();
|
|
 |
135360 |
|
|
 |
135360 |
uno::Reference<lang::XComponent> mxComponent;
|
|
 |
135360 |
@@ -491,6 +497,46 @@ void DesktopLOKTest::testCommandResult()
|
|
 |
135360 |
CPPUNIT_ASSERT_EQUAL(aTree.get_child("success").get_value<bool>(), true);
|
|
 |
135360 |
}
|
|
 |
135360 |
|
|
 |
135360 |
+void DesktopLOKTest::testWriterComments()
|
|
 |
135360 |
+{
|
|
 |
135360 |
+ comphelper::LibreOfficeKit::setActive();
|
|
 |
135360 |
+ LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
|
|
 |
135360 |
+ pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this);
|
|
 |
135360 |
+ uno::Reference<awt::XReschedule> xToolkit(com::sun::star::awt::Toolkit::create(comphelper::getProcessComponentContext()), uno::UNO_QUERY);
|
|
 |
135360 |
+
|
|
 |
135360 |
+ // Insert a comment at the beginning of the document and wait till the main
|
|
 |
135360 |
+ // loop grabs the focus, so characters end up in the annotation window.
|
|
 |
135360 |
+ TimeValue aTimeValue = {2 , 0}; // 2 seconds max
|
|
 |
135360 |
+ m_aCommandResultCondition.reset();
|
|
 |
135360 |
+ pDocument->pClass->postUnoCommand(pDocument, ".uno:InsertAnnotation", nullptr, true);
|
|
 |
135360 |
+ m_aCommandResultCondition.wait(aTimeValue);
|
|
 |
135360 |
+ CPPUNIT_ASSERT(!m_aCommandResult.isEmpty());
|
|
 |
135360 |
+ xToolkit->reschedule();
|
|
 |
135360 |
+
|
|
 |
135360 |
+ // Test that we have a comment.
|
|
 |
135360 |
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
 |
135360 |
+ uno::Reference<container::XEnumerationAccess> xParagraphEnumerationAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
 |
135360 |
+ uno::Reference<container::XEnumeration> xParagraphEnumeration = xParagraphEnumerationAccess->createEnumeration();
|
|
 |
135360 |
+ uno::Reference<container::XEnumerationAccess> xParagraph(xParagraphEnumeration->nextElement(), uno::UNO_QUERY);
|
|
 |
135360 |
+ uno::Reference<container::XEnumeration> xTextPortionEnumeration = xParagraph->createEnumeration();
|
|
 |
135360 |
+ uno::Reference<beans::XPropertySet> xTextPortion(xTextPortionEnumeration->nextElement(), uno::UNO_QUERY);
|
|
 |
135360 |
+ CPPUNIT_ASSERT_EQUAL(OUString("Annotation"), xTextPortion->getPropertyValue("TextPortionType").get<OUString>());
|
|
 |
135360 |
+
|
|
 |
135360 |
+ // Type "test" and finish editing.
|
|
 |
135360 |
+ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 't', 0);
|
|
 |
135360 |
+ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'e', 0);
|
|
 |
135360 |
+ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 's', 0);
|
|
 |
135360 |
+ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 't', 0);
|
|
 |
135360 |
+ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 0, com::sun::star::awt::Key::ESCAPE);
|
|
 |
135360 |
+
|
|
 |
135360 |
+ // Test that the typed characters ended up in the right window.
|
|
 |
135360 |
+ auto xTextField = xTextPortion->getPropertyValue("TextField").get< uno::Reference<beans::XPropertySet> >();
|
|
 |
135360 |
+ // This was empty, typed characters ended up in the body text.
|
|
 |
135360 |
+ CPPUNIT_ASSERT_EQUAL(OUString("test"), xTextField->getPropertyValue("Content").get<OUString>());
|
|
 |
135360 |
+
|
|
 |
135360 |
+ comphelper::LibreOfficeKit::setActive(false);
|
|
 |
135360 |
+}
|
|
 |
135360 |
+
|
|
 |
135360 |
CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
|
|
 |
135360 |
|
|
 |
135360 |
CPPUNIT_PLUGIN_IMPLEMENT();
|
|
 |
135360 |
--
|
|
 |
135360 |
2.12.0
|
|
 |
135360 |
|