sw/qa/extras/uiwriter/uiwriter8.cxx | 17 +++++++++++++++++ sw/qa/uitest/writer_tests8/tdf146356.py | 24 ------------------------ 2 files changed, 17 insertions(+), 24 deletions(-)
New commits: commit 4206cdaa3621cd95b81496ade829112db9e6a935 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Fri Mar 8 10:11:02 2024 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Mar 8 14:43:48 2024 +0100 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 <xiscofa...@libreoffice.org> diff --git a/sw/qa/uitest/data/tdf146356.odt b/sw/qa/extras/uiwriter/data/tdf146356.odt old mode 100644 new mode 100755 similarity index 100% rename from sw/qa/uitest/data/tdf146356.odt rename to sw/qa/extras/uiwriter/data/tdf146356.odt 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"}))