[Libreoffice-commits] core.git: sw/qa
Ilmari Lauhakangas (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 16 11:59:57 UTC 2020
sw/qa/extras/uiwriter/uiwriter3.cxx | 40 ++++++++++++++++++++++
sw/qa/uitest/writer_tests7/tdf127652.py | 56 --------------------------------
2 files changed, 40 insertions(+), 56 deletions(-)
New commits:
commit 72186f02c118e9f5602e15c2bac9b3ac19987f93
Author: Ilmari Lauhakangas <ilmari.lauhakangas at libreoffice.org>
AuthorDate: Sun Jul 12 15:27:08 2020 +0300
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Jul 16 13:59:16 2020 +0200
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 at libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sw/qa/uitest/writer_tests7/data/tdf127652.odt b/sw/qa/extras/uiwriter/data3/tdf127652.odt
similarity index 100%
rename from sw/qa/uitest/writer_tests7/data/tdf127652.odt
rename to sw/qa/extras/uiwriter/data3/tdf127652.odt
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:
More information about the Libreoffice-commits
mailing list