summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2024-03-08 10:11:02 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2024-03-08 14:43:48 +0100
commit4206cdaa3621cd95b81496ade829112db9e6a935 (patch)
tree133d39ff803ecb6ca6a801077af4d42c61c15815 /sw
parent1406e7b2f01a88377649c763cd65d20803c3c3a6 (diff)
tdf#146356: sw: move UItest to CppUnittest
Change-Id: Ic1cd24dabf58e2aea2ed7c6e4a6c62f4fbc4f094 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164565 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rwxr-xr-x[-rw-r--r--]sw/qa/extras/uiwriter/data/tdf146356.odt (renamed from sw/qa/uitest/data/tdf146356.odt)bin11975 -> 11975 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter8.cxx17
-rwxr-xr-xsw/qa/uitest/writer_tests8/tdf146356.py24
3 files changed, 17 insertions, 24 deletions
diff --git a/sw/qa/uitest/data/tdf146356.odt b/sw/qa/extras/uiwriter/data/tdf146356.odt
index a143986a1423..a143986a1423 100644..100755
--- a/sw/qa/uitest/data/tdf146356.odt
+++ b/sw/qa/extras/uiwriter/data/tdf146356.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx b/sw/qa/extras/uiwriter/uiwriter8.cxx
index e0c97099e1b7..21fb637e0157 100644
--- a/sw/qa/extras/uiwriter/uiwriter8.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter8.cxx
@@ -1272,6 +1272,23 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, TestTextBoxCrashAfterLineDel)
xCursor->setString(OUString());
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146356)
+{
+ createSwDoc("tdf146356.odt");
+
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+
+ pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_MOD2 | awt::Key::RETURN);
+ Scheduler::ProcessEventsToIdle();
+
+ emulateTyping(*pTextDoc, u"Some Text");
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: Some Text
+ // - Actual : Table of Contents
+ CPPUNIT_ASSERT_EQUAL(OUString("Some Text"), getParagraph(1)->getString());
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf121546)
{
createSwDoc("tdf121546.odt");
diff --git a/sw/qa/uitest/writer_tests8/tdf146356.py b/sw/qa/uitest/writer_tests8/tdf146356.py
deleted file mode 100755
index 9fd9631d4794..000000000000
--- a/sw/qa/uitest/writer_tests8/tdf146356.py
+++ /dev/null
@@ -1,24 +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_state_as_dict, get_url_for_data_file
-from libreoffice.uno.propertyvalue import mkPropertyValues
-from libreoffice.linguistic.linguservice import get_lingu_service_manager
-from com.sun.star.lang import Locale
-import time
-
-# insert paragraph in front of a protected table of contents
-# and insert text into this new paragraph
-class tdf146356(UITestCase):
- def test_tdf146356_insert_para_before_TOX(self):
- with self.ui_test.load_file(get_url_for_data_file("tdf146356.odt")) as writer_doc:
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RETURN"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Some text"}))