sw/qa/extras/uiwriter/uiwriter3.cxx | 29 ++++++++++++++++++++ sw/qa/uitest/writer_tests7/tdf132596.py | 45 -------------------------------- 2 files changed, 29 insertions(+), 45 deletions(-)
New commits: commit 96bf396ef283822c94c233510c67f0ac58d3827e Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Mon Jan 18 09:54:11 2021 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Jan 18 11:11:53 2021 +0100 tdf#132596: sw: Move UItest to CppUnitTest Change-Id: I9c9ca9e266034f254c68b3f96d3582ce2cf08ab5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109511 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/uitest/data/tdf132596.docx b/sw/qa/extras/uiwriter/data3/tdf132596.docx similarity index 100% rename from sw/qa/uitest/data/tdf132596.docx rename to sw/qa/extras/uiwriter/data3/tdf132596.docx diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index 6eb6c34c7f7c..8250b01ef5dc 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -434,6 +434,35 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf131963) CPPUNIT_ASSERT_EQUAL(11, getPages()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132596) +{ + load(DATA_DIRECTORY, "tdf132596.docx"); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + CPPUNIT_ASSERT_EQUAL(2, 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(2, getPages()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf126626) { load(DATA_DIRECTORY, "tdf126626.docx"); diff --git a/sw/qa/uitest/writer_tests7/tdf132596.py b/sw/qa/uitest/writer_tests7/tdf132596.py deleted file mode 100644 index daed846332be..000000000000 --- a/sw/qa/uitest/writer_tests7/tdf132596.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 tdf132596(UITestCase): - - def test_tdf132596(self): - writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf132596.docx")) - - document = self.ui_test.get_component() - self.assertEqual(2, 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(2, 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