tdf#143574: sw: move UItest to CppUnittest
Change-Id: I7a259df2291ab34a99ab58c359965c5e4873f97e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151314
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sw/qa/uitest/data/tdf143574.odt b/sw/qa/extras/uiwriter/data/tdf143574.odt
similarity index 100%
rename from sw/qa/uitest/data/tdf143574.odt
rename to sw/qa/extras/uiwriter/data/tdf143574.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index c64c87d..00665b3 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -112,6 +112,31 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf139843)
CPPUNIT_ASSERT_EQUAL(nPages, getPages());
}
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf143574)
{
createSwDoc("tdf143574.odt");
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
CPPUNIT_ASSERT_EQUAL(1, getShapes());
uno::Reference<drawing::XShapes> xGroupShape(getShape(1), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xGroupShape->getCount());
uno::Reference<beans::XPropertySet> xProperties(xGroupShape->getByIndex(2), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(false, xProperties->getPropertyValue("TextBox").get<bool>());
selectShape(1);
dispatchCommand(mxComponent, ".uno:EnterGroup", {});
// Select a shape in the group
pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_TAB);
Scheduler::ProcessEventsToIdle();
// Without the fix in place, this test would have crashed
dispatchCommand(mxComponent, ".uno:AddTextBox", {});
CPPUNIT_ASSERT_EQUAL(true, xProperties->getPropertyValue("TextBox").get<bool>());
}
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf146848)
{
// Reuse existing document
diff --git a/sw/qa/uitest/writer_tests7/tdf143574.py b/sw/qa/uitest/writer_tests7/tdf143574.py
deleted file mode 100644
index 2093008..0000000
--- a/sw/qa/uitest/writer_tests7/tdf143574.py
+++ /dev/null
@@ -1,39 +0,0 @@
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
#
# This file is part of the LibreOffice project.
#
# 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_url_for_data_file
from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf143574(UITestCase):
def test_tdf143574(self):
# load the sample file
with self.ui_test.load_file(get_url_for_data_file("tdf143574.odt")):
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
document = self.ui_test.get_component()
# check the shape type.
self.assertEqual("com.sun.star.drawing.GroupShape", document.DrawPage.getByIndex(0).ShapeType)
# select the shape.
self.xUITest.executeCommand(".uno:JumpToNextFrame")
self.ui_test.wait_until_child_is_available('metricfield')
# go inside the group
self.xUITest.executeCommand(".uno:EnterGroup");
# select a shape in the group
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
# At this point the Writer crashed here before the fix.
self.xUITest.executeCommand(".uno:AddTextBox");
self.assertEqual(True, document.DrawPage.getByIndex(0).getByIndex(2).TextBox)
# vim: set shiftwidth=4 softtabstop=4 expandtab: