diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-10-26 16:07:20 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-10-26 19:51:23 +0100 |
commit | 5711858e00f542f1770d7ff3c035e8a2fdb72266 (patch) | |
tree | bcb16f0f8c835ccf7291e85a83d67414fee3fb50 /uitest | |
parent | 8f362f1bc5ceca9bde282b5db98282b1ab132309 (diff) |
uitest: move all writer tests to sw/qa/uitest
remove a few duplicated ones
Change-Id: I25b031c8fe11ae28f55978f8a25528c307a908e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104814
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/Module_uitest.mk | 8 | ||||
-rw-r--r-- | uitest/UITest_writer_demo1.mk | 20 | ||||
-rw-r--r-- | uitest/UITest_writer_demo2.mk | 20 | ||||
-rw-r--r-- | uitest/UITest_writer_demo3.mk | 20 | ||||
-rw-r--r-- | uitest/UITest_writer_demo4.mk | 20 | ||||
-rw-r--r-- | uitest/UITest_writer_demo5.mk | 20 | ||||
-rw-r--r-- | uitest/UITest_writer_demo6.mk | 20 | ||||
-rw-r--r-- | uitest/UITest_writer_demo7.mk | 20 | ||||
-rw-r--r-- | uitest/UITest_writer_demo8.mk | 20 | ||||
-rw-r--r-- | uitest/writer_tests/data/3pages.odt | bin | 8276 -> 0 bytes | |||
-rw-r--r-- | uitest/writer_tests2/tdf92611.py | 21 | ||||
-rw-r--r-- | uitest/writer_tests4/insertTableDialog.py | 78 | ||||
-rw-r--r-- | uitest/writer_tests4/start.py | 70 | ||||
-rw-r--r-- | uitest/writer_tests5/spellDialog.py | 102 | ||||
-rw-r--r-- | uitest/writer_tests6/insertBreakDialog.py | 85 | ||||
-rw-r--r-- | uitest/writer_tests6/insertPageHeader.py | 72 | ||||
-rw-r--r-- | uitest/writer_tests7/autoredactDialog.py | 198 | ||||
-rw-r--r-- | uitest/writer_tests7/goToPage.py | 48 | ||||
-rw-r--r-- | uitest/writer_tests8/customizeDialog.py | 135 | ||||
-rw-r--r-- | uitest/writer_tests8/tdf79236.py | 124 |
20 files changed, 0 insertions, 1101 deletions
diff --git a/uitest/Module_uitest.mk b/uitest/Module_uitest.mk index bd65a088e301..647dd574f1fd 100644 --- a/uitest/Module_uitest.mk +++ b/uitest/Module_uitest.mk @@ -12,14 +12,6 @@ $(eval $(call gb_Module_Module,uitest)) $(eval $(call gb_Module_add_uicheck_targets,uitest,\ UITest_calc_demo \ - UITest_writer_demo1 \ - UITest_writer_demo2 \ - UITest_writer_demo3 \ - UITest_writer_demo4 \ - UITest_writer_demo5 \ - UITest_writer_demo6 \ - UITest_writer_demo7 \ - UITest_writer_demo8 \ UITest_impress_demo \ UITest_demo_ui \ UITest_math_demo \ diff --git a/uitest/UITest_writer_demo1.mk b/uitest/UITest_writer_demo1.mk deleted file mode 100644 index e951e4ad2b9d..000000000000 --- a/uitest/UITest_writer_demo1.mk +++ /dev/null @@ -1,20 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# 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/. -# - -$(eval $(call gb_UITest_UITest,writer_demo1)) - -$(eval $(call gb_UITest_add_modules,writer_demo1,$(SRCDIR)/uitest,\ - writer_tests1/ \ -)) - -$(eval $(call gb_UITest_set_defs,writer_demo1, \ - TDOC="$(SRCDIR)/uitest/writer_tests/data" \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/uitest/UITest_writer_demo2.mk b/uitest/UITest_writer_demo2.mk deleted file mode 100644 index 6f74f97ab75a..000000000000 --- a/uitest/UITest_writer_demo2.mk +++ /dev/null @@ -1,20 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# 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/. -# - -$(eval $(call gb_UITest_UITest,writer_demo2)) - -$(eval $(call gb_UITest_add_modules,writer_demo2,$(SRCDIR)/uitest,\ - writer_tests2/ \ -)) - -$(eval $(call gb_UITest_set_defs,writer_demo2, \ - TDOC="$(SRCDIR)/uitest/writer_tests/data" \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/uitest/UITest_writer_demo3.mk b/uitest/UITest_writer_demo3.mk deleted file mode 100644 index 9f6302670493..000000000000 --- a/uitest/UITest_writer_demo3.mk +++ /dev/null @@ -1,20 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# 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/. -# - -$(eval $(call gb_UITest_UITest,writer_demo3)) - -$(eval $(call gb_UITest_add_modules,writer_demo3,$(SRCDIR)/uitest,\ - writer_tests3/ \ -)) - -$(eval $(call gb_UITest_set_defs,writer_demo3, \ - TDOC="$(SRCDIR)/uitest/writer_tests/data" \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/uitest/UITest_writer_demo4.mk b/uitest/UITest_writer_demo4.mk deleted file mode 100644 index 5ad99203efd5..000000000000 --- a/uitest/UITest_writer_demo4.mk +++ /dev/null @@ -1,20 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# 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/. -# - -$(eval $(call gb_UITest_UITest,writer_demo4)) - -$(eval $(call gb_UITest_add_modules,writer_demo4,$(SRCDIR)/uitest,\ - writer_tests4/ \ -)) - -$(eval $(call gb_UITest_set_defs,writer_demo4, \ - TDOC="$(SRCDIR)/uitest/writer_tests/data" \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/uitest/UITest_writer_demo5.mk b/uitest/UITest_writer_demo5.mk deleted file mode 100644 index 1f44c66660e8..000000000000 --- a/uitest/UITest_writer_demo5.mk +++ /dev/null @@ -1,20 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# 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/. -# - -$(eval $(call gb_UITest_UITest,writer_demo5)) - -$(eval $(call gb_UITest_add_modules,writer_demo5,$(SRCDIR)/uitest,\ - writer_tests5/ \ -)) - -$(eval $(call gb_UITest_set_defs,writer_demo5, \ - TDOC="$(SRCDIR)/uitest/writer_tests/data" \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/uitest/UITest_writer_demo6.mk b/uitest/UITest_writer_demo6.mk deleted file mode 100644 index 9c1e040a0d24..000000000000 --- a/uitest/UITest_writer_demo6.mk +++ /dev/null @@ -1,20 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# 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/. -# - -$(eval $(call gb_UITest_UITest,writer_demo6)) - -$(eval $(call gb_UITest_add_modules,writer_demo6,$(SRCDIR)/uitest,\ - writer_tests6/ \ -)) - -$(eval $(call gb_UITest_set_defs,writer_demo6, \ - TDOC="$(SRCDIR)/uitest/writer_tests/data" \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/uitest/UITest_writer_demo7.mk b/uitest/UITest_writer_demo7.mk deleted file mode 100644 index 10fc45008562..000000000000 --- a/uitest/UITest_writer_demo7.mk +++ /dev/null @@ -1,20 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# 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/. -# - -$(eval $(call gb_UITest_UITest,writer_demo7)) - -$(eval $(call gb_UITest_add_modules,writer_demo7,$(SRCDIR)/uitest,\ - writer_tests7/ \ -)) - -$(eval $(call gb_UITest_set_defs,writer_demo7, \ - TDOC="$(SRCDIR)/uitest/writer_tests/data" \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/uitest/UITest_writer_demo8.mk b/uitest/UITest_writer_demo8.mk deleted file mode 100644 index 7c9eabceb9bf..000000000000 --- a/uitest/UITest_writer_demo8.mk +++ /dev/null @@ -1,20 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# 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/. -# - -$(eval $(call gb_UITest_UITest,writer_demo8)) - -$(eval $(call gb_UITest_add_modules,writer_demo8,$(SRCDIR)/uitest,\ - writer_tests8/ \ -)) - -$(eval $(call gb_UITest_set_defs,writer_demo8, \ - TDOC="$(SRCDIR)/uitest/writer_tests/data" \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/uitest/writer_tests/data/3pages.odt b/uitest/writer_tests/data/3pages.odt Binary files differdeleted file mode 100644 index 0f2512903981..000000000000 --- a/uitest/writer_tests/data/3pages.odt +++ /dev/null diff --git a/uitest/writer_tests2/tdf92611.py b/uitest/writer_tests2/tdf92611.py deleted file mode 100644 index 8fee6143c4c7..000000000000 --- a/uitest/writer_tests2/tdf92611.py +++ /dev/null @@ -1,21 +0,0 @@ -# -# 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 - -class tdf92611(UITestCase): - - def test_launch_and_close_bibliography(self): - - self.ui_test.create_doc_in_start_center("writer") - - self.xUITest.executeCommand(".uno:BibliographyComponent") - - self.xUITest.executeCommand(".uno:CloseWin") - - self.ui_test.close_doc() - -# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/writer_tests4/insertTableDialog.py b/uitest/writer_tests4/insertTableDialog.py deleted file mode 100644 index 427920e1985c..000000000000 --- a/uitest/writer_tests4/insertTableDialog.py +++ /dev/null @@ -1,78 +0,0 @@ -# -# 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 libreoffice.uno.propertyvalue import mkPropertyValues -from uitest.uihelper.common import get_state_as_dict - -class WriterInsertTableDialog(UITestCase): - - def insert_table(self, name, rows, cols): - - self.ui_test.create_doc_in_start_center("writer") - - self.ui_test.execute_dialog_through_command(".uno:InsertTable") - xDialog = self.xUITest.getTopFocusWindow() - - xNameEdit = xDialog.getChild("nameedit") - - xNameEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xNameEdit.executeAction("TYPE", mkPropertyValues({"TEXT": name})) - - xColSpin = xDialog.getChild("colspin") - xColSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xColSpin.executeAction("TYPE", mkPropertyValues({"TEXT": str(cols)})) - - xRowSpin = xDialog.getChild("rowspin") - xRowSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xRowSpin.executeAction("TYPE", mkPropertyValues({"TEXT": str(rows)})) - - self.assertEqual(get_state_as_dict(xNameEdit)["Text"], name) - self.assertEqual(get_state_as_dict(xColSpin)["Text"], str(cols)) - self.assertEqual(get_state_as_dict(xRowSpin)["Text"], str(rows)) - - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - - document = self.ui_test.get_component() - - tables = document.getTextTables() - - self.assertEqual(tables[0].getName(), name) - self.assertEqual(len(tables[0].getRows()), rows) - self.assertEqual(len(tables[0].getColumns()), cols) - - def insertTextIntoCell(self, table, cellName, text ): - tableText = table.getCellByName( cellName ) - tableText.setString( text ) - - def test_tdf104158(self): - - self.insert_table("Test3", 2, 2) - - self.ui_test.execute_dialog_through_command(".uno:TableNumberFormatDialog") - - xNumberFormatDlg = self.xUITest.getTopFocusWindow() - - xOkBtn = xNumberFormatDlg.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - - self.ui_test.close_doc() - - def test_cancel_button_insert_table_dialog(self): - self.ui_test.create_doc_in_start_center("writer") - self.ui_test.execute_dialog_through_command(".uno:InsertTable") - Dialog = self.xUITest.getTopFocusWindow() - CancelBtn = Dialog.getChild("cancel") - self.ui_test.close_dialog_through_button(CancelBtn) - - document = self.ui_test.get_component() - tables = document.getTextTables() - self.assertEqual(len(tables), 0) - - self.ui_test.close_doc() - -# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/writer_tests4/start.py b/uitest/writer_tests4/start.py deleted file mode 100644 index 5851e8eff7c9..000000000000 --- a/uitest/writer_tests4/start.py +++ /dev/null @@ -1,70 +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 libreoffice.uno.propertyvalue import mkPropertyValues - -from uitest.framework import UITestCase -from uitest.uihelper.common import get_state_as_dict, type_text - -import time - -class SimpleWriterTest(UITestCase): - - def test_start_writer(self): - - self.ui_test.create_doc_in_start_center("writer") - - xWriterDoc = self.xUITest.getTopFocusWindow() - - xWriterEdit = xWriterDoc.getChild("writer_edit") - - xWriterEdit.executeAction("SET", mkPropertyValues({"ZOOM": "200"})) - - self.ui_test.close_doc() - - def test_type_text(self): - - self.ui_test.create_doc_in_start_center("writer") - - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - - type_text(xWriterEdit, "This is my first writer text written through the UI testing") - - self.ui_test.close_doc() - - def test_goto_first_page(self): - - self.ui_test.create_doc_in_start_center("writer") - - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - - state = get_state_as_dict(xWriterEdit) - while state["CurrentPage"] == "1": - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - state = get_state_as_dict(xWriterEdit) - - xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "1"})) - - self.ui_test.close_doc() - - - def test_select_text(self): - - self.ui_test.create_doc_in_start_center("writer") - - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - - type_text(xWriterEdit, "This is my first writer text written through the UI testing") - - xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "4"})) - - self.ui_test.close_doc() - -# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/writer_tests5/spellDialog.py b/uitest/writer_tests5/spellDialog.py deleted file mode 100644 index e678afea53e9..000000000000 --- a/uitest/writer_tests5/spellDialog.py +++ /dev/null @@ -1,102 +0,0 @@ -# -# 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/. -# - -import re - -from uitest.framework import UITestCase -from uitest.uihelper.common import get_state_as_dict - -from libreoffice.linguistic.linguservice import get_spellchecker -from com.sun.star.lang import Locale - -class SpellingAndGrammarDialog(UITestCase): - - def is_supported_locale(self, language, country): - xSpellChecker = get_spellchecker(self.ui_test._xContext) - locales = xSpellChecker.getLocales() - for locale in locales: - if language != None: - if locale.Language != language: - continue - - if country != None: - if locale.Country != country: - continue - - # we found the correct combination - return True - - def launch_dialog(self): - self.ui_test.execute_modeless_dialog_through_command( - ".uno:SpellingAndGrammarDialog") - - return self.xUITest.getTopFocusWindow() - - TDF46852_INPUT = """\ -dogg -dogg -catt dogg -frogg frogg -frogg catt dogg -dogg catt -frog, dogg, catt""" - - TDF46852_REGEX = """\ -([a-z]+) -\\1 -([a-z]+) \\1 -([a-z]+) \\3 -\\3 \\2 \\1 -\\1 \\2 -\\3, \\1, \\2""" - - def test_tdf46852(self): - supported_locale = self.is_supported_locale("en", "US") - if not supported_locale: - self.skipTest("no dictionary support for en_US available") - # This automates the steps described in the bug report tdf#46852 - - # Step 1: Create a document with repetitious misspelled words - self.ui_test.create_doc_in_start_center("writer") - document = self.ui_test.get_component() - cursor = document.getCurrentController().getViewCursor() - # Inserted text must be en_US, so make sure to set language in current location - cursor.CharLocale = Locale("en", "US", "") - input_text = self.TDF46852_INPUT.replace('\n', '\r') # \r = para break - document.Text.insertString(cursor, input_text, False) - - # Step 2: Place cursor on 4th line after second "frogg" - cursor.goUp(2, False) - cursor.goLeft(1, False) - - # Step 3: Initiate spellchecking, and make sure "Check grammar" is - # unchecked - spell_dialog = self.launch_dialog() - checkgrammar = spell_dialog.getChild('checkgrammar') - if get_state_as_dict(checkgrammar)['Selected'] == 'true': - checkgrammar.executeAction('CLICK', ()) - self.assertTrue(get_state_as_dict(checkgrammar)['Selected'] == 'false') - - # Step 4: Repetitively click on "Correct all" for each misspelling - # prompt until end of document is reached. - changeall = spell_dialog.getChild('changeall') - changeall.executeAction("CLICK", ()) - changeall.executeAction("CLICK", ()) - # The third time we click on changeall, the click action is going to - # block while two message boxes are shown, so we need to do this third - # click specially: - self.ui_test.execute_blocking_action( - changeall.executeAction, args=('CLICK', ()), - # Step 5: Confirm to "Continue check at beginning of document" - dialog_handler=lambda dialog : - self.ui_test.execute_blocking_action( - dialog.getChild('yes').executeAction, 'ok', ('CLICK', ()) - ) - ) - - output_text = document.Text.getString().replace('\r\n', '\n') - self.assertTrue(re.match(self.TDF46852_REGEX, output_text)) - diff --git a/uitest/writer_tests6/insertBreakDialog.py b/uitest/writer_tests6/insertBreakDialog.py deleted file mode 100644 index 291ffdac53b4..000000000000 --- a/uitest/writer_tests6/insertBreakDialog.py +++ /dev/null @@ -1,85 +0,0 @@ -# -# 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 libreoffice.uno.propertyvalue import mkPropertyValues - -class WriterInsertBreakDialog(UITestCase): - - def launch_dialog_and_select_option(self, child): - - self.ui_test.execute_dialog_through_command(".uno:InsertBreak") - xDialog = self.xUITest.getTopFocusWindow() - - xOption = xDialog.getChild(child) - xOption.executeAction("CLICK", tuple()) - - return xDialog - - def getPages(self, total): - document = self.ui_test.get_component() - - xCursor = document.getCurrentController().getViewCursor() - xCursor.jumpToLastPage() - - self.assertEqual(xCursor.getPage(), total) - - def test_insert_line_break(self): - - self.ui_test.create_doc_in_start_center("writer") - - xDialog = self.launch_dialog_and_select_option("linerb") - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - - self.getPages(1) - - self.ui_test.close_doc() - - def test_insert_column_break(self): - - self.ui_test.create_doc_in_start_center("writer") - - xDialog = self.launch_dialog_and_select_option("columnrb") - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - - self.getPages(1) - - self.ui_test.close_doc() - - def test_insert_page_break(self): - - self.ui_test.create_doc_in_start_center("writer") - - for i in range(9): - with self.subTest(i=i): - xDialog = self.launch_dialog_and_select_option("pagerb") - - xStyleList = xDialog.getChild("stylelb") - xStyleList.executeAction("SELECT", mkPropertyValues({"POS": str(i)})) - - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - - self.getPages(i + 2) - - self.ui_test.close_doc() - - def test_cancel_button_insert_line_break_dialog(self): - - self.ui_test.create_doc_in_start_center("writer") - - self.ui_test.execute_dialog_through_command(".uno:InsertBreak") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - - self.getPages(1) - - self.ui_test.close_doc() - -# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/writer_tests6/insertPageHeader.py b/uitest/writer_tests6/insertPageHeader.py deleted file mode 100644 index 245073ace5a5..000000000000 --- a/uitest/writer_tests6/insertPageHeader.py +++ /dev/null @@ -1,72 +0,0 @@ -# -# 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 - -class WriterInsertPageHeader(UITestCase): - - def insert_header(self): - document = self.ui_test.get_component() - - self.assertEqual( - document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False) - - self.xUITest.executeCommand( - ".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=true") - - self.assertEqual( - document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True) - - def delete_header(self): - document = self.ui_test.get_component() - - self.assertEqual( - document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True) - - self.ui_test.execute_dialog_through_command( - ".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=false") - - xDialog = self.xUITest.getTopFocusWindow() - - xOption = xDialog.getChild("yes") - xOption.executeAction("CLICK", tuple()) - - self.assertEqual( - document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False) - - def test_header(self): - self.ui_test.create_doc_in_start_center("writer") - - self.insert_header() - - self.delete_header() - - self.ui_test.close_doc() - - def test_tdf107427(self): - self.ui_test.create_doc_in_start_center("writer") - - self.insert_header() - - self.ui_test.execute_dialog_through_command(".uno:InsertTable") - - xInsertDlg = self.xUITest.getTopFocusWindow() - - xOkBtn = xInsertDlg.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - - document = self.ui_test.get_component() - - tables = document.getTextTables() - self.assertEqual(len(tables[0].getRows()), 2) - self.assertEqual(len(tables[0].getColumns()), 2) - - self.xUITest.executeCommand(".uno:SelectAll") - - self.delete_header() - - self.ui_test.close_doc() - diff --git a/uitest/writer_tests7/autoredactDialog.py b/uitest/writer_tests7/autoredactDialog.py deleted file mode 100644 index 015081431d7a..000000000000 --- a/uitest/writer_tests7/autoredactDialog.py +++ /dev/null @@ -1,198 +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 libreoffice.uno.propertyvalue import mkPropertyValues -from uitest.uihelper.common import get_state_as_dict -from uitest.uihelper.common import type_text -from uitest.uihelper.common import select_pos -from uitest.uihelper.common import select_text -import time -import re -from uitest.debug import sleep - -class AutoRedactDialog(UITestCase): - - add_target_counter = 0 - - # Open the Auto Redact Dialog - def launch_and_get_autoredact_dialog(self): - self.ui_test.execute_dialog_through_command(".uno:AutoRedactDoc") - xDialog = self.xUITest.getTopFocusWindow() - self.assertTrue(xDialog is not None) - return xDialog - - def getText(self, xObj): - return get_state_as_dict(xObj)["Text"] - - def parseTargetContent(self, xObj): - return re.split(r'\t+', self.getText(xObj)) - - def clearTargetsbox(self, xDialog): - xTargetsListbox = xDialog.getChild("targets") - xDeleteBtn = xDialog.getChild("delete") - - child_count = len(xTargetsListbox.getChildren()) - - if child_count < 1: - return - - for i in range(0, child_count): - child = xTargetsListbox.getChild(0) - child.executeAction("SELECT", tuple()) - xDeleteBtn.executeAction("CLICK", tuple()) - - # Verify - self.assertEqual(len(xTargetsListbox.getChildren()), 0) - - - def test_open_AutoRedactDialog_writer(self): - self.ui_test.create_doc_in_start_center("writer") - xDialog = self.launch_and_get_autoredact_dialog() - xcancBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xcancBtn) - self.ui_test.close_doc() - - def test_add_target(self): - self.ui_test.create_doc_in_start_center("writer") - xDialog = self.launch_and_get_autoredact_dialog() - xAddBtn = xDialog.getChild("add") - - # Make sure we are starting with an empty targets list - self.clearTargetsbox(xDialog) - - # Names need to be distinct - # ["target name", "target content"], - targets_list = [ - ["target1", "content1"], - ["target2", "content2"], - ["target3", "content3"], - ] - - def handle_add_dlg(dialog): #handle add target dialog - need special handling - xNewNameTxt=dialog.getChild("name") - xNewContentTxt=dialog.getChild("content") - xOKBtn = dialog.getChild("close") - xTypeList = dialog.getChild("type") #0: Text, 1: Regex, 2: Predefined - - select_pos(xTypeList, 0) #Text - self.assertEqual(int(get_state_as_dict(xTypeList)["SelectEntryPos"]), 0) - - type_text(xNewNameTxt, targets_list[self.add_target_counter][0]) - type_text(xNewContentTxt, targets_list[self.add_target_counter][1]) - - self.ui_test.close_dialog_through_button(xOKBtn) - - for i in range(0, len(targets_list)): - self.add_target_counter = i - self.ui_test.execute_blocking_action(xAddBtn.executeAction, args=('CLICK', ()), - dialog_handler=handle_add_dlg) #close add target dialog with OK button - - # Make sure targets are added successfully - xTargetsListbox = xDialog.getChild("targets") - targets_box_state_dict = get_state_as_dict(xTargetsListbox) - self.assertEqual(int(targets_box_state_dict["Children"]), len(targets_list)) - - # Make sure targets are added with correct names and contents - for i in range(0, len(targets_list)): - child = xTargetsListbox.getChild(i) - child_text = self.parseTargetContent(child) - self.assertEqual(child_text[0], targets_list[i][0]) #name - self.assertEqual(child_text[2], targets_list[i][1]) #content - - xcancBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xcancBtn) - - # Now let's make sure the dialog remembers last state - xDialog = self.launch_and_get_autoredact_dialog() - xTargetsListbox = xDialog.getChild("targets") - targets_box_state_dict = get_state_as_dict(xTargetsListbox) - self.assertEqual(int(targets_box_state_dict["Children"]), len(targets_list)) - - # Make sure targets are remembered with correct names and contents - for i in range(0, len(targets_list)): - child = xTargetsListbox.getChild(i) - child_text = self.parseTargetContent(child) - self.assertEqual(child_text[0], targets_list[i][0]) #name - self.assertEqual(child_text[2], targets_list[i][1]) #content - - xcancBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xcancBtn) - - self.ui_test.close_doc() - - - def test_edit_target(self): - self.ui_test.create_doc_in_start_center("writer") - xDialog = self.launch_and_get_autoredact_dialog() - xAddBtn = xDialog.getChild("add") - xEditBtn = xDialog.getChild("edit") - - # Make sure we are starting with an empty targets list - self.clearTargetsbox(xDialog) - - # We first need to add a target so that we can edit it - def handle_add_dlg(dialog): #handle add target dialog - need special handling - xNewNameTxt=dialog.getChild("name") - xNewContentTxt=dialog.getChild("content") - xOKBtn = dialog.getChild("close") - xTypeList = dialog.getChild("type") #0: Text, 1: Regex, 2: Predefined - - select_pos(xTypeList, 0) #Text - self.assertEqual(int(get_state_as_dict(xTypeList)["SelectEntryPos"]), 0) - - type_text(xNewNameTxt, "TestTarget") - type_text(xNewContentTxt, "TestContent") - - self.ui_test.close_dialog_through_button(xOKBtn) - - self.ui_test.execute_blocking_action(xAddBtn.executeAction, args=('CLICK', ()), - dialog_handler=handle_add_dlg) #close add target dialog with OK button - - # Make sure target is added successfully - xTargetsListbox = xDialog.getChild("targets") - targets_box_state_dict = get_state_as_dict(xTargetsListbox) - self.assertEqual(int(targets_box_state_dict["Children"]), 1) - - # Select the added target - target_entry = xTargetsListbox.getChild(0) - target_entry.executeAction("SELECT", tuple()) - - # Now edit the target - def handle_edit_dlg(dialog): #handle add target dialog - need special handling - xNameTxt=dialog.getChild("name") - xContentTxt=dialog.getChild("content") - xOKBtn = dialog.getChild("close") - - xNameTxt.executeAction("CLEAR", tuple()) - xContentTxt.executeAction("CLEAR", tuple()) - - type_text(xNameTxt, "TestTargetEdited") - type_text(xContentTxt, "TestContentEdited") - - self.ui_test.close_dialog_through_button(xOKBtn) - - self.ui_test.execute_blocking_action(xEditBtn.executeAction, args=('CLICK', ()), - dialog_handler=handle_edit_dlg) #close add target dialog with OK button - - # Make sure target is still there - xTargetsListbox = xDialog.getChild("targets") - targets_box_state_dict = get_state_as_dict(xTargetsListbox) - self.assertEqual(int(targets_box_state_dict["Children"]), 1) - - # Make sure target has the new values - target_entry = xTargetsListbox.getChild(0) - target_text = self.parseTargetContent(target_entry) - self.assertEqual(target_text[0], "TestTargetEdited") #name - self.assertEqual(target_text[2], "TestContentEdited") #content - - xcancBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xcancBtn) - - self.ui_test.close_doc() - - -# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/writer_tests7/goToPage.py b/uitest/writer_tests7/goToPage.py deleted file mode 100644 index 7c56791a9066..000000000000 --- a/uitest/writer_tests7/goToPage.py +++ /dev/null @@ -1,48 +0,0 @@ -# -# 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 libreoffice.uno.propertyvalue import mkPropertyValues -from uitest.uihelper.common import get_state_as_dict -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() - -class GoToPage_dialog(UITestCase): - - def test_go_to_page(self): - writer_doc = self.ui_test.load_file(get_url_for_data_file("3pages.odt")) - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - - self.ui_test.execute_dialog_through_command(".uno:GotoPage") - xDialog = self.xUITest.getTopFocusWindow() - xPageText = xDialog.getChild("page") - xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - - self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") - - self.ui_test.execute_dialog_through_command(".uno:GotoPage") - xDialog = self.xUITest.getTopFocusWindow() - xPageText = xDialog.getChild("page") - xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"3a"})) - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - - self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3") - - # check cancel button - self.ui_test.execute_dialog_through_command(".uno:GotoPage") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - - self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3") - - self.ui_test.close_doc() diff --git a/uitest/writer_tests8/customizeDialog.py b/uitest/writer_tests8/customizeDialog.py deleted file mode 100644 index 5b6ab664346a..000000000000 --- a/uitest/writer_tests8/customizeDialog.py +++ /dev/null @@ -1,135 +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/. - -import time - -from uitest.framework import UITestCase -from libreoffice.uno.propertyvalue import mkPropertyValues -from uitest.uihelper.common import get_state_as_dict -from uitest.uihelper.common import select_pos - -class ConfigureDialog(UITestCase): - - def test_open_ConfigureDialog_writer(self): - - self.ui_test.create_doc_in_start_center("writer") - self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") - xDialog = self.xUITest.getTopFocusWindow() - - xcancBtn = xDialog.getChild("cancel") - xcancBtn.executeAction("CLICK", tuple()) - - self.ui_test.close_doc() - - def test_search_filter(self): - self.ui_test.create_doc_in_start_center("writer") - self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") - xDialog = self.xUITest.getTopFocusWindow() - - xfunc = xDialog.getChild("functions") - xSearch = xDialog.getChild("searchEntry") - - initialEntryCount = get_state_as_dict(xfunc)["Children"] - self.assertTrue(initialEntryCount != 0) - - xSearch.executeAction("SET", mkPropertyValues({"TEXT":"format"})) - - # Wait for the search/filter op to be completed - timeout = time.time() + 1 - while time.time() < timeout: - filteredEntryCount = get_state_as_dict(xfunc)["Children"] - if filteredEntryCount != initialEntryCount: - break - time.sleep(0.1) - - self.assertTrue(filteredEntryCount < initialEntryCount) - - xSearch.executeAction("CLEAR", tuple()) - - # Wait for the search/filter op to be completed - timeout = time.time() + 1 - while time.time() < timeout: - finalEntryCount = get_state_as_dict(xfunc)["Children"] - if finalEntryCount != filteredEntryCount: - break - time.sleep(0.1) - - self.assertEqual(initialEntryCount, finalEntryCount) - - - xcancBtn = xDialog.getChild("cancel") #button Cancel - xcancBtn.executeAction("CLICK", tuple()) #click the button - - self.ui_test.close_doc() - - def test_category_listbox(self): - self.ui_test.create_doc_in_start_center("writer") - self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") - xDialog = self.xUITest.getTopFocusWindow() - - xFunc = xDialog.getChild("functions") - xCategory = xDialog.getChild("commandcategorylist") - - initialEntryCount = get_state_as_dict(xFunc)["Children"] - self.assertTrue(initialEntryCount != 0) - - select_pos(xCategory, "1") - filteredEntryCount = get_state_as_dict(xFunc)["Children"] - self.assertTrue(filteredEntryCount < initialEntryCount) - - select_pos(xCategory, "0") - finalEntryCount = get_state_as_dict(xFunc)["Children"] - self.assertEqual(initialEntryCount, finalEntryCount) - - xcancBtn = xDialog.getChild("cancel") #button Cancel - xcancBtn.executeAction("CLICK", tuple()) #click the button - - self.ui_test.close_doc() - - def test_tdf133862(self): - self.ui_test.create_doc_in_start_center("writer") - - self.xUITest.executeCommand(".uno:InsertObjectStarMath") - - # Without the fix in place, calling customize dialog after inserting - # a formula object would crash - self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") - xDialog = self.xUITest.getTopFocusWindow() - - xcancBtn = xDialog.getChild("cancel") - xcancBtn.executeAction("CLICK", tuple()) - - self.ui_test.close_doc() - - def test_gear_button_menu(self): - self.ui_test.create_doc_in_start_center("writer") - - self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") - def close_dialog(dlg): - CancelBtn = dlg.getChild("cancel") - self.ui_test.close_dialog_through_button(CancelBtn) - - # Open the New Menu Dialog with id = 0 - xDialog = self.xUITest.getTopFocusWindow() - xmenugearbtn=xDialog.getChild("menugearbtn") - def show_dialog0(): - xmenugearbtn.executeAction("OPENFROMLIST", mkPropertyValues({"POS": "0" })) - self.ui_test.execute_blocking_action( action=show_dialog0, dialog_handler=close_dialog) - - # Open the Rename Menu Dialog with id = 2 - xDialog = self.xUITest.getTopFocusWindow() - xmenugearbtn=xDialog.getChild("menugearbtn") - def show_dialog2(): - xmenugearbtn.executeAction("OPENFROMLIST", mkPropertyValues({"POS": "2"})) - self.ui_test.execute_blocking_action( action=show_dialog2, dialog_handler=close_dialog) - - xDialog = self.xUITest.getTopFocusWindow() - xcancBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xcancBtn) - - self.ui_test.close_doc() - -# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/writer_tests8/tdf79236.py b/uitest/writer_tests8/tdf79236.py deleted file mode 100644 index 8585e48d8c64..000000000000 --- a/uitest/writer_tests8/tdf79236.py +++ /dev/null @@ -1,124 +0,0 @@ -# -# 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 -import time -from uitest.uihelper.common import get_state_as_dict, type_text - -class tdf79236(UITestCase): - - def test_paragraph(self): - - self.ui_test.create_doc_in_start_center("writer") - - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - - type_text(xWriterEdit, "Test for tdf79236") - - document = self.ui_test.get_component() - - selection = self.xUITest.executeCommand(".uno:SelectAll") - - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0) - - self.assertEqual(document.CurrentSelection.getByIndex(0).String, "Test for tdf79236") - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - - xParagraphDlg = self.xUITest.getTopFocusWindow() - - - xLeftSpnBtn = xParagraphDlg.getChild("spinED_LEFTINDENT") - for _ in range(0,20): - xLeftSpnBtn.executeAction("UP", tuple()) - - xRightSpnBtn = xParagraphDlg.getChild("spinED_RIGHTINDENT") - for _ in range(0,20): - xRightSpnBtn.executeAction("UP", tuple()) - - - xLineSpnBtn = xParagraphDlg.getChild("spinED_FLINEINDENT") - for _ in range(0,20): - xLineSpnBtn.executeAction("UP", tuple()) - - - xBottomSpnBtn = xParagraphDlg.getChild("spinED_BOTTOMDIST") - for _ in range(0,20): - xBottomSpnBtn.executeAction("UP", tuple()) - - xTopSpnBtn = xParagraphDlg.getChild("spinED_TOPDIST") - for _ in range(0,20): - xTopSpnBtn.executeAction("UP", tuple()) - - xOkBtn = xParagraphDlg.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 3704) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 3704) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 5503) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 5503) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 3704) - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - - xParagraphDlg = self.xUITest.getTopFocusWindow() - - xLeftSpnBtn = xParagraphDlg.getChild("spinED_LEFTINDENT") - for _ in range(0,20): - xLeftSpnBtn.executeAction("DOWN", tuple()) - - xRightSpnBtn = xParagraphDlg.getChild("spinED_RIGHTINDENT") - for _ in range(0,20): - xRightSpnBtn.executeAction("DOWN", tuple()) - - - xLineSpnBtn = xParagraphDlg.getChild("spinED_FLINEINDENT") - for _ in range(0,20): - xLineSpnBtn.executeAction("DOWN", tuple()) - - xBottomSpnBtn = xParagraphDlg.getChild("spinED_BOTTOMDIST") - for _ in range(0,20): - xBottomSpnBtn.executeAction("DOWN", tuple()) - - xTopSpnBtn = xParagraphDlg.getChild("spinED_TOPDIST") - for _ in range(0,20): - xTopSpnBtn.executeAction("DOWN", tuple()) - - xOkBtn = xParagraphDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) - - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0) - - self.xUITest.executeCommand(".uno:Undo") - - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 3704) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 3704) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 5503) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 5503) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 3704) - - self.xUITest.executeCommand(".uno:Undo") - - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0) - - self.assertEqual(document.CurrentSelection.getByIndex(0).String, "Test for tdf79236") - - self.ui_test.close_doc() - -# vim: set shiftwidth=4 softtabstop=4 expandtab: |