summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-05-03 10:39:08 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-05-03 12:35:14 +0200
commit6f8d649b8c0ae0849e5c1f279c0f24700ec3f0d2 (patch)
treed3097235cd17fdf8f39cad2cdb48815c927d7ae5
parent9b8ae4df0ec765c5d65a27a6c3ef5daa7606e99f (diff)
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>
-rw-r--r--sw/qa/extras/uiwriter/data/tdf143574.odt (renamed from sw/qa/uitest/data/tdf143574.odt)bin10275 -> 10275 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx25
-rw-r--r--sw/qa/uitest/writer_tests7/tdf143574.py39
3 files changed, 25 insertions, 39 deletions
diff --git a/sw/qa/uitest/data/tdf143574.odt b/sw/qa/extras/uiwriter/data/tdf143574.odt
index a2e961e11253..a2e961e11253 100644
--- a/sw/qa/uitest/data/tdf143574.odt
+++ b/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 c64c87db2cad..00665b353d7d 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 209300802c88..000000000000
--- 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: