summaryrefslogtreecommitdiff
path: root/sw/qa/uitest/writer_tests5
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/uitest/writer_tests5')
-rw-r--r--sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py183
-rw-r--r--sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py431
-rw-r--r--sw/qa/uitest/writer_tests5/about_test.py13
-rw-r--r--sw/qa/uitest/writer_tests5/autocorrectOptions.py166
-rw-r--r--sw/qa/uitest/writer_tests5/columns.py101
-rw-r--r--sw/qa/uitest/writer_tests5/tdf106899.py42
-rw-r--r--sw/qa/uitest/writer_tests5/tdf107494.py88
-rwxr-xr-xsw/qa/uitest/writer_tests5/tdf115871.py87
-rw-r--r--sw/qa/uitest/writer_tests5/tdf117039.py17
-rw-r--r--sw/qa/uitest/writer_tests5/tdf118540.py25
-rw-r--r--sw/qa/uitest/writer_tests5/tdf121591.py41
-rw-r--r--sw/qa/uitest/writer_tests5/tdf122045.py33
-rw-r--r--sw/qa/uitest/writer_tests5/tdf122722.py83
-rw-r--r--sw/qa/uitest/writer_tests5/tdf123378.py18
-rw-r--r--sw/qa/uitest/writer_tests5/tdf123446.py60
-rw-r--r--sw/qa/uitest/writer_tests5/tdf138531.py67
-rw-r--r--sw/qa/uitest/writer_tests5/tdf142847.py45
-rw-r--r--sw/qa/uitest/writer_tests5/tdf145326.py84
-rw-r--r--sw/qa/uitest/writer_tests5/tdf147935.py42
-rw-r--r--sw/qa/uitest/writer_tests5/tdf148920.py33
-rw-r--r--sw/qa/uitest/writer_tests5/tdf150151.py45
-rwxr-xr-xsw/qa/uitest/writer_tests5/tdf154543.py39
-rw-r--r--sw/qa/uitest/writer_tests5/titlePage.py43
-rw-r--r--sw/qa/uitest/writer_tests5/titlePageWizard.py312
-rw-r--r--sw/qa/uitest/writer_tests5/titlePageWizard2.py124
-rw-r--r--sw/qa/uitest/writer_tests5/xwindow.py193
-rw-r--r--sw/qa/uitest/writer_tests5/zoom.py148
27 files changed, 1485 insertions, 1078 deletions
diff --git a/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py b/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py
index 4e87563f9c82..0f8e9f1d305e 100644
--- a/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py
+++ b/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py
@@ -1,5 +1,7 @@
# -*- 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/.
@@ -7,152 +9,139 @@
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
+import platform
class dateFormFieldDialog(UITestCase):
def test_setting_date_format(self):
# open a file with a date form field
- writer_doc = self.ui_test.load_file(get_url_for_data_file("date_form_field.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- # open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("date_form_field.odt")):
- itemsList = xDialog.getChild("date_formats_treeview")
+ # open the dialog (cursor is at the field)
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
- # check whether we have the right format selected
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")
+ itemsList = xDialog.getChild("date_formats_treeview")
- # select a new format
- itemsList.getChild("11").executeAction("SELECT", tuple());
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
+ # check whether we have the right format selected
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/01/99")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ # select a new format
+ itemsList.getChild("11").executeAction("SELECT", tuple());
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-01")
- # open the dialog again
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
- itemsList = xDialog.getChild("date_formats_treeview")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ # open the dialog again
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+ itemsList = xDialog.getChild("date_formats_treeview")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-01")
- self.ui_test.close_doc()
def test_date_field_with_custom_format(self):
# open a file with a date form field
- writer_doc = self.ui_test.load_file(get_url_for_data_file("date_form_field_custom_format.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("date_form_field_custom_format.odt")):
- # open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ # open the dialog (cursor is at the field)
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
- itemsList = xDialog.getChild("date_formats_treeview")
+ itemsList = xDialog.getChild("date_formats_treeview")
- # check whether we have the right format selected
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "1999. december 31., péntek")
+ # check whether we have the right format selected
+ # This is awkward though because checking for a fixed number of
+ # entries if the selected default format happens to equal a
+ # standard system format the entry gets duplicated with
+ # "[System]" appended. So this may be either 20 or 21 ... and
+ # in that case it is the selected format and the
+ # SelectEntryText doesn't match the sample string, so all this
+ # is rather fragile depending on actual locale data.
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "21")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "1999. december 1., szerda[System]")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
def test_date_reformat(self):
# open a file with a date form field
- writer_doc = self.ui_test.load_file(get_url_for_data_file("date_form_field.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- self.assertEqual(writer_doc.getText().getString(), "07/17/19")
-
- # open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("date_form_field.odt")) as writer_doc:
+ self.assertEqual(writer_doc.getText().getString(), "07/17/19")
- itemsList = xDialog.getChild("date_formats_treeview")
+ # open the dialog (cursor is at the field)
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
- # check whether we have the right format selected
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")
+ itemsList = xDialog.getChild("date_formats_treeview")
- # select a new format
- itemsList.getChild("11").executeAction("SELECT", tuple());
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
+ # check whether we have the right format selected
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/01/99")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ # select a new format
+ itemsList.getChild("11").executeAction("SELECT", tuple());
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-01")
- # after applying the new format, the field content should be updated
- self.assertEqual(writer_doc.getText().getString(), "07-17")
- self.ui_test.close_doc()
+ # after applying the new format, the field content should be updated
+ self.assertEqual(writer_doc.getText().getString(), "07-17")
def test_date_field_with_placeholder(self):
# open a file with a date form field
- writer_doc = self.ui_test.load_file(get_url_for_data_file("date_form_field_with_placeholder.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- self.assertEqual(writer_doc.getText().getString(), "[select date]")
+ with self.ui_test.load_file(get_url_for_data_file("date_form_field_with_placeholder.odt")) as writer_doc:
+ self.assertEqual(writer_doc.getText().getString(), "[select date]")
- # open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ # open the dialog (cursor is at the field)
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
- itemsList = xDialog.getChild("date_formats_treeview")
+ itemsList = xDialog.getChild("date_formats_treeview")
- # check whether we have the right format selected
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "Fri 31/Dec 99")
+ # check whether we have the right format selected
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "Wed 01/Dec 99")
- # select a new format
- itemsList.getChild("11").executeAction("SELECT", tuple());
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
+ # select a new format
+ itemsList.getChild("11").executeAction("SELECT", tuple());
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-01")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- # a placeholder text is not changed by format change
- self.assertEqual(writer_doc.getText().getString(), "[select date]")
-
- self.ui_test.close_doc()
+ # a placeholder text is not changed by format change
+ self.assertEqual(writer_doc.getText().getString(), "[select date]")
def test_date_field_without_current_date(self):
# current date means the current date fieldmark parameter which contains the current date in YYYY-MM-DD format
# when this parameter is missing LO tries to parse the content string to find out the set date
# open a file with a date form field
- writer_doc = self.ui_test.load_file(get_url_for_data_file("date_form_field_without_current_date.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- self.assertEqual(writer_doc.getText().getString(), "07/17/19")
+ with self.ui_test.load_file(get_url_for_data_file("date_form_field_without_current_date.odt")) as writer_doc:
+ self.assertEqual(writer_doc.getText().getString(), "07/17/19")
+
+ # open the dialog (cursor is at the field)
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemsList = xDialog.getChild("date_formats_treeview")
- # open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ # check whether we have the right format selected
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/01/99")
- itemsList = xDialog.getChild("date_formats_treeview")
+ # select a new format
+ itemsList.getChild("3").executeAction("SELECT", tuple());
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "Dec 1, 1999")
- # check whether we have the right format selected
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")
- # select a new format
- itemsList.getChild("3").executeAction("SELECT", tuple());
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "Dec 31, 1999")
+ # a placeholder text is not changed by format change
+ self.assertEqual(writer_doc.getText().getString(), "Jul 17, 2019")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ def test_date_picker_drop_down(self):
+ with self.ui_test.load_file(get_url_for_data_file("date_picker.docx")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- # a placeholder text is not changed by format change
- self.assertEqual(writer_doc.getText().getString(), "Jul 17, 2019")
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
- self.ui_test.close_doc()
+ # open the dialog (cursor is at the field)
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ESC"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
+ if platform.system() == "Windows":
+ self.assertEqual(writer_doc.getText().getString(), "\r\nClick to choose a date")
+ else:
+ self.assertEqual(writer_doc.getText().getString(), "\nClick to choose a date")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py b/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py
index 48608e3ee95d..c68bc8a73ee0 100644
--- a/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py
+++ b/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py
@@ -1,5 +1,7 @@
# -*- 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/.
@@ -13,257 +15,220 @@ class dropDownFormFieldDialog(UITestCase):
def test_add_new_items(self):
# open a file with an empty form field
- writer_doc = self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- # open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
-
- itemEntry = xDialog.getChild("item_entry")
- addButton = xDialog.getChild("add_button")
- itemsList = xDialog.getChild("items_treeview")
-
- # initial state
- self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
-
- # add some new items
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
- addButton.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
- addButton.executeAction("CLICK", tuple())
-
- # check whether the items are there in the list
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # check whether items are the same after reopening
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
-
- itemsList = xDialog.getChild("items_treeview")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")):
+
+ # open the dialog (cursor is at the field)
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemEntry = xDialog.getChild("item_entry")
+ addButton = xDialog.getChild("add_button")
+ itemsList = xDialog.getChild("items_treeview")
+
+ # initial state
+ self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
+
+ # add some new items
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
+ addButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
+ addButton.executeAction("CLICK", tuple())
+
+ # check whether the items are there in the list
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
+
+ # check whether items are the same after reopening
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemsList = xDialog.getChild("items_treeview")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
def test_remove_items(self):
# open a file with an empty form field
- writer_doc = self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- # open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
-
- itemEntry = xDialog.getChild("item_entry")
- addButton = xDialog.getChild("add_button")
- itemsList = xDialog.getChild("items_treeview")
- removeButton = xDialog.getChild("remove_button")
-
- # initial state
- self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
- self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "false")
-
- # add some new items
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
- addButton.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "true")
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
- addButton.executeAction("CLICK", tuple())
-
- # check whether the items are there in the list
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
-
- # select an item from the list and remove it
- itemsList.getChild("1").executeAction("SELECT", tuple());
- removeButton.executeAction("CLICK", tuple())
-
- # check whether the right item was removed
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "3")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # check whether items are the same after reopening
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
-
- itemsList = xDialog.getChild("items_treeview")
- removeButton = xDialog.getChild("remove_button")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "3")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
-
- # remove all items
- itemsList.getChild("1").executeAction("SELECT", tuple());
- removeButton.executeAction("CLICK", tuple())
- removeButton.executeAction("CLICK", tuple())
- removeButton.executeAction("CLICK", tuple())
-
- self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "false")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")):
+
+ # open the dialog (cursor is at the field)
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemEntry = xDialog.getChild("item_entry")
+ addButton = xDialog.getChild("add_button")
+ itemsList = xDialog.getChild("items_treeview")
+ removeButton = xDialog.getChild("remove_button")
+
+ # initial state
+ self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
+ self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "false")
+
+ # add some new items
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
+ addButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "true")
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
+ addButton.executeAction("CLICK", tuple())
+
+ # check whether the items are there in the list
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
+ # select an item from the list and remove it
+ itemsList.getChild("1").executeAction("SELECT", tuple());
+ removeButton.executeAction("CLICK", tuple())
+
+ # check whether the right item was removed
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "3")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
+
+
+ # check whether items are the same after reopening
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemsList = xDialog.getChild("items_treeview")
+ removeButton = xDialog.getChild("remove_button")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "3")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
+
+ # remove all items
+ itemsList.getChild("1").executeAction("SELECT", tuple());
+ removeButton.executeAction("CLICK", tuple())
+ removeButton.executeAction("CLICK", tuple())
+ removeButton.executeAction("CLICK", tuple())
+
+ self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
+
def test_move_items(self):
# open a file with an empty form field
- writer_doc = self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- # open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
-
- itemEntry = xDialog.getChild("item_entry")
- addButton = xDialog.getChild("add_button")
- itemsList = xDialog.getChild("items_treeview")
- upButton = xDialog.getChild("up_button")
- downButton = xDialog.getChild("down_button")
-
- # initial state
- self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
- self.assertEqual(get_state_as_dict(upButton)["Enabled"], "false")
- self.assertEqual(get_state_as_dict(downButton)["Enabled"], "false")
-
- # add some new items
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
- addButton.executeAction("CLICK", tuple())
-
- # check whether the items are there in the list
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
-
- # select an item from the list and move it up
- itemsList.getChild("1").executeAction("SELECT", tuple())
- self.assertEqual(get_state_as_dict(upButton)["Enabled"], "true")
- self.assertEqual(get_state_as_dict(downButton)["Enabled"], "true")
- upButton.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(upButton)["Enabled"], "false")
- self.assertEqual(get_state_as_dict(downButton)["Enabled"], "true")
-
- # check whether the item was correctly moved
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "2000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
-
- # move down the selected item
- downButton.executeAction("CLICK", tuple())
- downButton.executeAction("CLICK", tuple())
- downButton.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(upButton)["Enabled"], "true")
- self.assertEqual(get_state_as_dict(downButton)["Enabled"], "false")
-
- # check whether the item was correctly moved
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "2000")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # check whether items are the same after reopening
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
-
- itemsList = xDialog.getChild("items_treeview")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "2000")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")):
+
+ # open the dialog (cursor is at the field)
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemEntry = xDialog.getChild("item_entry")
+ addButton = xDialog.getChild("add_button")
+ itemsList = xDialog.getChild("items_treeview")
+ upButton = xDialog.getChild("up_button")
+ downButton = xDialog.getChild("down_button")
+
+ # initial state
+ self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
+ self.assertEqual(get_state_as_dict(upButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(downButton)["Enabled"], "false")
+
+ # add some new items
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
+ addButton.executeAction("CLICK", tuple())
+
+ # check whether the items are there in the list
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
+ # select an item from the list and move it up
+ itemsList.getChild("1").executeAction("SELECT", tuple())
+ self.assertEqual(get_state_as_dict(upButton)["Enabled"], "true")
+ self.assertEqual(get_state_as_dict(downButton)["Enabled"], "true")
+ upButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(upButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(downButton)["Enabled"], "true")
+
+ # check whether the item was correctly moved
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
+ # move down the selected item
+ downButton.executeAction("CLICK", tuple())
+ downButton.executeAction("CLICK", tuple())
+ downButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(upButton)["Enabled"], "true")
+ self.assertEqual(get_state_as_dict(downButton)["Enabled"], "false")
+
+ # check whether the item was correctly moved
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "2000")
+
+
+ # check whether items are the same after reopening
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemsList = xDialog.getChild("items_treeview")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "2000")
+
def test_drop_down_after_import(self):
files = ["drop_down_form_field.odt", "drop_down_form_field.doc", "drop_down_form_field.docx"]
for file in files:
# open a file with a drop-down for field with items and selection
- writer_doc = self.ui_test.load_file(get_url_for_data_file(file))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- # open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file(file)):
- itemsList = xDialog.getChild("items_treeview")
+ # open the dialog (cursor is at the field)
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
- # check whether the items are there in the list
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+ itemsList = xDialog.getChild("items_treeview")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "3000")
+ # check whether the items are there in the list
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "3000")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/about_test.py b/sw/qa/uitest/writer_tests5/about_test.py
index 7005dbb65221..980eca989021 100644
--- a/sw/qa/uitest/writer_tests5/about_test.py
+++ b/sw/qa/uitest/writer_tests5/about_test.py
@@ -1,5 +1,7 @@
# -*- 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/.
@@ -11,15 +13,10 @@ class AboutDlgTest(UITestCase):
def test_about_dlg(self):
- self.ui_test.create_doc_in_start_center("writer")
-
- self.ui_test.execute_dialog_through_command(".uno:About")
-
- xAboutDlg = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center("writer"):
- xCloseBtn = xAboutDlg.getChild("btnClose")
- self.ui_test.close_dialog_through_button(xCloseBtn)
+ with self.ui_test.execute_dialog_through_command(".uno:About", close_button="btnClose"):
+ pass
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/autocorrectOptions.py b/sw/qa/uitest/writer_tests5/autocorrectOptions.py
index f9d5d5b9117b..d891a0d99faf 100644
--- a/sw/qa/uitest/writer_tests5/autocorrectOptions.py
+++ b/sw/qa/uitest/writer_tests5/autocorrectOptions.py
@@ -1,102 +1,96 @@
# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.common import get_state_as_dict
-import time
-from uitest.debug import sleep
from uitest.uihelper.common import select_pos
class autocorrectOptions(UITestCase):
def test_autocorrect_options_writer(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0") #tab replace
- origtext = xDialog.getChild("origtext")
- newtext = xDialog.getChild("newtext")
- xnew = xDialog.getChild("new")
- xdelete = xDialog.getChild("delete")
- xtabview = xDialog.getChild("tabview")
- xreset = xDialog.getChild("reset")
- nrRows = get_state_as_dict(xtabview)["VisibleCount"]
-
- self.assertTrue(int(nrRows) > 0)
-
- #add new rule
- origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"}))
- newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"}))
- xnew.executeAction("CLICK", tuple())
- nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"]
- nrRowsDiff = int(nrRowsNew) - int(nrRows)
- self.assertEqual(nrRowsDiff, 1) #we have +1 rule
- #delete rule
- origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"}))
- newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"}))
- xdelete.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules
-
- select_pos(xTabs, "1") #tab Exceptions
- #abbreviations
- abbrev = xDialog.getChild("abbrev")
- newabbrev = xDialog.getChild("newabbrev")
- delabbrev = xDialog.getChild("delabbrev")
- abbrevlist = xDialog.getChild("abbrevlist")
-
- nrRowsAbb = get_state_as_dict(abbrevlist)["VisibleCount"]
-
- self.assertTrue(int(nrRowsAbb) > 0)
-
- abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"}))
- newabbrev.executeAction("CLICK", tuple())
- nrRowsAbbNew = get_state_as_dict(abbrevlist)["VisibleCount"]
- nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb)
- self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule
- delabbrev.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(abbrevlist)["VisibleCount"], nrRowsAbb) #we have default nr of rules
-
- #words with two initial capitals
- double = xDialog.getChild("double")
- newdouble = xDialog.getChild("newdouble")
- deldouble = xDialog.getChild("deldouble")
- doublelist = xDialog.getChild("doublelist")
-
- nrRowsDouble = get_state_as_dict(doublelist)["VisibleCount"]
-
- self.assertTrue(int(nrRowsDouble) > 0)
-
- double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"}))
- newdouble.executeAction("CLICK", tuple())
- nrRowsDoubleNew = get_state_as_dict(doublelist)["VisibleCount"]
- nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and
- self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule
- deldouble.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(doublelist)["VisibleCount"], nrRowsDouble) #we have default nr of rules
-
- xCancelButton = xDialog.getChild("cancel")
- xCancelButton.executeAction("CLICK", tuple())
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ with self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0") #tab replace
+ origtext = xDialog.getChild("origtext")
+ newtext = xDialog.getChild("newtext")
+ xnew = xDialog.getChild("new")
+ xdelete = xDialog.getChild("delete")
+ xtabview = xDialog.getChild("tabview")
+ nrRows = get_state_as_dict(xtabview)["VisibleCount"]
+
+ self.assertTrue(int(nrRows) > 0)
+
+ #add new rule
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"}))
+ xnew.executeAction("CLICK", tuple())
+ nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"]
+ nrRowsDiff = int(nrRowsNew) - int(nrRows)
+ self.assertEqual(nrRowsDiff, 1) #we have +1 rule
+ #delete rule
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"}))
+ xdelete.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules
+
+ select_pos(xTabs, "1") #tab Exceptions
+ #abbreviations
+ abbrev = xDialog.getChild("abbrev")
+ newabbrev = xDialog.getChild("newabbrev")
+ delabbrev = xDialog.getChild("delabbrev")
+ abbrevlist = xDialog.getChild("abbrevlist")
+
+ nrRowsAbb = get_state_as_dict(abbrevlist)["VisibleCount"]
+
+ self.assertTrue(int(nrRowsAbb) > 0)
+
+ abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"}))
+ newabbrev.executeAction("CLICK", tuple())
+ nrRowsAbbNew = get_state_as_dict(abbrevlist)["VisibleCount"]
+ nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb)
+ self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule
+ delabbrev.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(abbrevlist)["VisibleCount"], nrRowsAbb) #we have default nr of rules
+
+ #words with two initial capitals
+ double = xDialog.getChild("double")
+ newdouble = xDialog.getChild("newdouble")
+ deldouble = xDialog.getChild("deldouble")
+ doublelist = xDialog.getChild("doublelist")
+
+ nrRowsDouble = get_state_as_dict(doublelist)["VisibleCount"]
+
+ self.assertTrue(int(nrRowsDouble) > 0)
+
+ double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"}))
+ newdouble.executeAction("CLICK", tuple())
+ nrRowsDoubleNew = get_state_as_dict(doublelist)["VisibleCount"]
+ nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and
+ self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule
+ deldouble.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(doublelist)["VisibleCount"], nrRowsDouble) #we have default nr of rules
+
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/columns.py b/sw/qa/uitest/writer_tests5/columns.py
index 0e71c065d057..8da22cef4178 100644
--- a/sw/qa/uitest/writer_tests5/columns.py
+++ b/sw/qa/uitest/writer_tests5/columns.py
@@ -1,58 +1,73 @@
# -*- 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
-from uitest.uihelper.common import select_pos
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
from uitest.uihelper.common import change_measurement_unit
-from uitest.uihelper.calc import enter_text_to_cell
-from libreoffice.calc.document import get_cell_by_position
-from uitest.debug import sleep
from libreoffice.uno.propertyvalue import mkPropertyValues
#uitest sw / Columns dialog
class columns(UITestCase):
def test_columns(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- change_measurement_unit(self, "Centimeter")
-
- #dialog Columns
- self.ui_test.execute_dialog_through_command(".uno:FormatColumns")
- xDialog = self.xUITest.getTopFocusWindow()
-
- colsnf = xDialog.getChild("colsnf")
- colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- colsnf.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
- colsnf.executeAction("UP", tuple())
- colsnf.executeAction("DOWN", tuple())
- spacing1mf = xDialog.getChild("spacing1mf")
- spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- spacing1mf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
- autowidth = xDialog.getChild("autowidth")
- autowidth.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- #verify
- self.ui_test.execute_dialog_through_command(".uno:FormatColumns")
- xDialog = self.xUITest.getTopFocusWindow()
- colsnf = xDialog.getChild("colsnf")
- spacing1mf = xDialog.getChild("spacing1mf")
- autowidth = xDialog.getChild("autowidth")
-
- self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
- self.assertEqual(get_state_as_dict(spacing1mf)["Text"], "1.00 cm")
- self.assertEqual(get_state_as_dict(autowidth)["Selected"], "false")
- xOKBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ with change_measurement_unit(self, "Centimeter"):
+
+ #dialog Columns
+ with self.ui_test.execute_dialog_through_command(".uno:FormatColumns") as xDialog:
+
+ colsnf = xDialog.getChild("colsnf")
+ colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ colsnf.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
+ colsnf.executeAction("UP", tuple())
+ colsnf.executeAction("DOWN", tuple())
+ spacing1mf = xDialog.getChild("spacing1mf")
+ spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ spacing1mf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
+ autowidth = xDialog.getChild("autowidth")
+ autowidth.executeAction("CLICK", tuple())
+ #verify
+ with self.ui_test.execute_dialog_through_command(".uno:FormatColumns", close_button="cancel") as xDialog:
+ colsnf = xDialog.getChild("colsnf")
+ spacing1mf = xDialog.getChild("spacing1mf")
+ autowidth = xDialog.getChild("autowidth")
+
+ self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
+ self.assertEqual(get_state_as_dict(spacing1mf)["Text"], "1.00 cm")
+ self.assertEqual(get_state_as_dict(autowidth)["Selected"], "false")
+
+ def test_tdf150293_separator_width_unit_conversion(self):
+ with self.ui_test.load_file(get_url_for_data_file("section-columns-separator.fodt")):
+
+ #dialog Columns
+ with self.ui_test.execute_dialog_through_command(".uno:FormatColumns") as xDialog:
+ linewidthmf = xDialog.getChild("linewidthmf")
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '0.45 pt' != '0.25 pt'
+ self.assertEqual(get_state_as_dict(linewidthmf)["Text"], "0.25 pt")
+
+ # Set it to 0.5 pt
+ linewidthmf.executeAction("UP", tuple())
+ self.assertEqual(get_state_as_dict(linewidthmf)["Text"], "0.50 pt")
+
+ # save and reload: the new value of line width must roundtrip unchanged
+ self.xUITest.executeCommand('.uno:Save')
+ self.xUITest.executeCommand('.uno:Reload')
+
+ with self.ui_test.execute_dialog_through_command(".uno:FormatColumns", close_button="cancel") as xDialog:
+ linewidthmf = xDialog.getChild("linewidthmf")
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '0.55 pt' != '0.50 pt'
+ self.assertEqual(get_state_as_dict(linewidthmf)["Text"], "0.50 pt")
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf106899.py b/sw/qa/uitest/writer_tests5/tdf106899.py
new file mode 100644
index 000000000000..38f2b715104b
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf106899.py
@@ -0,0 +1,42 @@
+# -*- 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/.
+#
+
+import org.libreoffice.unotest
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_url_for_data_file
+
+class tdf106899(UITestCase):
+
+ def test_tdf106899_alphabetical_index_utf8(self):
+ # Copy concordance file containing an utf8 index entry
+ org.libreoffice.unotest.makeCopyFromTDOC("tdf106899.sdi")
+ with self.ui_test.load_file(get_url_for_data_file("tdf106899.odt")) as document:
+
+ # Update the alphabetical index and check if it contains the utf8 index entry
+ xDocumentIndexes = document.DocumentIndexes
+ self.assertEqual(len(xDocumentIndexes), 1)
+ self.assertEqual(xDocumentIndexes.hasByName("Alphabetical Index1"), True)
+ xDocumentIndex = xDocumentIndexes.getByName("Alphabetical Index1")
+ xIndexAnchor = xDocumentIndex.getAnchor()
+ self.assertEqual("Nguyễn Khánh" in xIndexAnchor.getString(), False)
+
+ # TODO Bug Report - Refresh of the index does only work using .uno:UpdateAllIndexes
+ # It does not work with xDocumentIndex.refresh() nor with xDocumentIndex.update()
+ self.xUITest.executeCommand(".uno:UpdateAllIndexes")
+
+ # TODO Bug Report - Retrieving the text of the updated index only works using the cursor
+ # It does not work with xIndexAnchor.getString()
+ xCursor = document.getText().createTextCursor()
+ xCursor.gotoRange(xDocumentIndex.getAnchor().getEnd(), False)
+ xCursor.gotoStartOfParagraph(True)
+
+ # Without the fix in place the index does not contain the utf8 index entry
+ self.assertEqual("Nguyễn Khánh" in xCursor.getString(), True)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf107494.py b/sw/qa/uitest/writer_tests5/tdf107494.py
deleted file mode 100644
index f7eadf68a4c3..000000000000
--- a/sw/qa/uitest/writer_tests5/tdf107494.py
+++ /dev/null
@@ -1,88 +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, get_url_for_data_file
-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
-
-#Bug 107494 - CRASH: LibreOffice crashes while deleting the header containing an image
-
-class tdf107494(UITestCase):
- def test_tdf107494_delete_header_with_image(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #insert header
- 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)
- #insert image
- text = document.getText()
- cursor = text.createTextCursor()
- oStyleFamilies = document.getStyleFamilies()
- #https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=71227
- obj2 = oStyleFamilies.getByName("PageStyles")
- obj3 = obj2.getByName("Standard")
- oHeaderText = obj3.HeaderText
- oHeaderText.setString("New text for header") #write text to header
- obj4 = oHeaderText.createTextCursor()
- text = obj4.getText()
- cursor = text.createTextCursor()
-
- textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject')
- provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider')
- graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice_external_logo_100px.png")}))
- textGraphic.Graphic = graphic
- text.insertTextContent(cursor, textGraphic, False)
- # Delete the header
- self.ui_test.execute_dialog_through_command(".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=false")
- xDialog = self.xUITest.getTopFocusWindow() #question dialog
- xOption = xDialog.getChild("yes")
- xOption.executeAction("CLICK", tuple())
-
- self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False)
-
- self.ui_test.close_doc()
-
- def test_tdf107494_delete_footer_with_image(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #insert footer
- self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, False)
- self.xUITest.executeCommand(".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=true")
- self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, True)
- #insert image
- text = document.getText()
- cursor = text.createTextCursor()
- oStyleFamilies = document.getStyleFamilies()
- #https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=71227
- obj2 = oStyleFamilies.getByName("PageStyles")
- obj3 = obj2.getByName("Standard")
- oFooterText = obj3.FooterText
- oFooterText.setString("New text for footer") #write text to footer
- obj4 = oFooterText.createTextCursor()
- text = obj4.getText()
- cursor = text.createTextCursor()
-
- textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject')
- provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider')
- graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice_external_logo_100px.png")}))
- textGraphic.Graphic = graphic
- text.insertTextContent(cursor, textGraphic, False)
- # Delete the footer
- self.ui_test.execute_dialog_through_command(".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=false")
- xDialog = self.xUITest.getTopFocusWindow() #question dialog
- xOption = xDialog.getChild("yes")
- xOption.executeAction("CLICK", tuple())
-
- self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, False)
-
- self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf115871.py b/sw/qa/uitest/writer_tests5/tdf115871.py
new file mode 100755
index 000000000000..1f8639b64586
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf115871.py
@@ -0,0 +1,87 @@
+# -*- 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 type_text
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.common import get_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf115871(UITestCase):
+
+ def test_tdf115871_reset_outline_list_options_parent(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ # Create new style from selection
+ with self.ui_test.execute_dialog_through_command(".uno:StyleNewByExample") as xDialog:
+ xStyleName = xDialog.getChild("stylename")
+ type_text(xStyleName, "Custom Heading 1")
+
+ # Modify the created style to inherit paragraph attributes from Heading 1
+ with self.ui_test.execute_dialog_through_command(".uno:EditStyle") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xLinkedWith = xTabs.getChild("linkedwith")
+ xLinkedWith.executeAction("SELECT", mkPropertyValues({"TEXT": "Heading 1"}))
+ self.assertEqual(get_state_as_dict(xLinkedWith)["SelectEntryText"], "Heading 1")
+
+ # Modify outline & list settings of the created style
+ with self.ui_test.execute_dialog_through_command(".uno:EditStyle") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "15")
+
+ # Outline level
+ xOutlineLevel = xTabs.getChild("comboLB_OUTLINE_LEVEL")
+ xOutlineLevel.executeAction("SELECT", mkPropertyValues({"TEXT": "Level 5"}))
+ self.assertEqual(get_state_as_dict(xOutlineLevel)["SelectEntryText"], "Level 5")
+
+ # List style
+ xListStyle = xTabs.getChild("comboLB_NUMBER_STYLE")
+ xListStyle.executeAction("SELECT", mkPropertyValues({"TEXT": "Numbering 123"}))
+ self.assertEqual(get_state_as_dict(xListStyle)["SelectEntryText"], "Numbering 123")
+
+ # Line numbering including start with
+ xRestartAtParagraph = xTabs.getChild("checkCB_RESTART_PARACOUNT")
+ xRestartAtParagraph.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(xRestartAtParagraph)["Selected"], "true")
+ xStartWith = xTabs.getChild("spinNF_RESTART_PARA")
+ xStartWith.executeAction("UP", tuple())
+ self.assertEqual(get_state_as_dict(xStartWith)["Text"], "2")
+
+ # Open the paragraph style dialog and reset dialog to parent settings
+ with self.ui_test.execute_dialog_through_command(".uno:EditStyle") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "15")
+
+ xStandardButton = xDialog.getChild("standard")
+ xStandardButton.executeAction("CLICK", tuple())
+
+ xOutlineLevel = xTabs.getChild("comboLB_OUTLINE_LEVEL")
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Level 5' != 'Level 1'
+ self.assertEqual(get_state_as_dict(xOutlineLevel)["SelectEntryText"], "Level 1")
+
+ xListStyle = xTabs.getChild("comboLB_NUMBER_STYLE")
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Numbering 123' != 'Heading Numbering'
+ self.assertEqual(get_state_as_dict(xListStyle)["SelectEntryText"], "Heading Numbering")
+
+ xRestartAtParagraph = xTabs.getChild("checkCB_RESTART_PARACOUNT")
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'true' != 'false'
+ self.assertEqual(get_state_as_dict(xRestartAtParagraph)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xListStyle)["SelectEntryText"], "Heading Numbering")
+
+ xStartWith = xTabs.getChild("spinNF_RESTART_PARA")
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '2' != '1'
+ self.assertEqual(get_state_as_dict(xStartWith)["Text"], "1")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf117039.py b/sw/qa/uitest/writer_tests5/tdf117039.py
index 0ec90810a7b3..a08885308989 100644
--- a/sw/qa/uitest/writer_tests5/tdf117039.py
+++ b/sw/qa/uitest/writer_tests5/tdf117039.py
@@ -8,22 +8,19 @@
#
from uitest.framework import UITestCase
-from libreoffice.uno.propertyvalue import mkPropertyValues
-from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from uitest.uihelper.common import get_url_for_data_file
#Bug 117039 - Print Preview crashes on signed document
class tdf117039(UITestCase):
def test_tdf117039_preview_signed_document(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf117039.odt"))
- document = self.ui_test.get_component()
- self.xUITest.executeCommand(".uno:PrintPreview") #open print preview
- self.xUITest.executeCommand(".uno:ClosePreview") # close print preview
+ with self.ui_test.load_file(get_url_for_data_file("tdf117039.odt")) as writer_doc:
+ self.xUITest.executeCommand(".uno:PrintPreview") #open print preview
+ self.xUITest.executeCommand(".uno:ClosePreview") # close print preview
- self.xUITest.getTopFocusWindow() #Get focus after closing preview
+ self.xUITest.getTopFocusWindow() #Get focus after closing preview
- #verify
- self.assertEqual(document.Text.String[0:22], "Test digital signature")
- self.ui_test.close_doc()
+ #verify
+ self.assertEqual(writer_doc.Text.String[0:22], "Test digital signature")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf118540.py b/sw/qa/uitest/writer_tests5/tdf118540.py
index 1ae4a30c2055..e33cad63b888 100644
--- a/sw/qa/uitest/writer_tests5/tdf118540.py
+++ b/sw/qa/uitest/writer_tests5/tdf118540.py
@@ -8,28 +8,21 @@
#
from uitest.framework import UITestCase
-from libreoffice.uno.propertyvalue import mkPropertyValues
-from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from uitest.uihelper.common import get_url_for_data_file
#Bug 118540 - LO6.1b2: DOCX crashes when properties are opened in print preview mode
class tdf118540(UITestCase):
def test_tdf118540_preview_document_properties(self):
- # FIXME flaky test, usually passes, but breaks regularly.
- return
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf118540.docx"))
- document = self.ui_test.get_component()
- self.xUITest.executeCommand(".uno:PrintPreview") #open print preview
- self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") #open properties dialog
- xDialog = self.xUITest.getTopFocusWindow()
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
- self.xUITest.executeCommand(".uno:ClosePreview") # close print preview
+ with self.ui_test.load_file(get_url_for_data_file("tdf118540.docx")) as writer_doc:
+ self.xUITest.executeCommand(".uno:PrintPreview") #open print preview
+ with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties"):
+ pass
+ self.xUITest.executeCommand(".uno:ClosePreview") # close print preview
- self.xUITest.getTopFocusWindow() #Get focus after closing preview
+ self.xUITest.getTopFocusWindow() #Get focus after closing preview
- #verify
- self.assertEqual(document.Text.String[0:4], "Test")
- self.ui_test.close_doc()
+ #verify
+ self.assertEqual(writer_doc.Text.String[0:4], "Test")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf121591.py b/sw/qa/uitest/writer_tests5/tdf121591.py
deleted file mode 100644
index df6deac658b7..000000000000
--- a/sw/qa/uitest/writer_tests5/tdf121591.py
+++ /dev/null
@@ -1,41 +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
-import time
-from uitest.uihelper.common import get_state_as_dict, type_text
-from uitest.debug import sleep
-from uitest.uihelper.common import select_pos
-#Bug 121591 - CRASH: Print Preview fails if cursor inside Floating frame
-class tdf121591(UITestCase):
-
- def test_tdf121591_frame_print_preview(self):
- # FIXME unstable test
- return
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.ui_test.execute_dialog_through_command(".uno:InsertFrame") # insert frame
- xDialogFr = self.xUITest.getTopFocusWindow()
-
- xOkBtn=xDialogFr.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
-
- type_text(xWriterEdit, "Text in the frame")
- #open and close print preview
- self.xUITest.executeCommand(".uno:PrintPreview") #open print preview
- self.xUITest.executeCommand(".uno:ClosePreview") # close print preview
-
- self.xUITest.getTopFocusWindow() #Get focus after closing preview
-
- #verify nr. of frames
- self.assertEqual(document.TextFrames.getCount(), 1)
-
- self.ui_test.close_doc()
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf122045.py b/sw/qa/uitest/writer_tests5/tdf122045.py
index 80d11384ac8f..a43c6b378cb7 100644
--- a/sw/qa/uitest/writer_tests5/tdf122045.py
+++ b/sw/qa/uitest/writer_tests5/tdf122045.py
@@ -1,43 +1,38 @@
# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.common import select_pos
class tdf122045(UITestCase):
def test_tdf122045(self):
- self.ui_test.create_doc_in_start_center("writer")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- document = self.ui_test.get_component()
+ with self.ui_test.create_doc_in_start_center("writer") as document:
- self.ui_test.execute_dialog_through_command(".uno:PageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog", close_button="cancel") as xDialog:
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "2")
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
- btncolor = xDialog.getChild("btncolor")
- btncolor.executeAction("CLICK", tuple())
+ btncolor = xDialog.getChild("btncolor")
+ btncolor.executeAction("CLICK", tuple())
- xApplyBtn = xDialog.getChild("apply")
- xApplyBtn.executeAction("CLICK", tuple())
+ xApplyBtn = xDialog.getChild("apply")
+ xApplyBtn.executeAction("CLICK", tuple())
- self.assertTrue(document.isModified())
- self.assertEqual("0x729fcf", hex(document.StyleFamilies.PageStyles.Standard.BackColor))
+ self.assertTrue(document.isModified())
+ self.assertEqual("0x729fcf", hex(document.StyleFamilies.PageStyles.Standard.BackColor))
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
- self.assertTrue(document.isModified())
- self.assertEqual("0x729fcf", hex(document.StyleFamilies.PageStyles.Standard.BackColor))
+ self.assertTrue(document.isModified())
+ self.assertEqual("0x729fcf", hex(document.StyleFamilies.PageStyles.Standard.BackColor))
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf122722.py b/sw/qa/uitest/writer_tests5/tdf122722.py
index cbc46e09c17b..f58c32b83ebe 100644
--- a/sw/qa/uitest/writer_tests5/tdf122722.py
+++ b/sw/qa/uitest/writer_tests5/tdf122722.py
@@ -1,76 +1,53 @@
# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.common import get_state_as_dict, type_text
-import time
-from uitest.debug import sleep
-from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.common import select_pos
#Bug 122722 - Hiding characters will crash. Crash in: SwAttrIter::CtorInitAttrIter(SwTextNode &,SwScriptInfo &,SwTextFrame const *)
class tdf122722(UITestCase):
def test_tdf122722_format_character_hidden(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- #1. Start LibreOffice
- #2. Create New Writer Document
- #3. Type "LibreOffice" in Writer
- type_text(xWriterEdit, "LibreOffice")
- #4. Select "LibreOffice" with mouse, and right click
- self.xUITest.executeCommand(".uno:SelectAll")
- self.assertEqual(document.Text.String[0:11], "LibreOffice")
- #5. Appear Context Menu, Character -> Character
- #6. Opened Character, Select "Font Effect" tab
- #7. Check Hidden, and click [OK]
- #8. Crash a LibreOffice
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #1. Start LibreOffice
+ #2. Create New Writer Document
+ #3. Type "LibreOffice" in Writer
+ type_text(xWriterEdit, "LibreOffice")
+ #4. Select "LibreOffice" with mouse, and right click
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.assertEqual(document.Text.String[0:11], "LibreOffice")
+ #5. Appear Context Menu, Character -> Character
+ #6. Opened Character, Select "Font Effect" tab
+ #7. Check Hidden, and click [OK]
+ #8. Crash a LibreOffice
+ with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
- xEffects = xDialog.getChild("effectslb")
- xRelief = xDialog.getChild("relieflb")
- xHidden = xDialog.getChild("hiddencb")
- xOverline = xDialog.getChild("overlinelb")
- xStrikeout = xDialog.getChild("strikeoutlb")
- xUnderline = xDialog.getChild("underlinelb")
- xEmphasis = xDialog.getChild("emphasislb")
- xPosition = xDialog.getChild("positionlb")
+ xHidden = xDialog.getChild("hiddencb")
- xHidden.executeAction("CLICK", tuple())
+ xHidden.executeAction("CLICK", tuple())
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
- #un-hidden
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
+ #un-hidden
+ with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
- xEffects = xDialog.getChild("effectslb")
- xRelief = xDialog.getChild("relieflb")
- xHidden = xDialog.getChild("hiddencb")
- xOverline = xDialog.getChild("overlinelb")
- xStrikeout = xDialog.getChild("strikeoutlb")
- xUnderline = xDialog.getChild("underlinelb")
- xEmphasis = xDialog.getChild("emphasislb")
- xPosition = xDialog.getChild("positionlb")
+ xHidden = xDialog.getChild("hiddencb")
- self.assertEqual(get_state_as_dict(xHidden)["Selected"], "true")
- xHidden.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(xHidden)["Selected"], "true")
+ xHidden.executeAction("CLICK", tuple())
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
- self.assertEqual(document.Text.String[0:11], "LibreOffice")
+ self.assertEqual(document.Text.String[0:11], "LibreOffice")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf123378.py b/sw/qa/uitest/writer_tests5/tdf123378.py
index d7b832e25c8c..ba58d0f64e4a 100644
--- a/sw/qa/uitest/writer_tests5/tdf123378.py
+++ b/sw/qa/uitest/writer_tests5/tdf123378.py
@@ -1,8 +1,11 @@
# -*- 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
@@ -12,16 +15,13 @@ class tdf123378(UITestCase):
def test_tdf123378_print_sets_modified(self):
# FIXME unstable test
return
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center("writer") as document:
- self.xUITest.executeCommand(".uno:Print")
- xDialog = self.xUITest.getTopFocusWindow()
- xOK = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xOK)
+ self.xUITest.executeCommand(".uno:Print")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xOK = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xOK)
- self.assertEqual(document.isModified(), False)
+ self.assertEqual(document.isModified(), False)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf123446.py b/sw/qa/uitest/writer_tests5/tdf123446.py
index dd39dd9f5c64..53f8208f8334 100644
--- a/sw/qa/uitest/writer_tests5/tdf123446.py
+++ b/sw/qa/uitest/writer_tests5/tdf123446.py
@@ -1,46 +1,42 @@
# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
-from uitest.uihelper.common import get_state_as_dict, type_text
-import time
-from uitest.debug import sleep
+from uitest.uihelper.common import type_text
#Bug 123446 - Writer crashes after undoing + redoing ToC insertion in middle of word
class tdf123446(UITestCase):
- def test_tsd123446_undo_redo_ToC_crash(self):
- self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- #- Add a word to an empty document.
- type_text(xWriterEdit, "LibreOffice")
- #- Change its style to Heading 2.
- self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%202&FamilyName:string=ParagraphStyles")
- #- Position cursor somewhere in the middle of the word, and add Table of Contents
- #(no need to change anything in the dialog).
- self.xUITest.executeCommand(".uno:GoLeft")
- self.xUITest.executeCommand(".uno:GoLeft")
- self.xUITest.executeCommand(".uno:GoLeft")
- self.xUITest.executeCommand(".uno:GoLeft")
+ def test_tdf123446_undo_redo_ToC_crash(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #- Add a word to an empty document.
+ type_text(xWriterEdit, "LibreOffice")
+ #- Change its style to Heading 2.
+ self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%202&FamilyName:string=ParagraphStyles")
+ #- Position cursor somewhere in the middle of the word, and add Table of Contents
+ #(no need to change anything in the dialog).
+ self.xUITest.executeCommand(".uno:GoLeft")
+ self.xUITest.executeCommand(".uno:GoLeft")
+ self.xUITest.executeCommand(".uno:GoLeft")
+ self.xUITest.executeCommand(".uno:GoLeft")
- self.ui_test.execute_dialog_through_command(".uno:InsertMultiIndex")
- xDialog = self.xUITest.getTopFocusWindow()
- xokbtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xokbtn)
- #- Undo the ToC insertion.
- self.xUITest.executeCommand(".uno:Undo")
- #- Redo the ToC insertion.
- self.xUITest.executeCommand(".uno:Redo")
- #=> Crash. Now we verify the text
- # This second undo crash in Clang build https://bugs.documentfoundation.org/show_bug.cgi?id=123313#c9
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.Text.String[0:7], "LibreOf")
+ with self.ui_test.execute_dialog_through_command(".uno:InsertMultiIndex"):
+ pass
+ #- Undo the ToC insertion.
+ self.xUITest.executeCommand(".uno:Undo")
+ #- Redo the ToC insertion.
+ self.xUITest.executeCommand(".uno:Redo")
+ #=> Crash. Now we verify the text
+ # This second undo crash in Clang build https://bugs.documentfoundation.org/show_bug.cgi?id=123313#c9
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Text.String[0:7], "LibreOf")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf138531.py b/sw/qa/uitest/writer_tests5/tdf138531.py
new file mode 100644
index 000000000000..f4c4ae2994e7
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf138531.py
@@ -0,0 +1,67 @@
+# -*- 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
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.calc import enter_text_to_cell
+
+class Tdf138531(UITestCase):
+
+ def test_tdf138531(self):
+
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ #enter data
+ enter_text_to_cell(gridwin, "A1", "First")
+ enter_text_to_cell(gridwin, "A2", "Second")
+
+ #select A1:A2
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"}))
+
+ self.xUITest.executeCommand(".uno:Copy")
+
+ # Work with both documents at the same time
+ with self.ui_test.load_empty_file("writer") as writer_doc:
+
+ # Paste as DDE
+ formatProperty = mkPropertyValues({"SelectedFormat": 59})
+ self.xUITest.executeCommandWithParameters(".uno:ClipboardFormatItems", formatProperty)
+
+ self.assertEqual(1, len(writer_doc.TextTables))
+ table = writer_doc.getTextTables()[0]
+ self.assertEqual("First", table.getCellByName("A1").getString())
+ self.assertEqual("Second", table.getCellByName("A2").getString())
+
+ frames = self.ui_test.get_frames()
+ # switch view to the calc document
+ frames[0].activate()
+ enter_text_to_cell(gridwin, "A1", "Second")
+ enter_text_to_cell(gridwin, "A2", "First")
+
+ # switch view back to the writer document
+ frames[1].activate()
+
+ with self.ui_test.execute_dialog_through_command(".uno:LinkDialog", close_button="close") as xDialog:
+ xLinks = xDialog.getChild("TB_LINKS")
+ self.assertEqual(1, len(xLinks.getChildren()))
+
+ xFileName = xDialog.getChild("FULL_FILE_NAME")
+ self.assertEqual("Untitled 1", get_state_as_dict(xFileName)["Text"])
+
+ xUpdate = xDialog.getChild("UPDATE_NOW")
+ xUpdate.executeAction("CLICK", tuple())
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Second' != 'First'
+ self.assertEqual("Second", table.getCellByName("A1").getString())
+ self.assertEqual("First", table.getCellByName("A2").getString())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf142847.py b/sw/qa/uitest/writer_tests5/tdf142847.py
new file mode 100644
index 000000000000..332e95051f52
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf142847.py
@@ -0,0 +1,45 @@
+# -*- 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_url_for_data_file
+
+class tdf142847(UITestCase):
+ def test_tdf142847(self):
+ # load the sample file
+ with self.ui_test.load_file(get_url_for_data_file("tdf142847.fodt")):
+ document = self.ui_test.get_component()
+
+ # get the shape
+ shape = document.DrawPage[0]
+
+ # get the textbox
+ frame = shape.getText()
+
+ oldFramePos = frame.getPropertyValue("HoriOrientPosition")
+ oldShapePos = shape.getPropertyValue("LeftMargin")
+ oldDiff = oldFramePos - oldShapePos
+
+ # select the shape.
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ self.ui_test.wait_until_child_is_available('metricfield')
+
+ # set the wrap spacing of the shape
+ with self.ui_test.execute_dialog_through_command(".uno:TextWrap") as wrap_dialog:
+ wrap_dialog.getChild('left').executeAction("UP", tuple())
+
+ newDiff = frame.getPropertyValue("HoriOrientPosition") - shape.getPropertyValue("LeftMargin")
+
+ # without the fix, this will fail.
+ # the textbox has fallen apart.
+ self.assertEqual(oldDiff, newDiff)
+
+ self.assertGreater(frame.getPropertyValue("HoriOrientPosition"), oldFramePos)
+ self.assertGreater(shape.getPropertyValue("LeftMargin"), oldShapePos)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf145326.py b/sw/qa/uitest/writer_tests5/tdf145326.py
new file mode 100644
index 000000000000..6a4d9e361495
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf145326.py
@@ -0,0 +1,84 @@
+# -*- 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 org.libreoffice.unotest import systemPathToFileUrl
+from tempfile import TemporaryDirectory
+import os.path
+
+class Tdf145326(UITestCase):
+
+ def test_tdf145326(self):
+
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, "tdf145326-temp.odt")
+
+ with self.ui_test.execute_dialog_through_command(".uno:Open", close_button="") as xOpenDialog:
+
+ xFileName = xOpenDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf145326.odt")}))
+
+ xOpenBtn = xOpenDialog.getChild("open")
+ # Update all links dialog
+ with self.ui_test.wait_until_component_loaded():
+ with self.ui_test.execute_blocking_action(xOpenBtn.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
+
+ with self.ui_test.execute_dialog_through_command(".uno:LinkDialog", close_button="close") as xDialog:
+
+ sLinks = "TB_LINKS"
+ xLinks = xDialog.getChild(sLinks)
+ self.assertEqual(1, len(xLinks.getChildren()))
+
+ sFileName = "FULL_FILE_NAME"
+ xFileName = xDialog.getChild(sFileName)
+ self.assertTrue(get_state_as_dict(xFileName)["Text"].endswith("SAmple odp.ods"))
+
+ sBreakLink = "BREAK_LINK"
+ xBreakLink = xDialog.getChild(sBreakLink)
+
+ with self.ui_test.execute_blocking_action(xBreakLink.executeAction,
+ args=("CLICK", tuple()), close_button="yes"):
+ pass
+
+ # Save Copy as
+ with self.ui_test.execute_dialog_through_command('.uno:SaveAs', close_button="open") as xDialog:
+ xFileName = xDialog.getChild('file_name')
+ xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'}))
+ xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'}))
+ xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath}))
+
+ self.ui_test.close_doc()
+
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as doc2:
+
+ self.xUITest.executeCommand(".uno:LinkDialog")
+
+ # Since the image is no longer linked, the link dialog is not open.
+ # Without the fix in place, this dialog would have been opened
+ xMainWin = self.xUITest.getTopFocusWindow()
+ self.assertTrue(sLinks not in xMainWin.getChildren())
+ self.assertTrue(sFileName not in xMainWin.getChildren())
+ self.assertTrue(sBreakLink not in xMainWin.getChildren())
+ self.assertTrue("writer_edit" in xMainWin.getChildren())
+
+ self.assertEqual(len(doc2.TextTables), 1)
+ table = doc2.getTextTables()[0]
+
+ self.assertEqual(len(table.getRows()), 7)
+ self.assertEqual("10,000", table.getCellByName("D2").getString())
+ self.assertEqual("20,000", table.getCellByName("D3").getString())
+ self.assertEqual("5,000", table.getCellByName("D4").getString())
+ self.assertEqual("7,000", table.getCellByName("D5").getString())
+ self.assertEqual("5,000", table.getCellByName("D6").getString())
+ self.assertEqual("7,000", table.getCellByName("D7").getString())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf147935.py b/sw/qa/uitest/writer_tests5/tdf147935.py
new file mode 100644
index 000000000000..f1d8c399b5d9
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf147935.py
@@ -0,0 +1,42 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.calc import enter_text_to_cell
+
+class Tdf147935(UITestCase):
+
+ def test_tdf147935(self):
+
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ #enter data
+ enter_text_to_cell(gridwin, "A1", "DDE")
+
+ #select A1
+ gridwin.executeAction("SELECT", mkPropertyValues({"Cell": "A1"}))
+
+ self.xUITest.executeCommand(".uno:Copy")
+
+ with self.ui_test.load_empty_file("writer") as writer_doc:
+
+ # Paste as DDE
+ formatProperty = mkPropertyValues({"SelectedFormat": 59})
+ self.xUITest.executeCommandWithParameters(".uno:ClipboardFormatItems", formatProperty)
+
+ # Without the fix in place, this test would have failed because the warning message
+ # "A table with no rows or no cells cannot be inserted" would have been displayed
+
+ self.assertEqual(1, len(writer_doc.TextTables))
+ table = writer_doc.getTextTables()[0]
+ self.assertEqual("DDE", table.getCellByName("A1").getString())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf148920.py b/sw/qa/uitest/writer_tests5/tdf148920.py
new file mode 100644
index 000000000000..2125ae587d59
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf148920.py
@@ -0,0 +1,33 @@
+# -*- 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
+
+class tdf148920(UITestCase):
+
+ def test_tdf148920(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ self.xUITest.executeCommand(".uno:StyleApply?Style:string=Text%20body&FamilyName:string=ParagraphStyles")
+
+ with self.ui_test.execute_dialog_through_command(".uno:EditStyle", close_button="cancel") as xDialog:
+ xFilter = xDialog.getChild("filter")
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'true' != 'false'
+ self.assertEqual("true", get_state_as_dict(xFilter)["Enabled"])
+
+ # tdf#91035: Without the fix in place, this test would have failed with
+ # AssertionError: 'All Styles' != 'Hidden Styles'
+ self.assertEqual("All Styles", get_state_as_dict(xFilter)["SelectEntryText"])
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf150151.py b/sw/qa/uitest/writer_tests5/tdf150151.py
new file mode 100644
index 000000000000..9e51fa3546b8
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf150151.py
@@ -0,0 +1,45 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import type_text
+
+class Tdf150151(UITestCase):
+
+ def test_tdf150151(self):
+
+ sText = "Šđčćž ŠĐČĆŽ !”#$%&/()=?*,.-;:_ ° ~ˇ^˘°˛`˙’˝”¸"
+
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ type_text(xWriterEdit, sText)
+
+ self.xUITest.executeCommand(".uno:SelectAll")
+
+ self.xUITest.executeCommand(".uno:Copy")
+
+ with self.ui_test.load_empty_file("impress") as document:
+
+ xDoc = self.xUITest.getTopFocusWindow()
+ xEditWin = xDoc.getChild("impress_win")
+
+ xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"}))
+ self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
+
+ self.xUITest.executeCommand(".uno:Text")
+ self.xUITest.executeCommand(".uno:Paste")
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Šđčćž ŠĐČĆŽ !”#$%&/()=?*,.-;:_ ° ~ˇ^˘°˛`˙’˝”¸' != 'Š !#$%&/()=?*,.-;:_ ~^`'
+ self.assertEqual(sText, document.DrawPages[0][1].String)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf154543.py b/sw/qa/uitest/writer_tests5/tdf154543.py
new file mode 100755
index 000000000000..ab6ab0a06e19
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf154543.py
@@ -0,0 +1,39 @@
+# -*- 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 select_pos
+from uitest.uihelper.common import get_state_as_dict
+
+class tdf154543(UITestCase):
+
+ def test_tdf154543_reset_snap_to_grid_parent(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ # Open the paragraph style dialog and unselect the snap to grid checkbox
+ with self.ui_test.execute_dialog_through_command(".uno:EditStyle") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+ xSnapCheckbox = xTabs.getChild("checkCB_SNAP")
+ xSnapCheckbox.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(xSnapCheckbox)["Selected"], "false")
+
+ # Open the paragraph style dialog and reset dialog to parent settings
+ with self.ui_test.execute_dialog_through_command(".uno:EditStyle") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+ xSnapCheckbox = xTabs.getChild("checkCB_SNAP")
+ xStandardButton = xDialog.getChild("standard")
+ xStandardButton.executeAction("CLICK", tuple())
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'false' != 'true'
+ self.assertEqual(get_state_as_dict(xSnapCheckbox)["Selected"], "true")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/titlePage.py b/sw/qa/uitest/writer_tests5/titlePage.py
index 644406932c53..3d539e03b24d 100644
--- a/sw/qa/uitest/writer_tests5/titlePage.py
+++ b/sw/qa/uitest/writer_tests5/titlePage.py
@@ -1,43 +1,30 @@
# -*- 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
-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
#uitest sw / Title Page dialog
class titlePage(UITestCase):
def test_title_page(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- #print(xDialog.getChildren())
-
- #select new Pages; nr of pages =2 (click UP), save; verify pageCount = 3
- newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
- newPages.executeAction("CLICK", tuple())
- xpageCount = xDialog.getChild("NF_PAGE_COUNT")
- xpageCount.executeAction("UP", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- self.assertEqual(document.CurrentController.PageCount, 3)
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ #dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog:
+ #select new Pages; nr of pages =2 (click UP), save; verify pageCount = 3
+ newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
+ newPages.executeAction("CLICK", tuple())
+ xpageCount = xDialog.getChild("NF_PAGE_COUNT")
+ xpageCount.executeAction("UP", tuple())
+ self.assertEqual(document.CurrentController.PageCount, 3)
- # check cancel button
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
- self.assertEqual(document.CurrentController.PageCount, 3)
+ # check cancel button
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog", close_button="cancel"):
+ pass
+ self.assertEqual(document.CurrentController.PageCount, 3)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/titlePageWizard.py b/sw/qa/uitest/writer_tests5/titlePageWizard.py
index a04ebaf61eff..4146dab22d32 100644
--- a/sw/qa/uitest/writer_tests5/titlePageWizard.py
+++ b/sw/qa/uitest/writer_tests5/titlePageWizard.py
@@ -1,147 +1,195 @@
# -*- 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 uitest.uihelper.common import get_url_for_data_file
# This tests the Format->Title Page wizard, specifically the reset page number portion,
# replacing some pages with title pages,
+# inserting pages in the middle of the document,
# and inserting at the very end of the document.
class tdf138907(UITestCase):
def test_tdf138907(self):
- self.ui_test.load_file(get_url_for_data_file("tdf138907_titlePageDialog.odt"))
- document = self.ui_test.get_component()
-
- # Confirm the starting state. Just a page break, without a valid restart page number on page 2
- self.assertEqual(document.CurrentController.PageCount, 5)
- Paragraphs = document.Text.createEnumeration()
- Para1 = Paragraphs.nextElement()
- self.assertEqual(Para1.String, "6")
- self.assertEqual(Para1.PageDescName, "First Page")
- Para2 = Paragraphs.nextElement()
- self.assertEqual(Para2.String, "7")
- self.assertEqual(Para2.PageDescName, None)
- Para3 = Paragraphs.nextElement()
- self.assertEqual(Para3.String, "8")
- self.assertEqual(Para3.PageDescName, None)
- Para4 = Paragraphs.nextElement()
- self.assertEqual(Para4.String, "9")
- self.assertEqual(Para4.PageDescName, None)
- Para5 = Paragraphs.nextElement()
- self.assertEqual(Para5.String, "10")
- self.assertEqual(Para5.PageDescName, None)
-
-
- #dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- #set restart page number to 2. With this doc, it defaults to resetting to 1.
- xRestartNumbering = xDialog.getChild("NF_RESTART_NUMBERING")
- xRestartNumbering.executeAction("UP", tuple()) # restart numbering at 2
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # This correctly reset the starting page number for page 2 as "1".
- # It wasn't persistent across round-trips though
- Paragraphs = document.Text.createEnumeration()
- Para1 = Paragraphs.nextElement()
- self.assertEqual(Para1.String, "6")
- self.assertEqual(Para1.PageDescName, "First Page")
- self.assertEqual(Para2.String, "2")
- Para2 = Paragraphs.nextElement()
- # Without this fix, there was no PageDescName specified, just Landscape as default.
- self.assertEqual(Para2.PageDescName, "Landscape")
-
- #re-run dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- #accept defaults and OK without making any changes.
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # Without this fix, re-running the wizard was failing with the title page restarting at page 2.
- Paragraphs = document.Text.createEnumeration()
- Para1 = Paragraphs.nextElement()
- self.assertEqual(Para1.String, "6")
- self.assertEqual(Para1.PageDescName, "First Page")
- Para2 = Paragraphs.nextElement()
- self.assertEqual(Para2.String, "2")
- self.assertEqual(Para2.PageDescName, "Landscape")
-
- #Note: 6 virtual pages, including blank, even page seen in book view
- self.assertEqual(document.CurrentController.PageCount, 6)
-
- #Now test replacing several pages with title and index styles
-
- #dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- print(xDialog.getChildren())
- #Insert the title/index pages at page two.
- xPageCount = xDialog.getChild("NF_PAGE_COUNT")
- for _ in range(0,2):
- xPageCount.executeAction("UP", tuple())
- xUseStartingPage = xDialog.getChild("RB_PAGE_START")
- xUseStartingPage.executeAction("CLICK", tuple())
- xStartingPage = xDialog.getChild("NF_PAGE_START")
- xStartingPage.executeAction("UP", tuple()) #Start at page 2.
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- Paragraphs = document.Text.createEnumeration()
- Para1 = Paragraphs.nextElement()
- self.assertEqual(Para1.String, "6")
- self.assertEqual(Para1.PageDescName, "First Page")
- # Without the fix, the following results are all off by one.
- Para2 = Paragraphs.nextElement()
- self.assertEqual(Para2.String, "6")
- self.assertEqual(Para2.PageDescName, "First Page")
- Para3 = Paragraphs.nextElement()
- self.assertEqual(Para3.String, "7")
- self.assertEqual(Para3.PageDescName, "Index")
- Para4 = Paragraphs.nextElement()
- self.assertEqual(Para4.String, "8")
- self.assertEqual(Para4.PageDescName, "Index")
- Para5 = Paragraphs.nextElement()
- self.assertEqual(Para5.String, "2")
- self.assertEqual(Para5.PageDescName, "Landscape")
-
- #Now test inserting at the end of the document
-
- #dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- print(xDialog.getChildren())
- #Insert title/index pages at the end of the document.
- newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
- newPages.executeAction("CLICK", tuple())
- xPageCount = xDialog.getChild("NF_PAGE_COUNT")
- for _ in range(0,2):
- xPageCount.executeAction("UP", tuple())
- xUseStartingPage = xDialog.getChild("RB_PAGE_START")
- xUseStartingPage.executeAction("CLICK", tuple())
- xStartingPage = xDialog.getChild("NF_PAGE_START")
- for _ in range(0,18):
- xStartingPage.executeAction("UP", tuple()) #Start at mythical page 20.
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # Without the fix, the pages were being inserted before the last page.
- # NOTE: there are still LOTS of problems here that still need fixing.
- text = document.Text.String.replace('\r\n', '\n')
- self.assertEqual(text[0:1], "6")
- self.assertEqual(text[2:3], "6")
- self.assertEqual(text[4:5], "7")
- self.assertEqual(text[6:7], "8")
- # Without the fix, the new pages were inserted before the last page.
- self.assertFalse("\n" in text[8:9])
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf138907_titlePageDialog.odt")) as document:
+
+ # Confirm the starting state. Just a page break, without a valid restart page number on page 2
+ self.assertEqual(document.CurrentController.PageCount, 5)
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "6")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "7")
+ self.assertEqual(Para2.PageDescName, None)
+ Para3 = Paragraphs.nextElement()
+ self.assertEqual(Para3.String, "8")
+ self.assertEqual(Para3.PageDescName, None)
+ Para4 = Paragraphs.nextElement()
+ self.assertEqual(Para4.String, "9")
+ self.assertEqual(Para4.PageDescName, None)
+ Para5 = Paragraphs.nextElement()
+ self.assertEqual(Para5.String, "10")
+ self.assertEqual(Para5.PageDescName, None)
+
+
+ #dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog:
+ #set restart page number to 2. With this doc, it defaults to resetting to 1.
+ xRestartNumbering = xDialog.getChild("NF_RESTART_NUMBERING")
+ xRestartNumbering.executeAction("UP", tuple()) # restart numbering at 2
+
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "6")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ self.assertEqual(Para2.String, "2")
+ Para2 = Paragraphs.nextElement()
+ # Without this fix, there was no PageDescName specified, just Landscape as default.
+ self.assertEqual(Para2.PageDescName, "Landscape")
+
+ #re-run dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog"):
+ pass
+
+ # Without this fix, re-running the wizard was failing with the title page restarting at page 2.
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "6")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "2")
+ self.assertEqual(Para2.PageDescName, "Landscape")
+
+ #Note: 6 virtual pages, including blank, even page seen in book view
+ self.assertEqual(document.CurrentController.PageCount, 6)
+
+ #Now test replacing several pages with title and index styles
+
+ #dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog:
+ #Convert three pages to title/index pages starting at page two.
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,2):
+ xPageCount.executeAction("UP", tuple())
+ xUseStartingPage = xDialog.getChild("RB_PAGE_START")
+ xUseStartingPage.executeAction("CLICK", tuple())
+ xStartingPage = xDialog.getChild("NF_PAGE_START")
+ xStartingPage.executeAction("UP", tuple()) #Start at page 2.
+
+
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "6")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ # Without the fix, the following results are all off by one.
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "6")
+ self.assertEqual(Para2.PageDescName, "First Page")
+ Para3 = Paragraphs.nextElement()
+ self.assertEqual(Para3.String, "7")
+ self.assertEqual(Para3.PageDescName, "Index")
+ Para4 = Paragraphs.nextElement()
+ self.assertEqual(Para4.String, "8")
+ self.assertEqual(Para4.PageDescName, "Index")
+ Para5 = Paragraphs.nextElement()
+ self.assertEqual(Para5.String, "2")
+ self.assertEqual(Para5.PageDescName, "Landscape")
+
+ #Now test inserting at the end of the document
+
+ #dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog:
+ #Insert three title/index pages at the end of the document (plus a content page).
+ newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
+ newPages.executeAction("CLICK", tuple())
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,2):
+ xPageCount.executeAction("UP", tuple())
+ xUseStartingPage = xDialog.getChild("RB_PAGE_START")
+ xUseStartingPage.executeAction("CLICK", tuple())
+ xStartingPage = xDialog.getChild("NF_PAGE_START")
+ for _ in range(0,18):
+ xStartingPage.executeAction("UP", tuple()) #Start at mythical page 20.
+
+
+ # Without the fix, the pages were being inserted before the last page.
+ text = document.Text.String.replace('\r\n', '\n')
+ self.assertEqual(text[0:1], "6")
+ self.assertEqual(text[2:3], "6")
+ self.assertEqual(text[4:5], "7")
+ self.assertEqual(text[6:7], "8")
+ # Without the fix, the new pages were inserted before the last page.
+ self.assertFalse("\n" in text[8:9])
+ #Note: 13 total virtual pages, including four blanks, as seen in book view
+ self.assertEqual(document.CurrentController.PageCount, 13)
+
+ #Now test inserting in the middle of the document
+
+ #dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog:
+ #Insert three title/index pages starting at page 2.
+ newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
+ newPages.executeAction("CLICK", tuple())
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,2):
+ xPageCount.executeAction("UP", tuple())
+ xUseStartingPage = xDialog.getChild("RB_PAGE_START")
+ xUseStartingPage.executeAction("CLICK", tuple())
+ xStartingPage = xDialog.getChild("NF_PAGE_START")
+ for _ in range(0,10):
+ xStartingPage.executeAction("DOWN", tuple()) #Reset to page 1
+ xStartingPage.executeAction("UP", tuple()) #Start at page 2.
+
+
+ # Without first re-calculating the layout, the styles were applied to the wrong pages.
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "6")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ # The next three pages are the ones that were just inserted.
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "")
+ self.assertEqual(Para2.PageDescName, "First Page")
+ Para3 = Paragraphs.nextElement()
+ self.assertEqual(Para3.String, "")
+ self.assertEqual(Para3.PageDescName, "Index")
+ Para4 = Paragraphs.nextElement()
+ self.assertEqual(Para4.String, "")
+ self.assertEqual(Para4.PageDescName, "Index")
+ # A bit of a quirk is that the style of the first page after the
+ # title page is still First Page - so that is used as the Normal page style.
+ # OK - this is a bit of a strange workflow, so just accept that.
+ Para5 = Paragraphs.nextElement()
+ self.assertEqual(Para5.String, "6")
+ self.assertEqual(Para5.PageDescName, "First Page")
+ Para6 = Paragraphs.nextElement()
+ self.assertEqual(Para6.String, "7")
+ self.assertEqual(Para6.PageDescName, "Index")
+ Para7 = Paragraphs.nextElement()
+ self.assertEqual(Para7.String, "8")
+ self.assertEqual(Para7.PageDescName, "Index")
+ Para8 = Paragraphs.nextElement()
+ self.assertEqual(Para8.String, "2")
+ self.assertEqual(Para8.PageDescName, "Landscape")
+ Para9 = Paragraphs.nextElement()
+ self.assertEqual(Para9.String, "")
+ self.assertEqual(Para9.PageDescName, "First Page")
+ Para10 = Paragraphs.nextElement()
+ self.assertEqual(Para10.String, "")
+ self.assertEqual(Para10.PageDescName, "Index")
+ Para11 = Paragraphs.nextElement()
+ self.assertEqual(Para11.String, "")
+ self.assertEqual(Para11.PageDescName, "Index")
+ # The quirk resets this extra content page to the "style after First page == First Page"
+ Para12 = Paragraphs.nextElement()
+ self.assertEqual(Para12.String, "")
+ self.assertEqual(Para12.PageDescName, "First Page")
+ #Note: 17 total virtual pages, including five blanks, as seen in book view
+ self.assertEqual(document.CurrentController.PageCount, 17)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/titlePageWizard2.py b/sw/qa/uitest/writer_tests5/titlePageWizard2.py
new file mode 100644
index 000000000000..4f34735306d0
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/titlePageWizard2.py
@@ -0,0 +1,124 @@
+# -*- 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_url_for_data_file
+
+# This tests both an edge cases, and some more realistic situations.
+class tdf138907(UITestCase):
+ def test_tdf138907(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf138907_titlePageDialog.odt")) as document:
+
+ # Test an undefined situation - try to modify pages beyond the end of the document.
+
+ #dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog:
+ #set restart page number to 2. With this doc, it defaults to resetting to 1.
+ xRestartNumbering = xDialog.getChild("NF_RESTART_NUMBERING")
+ xRestartNumbering.executeAction("UP", tuple()) # restart numbering at 2
+
+ #Convert three pages to title/index pages starting at non-existing page twenty.
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,2):
+ xPageCount.executeAction("UP", tuple())
+ xUseStartingPage = xDialog.getChild("RB_PAGE_START")
+ xUseStartingPage.executeAction("CLICK", tuple())
+ xStartingPage = xDialog.getChild("NF_PAGE_START")
+ for _ in range(0,19):
+ xStartingPage.executeAction("UP", tuple()) #Start at mythical page 20.
+
+
+ # Nothing should happen when modifying pages that don't exist.
+ # Just a page break, without a valid restart page number on page 2
+ self.assertEqual(document.CurrentController.PageCount, 5)
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "6")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "7")
+ self.assertEqual(Para2.PageDescName, None)
+ Para3 = Paragraphs.nextElement()
+ self.assertEqual(Para3.String, "8")
+ self.assertEqual(Para3.PageDescName, None)
+ Para4 = Paragraphs.nextElement()
+ self.assertEqual(Para4.String, "9")
+ self.assertEqual(Para4.PageDescName, None)
+ Para5 = Paragraphs.nextElement()
+ self.assertEqual(Para5.String, "10")
+ self.assertEqual(Para5.PageDescName, None)
+
+
+ #dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog:
+ #set restart page number to 1 - which is the default.
+ #set restart title page to 1 - the current value for this document is 6.
+ xRestartNumbering = xDialog.getChild("NF_SET_PAGE_NUMBER")
+ for _ in range(0,5):
+ xRestartNumbering.executeAction("DOWN", tuple()) # restart title numbering at 1
+ #Insert two title/index pages at beginning of the document.
+ newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
+ newPages.executeAction("CLICK", tuple())
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,1):
+ xPageCount.executeAction("UP", tuple())
+
+
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "")
+ self.assertEqual(Para2.PageDescName, "Index")
+ Para3 = Paragraphs.nextElement()
+ self.assertEqual(Para3.String, "1")
+ self.assertEqual(Para3.PageDescName, "Landscape")
+ Para4 = Paragraphs.nextElement()
+ self.assertEqual(Para4.String, "2")
+ Para5 = Paragraphs.nextElement()
+ self.assertEqual(Para5.String, "3")
+ Para6 = Paragraphs.nextElement()
+ self.assertEqual(Para6.String, "4")
+ Para7 = Paragraphs.nextElement()
+ self.assertEqual(Para7.String, "5")
+
+ #Now test replacing several pages with title and index styles
+
+ #dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog:
+ #Convert four pages to title/index pages starting at page one.
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,3):
+ xPageCount.executeAction("DOWN", tuple()) #reset to 1 first
+ for _ in range(0,3):
+ xPageCount.executeAction("UP", tuple())
+
+
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "")
+ self.assertEqual(Para2.PageDescName, "Index")
+ Para3 = Paragraphs.nextElement()
+ self.assertEqual(Para3.String, "3")
+ self.assertEqual(Para3.PageDescName, "Index")
+ Para4 = Paragraphs.nextElement()
+ self.assertEqual(Para4.String, "4")
+ self.assertEqual(Para4.PageDescName, "Index")
+ Para5 = Paragraphs.nextElement()
+ self.assertEqual(Para5.String, "1")
+ self.assertEqual(Para5.PageDescName, "Landscape")
+ Para6 = Paragraphs.nextElement()
+ self.assertEqual(Para6.String, "2")
+ Para7 = Paragraphs.nextElement()
+ self.assertEqual(Para7.String, "3")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/xwindow.py b/sw/qa/uitest/writer_tests5/xwindow.py
index 49628776bf76..d7a0f885f478 100644
--- a/sw/qa/uitest/writer_tests5/xwindow.py
+++ b/sw/qa/uitest/writer_tests5/xwindow.py
@@ -1,15 +1,14 @@
# -*- 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
-import unittest
import unohelper
-from org.libreoffice.unotest import UnoInProcess
from com.sun.star.awt import XMouseListener
-from com.sun.star.awt import XToolkitRobot
from com.sun.star.awt import MouseButton
from com.sun.star.awt import MouseEvent
from com.sun.star.awt import KeyEvent
@@ -79,101 +78,99 @@ class XWindow(UITestCase):
def test_listeners(self):
global mouseListenerCount
- self.ui_test.create_doc_in_start_center("writer")
- xDoc = self.ui_test.get_component()
-
- # create new mouse listener
- xFrame = xDoc.getCurrentController().getFrame()
- self.assertIsNotNone(xFrame)
- xWindow = xFrame.getContainerWindow()
- self.assertIsNotNone(xWindow)
-
- # add new mouse listener
- xMouseListener = XMouseListenerExtended()
- self.assertIsNotNone(xMouseListener)
- xWindow.addMouseListener(xMouseListener)
- self.assertEqual(1, mouseListenerCount)
-
- # add new key listener
- xKeyListener = XKeyListenerExtended()
- self.assertIsNotNone(xKeyListener)
- xWindow.addKeyListener(xKeyListener)
-
- # create dummy mouse event
- xMouseEvent = MouseEvent()
- xMouseEvent.Modifiers = 0
- xMouseEvent.Buttons = MouseButton.LEFT
- xMouseEvent.X = 10
- xMouseEvent.Y = 10
- xMouseEvent.ClickCount = 1
- xMouseEvent.PopupTrigger = False
- xMouseEvent.Source = xWindow
-
- xMouseEvent2 = MouseEvent()
- xMouseEvent2.Modifiers = 0
- xMouseEvent2.Buttons = MouseButton.LEFT
- xMouseEvent2.X = 300
- xMouseEvent2.Y = 300
- xMouseEvent2.ClickCount = 1
- xMouseEvent2.PopupTrigger = False
- xMouseEvent2.Source = xWindow
-
- # send mouse event
- xToolkitRobot = xWindow.getToolkit()
- self.assertIsNotNone(xToolkitRobot)
-
- # Click in the menubar/toolbar area
- xToolkitRobot.mouseMove(xMouseEvent)
- xToolkitRobot.mousePress(xMouseEvent)
- xToolkitRobot.mouseRelease(xMouseEvent)
-
- # Click into the document content
- xToolkitRobot.mousePress(xMouseEvent2)
- xToolkitRobot.mouseRelease(xMouseEvent2)
-
- # send key press event
- xKeyEvent = KeyEvent()
- xKeyEvent.Modifiers = 0
- xKeyEvent.KeyCode = 70
- xKeyEvent.KeyChar = 70
- xKeyEvent.Source = xWindow
-
- xToolkitRobot.keyPress(xKeyEvent)
- xToolkitRobot.keyRelease(xKeyEvent)
-
- # Wait for async events to be processed
- xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
- xToolkit.processEventsToIdle()
-
- # remove mouse listener
- xWindow.removeMouseListener(xMouseListener)
- self.assertEqual(1, mouseListenerCount)
- del xMouseListener
-
- # remove key listener
- xWindow.removeKeyListener(xKeyListener)
- del xKeyListener
-
- global keymousePressedEventsIntercepted
- # Not expected any interceptions
- self.assertEqual(0, keymousePressedEventsIntercepted)
-
- global keymouseReleasedEventsIntercepted
- # Not expected any interceptions
- self.assertEqual(0, keymouseReleasedEventsIntercepted)
-
- global mousePressedEventsIntercepted
- self.assertEqual(0, mousePressedEventsIntercepted)
-
- global mouseReleasedEventsIntercepted
- self.assertEqual(0, mouseReleasedEventsIntercepted)
-
- global mouseEventsIntercepted
- # Not expected 3 interceptions
- self.assertEqual(0, mouseEventsIntercepted)
-
- # close document
- self.ui_test.close_doc()
+ with self.ui_test.create_doc_in_start_center("writer") as xDoc:
+
+ # create new mouse listener
+ xFrame = xDoc.getCurrentController().getFrame()
+ self.assertIsNotNone(xFrame)
+ xWindow = xFrame.getContainerWindow()
+ self.assertIsNotNone(xWindow)
+
+ # add new mouse listener
+ xMouseListener = XMouseListenerExtended()
+ self.assertIsNotNone(xMouseListener)
+ xWindow.addMouseListener(xMouseListener)
+ self.assertEqual(1, mouseListenerCount)
+
+ # add new key listener
+ xKeyListener = XKeyListenerExtended()
+ self.assertIsNotNone(xKeyListener)
+ xWindow.addKeyListener(xKeyListener)
+
+ # create dummy mouse event
+ xMouseEvent = MouseEvent()
+ xMouseEvent.Modifiers = 0
+ xMouseEvent.Buttons = MouseButton.LEFT
+ xMouseEvent.X = 10
+ xMouseEvent.Y = 10
+ xMouseEvent.ClickCount = 1
+ xMouseEvent.PopupTrigger = False
+ xMouseEvent.Source = xWindow
+
+ xMouseEvent2 = MouseEvent()
+ xMouseEvent2.Modifiers = 0
+ xMouseEvent2.Buttons = MouseButton.LEFT
+ xMouseEvent2.X = 300
+ xMouseEvent2.Y = 300
+ xMouseEvent2.ClickCount = 1
+ xMouseEvent2.PopupTrigger = False
+ xMouseEvent2.Source = xWindow
+
+ # send mouse event
+ xToolkitRobot = xWindow.getToolkit()
+ self.assertIsNotNone(xToolkitRobot)
+
+ # Click in the menubar/toolbar area
+ xToolkitRobot.mouseMove(xMouseEvent)
+ xToolkitRobot.mousePress(xMouseEvent)
+ xToolkitRobot.mouseRelease(xMouseEvent)
+
+ # Click into the document content
+ xToolkitRobot.mousePress(xMouseEvent2)
+ xToolkitRobot.mouseRelease(xMouseEvent2)
+
+ # send key press event
+ xKeyEvent = KeyEvent()
+ xKeyEvent.Modifiers = 0
+ xKeyEvent.KeyCode = 70
+ xKeyEvent.KeyChar = 70
+ xKeyEvent.Source = xWindow
+
+ xToolkitRobot.keyPress(xKeyEvent)
+ xToolkitRobot.keyRelease(xKeyEvent)
+
+ # Wait for async events to be processed
+ xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+ xToolkit.processEventsToIdle()
+
+ # remove mouse listener
+ xWindow.removeMouseListener(xMouseListener)
+ self.assertEqual(1, mouseListenerCount)
+ del xMouseListener
+
+ # remove key listener
+ xWindow.removeKeyListener(xKeyListener)
+ del xKeyListener
+
+ global keymousePressedEventsIntercepted
+ # Not expected any interceptions
+ self.assertEqual(0, keymousePressedEventsIntercepted)
+
+ global keymouseReleasedEventsIntercepted
+ # Not expected any interceptions
+ self.assertEqual(0, keymouseReleasedEventsIntercepted)
+
+ global mousePressedEventsIntercepted
+ self.assertEqual(0, mousePressedEventsIntercepted)
+
+ global mouseReleasedEventsIntercepted
+ self.assertEqual(0, mouseReleasedEventsIntercepted)
+
+ global mouseEventsIntercepted
+ # Not expected 3 interceptions
+ self.assertEqual(0, mouseEventsIntercepted)
+
+ # close document
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/zoom.py b/sw/qa/uitest/writer_tests5/zoom.py
index 3d9e224c1dd9..cbd455e14769 100644
--- a/sw/qa/uitest/writer_tests5/zoom.py
+++ b/sw/qa/uitest/writer_tests5/zoom.py
@@ -1,107 +1,85 @@
# -*- 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
-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
#uitest sw / View-Zoom
class writerZoom(UITestCase):
def test_zoom_writer(self):
- writer_doc = self.ui_test.create_doc_in_start_center("writer")
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #dialog View-Zoom-Zoom
- self.ui_test.execute_dialog_through_command(".uno:Zoom")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.create_doc_in_start_center("writer"):
+ #dialog View-Zoom-Zoom
+ with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog:
- #select Optimal & Automatic - OK - open and verify
- optimal = xDialog.getChild("optimal")
- optimal.executeAction("CLICK", tuple())
- automatic = xDialog.getChild("automatic")
- automatic.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ #select Optimal & Automatic - OK - open and verify
+ optimal = xDialog.getChild("optimal")
+ optimal.executeAction("CLICK", tuple())
+ automatic = xDialog.getChild("automatic")
+ automatic.executeAction("CLICK", tuple())
- self.ui_test.execute_dialog_through_command(".uno:Zoom")
- xDialog = self.xUITest.getTopFocusWindow()
- optimal = xDialog.getChild("optimal")
- automatic = xDialog.getChild("automatic")
- self.assertEqual(get_state_as_dict(optimal)["Checked"], "true")
- self.assertEqual(get_state_as_dict(automatic)["Checked"], "true")
- #select fit weight & Single page - OK - open and verify
- fitwandh = xDialog.getChild("fitwandh")
- singlepage = xDialog.getChild("singlepage")
- fitwandh.executeAction("CLICK", tuple())
- singlepage.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog:
+ optimal = xDialog.getChild("optimal")
+ automatic = xDialog.getChild("automatic")
+ self.assertEqual(get_state_as_dict(optimal)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(automatic)["Checked"], "true")
+ #select fit weight & Single page - OK - open and verify
+ fitwandh = xDialog.getChild("fitwandh")
+ singlepage = xDialog.getChild("singlepage")
+ fitwandh.executeAction("CLICK", tuple())
+ singlepage.executeAction("CLICK", tuple())
- self.ui_test.execute_dialog_through_command(".uno:Zoom")
- xDialog = self.xUITest.getTopFocusWindow()
- singlepage = xDialog.getChild("singlepage")
- fitwandh = xDialog.getChild("fitwandh")
- self.assertEqual(get_state_as_dict(singlepage)["Checked"], "true")
- self.assertEqual(get_state_as_dict(fitwandh)["Checked"], "true")
- #select fit width & columns - OK - open and verify
- fitw = xDialog.getChild("fitw")
- columnssb = xDialog.getChild("columnssb")
- columns = xDialog.getChild("columns")
- fitw.executeAction("CLICK", tuple())
- columns.executeAction("CLICK", tuple())
- columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- columnssb.executeAction("TYPE", mkPropertyValues({"TEXT":"3"}))
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog:
+ singlepage = xDialog.getChild("singlepage")
+ fitwandh = xDialog.getChild("fitwandh")
+ self.assertEqual(get_state_as_dict(singlepage)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(fitwandh)["Checked"], "true")
+ #select fit width & columns - OK - open and verify
+ fitw = xDialog.getChild("fitw")
+ columnssb = xDialog.getChild("columnssb")
+ columns = xDialog.getChild("columns")
+ fitw.executeAction("CLICK", tuple())
+ columns.executeAction("CLICK", tuple())
+ columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ columnssb.executeAction("TYPE", mkPropertyValues({"TEXT":"3"}))
- self.ui_test.execute_dialog_through_command(".uno:Zoom")
- xDialog = self.xUITest.getTopFocusWindow()
- fitw = xDialog.getChild("fitw")
- columnssb = xDialog.getChild("columnssb")
- columns = xDialog.getChild("columns")
- self.assertEqual(get_state_as_dict(fitw)["Checked"], "true")
- self.assertEqual(get_state_as_dict(columns)["Checked"], "true")
- self.assertEqual(get_state_as_dict(columnssb)["Text"], "3")
- #select 100% & Automatic - OK - open and verify
- automatic = xDialog.getChild("automatic")
- x100pc = xDialog.getChild("100pc")
- x100pc.executeAction("CLICK", tuple())
- automatic.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog:
+ fitw = xDialog.getChild("fitw")
+ columnssb = xDialog.getChild("columnssb")
+ columns = xDialog.getChild("columns")
+ self.assertEqual(get_state_as_dict(fitw)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(columns)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(columnssb)["Text"], "3")
+ #select 100% & Automatic - OK - open and verify
+ automatic = xDialog.getChild("automatic")
+ x100pc = xDialog.getChild("100pc")
+ x100pc.executeAction("CLICK", tuple())
+ automatic.executeAction("CLICK", tuple())
- self.ui_test.execute_dialog_through_command(".uno:Zoom")
- xDialog = self.xUITest.getTopFocusWindow()
- automatic = xDialog.getChild("automatic")
- x100pc = xDialog.getChild("100pc")
- self.assertEqual(get_state_as_dict(automatic)["Checked"], "true")
- self.assertEqual(get_state_as_dict(x100pc)["Checked"], "true")
- #select variable 103% & Automatic - OK - open and verify
- variable = xDialog.getChild("variable")
- zoomsb = xDialog.getChild("zoomsb")
- variable.executeAction("CLICK", tuple())
- zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- zoomsb.executeAction("TYPE", mkPropertyValues({"TEXT":"101"}))
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog:
+ automatic = xDialog.getChild("automatic")
+ x100pc = xDialog.getChild("100pc")
+ self.assertEqual(get_state_as_dict(automatic)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(x100pc)["Checked"], "true")
+ #select variable 103% & Automatic - OK - open and verify
+ variable = xDialog.getChild("variable")
+ zoomsb = xDialog.getChild("zoomsb")
+ variable.executeAction("CLICK", tuple())
+ zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ zoomsb.executeAction("TYPE", mkPropertyValues({"TEXT":"101"}))
- self.ui_test.execute_dialog_through_command(".uno:Zoom")
- xDialog = self.xUITest.getTopFocusWindow()
- variable = xDialog.getChild("variable")
- zoomsb = xDialog.getChild("zoomsb")
- self.assertEqual(get_state_as_dict(variable)["Checked"], "true")
- self.assertEqual(get_state_as_dict(zoomsb)["Text"], "101%")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog:
+ variable = xDialog.getChild("variable")
+ zoomsb = xDialog.getChild("zoomsb")
+ self.assertEqual(get_state_as_dict(variable)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(zoomsb)["Text"], "101%")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab: