diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-02-17 16:25:34 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-02-17 20:07:50 +0100 |
commit | 48aac3c1d06994d17f20dbdc2ad8add722192ec3 (patch) | |
tree | b816bb525b032e56ce9cff20e54cdc87e8727ddf | |
parent | 8805448f44624a5981ba252f060dcb9dee07abc3 (diff) |
tdf#130629: sw: Move UItest to CppUnitTest
Change-Id: I80f248ec79f5bc04dc370b4c549730392110aaca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111074
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 32 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf130629.py | 43 |
2 files changed, 32 insertions, 43 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index e4ccc62e6f17..7bb002b03ae9 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -1636,6 +1636,38 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135014) assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='NewNumberingStyle']/w:qFormat", 1); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130629) +{ + mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + uno::Sequence<beans::PropertyValue> aArgs( + comphelper::InitPropertySequence({ { "KeyModifier", uno::makeAny(KEY_MOD1) } })); + + dispatchCommand(mxComponent, ".uno:BasicShapes.diamond", aArgs); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(1, getShapes()); + + // Undo twice + dispatchCommand(mxComponent, ".uno:Undo", {}); + dispatchCommand(mxComponent, ".uno:Undo", {}); + + CPPUNIT_ASSERT_EQUAL(0, getShapes()); + + // Shape toolbar is active, use ESC before inserting a new shape + pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_ESCAPE); + Scheduler::ProcessEventsToIdle(); + + // Without the fix in place, this test would have crashed here + dispatchCommand(mxComponent, ".uno:BasicShapes.diamond", aArgs); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(1, getShapes()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133358) { mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"); diff --git a/sw/qa/uitest/writer_tests7/tdf130629.py b/sw/qa/uitest/writer_tests7/tdf130629.py deleted file mode 100644 index e4cf7942d8c3..000000000000 --- a/sw/qa/uitest/writer_tests7/tdf130629.py +++ /dev/null @@ -1,43 +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 uitest.uihelper.common import get_state_as_dict -from libreoffice.uno.propertyvalue import mkPropertyValues - -class tdf130629(UITestCase): - - def test_tdf130629(self): - - self.ui_test.create_doc_in_start_center("writer") - - document = self.ui_test.get_component() - self.assertEqual(0, document.DrawPage.getCount()) - - # Insert shape while pressing CTRL - self.xUITest.executeCommandWithParameters(".uno:BasicShapes.diamond", mkPropertyValues({"KeyModifier": 8192})) - - self.assertEqual(1, document.DrawPage.getCount()) - - # Undo twice - self.xUITest.executeCommand(".uno:Undo") - self.xUITest.executeCommand(".uno:Undo") - - self.assertEqual(0, document.DrawPage.getCount()) - - # Shape toolbar is active, use esc before inserting a new shape - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ESC"})) - - # Without the fix in place, this test would have crashed here - self.xUITest.executeCommandWithParameters(".uno:BasicShapes.diamond", mkPropertyValues({"KeyModifier": 8192})) - - self.assertEqual(1, document.DrawPage.getCount()) - - self.ui_test.close_doc() - -# vim: set shiftwidth=4 softtabstop=4 expandtab: |