tdf#131407: move UItest to CppunitTest

sw/qa/uitest/writer_tests5/tdf124722.py - tdf124722_crash_paste_text (tdf124722)

Change-Id: I08d89f5bb90b95c26c56ebc16df2c56c9803f845
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92074
Tested-by: Jenkins
Reviewed-by: Xisco FaulĂ­ <xiscofauli@libreoffice.org>
diff --git a/sw/qa/uitest/writer_tests/data/tdf124722.rtf b/sw/qa/extras/uiwriter/data3/tdf124722.rtf
similarity index 100%
rename from sw/qa/uitest/writer_tests/data/tdf124722.rtf
rename to sw/qa/extras/uiwriter/data3/tdf124722.rtf
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 2dc50a0..4f03eaa 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -95,6 +95,23 @@
    CPPUNIT_ASSERT_EQUAL(OUString(""), getParagraph(1)->getString());
}

CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf124722)
{
    load(DATA_DIRECTORY, "tdf124722.rtf");

    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
    CPPUNIT_ASSERT(pTextDoc);

    CPPUNIT_ASSERT_EQUAL(22, getPages());
    dispatchCommand(mxComponent, ".uno:SelectAll", {});
    dispatchCommand(mxComponent, ".uno:Copy", {});
    CPPUNIT_ASSERT_EQUAL(22, getPages());
    dispatchCommand(mxComponent, ".uno:Paste", {});
    CPPUNIT_ASSERT_EQUAL(43, getPages());
    dispatchCommand(mxComponent, ".uno:Undo", {});
    CPPUNIT_ASSERT_EQUAL(22, getPages());
}

CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf125261)
{
    load(DATA_DIRECTORY, "tdf125261.odt");
diff --git a/sw/qa/uitest/writer_tests5/tdf124722.py b/sw/qa/uitest/writer_tests5/tdf124722.py
deleted file mode 100644
index 80b9e8b..0000000
--- a/sw/qa/uitest/writer_tests5/tdf124722.py
+++ /dev/null
@@ -1,36 +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 uitest.uihelper.common import select_pos
from uitest.uihelper.calc import enter_text_to_cell
from libreoffice.calc.document import get_cell_by_position
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.common import get_state_as_dict, type_text
from uitest.debug import sleep
import org.libreoffice.unotest
import pathlib

def get_url_for_data_file(file_name):
    return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()


#Bug 124722 - CRASH: after pasting, if deleting more text than fits on a page

class tdf124722(UITestCase):
   def test_tdf124722_crash_paste_text(self):
        writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf124722.rtf"))
        document = self.ui_test.get_component()
        xWriterDoc = self.xUITest.getTopFocusWindow()

        self.xUITest.executeCommand(".uno:SelectAll")
        self.xUITest.executeCommand(".uno:Copy")
        self.xUITest.executeCommand(".uno:Paste")

        self.assertEqual(document.Text.String[0:9], "The quick")
        self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab: