sw/qa/extras/uiwriter/uiwriter3.cxx     |   28 +++++++++++++++++++
 sw/qa/uitest/writer_tests7/tdf131963.py |   45 --------------------------------
 2 files changed, 28 insertions(+), 45 deletions(-)

New commits:
commit d03b43fdb70ee975f4054bd49376179f792aa013
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Jan 18 09:32:18 2021 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Jan 18 11:10:52 2021 +0100

    tdf#131963: sw: Move UItest to CppUnitTest
    
    Change-Id: I19f7cdb4c345b55fe7eea27312513c05a54eb52c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109510
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/uitest/data/tdf131963.docx 
b/sw/qa/extras/uiwriter/data3/tdf131963.docx
similarity index 100%
rename from sw/qa/uitest/data/tdf131963.docx
rename to sw/qa/extras/uiwriter/data3/tdf131963.docx
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 6ba92153fb7d..6eb6c34c7f7c 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -406,6 +406,34 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132597)
     CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf131963)
+{
+    load(DATA_DIRECTORY, "tdf131963.docx");
+
+    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+
+    CPPUNIT_ASSERT_EQUAL(11, getPages());
+
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+    SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+    rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell);
+    xTransfer->Copy();
+
+    // Paste special as RTF
+    uno::Sequence<beans::PropertyValue> aPropertyValues = 
comphelper::InitPropertySequence(
+        { { "SelectedFormat", 
uno::makeAny(static_cast<sal_uInt32>(SotClipboardFormatId::RTF)) } });
+
+    dispatchCommand(mxComponent, ".uno:ClipboardFormatItems", aPropertyValues);
+    Scheduler::ProcessEventsToIdle();
+
+    // Without the fix in place, this test would have crashed here
+
+    // tdf#133169: without the fix in place, it would have been 2 instead of 11
+    CPPUNIT_ASSERT_EQUAL(11, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf126626)
 {
     load(DATA_DIRECTORY, "tdf126626.docx");
diff --git a/sw/qa/uitest/writer_tests7/tdf131963.py 
b/sw/qa/uitest/writer_tests7/tdf131963.py
deleted file mode 100644
index 3604a526d526..000000000000
--- a/sw/qa/uitest/writer_tests7/tdf131963.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-from uitest.framework import UITestCase
-from libreoffice.uno.propertyvalue import mkPropertyValues
-from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
-
-class tdf131963(UITestCase):
-
-    def test_tdf131963(self):
-        writer_doc = 
self.ui_test.load_file(get_url_for_data_file("tdf131963.docx"))
-
-        document = self.ui_test.get_component()
-        self.assertEqual(11, document.CurrentController.PageCount)
-
-        self.xUITest.executeCommand(".uno:SelectAll")
-        self.xUITest.executeCommand(".uno:Copy")
-        self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
-        xDialog = self.xUITest.getTopFocusWindow()
-
-        xList = xDialog.getChild('list')
-
-        for childName in xList.getChildren():
-            xChild = xList.getChild(childName)
-            if get_state_as_dict(xChild)['Text'] == "Rich text formatting 
(RTF)":
-                break
-
-        xChild.executeAction("SELECT", tuple())
-        self.assertEqual(get_state_as_dict(xList)['SelectEntryText'], "Rich 
text formatting (RTF)")
-
-        xOkBtn = xDialog.getChild("ok")
-        self.ui_test.close_dialog_through_button(xOkBtn)
-
-        # Without the fix in place, it would have crashed here
-
-        # tdf#133169: without the fix in place, it would have been 2 instead 
of 11
-        self.assertEqual(11, document.CurrentController.PageCount)
-
-        self.ui_test.close_doc()
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
-
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to