diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-24 01:53:06 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-06-24 02:40:43 +0200 |
commit | 9a89eea4c3c58d2efce8afe709c0317869839ff9 (patch) | |
tree | f235036802674593f9cf6253f2f6363664494233 /sw/qa/uitest/writer_tests | |
parent | 6805efdecb240fad8c82a5c1756a2a0e92f12b7d (diff) |
Revert "uitest: guard create_doc_in_start_center"
This reverts commit 374baf308979306aa35575118c40ccd7caae1e29.
Many uitests are failing randomly in jenkins for no apparent
reason
Change-Id: I5960330fab4967518bfeea32b3b8c5f8bfbea57e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117752
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/uitest/writer_tests')
-rw-r--r-- | sw/qa/uitest/writer_tests/comments.py | 240 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests/insertCaption.py | 84 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests/tdf134734.py | 134 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py | 24 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests/tdf53460.py | 111 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests/tdf78068.py | 29 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests/tdf93068.py | 65 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests/trackedChanges.py | 196 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests/watermark.py | 95 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests/wordCount.py | 307 |
10 files changed, 657 insertions, 628 deletions
diff --git a/sw/qa/uitest/writer_tests/comments.py b/sw/qa/uitest/writer_tests/comments.py index 273bbfcc1b51..66ecb06bb246 100644 --- a/sw/qa/uitest/writer_tests/comments.py +++ b/sw/qa/uitest/writer_tests/comments.py @@ -16,138 +16,142 @@ class Comments(UITestCase): def test_comments_features(self): - with self.ui_test.create_doc_in_start_center("writer"): + xMainDoc = self.ui_test.create_doc_in_start_center("writer") - xMainWindow = self.xUITest.getTopFocusWindow() + xMainWindow = self.xUITest.getTopFocusWindow() - xwriter_edit = xMainWindow.getChild("writer_edit") - xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Before "})) + xwriter_edit = xMainWindow.getChild("writer_edit") + xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Before "})) - # adding new Comment - self.xUITest.executeCommand(".uno:InsertAnnotation") + # adding new Comment + self.xUITest.executeCommand(".uno:InsertAnnotation") - # wait until the comment is available - xComment1 = self.ui_test.wait_until_child_is_available('Comment1') + # wait until the comment is available + xComment1 = self.ui_test.wait_until_child_is_available('Comment1') - xEditView1 = xComment1.getChild("editview") - xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": "This is the First Comment"})) - self.assertEqual(get_state_as_dict(xComment1)["Text"], "This is the First Comment" ) - self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "false" ) - self.assertEqual(get_state_as_dict(xComment1)["Author"], "Unknown Author" ) - self.assertEqual(get_state_as_dict(xComment1)["ReadOnly"], "false" ) + xEditView1 = xComment1.getChild("editview") + xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": "This is the First Comment"})) + self.assertEqual(get_state_as_dict(xComment1)["Text"], "This is the First Comment" ) + self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "false" ) + self.assertEqual(get_state_as_dict(xComment1)["Author"], "Unknown Author" ) + self.assertEqual(get_state_as_dict(xComment1)["ReadOnly"], "false" ) - xComment1.executeAction("LEAVE", mkPropertyValues({})) + xComment1.executeAction("LEAVE", mkPropertyValues({})) - xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "After"})) - xwriter_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "0", "START_POS": "13"})) - self.assertEqual(get_state_as_dict(xwriter_edit)["SelectedText"], "Before After" ) + xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "After"})) + xwriter_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "0", "START_POS": "13"})) + self.assertEqual(get_state_as_dict(xwriter_edit)["SelectedText"], "Before After" ) - # test Resolve Comment - xComment1.executeAction("RESOLVE", mkPropertyValues({})) - self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "true" ) + # test Resolve Comment + xComment1.executeAction("RESOLVE", mkPropertyValues({})) + self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "true" ) - # test Select text from Comment - xComment1.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "4"})) - self.assertEqual(get_state_as_dict(xComment1)["SelectedText"], "This" ) + # test Select text from Comment + xComment1.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "4"})) + self.assertEqual(get_state_as_dict(xComment1)["SelectedText"], "This" ) - # test Hide then Show Comment - xComment1.executeAction("HIDE", mkPropertyValues({})) - self.assertEqual(get_state_as_dict(xComment1)["Visible"], "false" ) - xComment1.executeAction("SHOW", mkPropertyValues({})) - self.assertEqual(get_state_as_dict(xComment1)["Visible"], "true" ) + # test Hide then Show Comment + xComment1.executeAction("HIDE", mkPropertyValues({})) + self.assertEqual(get_state_as_dict(xComment1)["Visible"], "false" ) + xComment1.executeAction("SHOW", mkPropertyValues({})) + self.assertEqual(get_state_as_dict(xComment1)["Visible"], "true" ) - # test delete Comment - xComment1.executeAction("DELETE", mkPropertyValues({})) - self.assertTrue("Comment1" not in xMainWindow.getChildren()) + # test delete Comment + xComment1.executeAction("DELETE", mkPropertyValues({})) + self.assertTrue("Comment1" not in xMainWindow.getChildren()) + + self.ui_test.close_doc() def test_multi_comments(self): - with self.ui_test.create_doc_in_start_center("writer"): - - xMainWindow = self.xUITest.getTopFocusWindow() - - xwriter_edit = xMainWindow.getChild("writer_edit") - - # adding 3 new Comment - xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Line 1"})) - self.xUITest.executeCommand(".uno:InsertAnnotation") - # wait until the comment is available - xComment1 = self.ui_test.wait_until_child_is_available('Comment1') - xEditView1 = xComment1.getChild("editview") - xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": "First Comment"})) - xComment1.executeAction("LEAVE", mkPropertyValues({})) - xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - - xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Line 2"})) - self.xUITest.executeCommand(".uno:InsertAnnotation") - # wait until the comment is available - xComment2 = self.ui_test.wait_until_child_is_available('Comment2') - xEditView2 = xComment2.getChild("editview") - xEditView2.executeAction("TYPE", mkPropertyValues({"TEXT": "Second Comment"})) - xComment2.executeAction("LEAVE", mkPropertyValues({})) - xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - - xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Line 3"})) - self.xUITest.executeCommand(".uno:InsertAnnotation") - # wait until the comment is available - xComment3 = self.ui_test.wait_until_child_is_available('Comment3') - xEditView3 = xComment3.getChild("editview") - xEditView3.executeAction("TYPE", mkPropertyValues({"TEXT": "Third Comment"})) - xComment3.executeAction("LEAVE", mkPropertyValues({})) - xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - - # Check text - self.assertEqual(get_state_as_dict(xComment1)["Text"], "First Comment" ) - self.assertEqual(get_state_as_dict(xComment2)["Text"], "Second Comment" ) - self.assertEqual(get_state_as_dict(xComment3)["Text"], "Third Comment" ) - - xComment2.executeAction("RESOLVE", mkPropertyValues({})) - xComment3.executeAction("RESOLVE", mkPropertyValues({})) - - # Check Resolved - self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "false" ) - self.assertEqual(get_state_as_dict(xComment2)["Resolved"], "true" ) - self.assertEqual(get_state_as_dict(xComment3)["Resolved"], "true" ) - - # Check ReadOnly - self.assertEqual(get_state_as_dict(xComment1)["ReadOnly"], "false" ) - self.assertEqual(get_state_as_dict(xComment2)["ReadOnly"], "false" ) - self.assertEqual(get_state_as_dict(xComment3)["ReadOnly"], "false" ) - - # Check Select - xComment1.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "5"})) - self.assertEqual(get_state_as_dict(xComment1)["SelectedText"], "First" ) - - xComment2.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "6"})) - self.assertEqual(get_state_as_dict(xComment2)["SelectedText"], "Second" ) - - xComment3.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "5"})) - self.assertEqual(get_state_as_dict(xComment3)["SelectedText"], "Third" ) - - # Check that they all are Visible - self.assertEqual(get_state_as_dict(xComment1)["Visible"], "true" ) - self.assertEqual(get_state_as_dict(xComment2)["Visible"], "true" ) - self.assertEqual(get_state_as_dict(xComment3)["Visible"], "true" ) - - # Hide all - xComment1.executeAction("HIDE", mkPropertyValues({})) - self.assertEqual(get_state_as_dict(xComment1)["Visible"], "false" ) - xComment2.executeAction("HIDE", mkPropertyValues({})) - self.assertEqual(get_state_as_dict(xComment2)["Visible"], "false" ) - xComment3.executeAction("HIDE", mkPropertyValues({})) - self.assertEqual(get_state_as_dict(xComment3)["Visible"], "false" ) - - # Show comment 2 only - xComment2.executeAction("SHOW", mkPropertyValues({})) - self.assertEqual(get_state_as_dict(xComment2)["Visible"], "true" ) - - # Then remove the 3 comments - xComment1.executeAction("DELETE", mkPropertyValues({})) - xComment2.executeAction("DELETE", mkPropertyValues({})) - xComment3.executeAction("DELETE", mkPropertyValues({})) - self.assertTrue("Comment1" not in xMainWindow.getChildren()) - self.assertTrue("Comment2" not in xMainWindow.getChildren()) - self.assertTrue("Comment3" not in xMainWindow.getChildren()) + xMainDoc = self.ui_test.create_doc_in_start_center("writer") + + xMainWindow = self.xUITest.getTopFocusWindow() + + xwriter_edit = xMainWindow.getChild("writer_edit") + + # adding 3 new Comment + xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Line 1"})) + self.xUITest.executeCommand(".uno:InsertAnnotation") + # wait until the comment is available + xComment1 = self.ui_test.wait_until_child_is_available('Comment1') + xEditView1 = xComment1.getChild("editview") + xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": "First Comment"})) + xComment1.executeAction("LEAVE", mkPropertyValues({})) + xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Line 2"})) + self.xUITest.executeCommand(".uno:InsertAnnotation") + # wait until the comment is available + xComment2 = self.ui_test.wait_until_child_is_available('Comment2') + xEditView2 = xComment2.getChild("editview") + xEditView2.executeAction("TYPE", mkPropertyValues({"TEXT": "Second Comment"})) + xComment2.executeAction("LEAVE", mkPropertyValues({})) + xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Line 3"})) + self.xUITest.executeCommand(".uno:InsertAnnotation") + # wait until the comment is available + xComment3 = self.ui_test.wait_until_child_is_available('Comment3') + xEditView3 = xComment3.getChild("editview") + xEditView3.executeAction("TYPE", mkPropertyValues({"TEXT": "Third Comment"})) + xComment3.executeAction("LEAVE", mkPropertyValues({})) + xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + # Check text + self.assertEqual(get_state_as_dict(xComment1)["Text"], "First Comment" ) + self.assertEqual(get_state_as_dict(xComment2)["Text"], "Second Comment" ) + self.assertEqual(get_state_as_dict(xComment3)["Text"], "Third Comment" ) + + xComment2.executeAction("RESOLVE", mkPropertyValues({})) + xComment3.executeAction("RESOLVE", mkPropertyValues({})) + + # Check Resolved + self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "false" ) + self.assertEqual(get_state_as_dict(xComment2)["Resolved"], "true" ) + self.assertEqual(get_state_as_dict(xComment3)["Resolved"], "true" ) + + # Check ReadOnly + self.assertEqual(get_state_as_dict(xComment1)["ReadOnly"], "false" ) + self.assertEqual(get_state_as_dict(xComment2)["ReadOnly"], "false" ) + self.assertEqual(get_state_as_dict(xComment3)["ReadOnly"], "false" ) + + # Check Select + xComment1.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "5"})) + self.assertEqual(get_state_as_dict(xComment1)["SelectedText"], "First" ) + + xComment2.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "6"})) + self.assertEqual(get_state_as_dict(xComment2)["SelectedText"], "Second" ) + + xComment3.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "5"})) + self.assertEqual(get_state_as_dict(xComment3)["SelectedText"], "Third" ) + + # Check that they all are Visible + self.assertEqual(get_state_as_dict(xComment1)["Visible"], "true" ) + self.assertEqual(get_state_as_dict(xComment2)["Visible"], "true" ) + self.assertEqual(get_state_as_dict(xComment3)["Visible"], "true" ) + + # Hide all + xComment1.executeAction("HIDE", mkPropertyValues({})) + self.assertEqual(get_state_as_dict(xComment1)["Visible"], "false" ) + xComment2.executeAction("HIDE", mkPropertyValues({})) + self.assertEqual(get_state_as_dict(xComment2)["Visible"], "false" ) + xComment3.executeAction("HIDE", mkPropertyValues({})) + self.assertEqual(get_state_as_dict(xComment3)["Visible"], "false" ) + + # Show comment 2 only + xComment2.executeAction("SHOW", mkPropertyValues({})) + self.assertEqual(get_state_as_dict(xComment2)["Visible"], "true" ) + + # Then remove the 3 comments + xComment1.executeAction("DELETE", mkPropertyValues({})) + xComment2.executeAction("DELETE", mkPropertyValues({})) + xComment3.executeAction("DELETE", mkPropertyValues({})) + self.assertTrue("Comment1" not in xMainWindow.getChildren()) + self.assertTrue("Comment2" not in xMainWindow.getChildren()) + self.assertTrue("Comment3" not in xMainWindow.getChildren()) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/insertCaption.py b/sw/qa/uitest/writer_tests/insertCaption.py index fa6223494bfb..57f6273875db 100644 --- a/sw/qa/uitest/writer_tests/insertCaption.py +++ b/sw/qa/uitest/writer_tests/insertCaption.py @@ -11,61 +11,63 @@ from uitest.uihelper.common import select_pos class insertCaption(UITestCase): def test_insert_caption(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - self.ui_test.execute_dialog_through_command(".uno:InsertFrame") # insert frame - xDialogFr = self.xUITest.getTopFocusWindow() + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + self.ui_test.execute_dialog_through_command(".uno:InsertFrame") # insert frame + xDialogFr = self.xUITest.getTopFocusWindow() - xWidth = xDialogFr.getChild("width") - xWidth.executeAction("UP", tuple()) - xWidth.executeAction("UP", tuple()) + xWidth = xDialogFr.getChild("width") + xWidth.executeAction("UP", tuple()) + xWidth.executeAction("UP", tuple()) - xHeight = xDialogFr.getChild("height") - xHeight.executeAction("UP", tuple()) - xHeight.executeAction("UP", tuple()) + xHeight = xDialogFr.getChild("height") + xHeight.executeAction("UP", tuple()) + xHeight.executeAction("UP", tuple()) - xOkBtn=xDialogFr.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + xOkBtn=xDialogFr.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - self.assertEqual(document.TextFrames.getCount(), 1) + self.assertEqual(document.TextFrames.getCount(), 1) - self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") # caption - xDialogCaption = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") # caption + xDialogCaption = self.xUITest.getTopFocusWindow() - xCapt = xDialogCaption.getChild("caption_edit") - xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption"})) + xCapt = xDialogCaption.getChild("caption_edit") + xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption"})) - xOkBtn=xDialogCaption.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + xOkBtn=xDialogCaption.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - xFrame = document.TextFrames[0] + xFrame = document.TextFrames[0] - self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption") + self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption") - self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") # 2nd caption - xDialogCaption = self.xUITest.getTopFocusWindow() - xCapt = xDialogCaption.getChild("caption_edit") - xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption2"})) - xSep = xDialogCaption.getChild("separator_edit") - xSep.executeAction("TYPE", mkPropertyValues({"TEXT":"-"})) + self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") # 2nd caption + xDialogCaption = self.xUITest.getTopFocusWindow() + xCapt = xDialogCaption.getChild("caption_edit") + xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption2"})) + xSep = xDialogCaption.getChild("separator_edit") + xSep.executeAction("TYPE", mkPropertyValues({"TEXT":"-"})) - xOkBtn=xDialogCaption.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + xOkBtn=xDialogCaption.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2") + self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2") - self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") # 3. caption - xDialogCaption = self.xUITest.getTopFocusWindow() - xCapt = xDialogCaption.getChild("caption_edit") - xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption3"})) - xSep = xDialogCaption.getChild("separator_edit") - xSep.executeAction("TYPE", mkPropertyValues({"TEXT":"-"})) - xPos = xDialogCaption.getChild("position") - select_pos(xPos, "1") + self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") # 3. caption + xDialogCaption = self.xUITest.getTopFocusWindow() + xCapt = xDialogCaption.getChild("caption_edit") + xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption3"})) + xSep = xDialogCaption.getChild("separator_edit") + xSep.executeAction("TYPE", mkPropertyValues({"TEXT":"-"})) + xPos = xDialogCaption.getChild("position") + select_pos(xPos, "1") - xOkBtn=xDialogCaption.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + xOkBtn=xDialogCaption.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2\nText 3--: Caption3") + self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2\nText 3--: Caption3") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/tdf134734.py b/sw/qa/uitest/writer_tests/tdf134734.py index fcef99a43bcb..5685f00a55a9 100644 --- a/sw/qa/uitest/writer_tests/tdf134734.py +++ b/sw/qa/uitest/writer_tests/tdf134734.py @@ -13,78 +13,80 @@ import importlib class TestClass(UITestCase): def test_master_page_background(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() - # set margins and fill color - self.ui_test.execute_dialog_through_command(".uno:PageDialog") - DrawPageDialog = self.xUITest.getTopFocusWindow() - xTabs = DrawPageDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize") - self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "true") - spinMargLeft = DrawPageDialog.getChild("spinMargLeft") - for _ in range(20): - spinMargLeft.executeAction("UP",tuple()) - spinMargRight = DrawPageDialog.getChild("spinMargRight") - for _ in range(15): - spinMargRight.executeAction("UP",tuple()) - spinMargTop = DrawPageDialog.getChild("spinMargTop") - for _ in range(10): - spinMargTop.executeAction("UP",tuple()) - spinMargBot = DrawPageDialog.getChild("spinMargBot") - for _ in range(5): - spinMargBot.executeAction("UP",tuple()) - xTabs = DrawPageDialog.getChild("tabcontrol") - select_pos(xTabs, "2") - btncolor = DrawPageDialog.getChild("btncolor") - btncolor.executeAction("CLICK",tuple()) - ok = DrawPageDialog.getChild("ok") - self.ui_test.close_dialog_through_button(ok) + # set margins and fill color + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + DrawPageDialog = self.xUITest.getTopFocusWindow() + xTabs = DrawPageDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize") + self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "true") + spinMargLeft = DrawPageDialog.getChild("spinMargLeft") + for _ in range(20): + spinMargLeft.executeAction("UP",tuple()) + spinMargRight = DrawPageDialog.getChild("spinMargRight") + for _ in range(15): + spinMargRight.executeAction("UP",tuple()) + spinMargTop = DrawPageDialog.getChild("spinMargTop") + for _ in range(10): + spinMargTop.executeAction("UP",tuple()) + spinMargBot = DrawPageDialog.getChild("spinMargBot") + for _ in range(5): + spinMargBot.executeAction("UP",tuple()) + xTabs = DrawPageDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + btncolor = DrawPageDialog.getChild("btncolor") + btncolor.executeAction("CLICK",tuple()) + ok = DrawPageDialog.getChild("ok") + self.ui_test.close_dialog_through_button(ok) - xStyle = document.StyleFamilies["PageStyles"]["Standard"] + xStyle = document.StyleFamilies["PageStyles"]["Standard"] - self.assertEqual(xStyle.FillStyle, SOLID) - self.assertEqual(xStyle.LeftMargin, 2997) - self.assertEqual(xStyle.RightMargin, 2743) - self.assertEqual(xStyle.TopMargin, 2489) - self.assertEqual(xStyle.BottomMargin, 2235) - self.assertEqual(xStyle.BackgroundFullSize, True) + self.assertEqual(xStyle.FillStyle, SOLID) + self.assertEqual(xStyle.LeftMargin, 2997) + self.assertEqual(xStyle.RightMargin, 2743) + self.assertEqual(xStyle.TopMargin, 2489) + self.assertEqual(xStyle.BottomMargin, 2235) + self.assertEqual(xStyle.BackgroundFullSize, True) - # uncheck it - self.ui_test.execute_dialog_through_command(".uno:PageDialog") - DrawPageDialog = self.xUITest.getTopFocusWindow() - xTabs = DrawPageDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize") - self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "true") - checkBackgroundFullSize.executeAction("CLICK",tuple()) - ok = DrawPageDialog.getChild("ok") - self.ui_test.close_dialog_through_button(ok) + # uncheck it + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + DrawPageDialog = self.xUITest.getTopFocusWindow() + xTabs = DrawPageDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize") + self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "true") + checkBackgroundFullSize.executeAction("CLICK",tuple()) + ok = DrawPageDialog.getChild("ok") + self.ui_test.close_dialog_through_button(ok) - self.assertEqual(xStyle.FillStyle, SOLID) - self.assertEqual(xStyle.LeftMargin, 2997) - self.assertEqual(xStyle.RightMargin, 2743) - self.assertEqual(xStyle.TopMargin, 2489) - self.assertEqual(xStyle.BottomMargin, 2235) - self.assertEqual(xStyle.BackgroundFullSize, False) + self.assertEqual(xStyle.FillStyle, SOLID) + self.assertEqual(xStyle.LeftMargin, 2997) + self.assertEqual(xStyle.RightMargin, 2743) + self.assertEqual(xStyle.TopMargin, 2489) + self.assertEqual(xStyle.BottomMargin, 2235) + self.assertEqual(xStyle.BackgroundFullSize, False) - # check it again - self.ui_test.execute_dialog_through_command(".uno:PageDialog") - DrawPageDialog = self.xUITest.getTopFocusWindow() - xTabs = DrawPageDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize") - self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "false") - checkBackgroundFullSize.executeAction("CLICK",tuple()) - ok = DrawPageDialog.getChild("ok") - self.ui_test.close_dialog_through_button(ok) + # check it again + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + DrawPageDialog = self.xUITest.getTopFocusWindow() + xTabs = DrawPageDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize") + self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "false") + checkBackgroundFullSize.executeAction("CLICK",tuple()) + ok = DrawPageDialog.getChild("ok") + self.ui_test.close_dialog_through_button(ok) - self.assertEqual(xStyle.FillStyle, SOLID) - self.assertEqual(xStyle.LeftMargin, 2997) - self.assertEqual(xStyle.RightMargin, 2743) - self.assertEqual(xStyle.TopMargin, 2489) - self.assertEqual(xStyle.BottomMargin, 2235) - self.assertEqual(xStyle.BackgroundFullSize, True) + self.assertEqual(xStyle.FillStyle, SOLID) + self.assertEqual(xStyle.LeftMargin, 2997) + self.assertEqual(xStyle.RightMargin, 2743) + self.assertEqual(xStyle.TopMargin, 2489) + self.assertEqual(xStyle.BottomMargin, 2235) + self.assertEqual(xStyle.BackgroundFullSize, True) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py b/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py index 989485eb100d..9adbd2047d37 100644 --- a/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py +++ b/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py @@ -15,19 +15,21 @@ class tdf137459(UITestCase): def test_tdf137459(self): - with self.ui_test.create_doc_in_start_center("writer"): + xMainDoc = self.ui_test.create_doc_in_start_center("writer") - # adding new Comment - self.xUITest.executeCommand(".uno:InsertAnnotation") - # wait until the comment is available - xComment1 = self.ui_test.wait_until_child_is_available('Comment1') + # adding new Comment + self.xUITest.executeCommand(".uno:InsertAnnotation") + # wait until the comment is available + xComment1 = self.ui_test.wait_until_child_is_available('Comment1') - xEditView1 = xComment1.getChild("editview") - sText = "Ctrl+Del should not delete BACKWARDS" - xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": sText})) - self.assertEqual(get_state_as_dict(xComment1)["Text"], sText ) + xEditView1 = xComment1.getChild("editview") + sText = "Ctrl+Del should not delete BACKWARDS" + xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": sText})) + self.assertEqual(get_state_as_dict(xComment1)["Text"], sText ) - xEditView1.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+DELETE"})) - self.assertEqual(get_state_as_dict(xComment1)["Text"], sText ) + xEditView1.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+DELETE"})) + self.assertEqual(get_state_as_dict(xComment1)["Text"], sText ) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/tdf53460.py b/sw/qa/uitest/writer_tests/tdf53460.py index 4bedf40c2303..7f4b57416e6f 100644 --- a/sw/qa/uitest/writer_tests/tdf53460.py +++ b/sw/qa/uitest/writer_tests/tdf53460.py @@ -12,65 +12,66 @@ class tdf53460(UITestCase): def test_resize_table_with_keyboard_tdf53460(self): - 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() - #-insert a table (by default 2x2) - self.ui_test.execute_dialog_through_command(".uno:InsertTable") - xDialog = self.xUITest.getTopFocusWindow() - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + document = self.ui_test.get_component() + #-insert a table (by default 2x2) + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - #-put the cursor inside first cell top left for example - #-insert an inner table (by default 2x2) inside this cell - self.ui_test.execute_dialog_through_command(".uno:InsertTable") - xDialog = self.xUITest.getTopFocusWindow() - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - #-still in top left cell, go to the line after the inner table - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - #- <ALT>+up key => crash - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"})) + #-put the cursor inside first cell top left for example + #-insert an inner table (by default 2x2) inside this cell + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + #-still in top left cell, go to the line after the inner table + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + #- <ALT>+up key => crash + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ALT+LEFT"})) - self.assertEqual(document.TextTables.getCount(), 2) + self.assertEqual(document.TextTables.getCount(), 2) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/tdf78068.py b/sw/qa/uitest/writer_tests/tdf78068.py index 89a10ced4ea2..1989722a3b1f 100644 --- a/sw/qa/uitest/writer_tests/tdf78068.py +++ b/sw/qa/uitest/writer_tests/tdf78068.py @@ -12,20 +12,21 @@ from uitest.uihelper.common import select_pos class tdf78068(UITestCase): def test_tdf78068_format_paragraph_crash(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - #- add some text - type_text(xWriterEdit, "Test") - #- go to Format > Paragraph - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) #close dialog + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #- add some text + type_text(xWriterEdit, "Test") + #- go to Format > Paragraph + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) #close dialog - self.assertEqual(document.Text.String[0:4], "Test") + self.assertEqual(document.Text.String[0:4], "Test") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/tdf93068.py b/sw/qa/uitest/writer_tests/tdf93068.py index 66d9ff51383f..a77b4e42da91 100644 --- a/sw/qa/uitest/writer_tests/tdf93068.py +++ b/sw/qa/uitest/writer_tests/tdf93068.py @@ -10,49 +10,50 @@ class tdf93068(UITestCase): def test_tdf93068(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - document = self.ui_test.get_component() + document = self.ui_test.get_component() - self.xUITest.getTopFocusWindow() + self.xUITest.getTopFocusWindow() - # tdf#135950: Character dialog crashes if multiple cells in a - # table are selected - self.ui_test.execute_dialog_through_command(".uno:InsertTable") - xDialog = self.xUITest.getTopFocusWindow() + # tdf#135950: Character dialog crashes if multiple cells in a + # table are selected + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + 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) - self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:SelectAll") - # Check the table is selected - self.assertEqual("SwXTextTableCursor", document.CurrentSelection.getImplementationName()) + # Check the table is selected + self.assertEqual("SwXTextTableCursor", document.CurrentSelection.getImplementationName()) - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xFontDlg = self.xUITest.getTopFocusWindow() - xOKBtn = xFontDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xFontDlg = self.xUITest.getTopFocusWindow() + xOKBtn = xFontDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xFontDlg = self.xUITest.getTopFocusWindow() - xCancBtn = xFontDlg.getChild("cancel") - xCancBtn.executeAction("CLICK", tuple()) + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xFontDlg = self.xUITest.getTopFocusWindow() + xCancBtn = xFontDlg.getChild("cancel") + xCancBtn.executeAction("CLICK", tuple()) - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xFontDlg = self.xUITest.getTopFocusWindow() - xDiscardBtn = xFontDlg.getChild("reset") - xDiscardBtn.executeAction("CLICK", tuple()) - xOKBtn = xFontDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xFontDlg = self.xUITest.getTopFocusWindow() + xDiscardBtn = xFontDlg.getChild("reset") + xDiscardBtn.executeAction("CLICK", tuple()) + xOKBtn = xFontDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - self.xUITest.getTopFocusWindow() + self.xUITest.getTopFocusWindow() - # Check the table is still selected after closing the dialog - self.assertEqual("SwXTextTableCursor", document.CurrentSelection.getImplementationName()) + # Check the table is still selected after closing the dialog + self.assertEqual("SwXTextTableCursor", document.CurrentSelection.getImplementationName()) - self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") - # Check the table is no longer selected - self.assertNotEqual("SwXTextTableCursor", document.CurrentSelection.getImplementationName()) + # Check the table is no longer selected + self.assertNotEqual("SwXTextTableCursor", document.CurrentSelection.getImplementationName()) + self.ui_test.close_doc() diff --git a/sw/qa/uitest/writer_tests/trackedChanges.py b/sw/qa/uitest/writer_tests/trackedChanges.py index faa8657e4f52..366954d76d16 100644 --- a/sw/qa/uitest/writer_tests/trackedChanges.py +++ b/sw/qa/uitest/writer_tests/trackedChanges.py @@ -12,135 +12,143 @@ class trackedchanges(UITestCase): def test_tdf91270(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - type_text(xWriterEdit, "Test") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + type_text(xWriterEdit, "Test") - self.xUITest.executeCommand(".uno:TrackChanges") + self.xUITest.executeCommand(".uno:TrackChanges") - selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text - self.xUITest.executeCommand(".uno:Cut") #cut text + selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text + self.xUITest.executeCommand(".uno:Cut") #cut text - self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges") - xTrackDlg = self.xUITest.getTopFocusWindow() - xCancBtn = xTrackDlg.getChild("close") - xCancBtn.executeAction("CLICK", tuple()) + self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges") + xTrackDlg = self.xUITest.getTopFocusWindow() + xCancBtn = xTrackDlg.getChild("close") + xCancBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() def test_tracked_changes_accept(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - self.xUITest.executeCommand(".uno:TrackChanges") - type_text(xWriterEdit, "Test LibreOffice") - self.xUITest.executeCommand(".uno:ShowTrackedChanges") + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, "Test LibreOffice") + self.xUITest.executeCommand(".uno:ShowTrackedChanges") - self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges") - xTrackDlg = self.xUITest.getTopFocusWindow() - xAccBtn = xTrackDlg.getChild("accept") - xAccBtn.executeAction("CLICK", tuple()) - xCancBtn = xTrackDlg.getChild("close") - xCancBtn.executeAction("CLICK", tuple()) + self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges") + xTrackDlg = self.xUITest.getTopFocusWindow() + xAccBtn = xTrackDlg.getChild("accept") + xAccBtn.executeAction("CLICK", tuple()) + xCancBtn = xTrackDlg.getChild("close") + xCancBtn.executeAction("CLICK", tuple()) - self.assertEqual(document.Text.String[0:16], "Test LibreOffice") + self.assertEqual(document.Text.String[0:16], "Test LibreOffice") + self.ui_test.close_doc() def test_tracked_changes_acceptall(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - self.xUITest.executeCommand(".uno:TrackChanges") - type_text(xWriterEdit, "Test LibreOffice") - self.xUITest.executeCommand(".uno:ShowTrackedChanges") + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, "Test LibreOffice") + self.xUITest.executeCommand(".uno:ShowTrackedChanges") - self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges") - xTrackDlg = self.xUITest.getTopFocusWindow() + self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges") + xTrackDlg = self.xUITest.getTopFocusWindow() - xAccBtn = xTrackDlg.getChild("acceptall") - xAccBtn.executeAction("CLICK", tuple()) - xCancBtn = xTrackDlg.getChild("close") - xCancBtn.executeAction("CLICK", tuple()) + xAccBtn = xTrackDlg.getChild("acceptall") + xAccBtn.executeAction("CLICK", tuple()) + xCancBtn = xTrackDlg.getChild("close") + xCancBtn.executeAction("CLICK", tuple()) - self.assertEqual(document.Text.String[0:16], "Test LibreOffice") + self.assertEqual(document.Text.String[0:16], "Test LibreOffice") + self.ui_test.close_doc() def test_tracked_changes_reject(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - self.xUITest.executeCommand(".uno:TrackChanges") - type_text(xWriterEdit, "Test LibreOffice") - self.xUITest.executeCommand(".uno:ShowTrackedChanges") + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, "Test LibreOffice") + self.xUITest.executeCommand(".uno:ShowTrackedChanges") - self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges") - xTrackDlg = self.xUITest.getTopFocusWindow() + self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges") + xTrackDlg = self.xUITest.getTopFocusWindow() - xRejBtn = xTrackDlg.getChild("reject") - xRejBtn.executeAction("CLICK", tuple()) - xCancBtn = xTrackDlg.getChild("close") - xCancBtn.executeAction("CLICK", tuple()) + xRejBtn = xTrackDlg.getChild("reject") + xRejBtn.executeAction("CLICK", tuple()) + xCancBtn = xTrackDlg.getChild("close") + xCancBtn.executeAction("CLICK", tuple()) - self.assertEqual(document.Text.String[0:1], "") + self.assertEqual(document.Text.String[0:1], "") + self.ui_test.close_doc() def test_tracked_changes_rejectall(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - self.xUITest.executeCommand(".uno:TrackChanges") - type_text(xWriterEdit, "Test LibreOffice") - self.xUITest.executeCommand(".uno:ShowTrackedChanges") + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, "Test LibreOffice") + self.xUITest.executeCommand(".uno:ShowTrackedChanges") - self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges") - xTrackDlg = self.xUITest.getTopFocusWindow() + 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()) + xAccBtn = xTrackDlg.getChild("rejectall") + xAccBtn.executeAction("CLICK", tuple()) + xCancBtn = xTrackDlg.getChild("close") + xCancBtn.executeAction("CLICK", tuple()) - self.assertEqual(document.Text.String[0:1], "") + self.assertEqual(document.Text.String[0:1], "") + self.ui_test.close_doc() def test_tracked_changes_zprev_next(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - - self.xUITest.executeCommand(".uno:TrackChanges") - type_text(xWriterEdit, "Test LibreOffice") - self.xUITest.executeCommand(".uno:TrackChanges") - type_text(xWriterEdit, " Test2") - self.xUITest.executeCommand(".uno:TrackChanges") - type_text(xWriterEdit, " Test3") - self.xUITest.executeCommand(".uno:TrackChanges") - type_text(xWriterEdit, " Test4") - self.xUITest.executeCommand(".uno:TrackChanges") - type_text(xWriterEdit, " Test5") - self.xUITest.executeCommand(".uno:PreviousTrackedChange") - self.xUITest.executeCommand(".uno:RejectTrackedChange") - self.assertEqual(document.Text.String[0:37], "Test LibreOffice Test2 Test3 Test4") - - self.xUITest.executeCommand(".uno:PreviousTrackedChange") - self.xUITest.executeCommand(".uno:PreviousTrackedChange") - self.xUITest.executeCommand(".uno:AcceptTrackedChange") - self.assertEqual(document.Text.String[0:37], "Test LibreOffice Test2 Test3 Test4") - - self.xUITest.executeCommand(".uno:NextTrackedChange") - self.xUITest.executeCommand(".uno:RejectTrackedChange") - self.assertEqual(document.Text.String[0:30], "Test LibreOffice Test2 Test4") + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, "Test LibreOffice") + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, " Test2") + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, " Test3") + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, " Test4") + self.xUITest.executeCommand(".uno:TrackChanges") + type_text(xWriterEdit, " Test5") + self.xUITest.executeCommand(".uno:PreviousTrackedChange") + self.xUITest.executeCommand(".uno:RejectTrackedChange") + self.assertEqual(document.Text.String[0:37], "Test LibreOffice Test2 Test3 Test4") + + self.xUITest.executeCommand(".uno:PreviousTrackedChange") + self.xUITest.executeCommand(".uno:PreviousTrackedChange") + self.xUITest.executeCommand(".uno:AcceptTrackedChange") + self.assertEqual(document.Text.String[0:37], "Test LibreOffice Test2 Test3 Test4") + + self.xUITest.executeCommand(".uno:NextTrackedChange") + self.xUITest.executeCommand(".uno:RejectTrackedChange") + self.assertEqual(document.Text.String[0:30], "Test LibreOffice Test2 Test4") + + self.ui_test.close_doc() def test_list_of_changes(self): with self.ui_test.load_file(get_url_for_data_file("trackedChanges.odt")): diff --git a/sw/qa/uitest/writer_tests/watermark.py b/sw/qa/uitest/writer_tests/watermark.py index e9d98e5b4edf..3cf7c6fd84f6 100644 --- a/sw/qa/uitest/writer_tests/watermark.py +++ b/sw/qa/uitest/writer_tests/watermark.py @@ -12,51 +12,52 @@ from uitest.uihelper.common import get_state_as_dict class watermark(UITestCase): def test_insert_watermark(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - - self.ui_test.execute_dialog_through_command(".uno:Watermark") - xDialog = self.xUITest.getTopFocusWindow() - xTextInput = xDialog.getChild("TextInput") - xAngle = xDialog.getChild("Angle") - xTransparency = xDialog.getChild("Transparency") - - xTextInput.executeAction("TYPE", mkPropertyValues({"TEXT":"Watermark"})) - xAngle.executeAction("UP", tuple()) - xTransparency.executeAction("UP", tuple()) - - xOkBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) - - self.ui_test.execute_dialog_through_command(".uno:Watermark") - xDialog = self.xUITest.getTopFocusWindow() - xTextInput = xDialog.getChild("TextInput") - xAngle = xDialog.getChild("Angle") - xTransparency = xDialog.getChild("Transparency") - - self.assertEqual(get_state_as_dict(xTextInput)["Text"], "Watermark") - self.assertEqual(get_state_as_dict(xAngle)["Text"], "90°") - self.assertEqual(get_state_as_dict(xTransparency)["Text"], "51%") - - xCancBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancBtn) - - self.ui_test.execute_dialog_through_command(".uno:Watermark") - xDialog = self.xUITest.getTopFocusWindow() - xTextInput = xDialog.getChild("TextInput") - xTextInput.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xTextInput.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xOkBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) - - self.ui_test.execute_dialog_through_command(".uno:Watermark") - xDialog = self.xUITest.getTopFocusWindow() - xTextInput = xDialog.getChild("TextInput") - - self.assertEqual(get_state_as_dict(xTextInput)["Text"], "") - - xCancBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancBtn) - + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:Watermark") + xDialog = self.xUITest.getTopFocusWindow() + xTextInput = xDialog.getChild("TextInput") + xAngle = xDialog.getChild("Angle") + xTransparency = xDialog.getChild("Transparency") + + xTextInput.executeAction("TYPE", mkPropertyValues({"TEXT":"Watermark"})) + xAngle.executeAction("UP", tuple()) + xTransparency.executeAction("UP", tuple()) + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.execute_dialog_through_command(".uno:Watermark") + xDialog = self.xUITest.getTopFocusWindow() + xTextInput = xDialog.getChild("TextInput") + xAngle = xDialog.getChild("Angle") + xTransparency = xDialog.getChild("Transparency") + + self.assertEqual(get_state_as_dict(xTextInput)["Text"], "Watermark") + self.assertEqual(get_state_as_dict(xAngle)["Text"], "90°") + self.assertEqual(get_state_as_dict(xTransparency)["Text"], "51%") + + xCancBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancBtn) + + self.ui_test.execute_dialog_through_command(".uno:Watermark") + xDialog = self.xUITest.getTopFocusWindow() + xTextInput = xDialog.getChild("TextInput") + xTextInput.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xTextInput.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.execute_dialog_through_command(".uno:Watermark") + xDialog = self.xUITest.getTopFocusWindow() + xTextInput = xDialog.getChild("TextInput") + + self.assertEqual(get_state_as_dict(xTextInput)["Text"], "") + + xCancBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests/wordCount.py b/sw/qa/uitest/writer_tests/wordCount.py index eed3215a22c7..9d8b3a6cba0a 100644 --- a/sw/qa/uitest/writer_tests/wordCount.py +++ b/sw/qa/uitest/writer_tests/wordCount.py @@ -13,36 +13,38 @@ class writerWordCount(UITestCase): def test_word_count_dialog(self): - 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() - - type_text(xWriterEdit, "Test for word count dialog") #type text - xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "8"})) #select two words - - self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") - xDialog = self.xUITest.getTopFocusWindow() - - xselectwords = xDialog.getChild("selectwords") - xdocwords = xDialog.getChild("docwords") - xselectchars = xDialog.getChild("selectchars") - xdocchars = xDialog.getChild("docchars") - xselectcharsnospaces = xDialog.getChild("selectcharsnospaces") - xdoccharsnospaces = xDialog.getChild("doccharsnospaces") - xselectcjkchars = xDialog.getChild("selectcjkchars") - xdoccjkchars = xDialog.getChild("doccjkchars") - - self.assertEqual(get_state_as_dict(xselectwords)["Text"], "2") - self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5") - self.assertEqual(get_state_as_dict(xselectchars)["Text"], "8") - self.assertEqual(get_state_as_dict(xdocchars)["Text"], "26") - self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "7") - self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "22") - self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0") - self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0") - xCloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + document = self.ui_test.get_component() + + type_text(xWriterEdit, "Test for word count dialog") #type text + xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "8"})) #select two words + + self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") + xDialog = self.xUITest.getTopFocusWindow() + + xselectwords = xDialog.getChild("selectwords") + xdocwords = xDialog.getChild("docwords") + xselectchars = xDialog.getChild("selectchars") + xdocchars = xDialog.getChild("docchars") + xselectcharsnospaces = xDialog.getChild("selectcharsnospaces") + xdoccharsnospaces = xDialog.getChild("doccharsnospaces") + xselectcjkchars = xDialog.getChild("selectcjkchars") + xdoccjkchars = xDialog.getChild("doccjkchars") + + self.assertEqual(get_state_as_dict(xselectwords)["Text"], "2") + self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5") + self.assertEqual(get_state_as_dict(xselectchars)["Text"], "8") + self.assertEqual(get_state_as_dict(xdocchars)["Text"], "26") + self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "7") + self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "22") + self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0") + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() def test_tdf68347(self): #Bug 68347 - Incorrect word count in a document with recorded changes @@ -77,14 +79,16 @@ class writerWordCount(UITestCase): self.ui_test.close_dialog_through_button(xCloseBtn) def test_tdf91100(self): - with self.ui_test.create_doc_in_start_center("writer"): - xWriterDoc = self.xUITest.getTopFocusWindow() - document = self.ui_test.get_component() + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() - self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() def test_tdf58050(self): with self.ui_test.load_file(get_url_for_data_file("tdf58050.html")) as writer_doc: @@ -114,122 +118,125 @@ class writerWordCount(UITestCase): def test_word_count_interpunction_counted_tdf56975_a(self): - 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() - #Open writer, enter "Testing one two! Test?" - type_text(xWriterEdit, "Testing one two! Test?") - #-> LO says: 4 words. SUCCESS! :) - self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") - xDialog = self.xUITest.getTopFocusWindow() - - xselectwords = xDialog.getChild("selectwords") - xdocwords = xDialog.getChild("docwords") - xselectchars = xDialog.getChild("selectchars") - xdocchars = xDialog.getChild("docchars") - xselectcharsnospaces = xDialog.getChild("selectcharsnospaces") - xdoccharsnospaces = xDialog.getChild("doccharsnospaces") - xselectcjkchars = xDialog.getChild("selectcjkchars") - xdoccjkchars = xDialog.getChild("doccjkchars") - - self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0") - self.assertEqual(get_state_as_dict(xdocwords)["Text"], "4") - self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0") - self.assertEqual(get_state_as_dict(xdocchars)["Text"], "22") - self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0") - self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "19") - self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0") - self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0") - xCloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + document = self.ui_test.get_component() + #Open writer, enter "Testing one two! Test?" + type_text(xWriterEdit, "Testing one two! Test?") + #-> LO says: 4 words. SUCCESS! :) + self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") + xDialog = self.xUITest.getTopFocusWindow() + + xselectwords = xDialog.getChild("selectwords") + xdocwords = xDialog.getChild("docwords") + xselectchars = xDialog.getChild("selectchars") + xdocchars = xDialog.getChild("docchars") + xselectcharsnospaces = xDialog.getChild("selectcharsnospaces") + xdoccharsnospaces = xDialog.getChild("doccharsnospaces") + xselectcjkchars = xDialog.getChild("selectcjkchars") + xdoccjkchars = xDialog.getChild("doccjkchars") + + self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0") + self.assertEqual(get_state_as_dict(xdocwords)["Text"], "4") + self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdocchars)["Text"], "22") + self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "19") + self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0") + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() def test_word_count_interpunction_counted_tdf56975_b(self): - 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() - #1. Create a new text document. - #2. Type-in the words: - # This is a test sentence. - type_text(xWriterEdit, "This is a test sentence.") - #3. Open the word count dialogue. - # Word count in both, dialogue and status line, shows 5 words. - self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") - xDialog = self.xUITest.getTopFocusWindow() - - xselectwords = xDialog.getChild("selectwords") - xdocwords = xDialog.getChild("docwords") - xselectchars = xDialog.getChild("selectchars") - xdocchars = xDialog.getChild("docchars") - xselectcharsnospaces = xDialog.getChild("selectcharsnospaces") - xdoccharsnospaces = xDialog.getChild("doccharsnospaces") - xselectcjkchars = xDialog.getChild("selectcjkchars") - xdoccjkchars = xDialog.getChild("doccjkchars") - - self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0") - self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5") - self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0") - self.assertEqual(get_state_as_dict(xdocchars)["Text"], "24") - self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0") - self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "20") - self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0") - self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0") - xCloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xCloseBtn) - #4. Select the space between 'a' and 'test'. - xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "9", "END_POS": "10"})) - #5. Replace selection by a non-breaking space by pressing Shift+Ctrl+Space. Don't move the cursor. - self.xUITest.executeCommand(".uno:InsertNonBreakingSpace") - # Word count in dialogue shows 4 words, whereas in the status line it shows 5 words. - self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") - xDialog = self.xUITest.getTopFocusWindow() - - xselectwords = xDialog.getChild("selectwords") - xdocwords = xDialog.getChild("docwords") - xselectchars = xDialog.getChild("selectchars") - xdocchars = xDialog.getChild("docchars") - xselectcharsnospaces = xDialog.getChild("selectcharsnospaces") - xdoccharsnospaces = xDialog.getChild("doccharsnospaces") - xselectcjkchars = xDialog.getChild("selectcjkchars") - xdoccjkchars = xDialog.getChild("doccjkchars") - - self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0") - self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5") - self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0") - self.assertEqual(get_state_as_dict(xdocchars)["Text"], "24") - self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0") - self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "20") - self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0") - self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0") - xCloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xCloseBtn) - #6. Move the cursor by pressing Left. - self.xUITest.executeCommand(".uno:GoLeft") - # Word count in both, dialogue and status line, shows 5 words. - self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") - xDialog = self.xUITest.getTopFocusWindow() - - xselectwords = xDialog.getChild("selectwords") - xdocwords = xDialog.getChild("docwords") - xselectchars = xDialog.getChild("selectchars") - xdocchars = xDialog.getChild("docchars") - xselectcharsnospaces = xDialog.getChild("selectcharsnospaces") - xdoccharsnospaces = xDialog.getChild("doccharsnospaces") - xselectcjkchars = xDialog.getChild("selectcjkchars") - xdoccjkchars = xDialog.getChild("doccjkchars") - - self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0") - self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5") - self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0") - self.assertEqual(get_state_as_dict(xdocchars)["Text"], "24") - self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0") - self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "20") - self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0") - self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0") - xCloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + document = self.ui_test.get_component() + #1. Create a new text document. + #2. Type-in the words: + # This is a test sentence. + type_text(xWriterEdit, "This is a test sentence.") + #3. Open the word count dialogue. + # Word count in both, dialogue and status line, shows 5 words. + self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") + xDialog = self.xUITest.getTopFocusWindow() + + xselectwords = xDialog.getChild("selectwords") + xdocwords = xDialog.getChild("docwords") + xselectchars = xDialog.getChild("selectchars") + xdocchars = xDialog.getChild("docchars") + xselectcharsnospaces = xDialog.getChild("selectcharsnospaces") + xdoccharsnospaces = xDialog.getChild("doccharsnospaces") + xselectcjkchars = xDialog.getChild("selectcjkchars") + xdoccjkchars = xDialog.getChild("doccjkchars") + + self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0") + self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5") + self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdocchars)["Text"], "24") + self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "20") + self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0") + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + #4. Select the space between 'a' and 'test'. + xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "9", "END_POS": "10"})) + #5. Replace selection by a non-breaking space by pressing Shift+Ctrl+Space. Don't move the cursor. + self.xUITest.executeCommand(".uno:InsertNonBreakingSpace") + # Word count in dialogue shows 4 words, whereas in the status line it shows 5 words. + self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") + xDialog = self.xUITest.getTopFocusWindow() + + xselectwords = xDialog.getChild("selectwords") + xdocwords = xDialog.getChild("docwords") + xselectchars = xDialog.getChild("selectchars") + xdocchars = xDialog.getChild("docchars") + xselectcharsnospaces = xDialog.getChild("selectcharsnospaces") + xdoccharsnospaces = xDialog.getChild("doccharsnospaces") + xselectcjkchars = xDialog.getChild("selectcjkchars") + xdoccjkchars = xDialog.getChild("doccjkchars") + + self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0") + self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5") + self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdocchars)["Text"], "24") + self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "20") + self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0") + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + #6. Move the cursor by pressing Left. + self.xUITest.executeCommand(".uno:GoLeft") + # Word count in both, dialogue and status line, shows 5 words. + self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") + xDialog = self.xUITest.getTopFocusWindow() + + xselectwords = xDialog.getChild("selectwords") + xdocwords = xDialog.getChild("docwords") + xselectchars = xDialog.getChild("selectchars") + xdocchars = xDialog.getChild("docchars") + xselectcharsnospaces = xDialog.getChild("selectcharsnospaces") + xdoccharsnospaces = xDialog.getChild("doccharsnospaces") + xselectcjkchars = xDialog.getChild("selectcjkchars") + xdoccjkchars = xDialog.getChild("doccjkchars") + + self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0") + self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5") + self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdocchars)["Text"], "24") + self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "20") + self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0") + self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0") + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.close_doc() def test_tdf51816(self): with self.ui_test.load_file(get_url_for_data_file("tdf51816.odt")) as writer_doc: |