diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-22 11:17:29 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-22 21:47:11 +0200 |
commit | 374baf308979306aa35575118c40ccd7caae1e29 (patch) | |
tree | 2570881a42fe5b5555db1dbf2aecc0a3fdd33878 /sw/qa/uitest/writer_tests7 | |
parent | b2331179fc508fd6bc37355e5c3c5a5ee54557c4 (diff) |
uitest: guard create_doc_in_start_center
Mostly done by a script
for motivation, see 89aaa17a0a4413f07da2bc5084b0164f15dc01ac
< UITest: introduce guarded context managers >
Change-Id: I75ef7712af3676363a9a464acf83f6f68ffc4f85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117617
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/tdf109083.py | 95 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf115853.py | 34 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf119661.py | 102 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf133348.py | 94 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf140731.py | 81 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf140863.py | 76 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests7/tdf90401.py | 2 |
7 files changed, 237 insertions, 247 deletions
diff --git a/sw/qa/uitest/writer_tests7/tdf109083.py b/sw/qa/uitest/writer_tests7/tdf109083.py index bf61a0e4ee3f..cfc3b5660888 100644 --- a/sw/qa/uitest/writer_tests7/tdf109083.py +++ b/sw/qa/uitest/writer_tests7/tdf109083.py @@ -12,56 +12,55 @@ from uitest.uihelper.common import select_pos #Bug 109083 - Updating table style: changes didn't propagate to other tables when selection was over two columns at the moment of updating class tdf109083(UITestCase): def test_tdf109083(self): - self.ui_test.create_doc_in_start_center("writer") - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - #generate two 2x2 tables with the same autoformat table style (Default Table Style) - #Note that this style is different than applying nothing! - for i in range(0, 2): - self.ui_test.execute_dialog_through_command(".uno:InsertTable") - xDialog = self.xUITest.getTopFocusWindow() - formatlbinstable = xDialog.getChild("formatlbinstable") - entry = formatlbinstable.getChild("1") - entry.executeAction("SELECT", tuple()) - xOkBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #generate two 2x2 tables with the same autoformat table style (Default Table Style) + #Note that this style is different than applying nothing! + for i in range(0, 2): + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + formatlbinstable = xDialog.getChild("formatlbinstable") + entry = formatlbinstable.getChild("1") + entry.executeAction("SELECT", tuple()) + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) - #select the last row of the first table - for i in range (0,2): - self.xUITest.executeCommand(".uno:GoDown") - for i in range (0,2): - self.xUITest.executeCommand(".uno:CharRightSel") - #set a specific color on the selected cells (last row) - self.xUITest.executeCommandWithParameters(".uno:TableCellBackgroundColor", mkPropertyValues({"TableCellBackgroundColor" : 16776960 })) + #select the last row of the first table + for i in range (0,2): + self.xUITest.executeCommand(".uno:GoDown") + for i in range (0,2): + self.xUITest.executeCommand(".uno:CharRightSel") + #set a specific color on the selected cells (last row) + self.xUITest.executeCommandWithParameters(".uno:TableCellBackgroundColor", mkPropertyValues({"TableCellBackgroundColor" : 16776960 })) - #Sidebar -> Table Styles -> Style Actions -> "Update Selected Style" (note: the row is still selected) - self.xUITest.executeCommand(".uno:Sidebar") - xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "StyleListPanel"})) - xLeft = xWriterEdit.getChild('left') - xLeft.executeAction("CLICK", mkPropertyValues({"POS": "5"})) - xRight = xWriterEdit.getChild('right') - xRight.executeAction("CLICK", mkPropertyValues({"POS": "3"})) - #select the second table - for i in range (0,2): - self.xUITest.executeCommand(".uno:GoDown") + #Sidebar -> Table Styles -> Style Actions -> "Update Selected Style" (note: the row is still selected) + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "StyleListPanel"})) + xLeft = xWriterEdit.getChild('left') + xLeft.executeAction("CLICK", mkPropertyValues({"POS": "5"})) + xRight = xWriterEdit.getChild('right') + xRight.executeAction("CLICK", mkPropertyValues({"POS": "3"})) + #select the second table + for i in range (0,2): + self.xUITest.executeCommand(".uno:GoDown") - #first row's cells must be yellow, second/last row's cells must be updated to yellow by now - for i in range (0,4): - self.ui_test.execute_dialog_through_command(".uno:TableDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") #tab Background - btncolor = xDialog.getChild("btncolor") - btncolor.executeAction("CLICK", tuple()) - hex_custom = xDialog.getChild("hex_custom") - if i >= 2: - self.assertEqual(get_state_as_dict(hex_custom)["Text"], "ffff00") - else: - self.assertEqual(get_state_as_dict(hex_custom)["Text"], "ffffff") - xOkBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) - self.xUITest.executeCommand(".uno:GoRight") - self.ui_test.close_doc() + #first row's cells must be yellow, second/last row's cells must be updated to yellow by now + for i in range (0,4): + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") #tab Background + btncolor = xDialog.getChild("btncolor") + btncolor.executeAction("CLICK", tuple()) + hex_custom = xDialog.getChild("hex_custom") + if i >= 2: + self.assertEqual(get_state_as_dict(hex_custom)["Text"], "ffff00") + else: + self.assertEqual(get_state_as_dict(hex_custom)["Text"], "ffffff") + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + self.xUITest.executeCommand(".uno:GoRight") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf115853.py b/sw/qa/uitest/writer_tests7/tdf115853.py index 42cddb2b388b..c9a5a2d53c8a 100644 --- a/sw/qa/uitest/writer_tests7/tdf115853.py +++ b/sw/qa/uitest/writer_tests7/tdf115853.py @@ -15,30 +15,28 @@ from uitest.uihelper.common import select_pos class tdf115853(UITestCase): def test_tdf115853(self): - self.ui_test.create_doc_in_start_center("writer") - self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") + xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") + xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "2") + select_pos(xTabs, "2") - xAddBtn = xDialog.getChild("add") - xAddBtn.executeAction("CLICK", tuple()) + xAddBtn = xDialog.getChild("add") + xAddBtn.executeAction("CLICK", tuple()) - xNameBox1 = xDialog.getChild("namebox1") - xNameBox1.executeAction("TYPE", mkPropertyValues({"TEXT":"Text"})) + xNameBox1 = xDialog.getChild("namebox1") + xNameBox1.executeAction("TYPE", mkPropertyValues({"TEXT":"Text"})) - xAddBtn = xDialog.getChild("add") - xAddBtn.executeAction("CLICK", tuple()) + xAddBtn = xDialog.getChild("add") + xAddBtn.executeAction("CLICK", tuple()) - # Without the fix in place, this test would have failed with - # AssertionError: 'Text' != '' - self.assertEqual("Text", get_state_as_dict(xNameBox1)['Text']) + # Without the fix in place, this test would have failed with + # AssertionError: 'Text' != '' + self.assertEqual("Text", get_state_as_dict(xNameBox1)['Text']) - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - - self.ui_test.close_doc() + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) # 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 9ad178f8a722..f0b1049e7825 100644 --- a/sw/qa/uitest/writer_tests7/tdf119661.py +++ b/sw/qa/uitest/writer_tests7/tdf119661.py @@ -15,78 +15,78 @@ class tdf119661(UITestCase): def test_tdf119661(self): - self.ui_test.create_doc_in_start_center("writer") + with self.ui_test.create_doc_in_start_center("writer"): - self.ui_test.execute_dialog_through_command(".uno:InsertGraphic") + self.ui_test.execute_dialog_through_command(".uno:InsertGraphic") - xOpenDialog = self.xUITest.getTopFocusWindow() + xOpenDialog = self.xUITest.getTopFocusWindow() - xFileName = xOpenDialog.getChild("file_name") - xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("LibreOffice.jpg")})) + 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.executeAction("CLICK", tuple()) + xOpenBtn = xOpenDialog.getChild("open") + xOpenBtn.executeAction("CLICK", tuple()) - #Confirmation dialog is displayed - xWarnDialog = self.xUITest.getTopFocusWindow() - xOK = xWarnDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + #Confirmation dialog is displayed + xWarnDialog = self.xUITest.getTopFocusWindow() + xOK = xWarnDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - self.ui_test.execute_dialog_through_command(".uno:LinkDialog") + self.ui_test.execute_dialog_through_command(".uno:LinkDialog") - xDialog = self.xUITest.getTopFocusWindow() + xDialog = self.xUITest.getTopFocusWindow() - 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 - xClose = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xClose) + xClose = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xClose) - with TemporaryDirectory() as tempdir: - xFilePath = os.path.join(tempdir, "tdf119661-tmp.odt") + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "tdf119661-tmp.odt") - # 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() - with 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()) + # 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/tdf133348.py b/sw/qa/uitest/writer_tests7/tdf133348.py index e9f91d8f17b6..a05541f8f96b 100644 --- a/sw/qa/uitest/writer_tests7/tdf133348.py +++ b/sw/qa/uitest/writer_tests7/tdf133348.py @@ -10,54 +10,52 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf133348(UITestCase): def test_tdf133348(self): - self.ui_test.create_doc_in_start_center("writer") - - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - - document = self.ui_test.get_component() - - selection = self.xUITest.executeCommand(".uno:SelectAll") - xArgs = mkPropertyValues({"Text": "C1"}) - self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) - - self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") - xDialogOpt = self.xUITest.getTopFocusWindow() - xPages = xDialogOpt.getChild("pages") - xEntry = xPages.getChild('0') - xEntry.executeAction("EXPAND", tuple()) - xGeneralEntry = xEntry.getChild('0') - xGeneralEntry.executeAction("SELECT", tuple()) - xFirstName = xDialogOpt.getChild("firstname") - props = {"TEXT": "Known Author"} - actionProps = mkPropertyValues(props) - xFirstName.executeAction("TYPE", actionProps) - xOKBtn = xDialogOpt.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - xWriterDoc = self.xUITest.getTopFocusWindow() - xArgs = mkPropertyValues({"Text": "C2"}) - self.xUITest.executeCommandWithParameters(".uno:ReplyComment", xArgs) - - # Wait for async events to be processed - xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') - xToolkit.processEventsToIdle() - - xEnum = document.TextFields.createEnumeration() - self.assertEqual(xEnum.nextElement().Author.strip(), 'Unknown Author') - self.assertEqual(xEnum.nextElement().Author.strip(), 'Known Author') - - self.xUITest.executeCommand(".uno:Undo") - self.xUITest.executeCommand(".uno:Undo") - - # Without the fix in place, it would have crashed here - self.xUITest.executeCommand(".uno:Undo") - self.xUITest.executeCommand(".uno:Undo") - - # all comments have been deleted - self.assertFalse(document.TextFields.createEnumeration().hasMoreElements()) - - self.ui_test.close_doc() + with self.ui_test.create_doc_in_start_center("writer"): + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + document = self.ui_test.get_component() + + selection = self.xUITest.executeCommand(".uno:SelectAll") + xArgs = mkPropertyValues({"Text": "C1"}) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") + xDialogOpt = self.xUITest.getTopFocusWindow() + xPages = xDialogOpt.getChild("pages") + xEntry = xPages.getChild('0') + xEntry.executeAction("EXPAND", tuple()) + xGeneralEntry = xEntry.getChild('0') + xGeneralEntry.executeAction("SELECT", tuple()) + xFirstName = xDialogOpt.getChild("firstname") + props = {"TEXT": "Known Author"} + actionProps = mkPropertyValues(props) + xFirstName.executeAction("TYPE", actionProps) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + xWriterDoc = self.xUITest.getTopFocusWindow() + xArgs = mkPropertyValues({"Text": "C2"}) + self.xUITest.executeCommandWithParameters(".uno:ReplyComment", xArgs) + + # Wait for async events to be processed + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + xEnum = document.TextFields.createEnumeration() + self.assertEqual(xEnum.nextElement().Author.strip(), 'Unknown Author') + self.assertEqual(xEnum.nextElement().Author.strip(), 'Known Author') + + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + + # Without the fix in place, it would have crashed here + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + + # all comments have been deleted + self.assertFalse(document.TextFields.createEnumeration().hasMoreElements()) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf140731.py b/sw/qa/uitest/writer_tests7/tdf140731.py index 79972c8ad7f8..2b6864459c10 100644 --- a/sw/qa/uitest/writer_tests7/tdf140731.py +++ b/sw/qa/uitest/writer_tests7/tdf140731.py @@ -11,47 +11,46 @@ from uitest.uihelper.common import type_text class tdf140731(UITestCase): def test_tdf140731(self): - self.ui_test.create_doc_in_start_center("writer") - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - type_text(xWriterEdit, 'Lorem') - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F3"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) - - #generating a big text with ~60k words and several paragraphs - for i in range(0,8): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + type_text(xWriterEdit, 'Lorem') + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F3"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + #generating a big text with ~60k words and several paragraphs + for i in range(0,8): + self.xUITest.executeCommand(".uno:SelectAll") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+c"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+v"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+v"})) + xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "1"})) + + #Format->Text operations on small selections (which would generate <~500 redlines), changetracking still working + self.xUITest.executeCommand(".uno:TrackChanges") + xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "1", "END_POS": "1000"})) + self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase") + document = self.ui_test.get_component() + self.assertTrue(document.Redlines.createEnumeration().hasMoreElements()) + + #Removing all the redlines. + self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges") + xTrackDlg = self.xUITest.getTopFocusWindow() + xAccBtn = xTrackDlg.getChild("rejectall") + xAccBtn.executeAction("CLICK", tuple()) + xCancBtn = xTrackDlg.getChild("close") + xCancBtn.executeAction("CLICK", tuple()) + + #Without the fix in place, on big selections writer would freeze. Now it ignores change tracking. self.xUITest.executeCommand(".uno:SelectAll") - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+c"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+v"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+v"})) - xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "1"})) - - #Format->Text operations on small selections (which would generate <~500 redlines), changetracking still working - self.xUITest.executeCommand(".uno:TrackChanges") - xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "1", "END_POS": "1000"})) - self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase") - document = self.ui_test.get_component() - self.assertTrue(document.Redlines.createEnumeration().hasMoreElements()) - - #Removing all the redlines. - self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges") - xTrackDlg = self.xUITest.getTopFocusWindow() - xAccBtn = xTrackDlg.getChild("rejectall") - xAccBtn.executeAction("CLICK", tuple()) - xCancBtn = xTrackDlg.getChild("close") - xCancBtn.executeAction("CLICK", tuple()) - - #Without the fix in place, on big selections writer would freeze. Now it ignores change tracking. - self.xUITest.executeCommand(".uno:SelectAll") - self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase") - self.assertFalse(document.Redlines.createEnumeration().hasMoreElements()) - - #The patch has no effects on the Format->Text operations - self.assertEqual(document.Text.String[0:26], "Lorem Ipsum Dolor Sit Amet") - self.xUITest.executeCommand(".uno:SelectAll") - self.xUITest.executeCommand(".uno:ChangeCaseToUpper") - self.assertEqual(document.Text.String[0:26], "LOREM IPSUM DOLOR SIT AMET") - - self.ui_test.close_doc() + self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase") + self.assertFalse(document.Redlines.createEnumeration().hasMoreElements()) + + #The patch has no effects on the Format->Text operations + self.assertEqual(document.Text.String[0:26], "Lorem Ipsum Dolor Sit Amet") + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:ChangeCaseToUpper") + self.assertEqual(document.Text.String[0:26], "LOREM IPSUM DOLOR SIT AMET") + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf140863.py b/sw/qa/uitest/writer_tests7/tdf140863.py index f0355e4684ed..b78fc15f61a7 100644 --- a/sw/qa/uitest/writer_tests7/tdf140863.py +++ b/sw/qa/uitest/writer_tests7/tdf140863.py @@ -12,64 +12,62 @@ class tdf140863(UITestCase): def test_tdf140863(self): - self.ui_test.create_doc_in_start_center("writer") + with self.ui_test.create_doc_in_start_center("writer"): - # Insert one section - self.ui_test.execute_dialog_through_command(".uno:InsertSection") + # Insert one section + self.ui_test.execute_dialog_through_command(".uno:InsertSection") - xDialog = self.xUITest.getTopFocusWindow() + xDialog = self.xUITest.getTopFocusWindow() - xOkBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - # Insert a page break in the section - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.xUITest.executeCommand(".uno:InsertPagebreak") - self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + # Insert a page break in the section + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + self.xUITest.executeCommand(".uno:InsertPagebreak") + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") - document = self.ui_test.get_component() - self.assertEqual(1, len(document.TextSections)) - self.assertTrue(document.TextSections.Section1.IsVisible) + document = self.ui_test.get_component() + self.assertEqual(1, len(document.TextSections)) + self.assertTrue(document.TextSections.Section1.IsVisible) - self.ui_test.execute_dialog_through_command(".uno:EditRegion") + self.ui_test.execute_dialog_through_command(".uno:EditRegion") - xDialog = self.xUITest.getTopFocusWindow() + xDialog = self.xUITest.getTopFocusWindow() - xHide = xDialog.getChild('hide') - self.assertEqual('false', get_state_as_dict(xHide)['Selected']) + xHide = xDialog.getChild('hide') + self.assertEqual('false', get_state_as_dict(xHide)['Selected']) - xHide.executeAction('CLICK', tuple()) + xHide.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) - self.assertEqual(1, len(document.TextSections)) - self.assertFalse(document.TextSections.Section1.IsVisible) - self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") + self.assertEqual(1, len(document.TextSections)) + self.assertFalse(document.TextSections.Section1.IsVisible) + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") - self.ui_test.execute_dialog_through_command(".uno:EditRegion") + self.ui_test.execute_dialog_through_command(".uno:EditRegion") - xDialog = self.xUITest.getTopFocusWindow() + xDialog = self.xUITest.getTopFocusWindow() - xHide = xDialog.getChild('hide') - self.assertEqual('true', get_state_as_dict(xHide)['Selected']) + xHide = xDialog.getChild('hide') + self.assertEqual('true', get_state_as_dict(xHide)['Selected']) - xHide.executeAction('CLICK', tuple()) + xHide.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) - self.assertEqual(1, len(document.TextSections)) - self.assertTrue(document.TextSections.Section1.IsVisible) + self.assertEqual(1, len(document.TextSections)) + self.assertTrue(document.TextSections.Section1.IsVisible) - # Without the fix in place, this test would have failed with - # AssertionError: '1' != '2' - self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") - - self.ui_test.close_doc() + # Without the fix in place, this test would have failed with + # AssertionError: '1' != '2' + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") # 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 cb70c401b142..32c523c85a61 100644 --- a/sw/qa/uitest/writer_tests7/tdf90401.py +++ b/sw/qa/uitest/writer_tests7/tdf90401.py @@ -98,6 +98,4 @@ class tdf90401(UITestCase): # 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: |