[Libreoffice-commits] core.git: sw/qa

Tamás Zolnai tamas.zolnai at collabora.com
Thu Jan 25 07:34:22 UTC 2018


 sw/qa/extras/tiledrendering/data/tdf115088.odt |binary
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   37 +++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

New commits:
commit b4c0621134d24080479b7f11e07cbb2ea3d80769
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Wed Jan 24 18:41:33 2018 +0100

    Test for tdf#115088.
    
    Change-Id: I27c97d174089c6567e38899522603d4a39d8ad40
    Reviewed-on: https://gerrit.libreoffice.org/48540
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/sw/qa/extras/tiledrendering/data/tdf115088.odt b/sw/qa/extras/tiledrendering/data/tdf115088.odt
new file mode 100644
index 000000000000..b29681eb8ef1
Binary files /dev/null and b/sw/qa/extras/tiledrendering/data/tdf115088.odt differ
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 5a90230be574..62a70ea74d11 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -99,6 +99,7 @@ public:
     void testDocumentRepair();
     void testPageHeader();
     void testPageFooter();
+    void testTdf115088();
 
     CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
     CPPUNIT_TEST(testRegisterCallback);
@@ -148,6 +149,7 @@ public:
     CPPUNIT_TEST(testDocumentRepair);
     CPPUNIT_TEST(testPageHeader);
     CPPUNIT_TEST(testPageFooter);
+    CPPUNIT_TEST(testTdf115088);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2024,6 +2026,41 @@ void SwTiledRenderingTest::testPageFooter()
     comphelper::LibreOfficeKit::setActive(false);
 }
 
+void SwTiledRenderingTest::testTdf115088()
+{
+    comphelper::LibreOfficeKit::setActive();
+
+    // We have three lines in the test document and we try to copy the second and third line
+    // To the beginning of the document
+    SwXTextDocument* pXTextDocument = createDoc("tdf115088.odt");
+
+    // Select and copy second and third line
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_HOME | KEY_MOD1);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_HOME | KEY_MOD1);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_DOWN);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_DOWN);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_DOWN | KEY_SHIFT);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_DOWN | KEY_SHIFT);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RIGHT | KEY_SHIFT);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_RIGHT | KEY_SHIFT);
+    Scheduler::ProcessEventsToIdle();
+    comphelper::dispatchCommand(".uno:Copy", uno::Sequence<beans::PropertyValue>());
+
+    // Move cursor to the begining of the first line and paste
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_HOME | KEY_MOD1);
+    pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_HOME | KEY_MOD1);
+    Scheduler::ProcessEventsToIdle();
+    comphelper::dispatchCommand(".uno:PasteUnformatted", uno::Sequence<beans::PropertyValue>());
+    Scheduler::ProcessEventsToIdle();
+
+    // Check the resulting text in the document. (it was 1text\n1\1)
+    CPPUNIT_ASSERT_EQUAL(OUString("1\n1Text\n1\n1"), pXTextDocument->getText()->getString());
+
+    mxComponent->dispose();
+    mxComponent.clear();
+    comphelper::LibreOfficeKit::setActive(false);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list