summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorIlmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>2020-07-12 15:27:08 +0300
committerXisco Fauli <xiscofauli@libreoffice.org>2020-07-16 13:59:16 +0200
commit72186f02c118e9f5602e15c2bac9b3ac19987f93 (patch)
tree7985ed53c5a72a502ebed1f926286924e19e218c /sw
parent10775fb4006dcdf3ce5b01179b4d9a6f009d8592 (diff)
tdf#127652: move UItest to CppunitTest
Change-Id: Id04414d00f92a0c32c38a9dd706d6656ba280746 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98597 Tested-by: Jenkins Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/data3/tdf127652.odt (renamed from sw/qa/uitest/writer_tests7/data/tdf127652.odt)bin26963 -> 26963 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx40
-rw-r--r--sw/qa/uitest/writer_tests7/tdf127652.py56
3 files changed, 40 insertions, 56 deletions
diff --git a/sw/qa/uitest/writer_tests7/data/tdf127652.odt b/sw/qa/extras/uiwriter/data3/tdf127652.odt
index 12b2b156bd23..12b2b156bd23 100644
--- a/sw/qa/uitest/writer_tests7/data/tdf127652.odt
+++ b/sw/qa/extras/uiwriter/data3/tdf127652.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index d191f6e4d453..7e4576dffcb0 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1107,4 +1107,44 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132637_protectTrackChanges)
CPPUNIT_ASSERT(!pTextDoc->GetDocShell()->IsReadOnly());
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf127652)
+{
+ load(DATA_DIRECTORY, "tdf127652.odt");
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+ SwCursorShell* pShell = pTextDoc->GetDocShell()->GetWrtShell();
+
+ // get a page cursor
+ uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
+ xModel->getCurrentController(), uno::UNO_QUERY);
+ uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(),
+ uno::UNO_QUERY);
+
+ // go to the start of page 4
+ xCursor->jumpToPage(4);
+ xCursor->jumpToStartOfPage();
+
+ // mark a section that overlaps multiple pages
+ pWrtShell->Down(false, 2);
+ pWrtShell->Up(true, 5);
+
+ // delete the marked section
+ pWrtShell->DelRight();
+
+ // go to the start of page 4
+ xCursor->jumpToPage(4);
+ xCursor->jumpToStartOfPage();
+
+ // move up to page 3
+ pWrtShell->Up(false, 5);
+
+ // check that we are on the third page
+ // in the bug one issue was that the cursor was placed incorrectly, so
+ // moving up to the previous page would not work any more
+ sal_uInt16 assertPage = 3;
+ sal_uInt16 currentPage = pShell->GetPageNumSeqNonEmpty();
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("We are on the wrong page!", assertPage, currentPage);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/uitest/writer_tests7/tdf127652.py b/sw/qa/uitest/writer_tests7/tdf127652.py
deleted file mode 100644
index b6e181c61b98..000000000000
--- a/sw/qa/uitest/writer_tests7/tdf127652.py
+++ /dev/null
@@ -1,56 +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.path import get_srcdir_url
-from libreoffice.uno.propertyvalue import mkPropertyValues
-from uitest.uihelper.common import get_state_as_dict
-
-def get_url_for_data_file(file_name):
- return get_srcdir_url() + "/sw/qa/uitest/writer_tests7/data/" + file_name
-
-class tdf127652 (UITestCase):
-
- def test_mark_delete_undo_delete_tdf127652 (self):
-
- self.ui_test.load_file(get_url_for_data_file("tdf127652.odt"))
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
-
- # go to the start of page 4
- xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "4"}))
- xWriterEdit.executeAction("CLICK", tuple())
-
- # mark a section that overlaps multiple pages
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+UP"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+UP"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+UP"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+UP"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+UP"}))
-
- # delete the marked section
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"}))
-
- # go to the start of page 4
- xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "4"}))
- xWriterEdit.executeAction("CLICK", tuple())
-
- # move up to page 3
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
-
- # check that we are on the third page
- # in the bug one issue was that the cursor was places in the wrong place
- # moving up to the previous page would not work any more
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
- self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab: