summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-10-26 12:18:17 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-10-26 14:44:14 +0200
commit1b6839f59b5aa9bf01674862aa320259ee488f63 (patch)
treed36f7eb2117dd4ad94c0fdfb23210873cfebb3cb /sw
parent97bf901e36f139ba16deb006ea293c20bcd8240e (diff)
uitest: rearrange tests to avoid "close_doc: no active frame"
Change-Id: I92bf81801797821c9ec4aa73c005f1d6c6f6da62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124182 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/uitest/writer_tests6/tdf144374.py26
-rw-r--r--sw/qa/uitest/writer_tests7/tdf119661.py84
-rw-r--r--sw/qa/uitest/writer_tests7/tdf90401.py216
3 files changed, 153 insertions, 173 deletions
diff --git a/sw/qa/uitest/writer_tests6/tdf144374.py b/sw/qa/uitest/writer_tests6/tdf144374.py
index c484b79b54cd..bdd0e59f05b2 100644
--- a/sw/qa/uitest/writer_tests6/tdf144374.py
+++ b/sw/qa/uitest/writer_tests6/tdf144374.py
@@ -16,10 +16,10 @@ import os.path
class tdf144374(UITestCase):
def test_tdf144374_DOCX(self):
- with self.ui_test.create_doc_in_start_center("writer"):
- with TemporaryDirectory() as tempdir:
- xFilePath = os.path.join(tempdir, "tdf144374-tmp.docx")
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, "tdf144374-tmp.docx")
+ with self.ui_test.create_doc_in_start_center("writer"):
# Save the document
with self.ui_test.execute_dialog_through_command(".uno:Save", close_button="") as xSaveDialog:
xFileName = xSaveDialog.getChild("file_name")
@@ -45,19 +45,17 @@ class tdf144374(UITestCase):
xSave = xWarnDialog.getChild("save")
self.ui_test.close_dialog_through_button(xSave)
- self.ui_test.close_doc()
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)):
+ xWriterEdit = self.xUITest.getTopFocusWindow().getChild("writer_edit")
+ document = self.ui_test.get_component()
- with self.ui_test.load_file(systemPathToFileUrl(xFilePath)):
- xWriterEdit = self.xUITest.getTopFocusWindow().getChild("writer_edit")
- document = self.ui_test.get_component()
+ self.assertTrue(document.isReadonly())
- self.assertTrue(document.isReadonly())
+ #Without the fix in place, this dialog wouldn't have been displayed
+ with self.ui_test.execute_dialog_through_action(xWriterEdit, "TYPE", mkPropertyValues({"KEYCODE": "CTRL+SHIFT+M"})) as xDialog:
+ xPassword = xDialog.getChild("newpassEntry")
+ xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"}))
- #Without the fix in place, this dialog wouldn't have been displayed
- with self.ui_test.execute_dialog_through_action(xWriterEdit, "TYPE", mkPropertyValues({"KEYCODE": "CTRL+SHIFT+M"})) as xDialog:
- xPassword = xDialog.getChild("newpassEntry")
- xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"}))
-
- self.assertFalse(document.isReadonly())
+ self.assertFalse(document.isReadonly())
# 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 da284add867b..2923128bf830 100644
--- a/sw/qa/uitest/writer_tests7/tdf119661.py
+++ b/sw/qa/uitest/writer_tests7/tdf119661.py
@@ -14,68 +14,64 @@ import os.path
class tdf119661(UITestCase):
def test_tdf119661(self):
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, "tdf119661-tmp.odt")
- with self.ui_test.create_doc_in_start_center("writer"):
+ with self.ui_test.create_doc_in_start_center("writer"):
- with self.ui_test.execute_dialog_through_command(".uno:InsertGraphic", close_button="") as xOpenDialog:
- xFileName = xOpenDialog.getChild("file_name")
- xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("LibreOffice.jpg")}))
+ with self.ui_test.execute_dialog_through_command(".uno:InsertGraphic", close_button="") as xOpenDialog:
+ xFileName = xOpenDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("LibreOffice.jpg")}))
- xLink = xOpenDialog.getChild("link")
- self.assertEqual("false", get_state_as_dict(xLink)['Selected'])
+ xLink = xOpenDialog.getChild("link")
+ self.assertEqual("false", get_state_as_dict(xLink)['Selected'])
- xLink.executeAction("CLICK", tuple())
+ xLink.executeAction("CLICK", tuple())
- xOpenBtn = xOpenDialog.getChild("open")
+ xOpenBtn = xOpenDialog.getChild("open")
- #Confirmation dialog is displayed
- with self.ui_test.execute_dialog_through_action(xOpenBtn, 'CLICK'):
- pass
+ #Confirmation dialog is displayed
+ with self.ui_test.execute_dialog_through_action(xOpenBtn, 'CLICK'):
+ pass
- with self.ui_test.execute_dialog_through_command(".uno:LinkDialog", close_button="close") as xDialog:
+ 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()))
+ 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("/LibreOffice.jpg"))
+ sFileName = "FULL_FILE_NAME"
+ xFileName = xDialog.getChild(sFileName)
+ self.assertTrue(get_state_as_dict(xFileName)["Text"].endswith("/LibreOffice.jpg"))
- sBreakLink = "BREAK_LINK"
- xBreakLink = xDialog.getChild(sBreakLink)
+ sBreakLink = "BREAK_LINK"
+ xBreakLink = xDialog.getChild(sBreakLink)
- with self.ui_test.execute_blocking_action(xBreakLink.executeAction,
- args=("CLICK", tuple()), close_button="yes"):
- pass
+ with self.ui_test.execute_blocking_action(xBreakLink.executeAction,
+ args=("CLICK", tuple()), close_button="yes"):
+ pass
- with TemporaryDirectory() as tempdir:
- xFilePath = os.path.join(tempdir, "tdf119661-tmp.odt")
- # Save Copy as
- with self.ui_test.execute_dialog_through_command(".uno:SaveAs", close_button="open") as xDialog:
+ # 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}))
+ xFileName = xDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath}))
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)):
- # Close the Writer document
- self.ui_test.close_doc()
+ self.xUITest.executeCommand(".uno:LinkDialog")
- with self.ui_test.load_file(systemPathToFileUrl(xFilePath)):
-
- 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())
+ # 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/tdf90401.py b/sw/qa/uitest/writer_tests7/tdf90401.py
index 5fa131be7839..df71127feb04 100644
--- a/sw/qa/uitest/writer_tests7/tdf90401.py
+++ b/sw/qa/uitest/writer_tests7/tdf90401.py
@@ -21,39 +21,37 @@ class tdf90401(UITestCase):
# load a test document with a tracked change, and add a comment
- 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')
-
- selection = self.xUITest.executeCommand('.uno:SelectAll')
- self.xUITest.executeCommand('.uno:InsertAnnotation')
-
- # enable remove personal info security option
-
- with self.ui_test.execute_dialog_through_command('.uno:OptionsTreeDialog') as xDialog:
- 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')
- if get_state_as_dict(xRemovePersonal)['Selected'] == "false":
- xRemovePersonal.executeAction('CLICK', tuple())
- self.ui_test.wait_until_property_is_updated(xRemovePersonal, "Selected", "true")
- self.assertEqual(get_state_as_dict(xRemovePersonal)["Selected"], "true")
-
- 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())
-
- # 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')
+
+ 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')
+
+ selection = self.xUITest.executeCommand('.uno:SelectAll')
+ self.xUITest.executeCommand('.uno:InsertAnnotation')
+
+ # enable remove personal info security option
+
+ with self.ui_test.execute_dialog_through_command('.uno:OptionsTreeDialog') as xDialog:
+ 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')
+ if get_state_as_dict(xRemovePersonal)['Selected'] == "false":
+ xRemovePersonal.executeAction('CLICK', tuple())
+ self.ui_test.wait_until_property_is_updated(xRemovePersonal, "Selected", "true")
+ self.assertEqual(get_state_as_dict(xRemovePersonal)["Selected"], "true")
+
+ 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())
# Save Copy as
with self.ui_test.execute_dialog_through_command('.uno:SaveAs', close_button="open") as xDialog:
@@ -62,72 +60,64 @@ class tdf90401(UITestCase):
xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'}))
xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath}))
- # Close the Writer document
- self.ui_test.close_doc()
-
- with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as writer_doc2:
-
- # check removed personal info on comments
-
- textfields = writer_doc2.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
- with self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges', close_button="close") as xTrackDlg:
- 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')
-
-
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as writer_doc2:
+
+ # check removed personal info on comments
+
+ textfields = writer_doc2.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
+ with self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges', close_button="close") as xTrackDlg:
+ 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')
def test_tdf142902_remove_personal_info_in_DOCX(self):
# load a test document with a tracked change, and add a comment
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, 'redline-para-join-tmp.docx')
- with self.ui_test.load_file(get_url_for_data_file('redline-para-join.docx')) as writer_doc:
-
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild('writer_edit')
+ with self.ui_test.load_file(get_url_for_data_file('redline-para-join.docx')) as writer_doc:
- selection = self.xUITest.executeCommand('.uno:SelectAll')
- self.xUITest.executeCommand('.uno:InsertAnnotation')
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild('writer_edit')
- # enable remove personal info security option
+ selection = self.xUITest.executeCommand('.uno:SelectAll')
+ self.xUITest.executeCommand('.uno:InsertAnnotation')
- with self.ui_test.execute_dialog_through_command('.uno:OptionsTreeDialog') as xDialog:
- xPages = xDialog.getChild('pages')
- xGenEntry = xPages.getChild('0')
- xSecurityPage = xGenEntry.getChild('6')
- xSecurityPage.executeAction('SELECT', tuple())
- # Click Button Options...
- xOptions = xDialog.getChild('options')
+ # enable remove personal info security option
- with self.ui_test.execute_blocking_action(xOptions.executeAction, args=('CLICK', ()), close_button="") as dialog:
- xRemovePersonal = dialog.getChild('removepersonal')
- if get_state_as_dict(xRemovePersonal)['Selected'] == "false":
- xRemovePersonal.executeAction('CLICK', tuple())
- self.ui_test.wait_until_property_is_updated(xRemovePersonal, "Selected", "true")
- self.assertEqual(get_state_as_dict(xRemovePersonal)["Selected"], "true")
+ with self.ui_test.execute_dialog_through_command('.uno:OptionsTreeDialog') as xDialog:
+ xPages = xDialog.getChild('pages')
+ xGenEntry = xPages.getChild('0')
+ xSecurityPage = xGenEntry.getChild('6')
+ xSecurityPage.executeAction('SELECT', tuple())
+ # Click Button Options...
+ xOptions = xDialog.getChild('options')
- 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')
+ if get_state_as_dict(xRemovePersonal)['Selected'] == "false":
+ xRemovePersonal.executeAction('CLICK', tuple())
+ self.ui_test.wait_until_property_is_updated(xRemovePersonal, "Selected", "true")
+ self.assertEqual(get_state_as_dict(xRemovePersonal)["Selected"], "true")
- # save and reload the document to remove personal info
-
- with TemporaryDirectory() as tempdir:
- xFilePath = os.path.join(tempdir, 'redline-para-join-tmp.docx')
+ 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())
# Save Copy as
with self.ui_test.execute_dialog_through_command('.uno:SaveAs', close_button="open") as xDialog:
@@ -141,32 +131,28 @@ class tdf90401(UITestCase):
xOK = xWarnDialog.getChild("save")
self.ui_test.close_dialog_through_button(xOK)
- # Close the Writer document
- self.ui_test.close_doc()
-
- with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as writer_doc2:
-
- # check removed personal info on comments
-
- textfields = writer_doc2.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
-
- with self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges', close_button="close") as xTrackDlg:
- 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')
-
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as writer_doc2:
+
+ # check removed personal info on comments
+
+ textfields = writer_doc2.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
+
+ with self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges', close_button="close") as xTrackDlg:
+ 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')
# vim: set shiftwidth=4 softtabstop=4 expandtab: