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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Sun Jan 17 22:26:52 UTC 2021


 sw/qa/extras/uiwriter/uiwriter3.cxx     |   31 ++++++++++++++++++++++
 sw/qa/uitest/writer_tests7/tdf132597.py |   44 --------------------------------
 2 files changed, 31 insertions(+), 44 deletions(-)

New commits:
commit 6bdfee076d7aea02f5ac3ea180d384974ed1ae58
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Sun Jan 17 21:50:33 2021 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Sun Jan 17 23:26:14 2021 +0100

    tdf#132597: sw: Move UItest to CppUnitTest
    
    Change-Id: I0409e22571fa2bb6a9fbf3eb7f6e81b544886aa0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109488
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/qa/uitest/data/tdf132597.odt b/sw/qa/extras/uiwriter/data3/tdf132597.odt
similarity index 100%
rename from sw/qa/uitest/data/tdf132597.odt
rename to sw/qa/extras/uiwriter/data3/tdf132597.odt
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index e7eeee81d266..6ba92153fb7d 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -375,6 +375,37 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135056)
     CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pWrtShell->GetTOXCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132597)
+{
+    load(DATA_DIRECTORY, "tdf132597.odt");
+
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+
+    CPPUNIT_ASSERT_EQUAL(1, getShapes());
+    CPPUNIT_ASSERT_EQUAL(1, 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
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(1, getShapes());
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf126626)
 {
     load(DATA_DIRECTORY, "tdf126626.docx");
diff --git a/sw/qa/uitest/writer_tests7/tdf132597.py b/sw/qa/uitest/writer_tests7/tdf132597.py
deleted file mode 100644
index 1666ecbfc21e..000000000000
--- a/sw/qa/uitest/writer_tests7/tdf132597.py
+++ /dev/null
@@ -1,44 +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 tdf132597(UITestCase):
-
-    def test_tdf132597(self):
-        writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf132597.odt"))
-
-        document = self.ui_test.get_component()
-        self.assertEqual(1, 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)
-
-        self.xUITest.executeCommand(".uno:Undo")
-        # Without the fix in place, it would have crashed here
-
-        self.assertEqual(1, document.CurrentController.PageCount)
-
-        self.ui_test.close_doc()
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list