summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-01-17 21:50:33 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-01-17 23:26:14 +0100
commit6bdfee076d7aea02f5ac3ea180d384974ed1ae58 (patch)
treeee76c8a4adb5c102d2743a5054b66bfbfe74c2bf /sw
parentb6f574ad86316956cf27efec61af9cbda273e054 (diff)
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@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/data3/tdf132597.odt (renamed from sw/qa/uitest/data/tdf132597.odt)bin132875 -> 132875 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx31
-rw-r--r--sw/qa/uitest/writer_tests7/tdf132597.py44
3 files changed, 31 insertions, 44 deletions
diff --git a/sw/qa/uitest/data/tdf132597.odt b/sw/qa/extras/uiwriter/data3/tdf132597.odt
index 68e9c9dffc77..68e9c9dffc77 100644
--- a/sw/qa/uitest/data/tdf132597.odt
+++ b/sw/qa/extras/uiwriter/data3/tdf132597.odt
Binary files differ
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: