diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-21 16:21:30 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-22 14:46:39 +0200 |
commit | be0a41679fea524e0935dc6617b5e65349812dd1 (patch) | |
tree | f14372226d5054c045f954e38ea09da5c412215b /sw/qa/uitest/writer_tests7 | |
parent | 14069d84174ca7a4e60db4d75912903e9679b643 (diff) |
uitest: guard load_file
Mostly done by a script
for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac
< UITest: introduce guarded context managers >
Change-Id: Ia924293dc2a12230fd13f69fd734875ced86be8a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117593
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/uitest/writer_tests7')
-rw-r--r-- | sw/qa/uitest/writer_tests7/apply_line_cap.py | 120 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/forms.py | 246 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf104795.py | 20 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf119661.py | 20 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf122780.py | 18 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf131936.py | 20 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf132169.py | 46 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf134243.py | 14 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf137802.py | 76 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf137803.py | 55 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf139301.py | 70 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf140117.py | 90 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf141158.py | 53 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf141557.py | 30 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf46561.py | 138 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf90401.py | 129 |
16 files changed, 553 insertions, 592 deletions
diff --git a/sw/qa/uitest/writer_tests7/apply_line_cap.py b/sw/qa/uitest/writer_tests7/apply_line_cap.py index 5e7b42ca9a2f..2813c997ad1e 100644 --- a/sw/qa/uitest/writer_tests7/apply_line_cap.py +++ b/sw/qa/uitest/writer_tests7/apply_line_cap.py @@ -11,92 +11,90 @@ from uitest.uihelper.common import select_pos class apply_line_cap(UITestCase): def test_apply_line_cap(self): - writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_Word97.docx")) + with self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_Word97.docx")) as writer_doc: - # check FLAT -> ROUND cap style change by selecting the new 'Rounded' preset line styles + # check FLAT -> ROUND cap style change by selecting the new 'Rounded' preset line styles - # select second line shape (dashDot) - writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1]) + # select second line shape (dashDot) + writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1]) - # wait for available line style setting - self.ui_test.wait_until_child_is_available('metricfield') + # wait for available line style setting + self.ui_test.wait_until_child_is_available('metricfield') - # line setting dialog window - self.ui_test.execute_dialog_through_command(".uno:FormatLine") - xFormatLineDlg = self.xUITest.getTopFocusWindow() + # line setting dialog window + self.ui_test.execute_dialog_through_command(".uno:FormatLine") + xFormatLineDlg = self.xUITest.getTopFocusWindow() - # get cap style combo box - xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE") - cap_style = get_state_as_dict(xCapStyle)['SelectEntryText'] + # get cap style combo box + xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE") + cap_style = get_state_as_dict(xCapStyle)['SelectEntryText'] - # get line style combo box - xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") + # get line style combo box + xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") - # select 'Dot (Rounded)', but store the previous value - style = get_state_as_dict(xLineStyle)['SelectEntryText'] - select_pos(xLineStyle, "3") + # select 'Dot (Rounded)', but store the previous value + style = get_state_as_dict(xLineStyle)['SelectEntryText'] + select_pos(xLineStyle, "3") - xOKBtn = xFormatLineDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xOKBtn = xFormatLineDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - self.assertEqual(cap_style, 'Flat') - self.assertEqual(style, 'Long Dash Dot') + self.assertEqual(cap_style, 'Flat') + self.assertEqual(style, 'Long Dash Dot') - # check round cap setting, opening the line style dialog again - writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1]) + # check round cap setting, opening the line style dialog again + writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1]) - # wait for available line style setting - self.ui_test.wait_until_child_is_available('metricfield') + # wait for available line style setting + self.ui_test.wait_until_child_is_available('metricfield') - # line setting dialog window - self.ui_test.execute_dialog_through_command(".uno:FormatLine") - xFormatLineDlg = self.xUITest.getTopFocusWindow() + # line setting dialog window + self.ui_test.execute_dialog_through_command(".uno:FormatLine") + xFormatLineDlg = self.xUITest.getTopFocusWindow() - # get cap style combo box - xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE") - cap_style = get_state_as_dict(xCapStyle)['SelectEntryText'] + # get cap style combo box + xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE") + cap_style = get_state_as_dict(xCapStyle)['SelectEntryText'] - # get line style combo box - xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") + # get line style combo box + xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") - # select 'Dot', but store the previous value - style = get_state_as_dict(xLineStyle)['SelectEntryText'] - select_pos(xLineStyle, "2") + # select 'Dot', but store the previous value + style = get_state_as_dict(xLineStyle)['SelectEntryText'] + select_pos(xLineStyle, "2") - xOKBtn = xFormatLineDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xOKBtn = xFormatLineDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - # This was 'Flat' (set only dash style of the line style before) - self.assertEqual(cap_style, 'Round') - self.assertEqual(style, 'Dot (Rounded)') + # This was 'Flat' (set only dash style of the line style before) + self.assertEqual(cap_style, 'Round') + self.assertEqual(style, 'Dot (Rounded)') - # 2. check ROUND -> FLAT cap style change - writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1]) + # 2. check ROUND -> FLAT cap style change + writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1]) - # wait for available line style setting - self.ui_test.wait_until_child_is_available('metricfield') + # wait for available line style setting + self.ui_test.wait_until_child_is_available('metricfield') - # line setting dialog window - self.ui_test.execute_dialog_through_command(".uno:FormatLine") - xFormatLineDlg = self.xUITest.getTopFocusWindow() + # line setting dialog window + self.ui_test.execute_dialog_through_command(".uno:FormatLine") + xFormatLineDlg = self.xUITest.getTopFocusWindow() - # get cap style combo box - xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE") - cap_style = get_state_as_dict(xCapStyle)['SelectEntryText'] + # get cap style combo box + xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE") + cap_style = get_state_as_dict(xCapStyle)['SelectEntryText'] - # get line style combo box - xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") + # get line style combo box + xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") - style = get_state_as_dict(xLineStyle)['SelectEntryText'] + style = get_state_as_dict(xLineStyle)['SelectEntryText'] - xOKBtn = xFormatLineDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xOKBtn = xFormatLineDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - # This was 'Flat' (set only dash style of the line style before) - self.assertEqual(cap_style, 'Flat') - self.assertEqual(style, 'Dot') - - self.ui_test.close_doc() + # This was 'Flat' (set only dash style of the line style before) + self.assertEqual(cap_style, 'Flat') + self.assertEqual(style, 'Dot') # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/forms.py b/sw/qa/uitest/writer_tests7/forms.py index b931c5d6f3fb..d58d9a15ae91 100644 --- a/sw/qa/uitest/writer_tests7/forms.py +++ b/sw/qa/uitest/writer_tests7/forms.py @@ -14,201 +14,189 @@ class Forms(UITestCase): def test_tdf140486(self): - self.ui_test.load_file(get_url_for_data_file("tdf140486.odt")) + with self.ui_test.load_file(get_url_for_data_file("tdf140486.odt")): - self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.xUITest.executeCommand(".uno:JumpToNextFrame") - self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties") - xChild = self.ui_test.wait_until_child_is_available('listbox-Empty string is NULL') - - # Without the fix in place, this test would have failed with - # AssertionError: 'Yes' != 'No' - self.assertEqual("Yes", get_state_as_dict(xChild)['SelectEntryText']) + self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties") + xChild = self.ui_test.wait_until_child_is_available('listbox-Empty string is NULL') - self.ui_test.close_doc() + # Without the fix in place, this test would have failed with + # AssertionError: 'Yes' != 'No' + self.assertEqual("Yes", get_state_as_dict(xChild)['SelectEntryText']) def test_tdf140198(self): - self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")) + with self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")): - self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.xUITest.executeCommand(".uno:JumpToNextFrame") - self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties") - xChild = self.ui_test.wait_until_child_is_available('listbox-Text type') - - # Without the fix in place, this test would have failed with - # AssertionError: 'Multi-line' != 'Single-line' - self.assertEqual("Multi-line", get_state_as_dict(xChild)['SelectEntryText']) + self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties") + xChild = self.ui_test.wait_until_child_is_available('listbox-Text type') - self.ui_test.close_doc() + # Without the fix in place, this test would have failed with + # AssertionError: 'Multi-line' != 'Single-line' + self.assertEqual("Multi-line", get_state_as_dict(xChild)['SelectEntryText']) def test_tdf141084(self): # Reuse document from tdf#140239 - self.ui_test.load_file(get_url_for_data_file("tdf140239.odt")) + with self.ui_test.load_file(get_url_for_data_file("tdf140239.odt")): - self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.xUITest.executeCommand(".uno:JumpToNextFrame") - self.ui_test.execute_modeless_dialog_through_command(".uno:FormProperties") - xURL = self.ui_test.wait_until_child_is_available('urlcontrol-URL') - xFrame = self.ui_test.wait_until_child_is_available('combobox-Frame') + self.ui_test.execute_modeless_dialog_through_command(".uno:FormProperties") + xURL = self.ui_test.wait_until_child_is_available('urlcontrol-URL') + xFrame = self.ui_test.wait_until_child_is_available('combobox-Frame') - xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) - xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) - xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "3"})) - xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "4"})) - xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "5"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "3"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "4"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "5"})) - # Without the fix in place, this test would have failed with - # AssertionError: '12345' != 'file:///tmp/tmp/5file:///tmp/tmp/4file://[40 chars]mp/1' - self.assertEqual("12345", get_state_as_dict(xURL)['Text']) + # Without the fix in place, this test would have failed with + # AssertionError: '12345' != 'file:///tmp/tmp/5file:///tmp/tmp/4file://[40 chars]mp/1' + self.assertEqual("12345", get_state_as_dict(xURL)['Text']) def test_tdf140239(self): - self.ui_test.load_file(get_url_for_data_file("tdf140239.odt")) + with self.ui_test.load_file(get_url_for_data_file("tdf140239.odt")): - self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.xUITest.executeCommand(".uno:JumpToNextFrame") - self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties") - xAction = self.ui_test.wait_until_child_is_available('listbox-Action') - xURL = self.ui_test.wait_until_child_is_available('urlcontrol-URL') - xEntry = self.ui_test.wait_until_child_is_available('entry') - - self.assertEqual("None", get_state_as_dict(xAction)['SelectEntryText']) - self.assertEqual("false", get_state_as_dict(xURL)['Enabled']) + self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties") + xAction = self.ui_test.wait_until_child_is_available('listbox-Action') + xURL = self.ui_test.wait_until_child_is_available('urlcontrol-URL') + xEntry = self.ui_test.wait_until_child_is_available('entry') - select_by_text(xAction, "Open document/web page") + self.assertEqual("None", get_state_as_dict(xAction)['SelectEntryText']) + self.assertEqual("false", get_state_as_dict(xURL)['Enabled']) - self.assertEqual("Open document/web page", get_state_as_dict(xAction)['SelectEntryText']) - self.assertEqual("true", get_state_as_dict(xURL)['Enabled']) + select_by_text(xAction, "Open document/web page") - xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) - xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) - xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "3"})) - xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "4"})) - xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "5"})) + self.assertEqual("Open document/web page", get_state_as_dict(xAction)['SelectEntryText']) + self.assertEqual("true", get_state_as_dict(xURL)['Enabled']) - # Without the fix in place, this test would have failed with - # AssertionError: '12345' != '54321' - self.assertEqual("12345", get_state_as_dict(xURL)['Text']) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "3"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "4"})) + xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "5"})) - xEntry.executeAction("FOCUS", tuple()) - self.assertEqual("Push Button", get_state_as_dict(xEntry)['Text']) + # Without the fix in place, this test would have failed with + # AssertionError: '12345' != '54321' + self.assertEqual("12345", get_state_as_dict(xURL)['Text']) - xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xEntry.executeAction("TYPE", mkPropertyValues({"TEXT": "Push"})) + xEntry.executeAction("FOCUS", tuple()) + self.assertEqual("Push Button", get_state_as_dict(xEntry)['Text']) - # Move the focus to another element so the changes done before will take effect - xAction.executeAction("FOCUS", tuple()) + xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xEntry.executeAction("TYPE", mkPropertyValues({"TEXT": "Push"})) - # tdf#131522: Without the fix in place, this test would have failed with - # AssertionError: 'Push' != 'Push Button' - self.assertEqual("Push", get_state_as_dict(xEntry)['Text']) + # Move the focus to another element so the changes done before will take effect + xAction.executeAction("FOCUS", tuple()) - self.ui_test.close_doc() + # tdf#131522: Without the fix in place, this test would have failed with + # AssertionError: 'Push' != 'Push Button' + self.assertEqual("Push", get_state_as_dict(xEntry)['Text']) def test_tdf138701(self): # Reuse file from another test - self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")) - - self.xUITest.executeCommand(".uno:JumpToNextFrame") + with self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")): - self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties") - xChild = self.ui_test.wait_until_child_is_available('combobox-Data field') + self.xUITest.executeCommand(".uno:JumpToNextFrame") - xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) - xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) - xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "3"})) - xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "4"})) - xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "5"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties") + xChild = self.ui_test.wait_until_child_is_available('combobox-Data field') - # Without the fix in place, this test would have failed with - # AssertionError: '12345' != '54321' - self.assertEqual("12345", get_state_as_dict(xChild)['Text']) + xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) + xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) + xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "3"})) + xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "4"})) + xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "5"})) - self.ui_test.close_doc() + # Without the fix in place, this test would have failed with + # AssertionError: '12345' != '54321' + self.assertEqual("12345", get_state_as_dict(xChild)['Text']) def test_tdf139486(self): # Reuse file from another test - self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")) - - change_measurement_unit(self, "Centimeter") + with self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")): - self.xUITest.executeCommand(".uno:JumpToNextFrame") + change_measurement_unit(self, "Centimeter") - document = self.ui_test.get_component() - drawPage = document.getDrawPages().getByIndex(0) - shape = drawPage.getByIndex(0) - self.assertEqual(13996, shape.getSize().Width) - self.assertEqual(2408, shape.getSize().Height) + self.xUITest.executeCommand(".uno:JumpToNextFrame") - self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties") - xWidth = self.ui_test.wait_until_child_is_available('numericfield-Width') - xHeight = self.ui_test.wait_until_child_is_available('numericfield-Height') + document = self.ui_test.get_component() + drawPage = document.getDrawPages().getByIndex(0) + shape = drawPage.getByIndex(0) + self.assertEqual(13996, shape.getSize().Width) + self.assertEqual(2408, shape.getSize().Height) - self.assertEqual("14.00 cm", get_state_as_dict(xWidth)['Text']) - self.assertEqual("2.41 cm", get_state_as_dict(xHeight)['Text']) + self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties") + xWidth = self.ui_test.wait_until_child_is_available('numericfield-Width') + xHeight = self.ui_test.wait_until_child_is_available('numericfield-Height') - xWidth.executeAction("FOCUS", tuple()) - xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xWidth.executeAction("TYPE", mkPropertyValues({"TEXT":"20 cm"})) + self.assertEqual("14.00 cm", get_state_as_dict(xWidth)['Text']) + self.assertEqual("2.41 cm", get_state_as_dict(xHeight)['Text']) - self.assertEqual("20 cm", get_state_as_dict(xWidth)['Text']) + xWidth.executeAction("FOCUS", tuple()) + xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xWidth.executeAction("TYPE", mkPropertyValues({"TEXT":"20 cm"})) - xHeight.executeAction("FOCUS", tuple()) - xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xHeight.executeAction("TYPE", mkPropertyValues({"TEXT":"5 cm"})) + self.assertEqual("20 cm", get_state_as_dict(xWidth)['Text']) - self.assertEqual("5 cm", get_state_as_dict(xHeight)['Text']) + xHeight.executeAction("FOCUS", tuple()) + xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xHeight.executeAction("TYPE", mkPropertyValues({"TEXT":"5 cm"})) - # Move the focus to another element so the changes done before take effect on the document - xDialog = self.xUITest.getTopFocusWindow() - xDialog.getChild('numericfield-PositionY').executeAction("FOCUS", tuple()) + self.assertEqual("5 cm", get_state_as_dict(xHeight)['Text']) - # Without the fix in place, the size of the form wouldn't have changed - self.assertEqual(20001, shape.getSize().Width) - self.assertEqual(5001, shape.getSize().Height) + # Move the focus to another element so the changes done before take effect on the document + xDialog = self.xUITest.getTopFocusWindow() + xDialog.getChild('numericfield-PositionY').executeAction("FOCUS", tuple()) - self.ui_test.close_doc() + # Without the fix in place, the size of the form wouldn't have changed + self.assertEqual(20001, shape.getSize().Width) + self.assertEqual(5001, shape.getSize().Height) def test_tdf138271(self): - self.ui_test.load_file(get_url_for_data_file("tdf138271.odt")) + with self.ui_test.load_file(get_url_for_data_file("tdf138271.odt")): - self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.xUITest.executeCommand(".uno:JumpToNextFrame") - aOldValue = ["-1000000.00", "1000000.00"] - aNewValue = ["-100.00", "100.00"] + aOldValue = ["-1000000.00", "1000000.00"] + aNewValue = ["-100.00", "100.00"] - for i, name in enumerate(['formattedcontrol-Value min.', 'formattedcontrol-Value max.']): + for i, name in enumerate(['formattedcontrol-Value min.', 'formattedcontrol-Value max.']): - self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties") - xChild = self.ui_test.wait_until_child_is_available(name) - - self.assertEqual(aOldValue[i], get_state_as_dict(xChild)['Text']) + self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties") + xChild = self.ui_test.wait_until_child_is_available(name) - xChild.executeAction("FOCUS", tuple()) - xChild.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xChild.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xChild.executeAction("TYPE", mkPropertyValues({"TEXT": aNewValue[i]})) + self.assertEqual(aOldValue[i], get_state_as_dict(xChild)['Text']) - #Close the dialog and open it again - self.xUITest.executeCommand(".uno:ControlProperties") + xChild.executeAction("FOCUS", tuple()) + xChild.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xChild.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xChild.executeAction("TYPE", mkPropertyValues({"TEXT": aNewValue[i]})) - self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties") - xChild = self.ui_test.wait_until_child_is_available(name) + #Close the dialog and open it again + self.xUITest.executeCommand(".uno:ControlProperties") - # Without the fix in place, this test would have failed here because - # the values wouldn't have changed - self.assertEqual(aNewValue[i], get_state_as_dict(xChild)['Text']) + self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties") + xChild = self.ui_test.wait_until_child_is_available(name) - self.xUITest.executeCommand(".uno:ControlProperties") + # Without the fix in place, this test would have failed here because + # the values wouldn't have changed + self.assertEqual(aNewValue[i], get_state_as_dict(xChild)['Text']) - self.ui_test.close_doc() + self.xUITest.executeCommand(".uno:ControlProperties") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf104795.py b/sw/qa/uitest/writer_tests7/tdf104795.py index 1fcc20f5b013..58316db101b5 100644 --- a/sw/qa/uitest/writer_tests7/tdf104795.py +++ b/sw/qa/uitest/writer_tests7/tdf104795.py @@ -13,19 +13,17 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file class tdf104795(UITestCase): def test_tdf104795(self): - writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf104795.odt")) - self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.load_file(get_url_for_data_file("tdf104795.odt")) as writer_doc: + self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") + xDialog = self.xUITest.getTopFocusWindow() - sShowSignedText = get_state_as_dict(xDialog.getChild('showsigned'))['Text'] + sShowSignedText = get_state_as_dict(xDialog.getChild('showsigned'))['Text'] - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - # Without the fix in place, this test would have failed with - # AssertionError: '12/19/2016, 23:06:31, timur.davletshin' != '12/19/2016, 00:00:00, !!br0ken!!' - self.assertEqual("12/19/2016, 23:06:31, timur.davletshin", sShowSignedText.split('@')[0]) - - self.ui_test.close_doc() + # Without the fix in place, this test would have failed with + # AssertionError: '12/19/2016, 23:06:31, timur.davletshin' != '12/19/2016, 00:00:00, !!br0ken!!' + self.assertEqual("12/19/2016, 23:06:31, timur.davletshin", sShowSignedText.split('@')[0]) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf119661.py b/sw/qa/uitest/writer_tests7/tdf119661.py index 9d09d25bb3c7..9ad178f8a722 100644 --- a/sw/qa/uitest/writer_tests7/tdf119661.py +++ b/sw/qa/uitest/writer_tests7/tdf119661.py @@ -77,18 +77,16 @@ class tdf119661(UITestCase): # Close the Writer document self.ui_test.close_doc() - self.ui_test.load_file(systemPathToFileUrl(xFilePath)) + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)): - self.xUITest.executeCommand(".uno:LinkDialog") + 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.ui_test.close_doc() + # 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()) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf122780.py b/sw/qa/uitest/writer_tests7/tdf122780.py index 09f881c5c781..45f6a75b5906 100644 --- a/sw/qa/uitest/writer_tests7/tdf122780.py +++ b/sw/qa/uitest/writer_tests7/tdf122780.py @@ -13,16 +13,14 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file class tdf122780(UITestCase): def test_tdf122780(self): - writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf122780.docx")) - self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") + with self.ui_test.load_file(get_url_for_data_file("tdf122780.docx")) as writer_doc: + self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") - # Without the fix in place, this test would have hung here - xDialog = self.xUITest.getTopFocusWindow() - self.assertEqual("Normal_x005F", get_state_as_dict(xDialog.getChild('showtemplate'))['Text'][:12]) - self.assertEqual(32767, len(get_state_as_dict(xDialog.getChild('showtemplate'))['Text'])) - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - - self.ui_test.close_doc() + # Without the fix in place, this test would have hung here + xDialog = self.xUITest.getTopFocusWindow() + self.assertEqual("Normal_x005F", get_state_as_dict(xDialog.getChild('showtemplate'))['Text'][:12]) + self.assertEqual(32767, len(get_state_as_dict(xDialog.getChild('showtemplate'))['Text'])) + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf131936.py b/sw/qa/uitest/writer_tests7/tdf131936.py index db0c4ae3b47c..7e147f006326 100644 --- a/sw/qa/uitest/writer_tests7/tdf131936.py +++ b/sw/qa/uitest/writer_tests7/tdf131936.py @@ -10,18 +10,16 @@ import time class tdf131936(UITestCase): def test_tdf131936_saveas_docx_version(self): - self.ui_test.load_file(get_url_for_data_file("tdf131936.docx")) + with self.ui_test.load_file(get_url_for_data_file("tdf131936.docx")): - self.ui_test.execute_dialog_through_command(".uno:SaveAs") - time.sleep(DEFAULT_SLEEP) - xDialog = self.xUITest.getTopFocusWindow() - xFileTypeCombo = xDialog.getChild("file_type") - state = get_state_as_dict(xFileTypeCombo) - self.assertEqual(state["SelectEntryText"], "Office Open XML Text (Transitional) (.docx)") + self.ui_test.execute_dialog_through_command(".uno:SaveAs") + time.sleep(DEFAULT_SLEEP) + xDialog = self.xUITest.getTopFocusWindow() + xFileTypeCombo = xDialog.getChild("file_type") + state = get_state_as_dict(xFileTypeCombo) + self.assertEqual(state["SelectEntryText"], "Office Open XML Text (Transitional) (.docx)") - xCancel = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancel) - - self.ui_test.close_doc() + xCancel = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancel) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf132169.py b/sw/qa/uitest/writer_tests7/tdf132169.py index 7914fbf85e15..ef1ec666c029 100644 --- a/sw/qa/uitest/writer_tests7/tdf132169.py +++ b/sw/qa/uitest/writer_tests7/tdf132169.py @@ -11,38 +11,36 @@ from uitest.uihelper.common import change_measurement_unit class tdf132169(UITestCase): def test_tdf132169(self): - writer_doc = self.ui_test.load_file(get_url_for_data_file("shape.odt")) + with self.ui_test.load_file(get_url_for_data_file("shape.odt")) as writer_doc: - #set measurement to points - change_measurement_unit(self, "Point") + #set measurement to points + change_measurement_unit(self, "Point") - self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.xUITest.executeCommand(".uno:JumpToNextFrame") - #wait until the toolbar is available - xLineMetric = self.ui_test.wait_until_child_is_available('metricfield') - self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "0.0 pt") + #wait until the toolbar is available + xLineMetric = self.ui_test.wait_until_child_is_available('metricfield') + self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "0.0 pt") - #Check changing value from dialog also works - self.ui_test.execute_dialog_through_command(".uno:FormatLine") - xFormatLineDlg = self.xUITest.getTopFocusWindow() - xWidth = xFormatLineDlg.getChild('MTR_FLD_LINE_WIDTH') - type_text(xWidth, "4.0") - xOKBtn = xFormatLineDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + #Check changing value from dialog also works + self.ui_test.execute_dialog_through_command(".uno:FormatLine") + xFormatLineDlg = self.xUITest.getTopFocusWindow() + xWidth = xFormatLineDlg.getChild('MTR_FLD_LINE_WIDTH') + type_text(xWidth, "4.0") + xOKBtn = xFormatLineDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - self.ui_test.wait_until_property_is_updated(xLineMetric, "Text", "4.0 pt") - self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "4.0 pt") + self.ui_test.wait_until_property_is_updated(xLineMetric, "Text", "4.0 pt") + self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "4.0 pt") - xLineMetric.executeAction("UP", tuple()) + xLineMetric.executeAction("UP", tuple()) - document = self.ui_test.get_component() - drawPage = document.getDrawPages().getByIndex(0) - shape = drawPage.getByIndex(0) + document = self.ui_test.get_component() + drawPage = document.getDrawPages().getByIndex(0) + shape = drawPage.getByIndex(0) - #Without the fix in place, it would have been 310 - self.assertEqual(shape.LineWidth, 176) - - self.ui_test.close_doc() + #Without the fix in place, it would have been 310 + self.assertEqual(shape.LineWidth, 176) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf134243.py b/sw/qa/uitest/writer_tests7/tdf134243.py index 53e9109e22bb..e41cb5ce410c 100644 --- a/sw/qa/uitest/writer_tests7/tdf134243.py +++ b/sw/qa/uitest/writer_tests7/tdf134243.py @@ -10,17 +10,15 @@ from uitest.uihelper.common import get_url_for_data_file class tdf134243(UITestCase): def test_tdf134243(self): - writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf134243.odt")) + with self.ui_test.load_file(get_url_for_data_file("tdf134243.odt")) as writer_doc: - # Without the fix in place, it would hung launching the mailmerge wizard - self.ui_test.execute_dialog_through_command(".uno:MailMergeWizard") + # Without the fix in place, it would hung launching the mailmerge wizard + self.ui_test.execute_dialog_through_command(".uno:MailMergeWizard") - xDialog = self.xUITest.getTopFocusWindow() + xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - - self.ui_test.close_doc() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf137802.py b/sw/qa/uitest/writer_tests7/tdf137802.py index a4067410f41c..99c6085f29dd 100644 --- a/sw/qa/uitest/writer_tests7/tdf137802.py +++ b/sw/qa/uitest/writer_tests7/tdf137802.py @@ -13,67 +13,65 @@ class tdf137802(UITestCase): def test_tdf137802(self): - self.ui_test.load_file(get_url_for_data_file("tdf137802.odt")) + with self.ui_test.load_file(get_url_for_data_file("tdf137802.odt")): - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + document = self.ui_test.get_component() - self.assertEqual(document.DrawPage.getCount(), 2) - self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType) + self.assertEqual(document.DrawPage.getCount(), 2) + self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType) - self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.xUITest.executeCommand(".uno:JumpToNextFrame") - self.ui_test.wait_until_child_is_available('metricfield') + self.ui_test.wait_until_child_is_available('metricfield') - self.ui_test.execute_dialog_through_command(".uno:TransformDialog") + self.ui_test.execute_dialog_through_command(".uno:TransformDialog") - xDialog = self.xUITest.getTopFocusWindow() + xDialog = self.xUITest.getTopFocusWindow() - xDialog.getChild('topage').executeAction("CLICK", tuple()) + xDialog.getChild('topage').executeAction("CLICK", tuple()) - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - self.assertEqual(AT_PAGE, document.DrawPage.getByIndex(0).AnchorType) + self.assertEqual(AT_PAGE, document.DrawPage.getByIndex(0).AnchorType) - self.assertEqual(document.DrawPage.getCount(), 2) + self.assertEqual(document.DrawPage.getCount(), 2) - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - # When shape 1 is selected, esc key doesn't put the focus back to the document - # because the shape has a textbox. Move the focus to another shape with tab key - # and then use escape - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ESC"})) + # When shape 1 is selected, esc key doesn't put the focus back to the document + # because the shape has a textbox. Move the focus to another shape with tab key + # and then use escape + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ESC"})) - # Wait until the shape is deselected and the cursor is on the document - self.ui_test.wait_until_child_is_available('FontNameBox') + # Wait until the shape is deselected and the cursor is on the document + self.ui_test.wait_until_child_is_available('FontNameBox') - # Delete the second paragraph. Shape 2 is anchored to this paragraph - # so it should be deleted - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + # Delete the second paragraph. Shape 2 is anchored to this paragraph + # so it should be deleted + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) - self.assertEqual(document.DrawPage.getCount(), 1) + self.assertEqual(document.DrawPage.getCount(), 1) - self.xUITest.executeCommand(".uno:JumpToNextFrame") - self.xUITest.executeCommand(".uno:Delete") + self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.xUITest.executeCommand(".uno:Delete") - self.assertEqual(document.DrawPage.getCount(), 0) + self.assertEqual(document.DrawPage.getCount(), 0) - self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.DrawPage.getCount(), 1) + self.assertEqual(document.DrawPage.getCount(), 1) - self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.DrawPage.getCount(), 2) + self.assertEqual(document.DrawPage.getCount(), 2) - self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType) - - self.ui_test.close_doc() + self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf137803.py b/sw/qa/uitest/writer_tests7/tdf137803.py index 3e48c267ca55..3549cc9d0b77 100644 --- a/sw/qa/uitest/writer_tests7/tdf137803.py +++ b/sw/qa/uitest/writer_tests7/tdf137803.py @@ -11,42 +11,41 @@ from uitest.uihelper.common import get_url_for_data_file class tdf137803(UITestCase): def test_tdf137803(self): # load the sample file - self.ui_test.load_file(get_url_for_data_file("tdf137803.odt")) - document = self.ui_test.get_component() + with self.ui_test.load_file(get_url_for_data_file("tdf137803.odt")): + document = self.ui_test.get_component() - # select the shape - self.xUITest.executeCommand(".uno:JumpToNextFrame") - self.ui_test.wait_until_child_is_available('metricfield') + # select the shape + self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.ui_test.wait_until_child_is_available('metricfield') - # open textattrs dialog - self.ui_test.execute_dialog_through_command(".uno:TextAttributes") - TextDialog = self.xUITest.getTopFocusWindow(); + # open textattrs dialog + self.ui_test.execute_dialog_through_command(".uno:TextAttributes") + TextDialog = self.xUITest.getTopFocusWindow(); - # check autosize on - TSB_AUTOGROW_SIZE = TextDialog.getChild('TSB_AUTOGROW_SIZE') - TSB_AUTOGROW_SIZE.executeAction("CLICK",tuple()) - ok = TextDialog.getChild("ok") - self.ui_test.close_dialog_through_button(ok) + # check autosize on + TSB_AUTOGROW_SIZE = TextDialog.getChild('TSB_AUTOGROW_SIZE') + TSB_AUTOGROW_SIZE.executeAction("CLICK",tuple()) + ok = TextDialog.getChild("ok") + self.ui_test.close_dialog_through_button(ok) - # get the shape - drawPage = document.getDrawPages().getByIndex(0) - shape = drawPage.getByIndex(0) + # get the shape + drawPage = document.getDrawPages().getByIndex(0) + shape = drawPage.getByIndex(0) - # and the textbox - frame = shape.getText() + # and the textbox + frame = shape.getText() - # get the positions - shapeYPos = shape.getPropertyValue("VertOrientPosition") - frameYPos = frame.getPropertyValue("VertOrientPosition") - shpsize = shape.getSize().Height + # get the positions + shapeYPos = shape.getPropertyValue("VertOrientPosition") + frameYPos = frame.getPropertyValue("VertOrientPosition") + shpsize = shape.getSize().Height - xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') - xToolkit.processEventsToIdle() + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() - # without the fix, at this point the textbox falls apart so this won't be passed - self.assertLess(frameYPos, shapeYPos + shpsize) + # without the fix, at this point the textbox falls apart so this won't be passed + self.assertLess(frameYPos, shapeYPos + shpsize) - # close the doc - self.ui_test.close_doc() + # close the doc # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf139301.py b/sw/qa/uitest/writer_tests7/tdf139301.py index 064018889031..7436dce42bda 100644 --- a/sw/qa/uitest/writer_tests7/tdf139301.py +++ b/sw/qa/uitest/writer_tests7/tdf139301.py @@ -12,58 +12,54 @@ class tdf139301(UITestCase): styles = ('Long Dash', 'Long Dash Dot', 'Long Dot', 'Double Dash', 'Double Dash Dot', 'Double Dash Dot Dot', 'Dash', 'Dash Dot', 'Dash Dot Dot', 'Dot') def test_tdf139301(self): - writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_Word97.docx")) + with self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_Word97.docx")) as writer_doc: - for i in range(len(self.styles)): - # select next line shape - writer_doc.getCurrentController().select(writer_doc.getDrawPage()[i]) + for i in range(len(self.styles)): + # select next line shape + writer_doc.getCurrentController().select(writer_doc.getDrawPage()[i]) - # wait for available line style setting - self.ui_test.wait_until_child_is_available('metricfield') + # wait for available line style setting + self.ui_test.wait_until_child_is_available('metricfield') - # line setting dialog window - self.ui_test.execute_dialog_through_command(".uno:FormatLine") - xFormatLineDlg = self.xUITest.getTopFocusWindow() - # get line style combo box - xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") + # line setting dialog window + self.ui_test.execute_dialog_through_command(".uno:FormatLine") + xFormatLineDlg = self.xUITest.getTopFocusWindow() + # get line style combo box + xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") - # check preset line style - style = get_state_as_dict(xLineStyle)['SelectEntryText'] + # check preset line style + style = get_state_as_dict(xLineStyle)['SelectEntryText'] - xOKBtn = xFormatLineDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xOKBtn = xFormatLineDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - self.assertEqual(style, self.styles[i]) - - self.ui_test.close_doc() + self.assertEqual(style, self.styles[i]) def test_round_cap(self): - writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_round_cap.docx")) - - style_name_extension = ' (Rounded)' + with self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_round_cap.docx")) as writer_doc: - for i in range(len(self.styles)): - # select next line shape - writer_doc.getCurrentController().select(writer_doc.getDrawPage()[i]) + style_name_extension = ' (Rounded)' - # wait for available line style setting - self.ui_test.wait_until_child_is_available('metricfield') + for i in range(len(self.styles)): + # select next line shape + writer_doc.getCurrentController().select(writer_doc.getDrawPage()[i]) - # line setting dialog window - self.ui_test.execute_dialog_through_command(".uno:FormatLine") - xFormatLineDlg = self.xUITest.getTopFocusWindow() - # get line style combo box - xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") + # wait for available line style setting + self.ui_test.wait_until_child_is_available('metricfield') - # check preset line style - style = get_state_as_dict(xLineStyle)['SelectEntryText'] + # line setting dialog window + self.ui_test.execute_dialog_through_command(".uno:FormatLine") + xFormatLineDlg = self.xUITest.getTopFocusWindow() + # get line style combo box + xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE") - xOKBtn = xFormatLineDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + # check preset line style + style = get_state_as_dict(xLineStyle)['SelectEntryText'] - self.assertEqual(style, self.styles[i] + style_name_extension) + xOKBtn = xFormatLineDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - self.ui_test.close_doc() + self.assertEqual(style, self.styles[i] + style_name_extension) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf140117.py b/sw/qa/uitest/writer_tests7/tdf140117.py index c6244841241e..a1790e642a64 100644 --- a/sw/qa/uitest/writer_tests7/tdf140117.py +++ b/sw/qa/uitest/writer_tests7/tdf140117.py @@ -13,51 +13,49 @@ from uitest.uihelper.common import get_url_for_data_file class tdf140117(UITestCase): def test_tdf140117(self): # load the sample file - self.ui_test.load_file(get_url_for_data_file("tdf140117.fodt")) - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - document = self.ui_test.get_component() - - for i in range(3): - xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"})) - - self.xUITest.executeCommand(".uno:JumpToHeader") - - xPageSytle = document.getStyleFamilies().getByIndex(2) - xHeaderText = xPageSytle.getByIndex(0).HeaderText.String - xHeaderFirstText = xPageSytle.getByIndex(0).HeaderTextFirst.String - xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String - xHeaderRightText = xPageSytle.getByIndex(0).HeaderTextRight.String - - # Option "same content on left and right pages" is false, - # insert text "XXXX" before actual header text "left" on page 2 - if i == 0: - type_text(xWriterEdit, "XXXX") - - # Option "same content on left and right pages" is true, - # header of page 2 contains the same text as page 1 - elif i == 1: - self.assertEqual("right", xHeaderText) - self.assertEqual("right", xHeaderRightText) - - # Option "same content on left and right pages" is false again. - # This was "right" instead of keeping the header content disabled - # temporarily for the second interaction of the loop. - elif i == 2: - self.assertEqual("XXXXleft", xHeaderLeftText) - - self.ui_test.execute_dialog_through_command(".uno:PageDialog") - PageDialog = self.xUITest.getTopFocusWindow(); - - xTabs = PageDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - - # Change option "same content on left and right pages" for the next iteration - Button = xTabs.getChild('checkSameLR') - Button.executeAction("CLICK", tuple()) - ok = PageDialog.getChild("ok") - self.ui_test.close_dialog_through_button(ok) - - self.ui_test.close_doc() + with self.ui_test.load_file(get_url_for_data_file("tdf140117.fodt")): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + document = self.ui_test.get_component() + + for i in range(3): + xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"})) + + self.xUITest.executeCommand(".uno:JumpToHeader") + + xPageSytle = document.getStyleFamilies().getByIndex(2) + xHeaderText = xPageSytle.getByIndex(0).HeaderText.String + xHeaderFirstText = xPageSytle.getByIndex(0).HeaderTextFirst.String + xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String + xHeaderRightText = xPageSytle.getByIndex(0).HeaderTextRight.String + + # Option "same content on left and right pages" is false, + # insert text "XXXX" before actual header text "left" on page 2 + if i == 0: + type_text(xWriterEdit, "XXXX") + + # Option "same content on left and right pages" is true, + # header of page 2 contains the same text as page 1 + elif i == 1: + self.assertEqual("right", xHeaderText) + self.assertEqual("right", xHeaderRightText) + + # Option "same content on left and right pages" is false again. + # This was "right" instead of keeping the header content disabled + # temporarily for the second interaction of the loop. + elif i == 2: + self.assertEqual("XXXXleft", xHeaderLeftText) + + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + PageDialog = self.xUITest.getTopFocusWindow(); + + xTabs = PageDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + # Change option "same content on left and right pages" for the next iteration + Button = xTabs.getChild('checkSameLR') + Button.executeAction("CLICK", tuple()) + ok = PageDialog.getChild("ok") + self.ui_test.close_dialog_through_button(ok) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf141158.py b/sw/qa/uitest/writer_tests7/tdf141158.py index e29c36418958..6624530ee3cd 100644 --- a/sw/qa/uitest/writer_tests7/tdf141158.py +++ b/sw/qa/uitest/writer_tests7/tdf141158.py @@ -10,32 +10,31 @@ import time class TestTdf141158(UITestCase): def test_tdf141158(self): # load the desired bugdoc - self.ui_test.load_file(get_url_for_data_file("TestHiddenHeadersFooters.docx")) - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - document = self.ui_test.get_component() - # open the page styles dialog and select the headers tab - self.xUITest.executeCommand(".uno:PageStyleName") - TemplateDialog8 = self.xUITest.getTopFocusWindow() - xTabs = TemplateDialog8.getChild("tabcontrol") - select_pos(xTabs, "4") - # make the same left right page header state to off and apply the setting - checkSameLR = TemplateDialog8.getChild("checkSameLR") - checkSameLR.executeAction("CLICK",tuple()) - ok = TemplateDialog8.getChild("ok") - self.ui_test.close_dialog_through_button(ok) - time.sleep(1) - # go to the left header - xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"})) - self.xUITest.executeCommand(".uno:JumpToHeader") - # get the text of the header - xPageSytle = document.getStyleFamilies().getByIndex(2) - xHeaderText = xPageSytle.getByIndex(0).HeaderText.String - xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String - # without the fix in place it was "Right Header" (lost hidden left header), - # with the fix it should pass... - self.assertEqual("Left Header", xHeaderLeftText) - time.sleep(1) - self.ui_test.close_doc() + with self.ui_test.load_file(get_url_for_data_file("TestHiddenHeadersFooters.docx")): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + document = self.ui_test.get_component() + # open the page styles dialog and select the headers tab + self.xUITest.executeCommand(".uno:PageStyleName") + TemplateDialog8 = self.xUITest.getTopFocusWindow() + xTabs = TemplateDialog8.getChild("tabcontrol") + select_pos(xTabs, "4") + # make the same left right page header state to off and apply the setting + checkSameLR = TemplateDialog8.getChild("checkSameLR") + checkSameLR.executeAction("CLICK",tuple()) + ok = TemplateDialog8.getChild("ok") + self.ui_test.close_dialog_through_button(ok) + time.sleep(1) + # go to the left header + xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"})) + self.xUITest.executeCommand(".uno:JumpToHeader") + # get the text of the header + xPageSytle = document.getStyleFamilies().getByIndex(2) + xHeaderText = xPageSytle.getByIndex(0).HeaderText.String + xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String + # without the fix in place it was "Right Header" (lost hidden left header), + # with the fix it should pass... + self.assertEqual("Left Header", xHeaderLeftText) + time.sleep(1) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf141557.py b/sw/qa/uitest/writer_tests7/tdf141557.py index c641cd3e23f3..3d25c7908d99 100644 --- a/sw/qa/uitest/writer_tests7/tdf141557.py +++ b/sw/qa/uitest/writer_tests7/tdf141557.py @@ -12,29 +12,27 @@ from uitest.uihelper.common import get_url_for_data_file class tdf141557(UITestCase): def test_tdf141557(self): # load the sample file - self.ui_test.load_file(get_url_for_data_file("tdf141557.docx")) - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - document = self.ui_test.get_component() + with self.ui_test.load_file(get_url_for_data_file("tdf141557.docx")): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + document = self.ui_test.get_component() - self.assertEqual(AS_CHARACTER, document.DrawPage.getByIndex(0).AnchorType) + self.assertEqual(AS_CHARACTER, document.DrawPage.getByIndex(0).AnchorType) - self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.xUITest.executeCommand(".uno:JumpToNextFrame") - self.ui_test.wait_until_child_is_available('metricfield') + self.ui_test.wait_until_child_is_available('metricfield') - self.ui_test.execute_dialog_through_command(".uno:TransformDialog") + self.ui_test.execute_dialog_through_command(".uno:TransformDialog") - xDialog = self.xUITest.getTopFocusWindow() + xDialog = self.xUITest.getTopFocusWindow() - xDialog.getChild('topara').executeAction("CLICK", tuple()) + xDialog.getChild('topara').executeAction("CLICK", tuple()) - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - # Without the fix in place, at this point crash occurs. - self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType) - - self.ui_test.close_doc() + # Without the fix in place, at this point crash occurs. + self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf46561.py b/sw/qa/uitest/writer_tests7/tdf46561.py index 1c90dc3c404a..1c34a89a71b4 100644 --- a/sw/qa/uitest/writer_tests7/tdf46561.py +++ b/sw/qa/uitest/writer_tests7/tdf46561.py @@ -26,75 +26,73 @@ class tdf46561(UITestCase): self.assertEqual(right, xHeaderTextRight) def test_tdf46561(self): - self.ui_test.load_file(get_url_for_data_file("tdf46561.odt")) - self.document = self.ui_test.get_component() - self.check_header_texts(master="right", first="1st", left="left", right="right") - - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"})) - self.xUITest.executeCommand(".uno:JumpToHeader") - - # Switch "same left and right page headers" on and off a few times - for _ in range(4): - self.ui_test.execute_dialog_through_command(".uno:PageDialog") - PageDialog = self.xUITest.getTopFocusWindow(); - - xTabs = PageDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - - Button = xTabs.getChild('checkSameLR') - Button.executeAction("CLICK",tuple()) - ok = PageDialog.getChild("ok") - self.ui_test.close_dialog_through_button(ok) - - # We should be back to the starting state after 2*k on/off changes - self.check_header_texts(master="right", first="1st", left="left", right="right") - - # Enter some additional text in the left page header - type_text(xWriterEdit, "XXXX") - self.check_header_texts(master="right", first="1st", left="XXXXleft", right="right") - - # Now go back one change (before entering "XXXX") - self.xUITest.executeCommand(".uno:Undo") - self.check_header_texts(master="right", first="1st", left="left", right="right") - - # Undo the fourth change - self.xUITest.executeCommand(".uno:Undo") - self.check_header_texts(master="right", first="1st", left="right", right="right") - - # Undo the third change - self.xUITest.executeCommand(".uno:Undo") - self.check_header_texts(master="right", first="1st", left="left", right="right") - - # Undo the second change - self.xUITest.executeCommand(".uno:Undo") - self.check_header_texts(master="right", first="1st", left="right", right="right") - - # Undo the first change - self.xUITest.executeCommand(".uno:Undo") - self.check_header_texts(master="right", first="1st", left="left", right="right") - - # Redo the first change - self.xUITest.executeCommand(".uno:Redo") - self.check_header_texts(master="right", first="1st", left="right", right="right") - - # Redo the second change - self.xUITest.executeCommand(".uno:Redo") - self.check_header_texts(master="right", first="1st", left="left", right="right") - - # Redo the third change - self.xUITest.executeCommand(".uno:Redo") - self.check_header_texts(master="right", first="1st", left="right", right="right") - - # Redo the fourth change - self.xUITest.executeCommand(".uno:Redo") - self.check_header_texts(master="right", first="1st", left="left", right="right") - - # Redo the final change - self.xUITest.executeCommand(".uno:Redo") - self.check_header_texts(master="right", first="1st", left="XXXXleft", right="right") - - self.ui_test.close_doc() + with self.ui_test.load_file(get_url_for_data_file("tdf46561.odt")): + self.document = self.ui_test.get_component() + self.check_header_texts(master="right", first="1st", left="left", right="right") + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"})) + self.xUITest.executeCommand(".uno:JumpToHeader") + + # Switch "same left and right page headers" on and off a few times + for _ in range(4): + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + PageDialog = self.xUITest.getTopFocusWindow(); + + xTabs = PageDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + Button = xTabs.getChild('checkSameLR') + Button.executeAction("CLICK",tuple()) + ok = PageDialog.getChild("ok") + self.ui_test.close_dialog_through_button(ok) + + # We should be back to the starting state after 2*k on/off changes + self.check_header_texts(master="right", first="1st", left="left", right="right") + + # Enter some additional text in the left page header + type_text(xWriterEdit, "XXXX") + self.check_header_texts(master="right", first="1st", left="XXXXleft", right="right") + + # Now go back one change (before entering "XXXX") + self.xUITest.executeCommand(".uno:Undo") + self.check_header_texts(master="right", first="1st", left="left", right="right") + + # Undo the fourth change + self.xUITest.executeCommand(".uno:Undo") + self.check_header_texts(master="right", first="1st", left="right", right="right") + + # Undo the third change + self.xUITest.executeCommand(".uno:Undo") + self.check_header_texts(master="right", first="1st", left="left", right="right") + + # Undo the second change + self.xUITest.executeCommand(".uno:Undo") + self.check_header_texts(master="right", first="1st", left="right", right="right") + + # Undo the first change + self.xUITest.executeCommand(".uno:Undo") + self.check_header_texts(master="right", first="1st", left="left", right="right") + + # Redo the first change + self.xUITest.executeCommand(".uno:Redo") + self.check_header_texts(master="right", first="1st", left="right", right="right") + + # Redo the second change + self.xUITest.executeCommand(".uno:Redo") + self.check_header_texts(master="right", first="1st", left="left", right="right") + + # Redo the third change + self.xUITest.executeCommand(".uno:Redo") + self.check_header_texts(master="right", first="1st", left="right", right="right") + + # Redo the fourth change + self.xUITest.executeCommand(".uno:Redo") + self.check_header_texts(master="right", first="1st", left="left", right="right") + + # Redo the final change + self.xUITest.executeCommand(".uno:Redo") + self.check_header_texts(master="right", first="1st", left="XXXXleft", right="right") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf90401.py b/sw/qa/uitest/writer_tests7/tdf90401.py index e204ef8bb62a..cb70c401b142 100644 --- a/sw/qa/uitest/writer_tests7/tdf90401.py +++ b/sw/qa/uitest/writer_tests7/tdf90401.py @@ -21,82 +21,83 @@ class tdf90401(UITestCase): # load a test document with a tracked change, and add a comment - writer_doc = self.ui_test.load_file(get_url_for_data_file('redline-autocorrect.fodt')) - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild('writer_edit') + with self.ui_test.load_file(get_url_for_data_file('redline-autocorrect.fodt')) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild('writer_edit') - document = self.ui_test.get_component() - selection = self.xUITest.executeCommand('.uno:SelectAll') - self.xUITest.executeCommand('.uno:InsertAnnotation') + document = self.ui_test.get_component() + selection = self.xUITest.executeCommand('.uno:SelectAll') + self.xUITest.executeCommand('.uno:InsertAnnotation') - # enable remove personal info security option + # enable remove personal info security option - self.ui_test.execute_dialog_through_command('.uno:OptionsTreeDialog') #optionsdialog - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command('.uno:OptionsTreeDialog') #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() - xPages = xDialog.getChild('pages') - xGenEntry = xPages.getChild('0') - xSecurityPage = xGenEntry.getChild('6') - xSecurityPage.executeAction('SELECT', tuple()) - # Click Button Options... - xOptions = xDialog.getChild('options') + xPages = xDialog.getChild('pages') + xGenEntry = xPages.getChild('0') + xSecurityPage = xGenEntry.getChild('6') + xSecurityPage.executeAction('SELECT', tuple()) + # Click Button Options... + xOptions = xDialog.getChild('options') - with self.ui_test.execute_blocking_action(xOptions.executeAction, args=('CLICK', ()), close_button="") as dialog: - xRemovePersonal = dialog.getChild('removepersonal') - xRemovePersonal.executeAction('CLICK', tuple()) - xOkBtn = dialog.getChild('ok') - # FIXME: we can't use close_dialog_through_button here, the dialog doesn't emit the - # event DialogClosed after closing - xOkBtn.executeAction('CLICK', tuple()) + with self.ui_test.execute_blocking_action(xOptions.executeAction, args=('CLICK', ()), close_button="") as dialog: + xRemovePersonal = dialog.getChild('removepersonal') + xRemovePersonal.executeAction('CLICK', tuple()) + xOkBtn = dialog.getChild('ok') + # FIXME: we can't use close_dialog_through_button here, the dialog doesn't emit the + # event DialogClosed after closing + xOkBtn.executeAction('CLICK', tuple()) - xOKBtn = xDialog.getChild('ok') - self.ui_test.close_dialog_through_button(xOKBtn) + xOKBtn = xDialog.getChild('ok') + self.ui_test.close_dialog_through_button(xOKBtn) - # save and reload the document to remove personal info + # save and reload the document to remove personal info - with TemporaryDirectory() as tempdir: - xFilePath = os.path.join(tempdir, 'tdf90401-tmp.fodt') + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, 'tdf90401-tmp.fodt') - # Save Copy as - self.ui_test.execute_dialog_through_command('.uno:SaveAs') - xDialog = self.xUITest.getTopFocusWindow() + # Save Copy as + self.ui_test.execute_dialog_through_command('.uno:SaveAs') + xDialog = self.xUITest.getTopFocusWindow() - xFileName = xDialog.getChild('file_name') - xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'})) - xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'})) - xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath})) + xFileName = xDialog.getChild('file_name') + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'})) + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'})) + xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath})) - xOpenBtn = xDialog.getChild('open') - self.ui_test.close_dialog_through_button(xOpenBtn) + xOpenBtn = xDialog.getChild('open') + self.ui_test.close_dialog_through_button(xOpenBtn) - # Close the Writer document - self.ui_test.close_doc() + # Close the Writer document + self.ui_test.close_doc() - self.ui_test.load_file(systemPathToFileUrl(xFilePath)) - document = self.ui_test.get_component() + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)): + document = self.ui_test.get_component() + + # check removed personal info on comments + + textfields = document.getTextFields() + author = "" + year = -1 + for textfield in textfields: + if textfield.supportsService("com.sun.star.text.TextField.Annotation"): + author = textfield.Author + year = textfield.Date.Year + # This was 'Unknown Author' + self.assertEqual(author, 'Author2') + # This was 2021 + self.assertEqual(year, 0) + + # check removed personal info on tracked changes + + self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges') + xTrackDlg = self.xUITest.getTopFocusWindow() + xTreeList = xTrackDlg.getChild('writerchanges') + state = get_state_as_dict(xTreeList) + # This was 'NL\t11/03/2020 19:19:05\t', containing personal info + self.assertEqual(state['SelectEntryText'], 'Author1\t01/01/1970 00:00:00\t') + + self.ui_test.close_doc() - # check removed personal info on comments - - textfields = document.getTextFields() - author = "" - year = -1 - for textfield in textfields: - if textfield.supportsService("com.sun.star.text.TextField.Annotation"): - author = textfield.Author - year = textfield.Date.Year - # This was 'Unknown Author' - self.assertEqual(author, 'Author2') - # This was 2021 - self.assertEqual(year, 0) - - # check removed personal info on tracked changes - - self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges') - xTrackDlg = self.xUITest.getTopFocusWindow() - xTreeList = xTrackDlg.getChild('writerchanges') - state = get_state_as_dict(xTreeList) - # This was 'NL\t11/03/2020 19:19:05\t', containing personal info - self.assertEqual(state['SelectEntryText'], 'Author1\t01/01/1970 00:00:00\t') - - self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: |