diff options
281 files changed, 15090 insertions, 14366 deletions
diff --git a/cui/qa/uitest/dialogs/chardlg.py b/cui/qa/uitest/dialogs/chardlg.py index 01c372ce9780..fb1c1286cbae 100644 --- a/cui/qa/uitest/dialogs/chardlg.py +++ b/cui/qa/uitest/dialogs/chardlg.py @@ -14,87 +14,90 @@ class Test(UITestCase): def testSvxCharEffectsPage(self): # Start Impress. - with self.ui_test.create_doc_in_start_center("impress"): - template = self.xUITest.getTopFocusWindow() - self.ui_test.close_dialog_through_button(template.getChild("close")) - doc = self.xUITest.getTopFocusWindow() - editWin = doc.getChild("impress_win") - # Select the title shape. - editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) - editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"})) - self.xUITest.executeCommand(".uno:SelectAll") + self.ui_test.create_doc_in_start_center("impress") + template = self.xUITest.getTopFocusWindow() + self.ui_test.close_dialog_through_button(template.getChild("close")) + doc = self.xUITest.getTopFocusWindow() + editWin = doc.getChild("impress_win") + # Select the title shape. + editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"})) + self.xUITest.executeCommand(".uno:SelectAll") - # Now use Format -> Character. - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - # Select RID_SVXPAGE_CHAR_EFFECTS. - select_pos(xTabs, "1") - xFontTransparency = xDialog.getChild("fonttransparencymtr") - for _ in range(5): - xFontTransparency.executeAction("UP", tuple()) - self.ui_test.close_dialog_through_button(xDialog.getChild("ok")) + # Now use Format -> Character. + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + # Select RID_SVXPAGE_CHAR_EFFECTS. + select_pos(xTabs, "1") + xFontTransparency = xDialog.getChild("fonttransparencymtr") + for _ in range(5): + xFontTransparency.executeAction("UP", tuple()) + self.ui_test.close_dialog_through_button(xDialog.getChild("ok")) - # Verify the result. - component = self.ui_test.get_component() - drawPage = component.getDrawPages().getByIndex(0) - shape = drawPage.getByIndex(0) + # Verify the result. + component = self.ui_test.get_component() + drawPage = component.getDrawPages().getByIndex(0) + shape = drawPage.getByIndex(0) - # Without the accompanying fix in place, this test would have failed with: - # AssertionError: 100 != 5 - # i.e. the dialog did not set transparency to 5%, instead it left the character color at - # COL_AUTO. - self.assertEqual(shape.CharTransparence, 5) + # Without the accompanying fix in place, this test would have failed with: + # AssertionError: 100 != 5 + # i.e. the dialog did not set transparency to 5%, instead it left the character color at + # COL_AUTO. + self.assertEqual(shape.CharTransparence, 5) + self.ui_test.close_doc() def testSvxCharEffectsPageWriter(self): # Start Writer. - with self.ui_test.create_doc_in_start_center("writer"): - doc = self.xUITest.getTopFocusWindow() - editWin = doc.getChild("writer_edit") - # Type a character and select it. - editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) - editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"})) - self.xUITest.executeCommand(".uno:SelectAll") + self.ui_test.create_doc_in_start_center("writer") + doc = self.xUITest.getTopFocusWindow() + editWin = doc.getChild("writer_edit") + # Type a character and select it. + editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"})) + self.xUITest.executeCommand(".uno:SelectAll") - # Now use Format -> Character. - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - # Select RID_SVXPAGE_CHAR_EFFECTS. - select_pos(xTabs, "1") - xFontTransparency = xDialog.getChild("fonttransparencymtr") - # Without the accompanying fix in place, this test would have failed with: - # AssertionError: 'false' != 'true' - # i.e. the transparency widget was hidden. - self.assertEqual(get_state_as_dict(xFontTransparency)["Visible"], "true") - for _ in range(5): - xFontTransparency.executeAction("UP", tuple()) - self.ui_test.close_dialog_through_button(xDialog.getChild("ok")) + # Now use Format -> Character. + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + # Select RID_SVXPAGE_CHAR_EFFECTS. + select_pos(xTabs, "1") + xFontTransparency = xDialog.getChild("fonttransparencymtr") + # Without the accompanying fix in place, this test would have failed with: + # AssertionError: 'false' != 'true' + # i.e. the transparency widget was hidden. + self.assertEqual(get_state_as_dict(xFontTransparency)["Visible"], "true") + for _ in range(5): + xFontTransparency.executeAction("UP", tuple()) + self.ui_test.close_dialog_through_button(xDialog.getChild("ok")) - # Verify the result. - component = self.ui_test.get_component() - paragraph = component.Text.createEnumeration().nextElement() + # Verify the result. + component = self.ui_test.get_component() + paragraph = component.Text.createEnumeration().nextElement() - self.assertEqual(paragraph.CharTransparence, 5) + self.assertEqual(paragraph.CharTransparence, 5) + self.ui_test.close_doc() def testSvxCharEffectsPageWriterAutomatic(self): # Start Writer. - with self.ui_test.create_doc_in_start_center("writer"): - doc = self.xUITest.getTopFocusWindow() - editWin = doc.getChild("writer_edit") + self.ui_test.create_doc_in_start_center("writer") + doc = self.xUITest.getTopFocusWindow() + editWin = doc.getChild("writer_edit") - # Use Format -> Character. - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - # Select RID_SVXPAGE_CHAR_EFFECTS. - select_pos(xTabs, "1") - xFontColorLB = xDialog.getChild("fontcolorlb") - # Without the accompanying fix in place, this test would have failed with: - # AssertionError: 'White' != 'Automatic' - # i.e. the auto color lost its alpha component and appeared as white. - self.assertEqual(get_state_as_dict(xFontColorLB)["Text"], "Automatic") + # Use Format -> Character. + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + # Select RID_SVXPAGE_CHAR_EFFECTS. + select_pos(xTabs, "1") + xFontColorLB = xDialog.getChild("fontcolorlb") + # Without the accompanying fix in place, this test would have failed with: + # AssertionError: 'White' != 'Automatic' + # i.e. the auto color lost its alpha component and appeared as white. + self.assertEqual(get_state_as_dict(xFontColorLB)["Text"], "Automatic") - self.ui_test.close_dialog_through_button(xDialog.getChild("ok")) + self.ui_test.close_dialog_through_button(xDialog.getChild("ok")) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/cui/qa/uitest/dialogs/pastedlg.py b/cui/qa/uitest/dialogs/pastedlg.py index f186a28c3e7a..9ac40c55d2b6 100644 --- a/cui/qa/uitest/dialogs/pastedlg.py +++ b/cui/qa/uitest/dialogs/pastedlg.py @@ -14,33 +14,34 @@ class Test(UITestCase): def testGetFormat(self): # Copy a string in Impress. - with self.ui_test.create_doc_in_start_center("impress"): - template = self.xUITest.getTopFocusWindow() - self.ui_test.close_dialog_through_button(template.getChild("close")) - doc = self.xUITest.getTopFocusWindow() - editWin = doc.getChild("impress_win") - # Select the title shape. - editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) - editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"})) - self.xUITest.executeCommand(".uno:SelectAll") - self.xUITest.executeCommand(".uno:Copy") - - # Now use paste special to see what formats are offered. - self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") - pasteSpecial = self.xUITest.getTopFocusWindow() - formats = pasteSpecial.getChild("list") - entryCount = int(get_state_as_dict(formats)["Children"]) - items = [] - for index in range(entryCount): - entry = formats.getChild(str(index)) - entry.executeAction("SELECT", tuple()) - items.append(get_state_as_dict(formats)["SelectEntryText"]) - - # Make sure there is no RTF vs Richtext duplication. - self.assertTrue("Rich text formatting (RTF)" in items) - self.assertFalse("Rich text formatting (Richtext)" in items) - - # Close the dialog and the document. - self.ui_test.close_dialog_through_button(pasteSpecial.getChild("cancel")) + self.ui_test.create_doc_in_start_center("impress") + template = self.xUITest.getTopFocusWindow() + self.ui_test.close_dialog_through_button(template.getChild("close")) + doc = self.xUITest.getTopFocusWindow() + editWin = doc.getChild("impress_win") + # Select the title shape. + editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"})) + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Copy") + + # Now use paste special to see what formats are offered. + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + pasteSpecial = self.xUITest.getTopFocusWindow() + formats = pasteSpecial.getChild("list") + entryCount = int(get_state_as_dict(formats)["Children"]) + items = [] + for index in range(entryCount): + entry = formats.getChild(str(index)) + entry.executeAction("SELECT", tuple()) + items.append(get_state_as_dict(formats)["SelectEntryText"]) + + # Make sure there is no RTF vs Richtext duplication. + self.assertTrue("Rich text formatting (RTF)" in items) + self.assertFalse("Rich text formatting (Richtext)" in items) + + # Close the dialog and the document. + self.ui_test.close_dialog_through_button(pasteSpecial.getChild("cancel")) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/cui/qa/uitest/dialogs/shortcuts.py b/cui/qa/uitest/dialogs/shortcuts.py index 3b5810757566..8a52ee42315a 100644 --- a/cui/qa/uitest/dialogs/shortcuts.py +++ b/cui/qa/uitest/dialogs/shortcuts.py @@ -13,29 +13,31 @@ from uitest.uihelper.common import get_state_as_dict class Test(UITestCase): def test_tab_navigation(self): - with self.ui_test.create_doc_in_start_center("writer"): - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - self.ui_test.execute_dialog_through_command(".uno:EditStyle") #open style dialog - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:EditStyle") #open style dialog + xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") - for i in range(16): - self.assertEqual(get_state_as_dict(xTabs)["CurrPagePos"], str(i)) + for i in range(16): + self.assertEqual(get_state_as_dict(xTabs)["CurrPagePos"], str(i)) - xTabs.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+PAGEDOWN"})) + xTabs.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+PAGEDOWN"})) - self.assertEqual(get_state_as_dict(xTabs)["CurrPagePos"], "0") + self.assertEqual(get_state_as_dict(xTabs)["CurrPagePos"], "0") - for i in reversed(range(16)): - xTabs.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+PAGEUP"})) + for i in reversed(range(16)): + xTabs.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+PAGEUP"})) - self.assertEqual(get_state_as_dict(xTabs)["CurrPagePos"], str(i)) + self.assertEqual(get_state_as_dict(xTabs)["CurrPagePos"], str(i)) - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index 2a06199b4c8c..1b5bcb1f113f 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -126,97 +126,101 @@ class AutofilterTest(UITestCase): self.assertFalse(is_row_hidden(doc, 4)) def test_differentSearches(self): - with self.ui_test.create_doc_in_start_center("calc"): - document = self.ui_test.get_component() - calcDoc = self.xUITest.getTopFocusWindow() + self.ui_test.create_doc_in_start_center("calc") + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = calcDoc.getChild("grid_window") - enter_text_to_cell(xGridWindow, "A1", "X") - enter_text_to_cell(xGridWindow, "A2", "11") - enter_text_to_cell(xGridWindow, "A3", "22") - xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"})) + xGridWindow = calcDoc.getChild("grid_window") + enter_text_to_cell(xGridWindow, "A1", "X") + enter_text_to_cell(xGridWindow, "A2", "11") + enter_text_to_cell(xGridWindow, "A3", "22") + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"})) - self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") - xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() + xFloatWindow = self.xUITest.getFloatWindow() - xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xCheckListMenu = xFloatWindow.getChild("check_list_menu") - xList = xCheckListMenu.getChild("check_list_box") + xList = xCheckListMenu.getChild("check_list_box") - self.assertEqual(2, len(xList.getChildren())) - self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text']) - self.assertEqual("22", get_state_as_dict(xList.getChild('1'))['Text']) + self.assertEqual(2, len(xList.getChildren())) + self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text']) + self.assertEqual("22", get_state_as_dict(xList.getChild('1'))['Text']) - xSearchEdit = xFloatWindow.getChild("search_edit") - xSearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT" : "11"})) + xSearchEdit = xFloatWindow.getChild("search_edit") + xSearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT" : "11"})) - self.assertEqual(1, len(xList.getChildren())) - self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text']) + self.assertEqual(1, len(xList.getChildren())) + self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text']) - xOkBtn = xFloatWindow.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - self.assertFalse(is_row_hidden(document, 0)) - self.assertFalse(is_row_hidden(document, 1)) - self.assertTrue(is_row_hidden(document, 2)) + self.assertFalse(is_row_hidden(document, 0)) + self.assertFalse(is_row_hidden(document, 1)) + self.assertTrue(is_row_hidden(document, 2)) - xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() + xFloatWindow = self.xUITest.getFloatWindow() - xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xCheckListMenu = xFloatWindow.getChild("check_list_menu") - xList = xCheckListMenu.getChild("check_list_box") + xList = xCheckListMenu.getChild("check_list_box") - self.assertEqual(2, len(xList.getChildren())) - self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text']) - self.assertEqual("22", get_state_as_dict(xList.getChild('1'))['Text']) + self.assertEqual(2, len(xList.getChildren())) + self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text']) + self.assertEqual("22", get_state_as_dict(xList.getChild('1'))['Text']) - xSearchEdit = xFloatWindow.getChild("search_edit") - xSearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT" : "22"})) + xSearchEdit = xFloatWindow.getChild("search_edit") + xSearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT" : "22"})) - self.assertEqual(1, len(xList.getChildren())) - self.assertEqual("22", get_state_as_dict(xList.getChild('0'))['Text']) + self.assertEqual(1, len(xList.getChildren())) + self.assertEqual("22", get_state_as_dict(xList.getChild('0'))['Text']) + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - xOkBtn = xFloatWindow.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + self.assertFalse(is_row_hidden(document, 0)) + self.assertTrue(is_row_hidden(document, 1)) + self.assertFalse(is_row_hidden(document, 2)) - self.assertFalse(is_row_hidden(document, 0)) - self.assertTrue(is_row_hidden(document, 1)) - self.assertFalse(is_row_hidden(document, 2)) + self.ui_test.close_doc() def test_tdf89244(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "AAA") - enter_text_to_cell(gridwin, "A3", "BBB") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + enter_text_to_cell(gridwin, "A1", "AAA") + enter_text_to_cell(gridwin, "A3", "BBB") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) - self.xUITest.executeCommand(".uno:MergeCells") + self.xUITest.executeCommand(".uno:MergeCells") - self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") - gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() + xFloatWindow = self.xUITest.getFloatWindow() - xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xCheckListMenu = xFloatWindow.getChild("check_list_menu") - xList = xCheckListMenu.getChild("check_list_box") + xList = xCheckListMenu.getChild("check_list_box") - self.assertEqual(2, len(xList.getChildren())) - self.assertEqual("(empty)", get_state_as_dict(xList.getChild('0'))['Text']) - self.assertEqual("BBB", get_state_as_dict(xList.getChild('1'))['Text']) + self.assertEqual(2, len(xList.getChildren())) + self.assertEqual("(empty)", get_state_as_dict(xList.getChild('0'))['Text']) + self.assertEqual("BBB", get_state_as_dict(xList.getChild('1'))['Text']) - xOkBtn = xFloatWindow.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() def test_tdf116818(self): with self.ui_test.load_file(get_url_for_data_file("tdf116818.xlsx")) as doc: @@ -368,52 +372,54 @@ class AutofilterTest(UITestCase): self.assertFalse(is_row_hidden(doc, 7)) def test_tdf142350(self): - with self.ui_test.create_doc_in_start_center("calc"): - document = self.ui_test.get_component() - calcDoc = self.xUITest.getTopFocusWindow() - gridwin = calcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - enter_text_to_cell(gridwin, "A1", "A") - enter_text_to_cell(gridwin, "A2", "0") - enter_text_to_cell(gridwin, "A3", "") - enter_text_to_cell(gridwin, "A4", "1") - - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) - - self.xUITest.executeCommand(".uno:DataFilterAutoFilter") - - gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xCheckListMenu = xFloatWindow.getChild("check_list_menu") - xList = xCheckListMenu.getChild("check_list_box") - - # tdf140745 show (empty) entry on top of the checkbox list - self.assertEqual(3, len(xList.getChildren())) - self.assertEqual("(empty)", get_state_as_dict(xList.getChild('0'))['Text']) - self.assertEqual("0", get_state_as_dict(xList.getChild('1'))['Text']) - self.assertEqual("1", get_state_as_dict(xList.getChild('2'))['Text']) - - xEntry = xList.getChild("0") - xEntry.executeAction("CLICK", tuple()) - - xOkButton = xFloatWindow.getChild("ok") - xOkButton.executeAction("CLICK", tuple()) - - self.assertFalse(is_row_hidden(document, 1)) - self.assertTrue(is_row_hidden(document, 2)) - self.assertFalse(is_row_hidden(document, 3)) - - gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xCheckListMenu = xFloatWindow.getChild("check_list_menu") - xList = xCheckListMenu.getChild("check_list_box") - self.assertEqual(3, len(xList.getChildren())) - self.assertEqual('false', get_state_as_dict(xList.getChild('0'))['IsChecked']) - self.assertEqual('true', get_state_as_dict(xList.getChild('1'))['IsChecked']) - self.assertEqual('true', get_state_as_dict(xList.getChild('2'))['IsChecked']) - xCloseButton = xFloatWindow.getChild("cancel") - xCloseButton.executeAction("CLICK", tuple()) + self.ui_test.create_doc_in_start_center("calc") + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "A2", "0") + enter_text_to_cell(gridwin, "A3", "") + enter_text_to_cell(gridwin, "A4", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xList = xCheckListMenu.getChild("check_list_box") + + # tdf140745 show (empty) entry on top of the checkbox list + self.assertEqual(3, len(xList.getChildren())) + self.assertEqual("(empty)", get_state_as_dict(xList.getChild('0'))['Text']) + self.assertEqual("0", get_state_as_dict(xList.getChild('1'))['Text']) + self.assertEqual("1", get_state_as_dict(xList.getChild('2'))['Text']) + + xEntry = xList.getChild("0") + xEntry.executeAction("CLICK", tuple()) + + xOkButton = xFloatWindow.getChild("ok") + xOkButton.executeAction("CLICK", tuple()) + + self.assertFalse(is_row_hidden(document, 1)) + self.assertTrue(is_row_hidden(document, 2)) + self.assertFalse(is_row_hidden(document, 3)) + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(3, len(xList.getChildren())) + self.assertEqual('false', get_state_as_dict(xList.getChild('0'))['IsChecked']) + self.assertEqual('true', get_state_as_dict(xList.getChild('1'))['IsChecked']) + self.assertEqual('true', get_state_as_dict(xList.getChild('2'))['IsChecked']) + xCloseButton = xFloatWindow.getChild("cancel") + xCloseButton.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() def test_tdf138438(self): with self.ui_test.load_file(get_url_for_data_file("tdf138438.ods")) as doc: diff --git a/sc/qa/uitest/autofilter/autofilterBugs.py b/sc/qa/uitest/autofilter/autofilterBugs.py index 189c524c5f1a..ffb6419690ea 100644 --- a/sc/qa/uitest/autofilter/autofilterBugs.py +++ b/sc/qa/uitest/autofilter/autofilterBugs.py @@ -26,32 +26,34 @@ class autofilter(UITestCase): self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) def test_tdf94055(self): - with self.ui_test.create_doc_in_start_center("calc"): - document = self.ui_test.get_component() - calcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = calcDoc.getChild("grid_window") - enter_text_to_cell(xGridWindow, "A1", "X") - enter_text_to_cell(xGridWindow, "B1", "Y") - enter_text_to_cell(xGridWindow, "A2", "a") - enter_text_to_cell(xGridWindow, "B2", "b") - enter_text_to_cell(xGridWindow, "A3", "c") - enter_text_to_cell(xGridWindow, "B3", "d") - xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B1"})) - - self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter") - xDialog = self.xUITest.getTopFocusWindow() - xYesBtn = xDialog.getChild("yes") - self.ui_test.close_dialog_through_button(xYesBtn) - - xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A3"})) - self.xUITest.executeCommand(".uno:SelectRow") #select two rows - - self.ui_test.execute_dialog_through_command(".uno:DataSort") - xDialog = self.xUITest.getTopFocusWindow() - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #autofilter still exist - self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) + self.ui_test.create_doc_in_start_center("calc") + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = calcDoc.getChild("grid_window") + enter_text_to_cell(xGridWindow, "A1", "X") + enter_text_to_cell(xGridWindow, "B1", "Y") + enter_text_to_cell(xGridWindow, "A2", "a") + enter_text_to_cell(xGridWindow, "B2", "b") + enter_text_to_cell(xGridWindow, "A3", "c") + enter_text_to_cell(xGridWindow, "B3", "d") + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B1"})) + + self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter") + xDialog = self.xUITest.getTopFocusWindow() + xYesBtn = xDialog.getChild("yes") + self.ui_test.close_dialog_through_button(xYesBtn) + + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A3"})) + self.xUITest.executeCommand(".uno:SelectRow") #select two rows + + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #autofilter still exist + self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) + + self.ui_test.close_doc() #tdf77479.ods def test_tdf77479(self): diff --git a/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py b/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py index 51f3e1cf1efb..89be1bb51099 100644 --- a/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py +++ b/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py @@ -49,129 +49,130 @@ class tdf117276_autofilter_reset(UITestCase): self.assertEqual(2, self.get_values_count_in_AutoFilter(xGridWindow, "1")) def test_run(self): - with self.ui_test.create_doc_in_start_center("calc"): - document = self.ui_test.get_component() - calcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = calcDoc.getChild("grid_window") - - # self.ui_test.execute_dialog_through_command(".uno:Insert") # insert sheet - # xDialog = self.xUITest.getTopFocusWindow() - # xOKButton = xDialog.getChild("ok") - # xOKButton.executeAction("CLICK", tuple()) - - # 1. prepare document - # | A | B | - # ----------------------------------------- - # 1 | HEADER-A | HEADER-B | - # ----------------------------------------- - # 2 | Unique a2 | common value for B2:B4 | - # 3 | Unique a3 | common value for B2:B4 | - # 4 | Unique a4 | common value for B2:B4 | - # 5 | Unique a5 | Unique b5 | - # 6 | Unique a6 | Unique b6 | - # - # row-1 - enter_text_to_cell(xGridWindow, "A1", "HEADER-A") - enter_text_to_cell(xGridWindow, "B1", "HEADER-B") - - # row-1 - enter_text_to_cell(xGridWindow, "A2", "Unique a2") - enter_text_to_cell(xGridWindow, "B2", "common value for B2:B4") - - # row-2 - enter_text_to_cell(xGridWindow, "A3", "Unique a3") - enter_text_to_cell(xGridWindow, "B3", "common value for B2:B4") - - # row-3 - enter_text_to_cell(xGridWindow, "A4", "Unique a4") - enter_text_to_cell(xGridWindow, "B4", "common value for B2:B4") - - # row-4 - enter_text_to_cell(xGridWindow, "A5", "Unique a5") - enter_text_to_cell(xGridWindow, "B5", "Unique b5") - - # row-5 - enter_text_to_cell(xGridWindow, "A6", "Unique a6") - enter_text_to_cell(xGridWindow, "B6", "Unique b6") - - xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B6"})) - - # 2. switch on auto-filter - self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter") - xDialog = self.xUITest.getTopFocusWindow() - xYesBtn = xDialog.getChild("yes") - self.ui_test.close_dialog_through_button(xYesBtn) - - # autofilter still exist - self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) - - # 3. open filter of column A and deselect first 3 entries (Unique a2, Unique a3, Unique a4) - xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xCheckListMenu = xFloatWindow.getChild("check_list_menu") - xTreeList = xCheckListMenu.getChild("check_list_box") - - xEntry1 = xTreeList.getChild("0") - xEntry1.executeAction("CLICK", tuple()) # Unique a2 - xEntry2 = xTreeList.getChild("1") - xEntry2.executeAction("CLICK", tuple()) # Unique a3 - xEntry3 = xTreeList.getChild("2") - xEntry3.executeAction("CLICK", tuple()) # Unique a4 - - xOkButton = xFloatWindow.getChild("ok") - xOkButton.executeAction("CLICK", tuple()) - - # check filtering - # | A | B | - # ----------------------------------------- - # 1 | HEADER-A | HEADER-B | - # ----------------------------------------- - # 5 | Unique a5 | Unique b5 | - # 6 | Unique a6 | Unique b6 | - self.assertFalse(is_row_hidden(document, 0)) # column headers - self.assertTrue(is_row_hidden(document, 1)) - self.assertTrue(is_row_hidden(document, 2)) - self.assertTrue(is_row_hidden(document, 3)) - self.assertFalse(is_row_hidden(document, 4)) - self.assertFalse(is_row_hidden(document, 5)) - - self.assertEqual(5, self.get_values_count_in_AutoFilter(xGridWindow, "0")) - self.assertEqual(2, self.get_values_count_in_AutoFilter(xGridWindow, "1")) - - # 4. open filter of column B and deselect "Unique b5" - xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xCheckListMenu = xFloatWindow.getChild("check_list_menu") - xTreeList = xCheckListMenu.getChild("check_list_box") - - xEntry = xTreeList.getChild("0") - xEntry.executeAction("CLICK", tuple()) # Unique b5 - - xOkButton = xFloatWindow.getChild("ok") - xOkButton.executeAction("CLICK", tuple()) - - # check filtering - # | A | B | - # ----------------------------------------- - # 1 | HEADER-A | HEADER-B | - # ----------------------------------------- - # 6 | Unique a6 | Unique b6 | - self.check_state(document, xGridWindow) - - # 4. open filters of column A, B and close it using different buttons - self.openAutoFilterAndCloseIt(xGridWindow, "1", "ok") - self.check_state(document, xGridWindow) - - self.openAutoFilterAndCloseIt(xGridWindow, "1", "cancel") - self.check_state(document, xGridWindow) - - self.openAutoFilterAndCloseIt(xGridWindow, "0", "cancel") - self.check_state(document, xGridWindow) - - self.openAutoFilterAndCloseIt(xGridWindow, "0", "ok") - self.check_state(document, xGridWindow) - - # finish + self.ui_test.create_doc_in_start_center("calc") + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = calcDoc.getChild("grid_window") + +# self.ui_test.execute_dialog_through_command(".uno:Insert") # insert sheet +# xDialog = self.xUITest.getTopFocusWindow() +# xOKButton = xDialog.getChild("ok") +# xOKButton.executeAction("CLICK", tuple()) + + # 1. prepare document + # | A | B | + # ----------------------------------------- + # 1 | HEADER-A | HEADER-B | + # ----------------------------------------- + # 2 | Unique a2 | common value for B2:B4 | + # 3 | Unique a3 | common value for B2:B4 | + # 4 | Unique a4 | common value for B2:B4 | + # 5 | Unique a5 | Unique b5 | + # 6 | Unique a6 | Unique b6 | + # + # row-1 + enter_text_to_cell(xGridWindow, "A1", "HEADER-A") + enter_text_to_cell(xGridWindow, "B1", "HEADER-B") + + # row-1 + enter_text_to_cell(xGridWindow, "A2", "Unique a2") + enter_text_to_cell(xGridWindow, "B2", "common value for B2:B4") + + # row-2 + enter_text_to_cell(xGridWindow, "A3", "Unique a3") + enter_text_to_cell(xGridWindow, "B3", "common value for B2:B4") + + # row-3 + enter_text_to_cell(xGridWindow, "A4", "Unique a4") + enter_text_to_cell(xGridWindow, "B4", "common value for B2:B4") + + # row-4 + enter_text_to_cell(xGridWindow, "A5", "Unique a5") + enter_text_to_cell(xGridWindow, "B5", "Unique b5") + + # row-5 + enter_text_to_cell(xGridWindow, "A6", "Unique a6") + enter_text_to_cell(xGridWindow, "B6", "Unique b6") + + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B6"})) + + # 2. switch on auto-filter + self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter") + xDialog = self.xUITest.getTopFocusWindow() + xYesBtn = xDialog.getChild("yes") + self.ui_test.close_dialog_through_button(xYesBtn) + + # autofilter still exist + self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) + + # 3. open filter of column A and deselect first 3 entries (Unique a2, Unique a3, Unique a4) + xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xTreeList = xCheckListMenu.getChild("check_list_box") + + xEntry1 = xTreeList.getChild("0") + xEntry1.executeAction("CLICK", tuple()) # Unique a2 + xEntry2 = xTreeList.getChild("1") + xEntry2.executeAction("CLICK", tuple()) # Unique a3 + xEntry3 = xTreeList.getChild("2") + xEntry3.executeAction("CLICK", tuple()) # Unique a4 + + xOkButton = xFloatWindow.getChild("ok") + xOkButton.executeAction("CLICK", tuple()) + + # check filtering + # | A | B | + # ----------------------------------------- + # 1 | HEADER-A | HEADER-B | + # ----------------------------------------- + # 5 | Unique a5 | Unique b5 | + # 6 | Unique a6 | Unique b6 | + self.assertFalse(is_row_hidden(document, 0)) # column headers + self.assertTrue(is_row_hidden(document, 1)) + self.assertTrue(is_row_hidden(document, 2)) + self.assertTrue(is_row_hidden(document, 3)) + self.assertFalse(is_row_hidden(document, 4)) + self.assertFalse(is_row_hidden(document, 5)) + + self.assertEqual(5, self.get_values_count_in_AutoFilter(xGridWindow, "0")) + self.assertEqual(2, self.get_values_count_in_AutoFilter(xGridWindow, "1")) + + # 4. open filter of column B and deselect "Unique b5" + xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xTreeList = xCheckListMenu.getChild("check_list_box") + + xEntry = xTreeList.getChild("0") + xEntry.executeAction("CLICK", tuple()) # Unique b5 + + xOkButton = xFloatWindow.getChild("ok") + xOkButton.executeAction("CLICK", tuple()) + + # check filtering + # | A | B | + # ----------------------------------------- + # 1 | HEADER-A | HEADER-B | + # ----------------------------------------- + # 6 | Unique a6 | Unique b6 | + self.check_state(document, xGridWindow) + + # 4. open filters of column A, B and close it using different buttons + self.openAutoFilterAndCloseIt(xGridWindow, "1", "ok") + self.check_state(document, xGridWindow) + + self.openAutoFilterAndCloseIt(xGridWindow, "1", "cancel") + self.check_state(document, xGridWindow) + + self.openAutoFilterAndCloseIt(xGridWindow, "0", "cancel") + self.check_state(document, xGridWindow) + + self.openAutoFilterAndCloseIt(xGridWindow, "0", "ok") + self.check_state(document, xGridWindow) + + # finish + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter/tdf126306.py b/sc/qa/uitest/autofilter/tdf126306.py index 71102365fd5e..73f8d83f8b85 100644 --- a/sc/qa/uitest/autofilter/tdf126306.py +++ b/sc/qa/uitest/autofilter/tdf126306.py @@ -21,119 +21,120 @@ class tdf126306(UITestCase): self.assertEqual(bVisible, value) def test_run(self): - with self.ui_test.create_doc_in_start_center("calc"): - document = self.ui_test.get_component() - calcDoc = self.xUITest.getTopFocusWindow() - xGridWin = calcDoc.getChild("grid_window") - - default_values = [25, 1023, 17, 9, 19, 0, 107, 89, 8, 453, 33, 3, 25, 204] - document = self.ui_test.get_component() - - for i, value in enumerate(default_values, start=2): - enter_text_to_cell(xGridWin, "A" + str(i), str(value)) - - xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A15"})) - - self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter") - xDialog = self.xUITest.getTopFocusWindow() - xYesBtn = xDialog.getChild("yes") - self.ui_test.close_dialog_through_button(xYesBtn) - - self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) - - self.check_values(document, default_values) - self.check_row_hidden(document) - - # Sort ascending button - xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xMenu = xFloatWindow.getChild("menu") - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SPACE"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) - - sort_asc_values = [0, 3, 8, 9, 17, 19, 25, 25, 33, 89, 107, 204, 453, 1023] - self.check_values(document, sort_asc_values) - self.check_row_hidden(document) - - #Undo - self.xUITest.executeCommand(".uno:Undo") - self.check_values(document, default_values) - self.check_row_hidden(document) - - # Sort descending button - xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xMenu = xFloatWindow.getChild("menu") - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) - - sort_des_values = [1023, 453, 204, 107, 89, 33, 25, 25, 19, 17, 9, 8, 3, 0] - self.check_values(document, sort_des_values) - self.check_row_hidden(document) - - #Undo - self.xUITest.executeCommand(".uno:Undo") - self.check_values(document, default_values) - self.check_row_hidden(document) - - # Top 10 button - xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xMenu = xFloatWindow.getChild("menu") - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) - - top10_hidden_values = [True, True, True, False, True, False, True, - True, False, True, True, False, True, True] - - #Values are the same - self.check_values(document, default_values) - self.check_row_hidden(document, top10_hidden_values) - - #Undo - self.xUITest.executeCommand(".uno:Undo") - self.check_values(document, default_values) - self.check_row_hidden(document) - - # Empty button - xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xMenu = xFloatWindow.getChild("menu") - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) - - empty_values = [False] * 14 - #Values are the same - self.check_values(document, default_values) - self.check_row_hidden(document, empty_values) - - #Undo - self.xUITest.executeCommand(".uno:Undo") - self.check_values(document, default_values) - self.check_row_hidden(document) - - # Not Empty button - xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xMenu = xFloatWindow.getChild("menu") - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) - - #Nothing should change - self.check_values(document, default_values) - self.check_row_hidden(document) - - #Undo - self.xUITest.executeCommand(".uno:Undo") - self.check_values(document, default_values) - self.check_row_hidden(document) - - # finish + self.ui_test.create_doc_in_start_center("calc") + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + xGridWin = calcDoc.getChild("grid_window") + + default_values = [25, 1023, 17, 9, 19, 0, 107, 89, 8, 453, 33, 3, 25, 204] + document = self.ui_test.get_component() + + for i, value in enumerate(default_values, start=2): + enter_text_to_cell(xGridWin, "A" + str(i), str(value)) + + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A15"})) + + self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter") + xDialog = self.xUITest.getTopFocusWindow() + xYesBtn = xDialog.getChild("yes") + self.ui_test.close_dialog_through_button(xYesBtn) + + self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) + + self.check_values(document, default_values) + self.check_row_hidden(document) + + # Sort ascending button + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xMenu = xFloatWindow.getChild("menu") + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SPACE"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + sort_asc_values = [0, 3, 8, 9, 17, 19, 25, 25, 33, 89, 107, 204, 453, 1023] + self.check_values(document, sort_asc_values) + self.check_row_hidden(document) + + #Undo + self.xUITest.executeCommand(".uno:Undo") + self.check_values(document, default_values) + self.check_row_hidden(document) + + # Sort descending button + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xMenu = xFloatWindow.getChild("menu") + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + sort_des_values = [1023, 453, 204, 107, 89, 33, 25, 25, 19, 17, 9, 8, 3, 0] + self.check_values(document, sort_des_values) + self.check_row_hidden(document) + + #Undo + self.xUITest.executeCommand(".uno:Undo") + self.check_values(document, default_values) + self.check_row_hidden(document) + + # Top 10 button + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xMenu = xFloatWindow.getChild("menu") + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + top10_hidden_values = [True, True, True, False, True, False, True, + True, False, True, True, False, True, True] + + #Values are the same + self.check_values(document, default_values) + self.check_row_hidden(document, top10_hidden_values) + + #Undo + self.xUITest.executeCommand(".uno:Undo") + self.check_values(document, default_values) + self.check_row_hidden(document) + + # Empty button + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xMenu = xFloatWindow.getChild("menu") + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + empty_values = [False] * 14 + #Values are the same + self.check_values(document, default_values) + self.check_row_hidden(document, empty_values) + + #Undo + self.xUITest.executeCommand(".uno:Undo") + self.check_values(document, default_values) + self.check_row_hidden(document) + + # Not Empty button + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xMenu = xFloatWindow.getChild("menu") + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + #Nothing should change + self.check_values(document, default_values) + self.check_row_hidden(document) + + #Undo + self.xUITest.executeCommand(".uno:Undo") + self.check_values(document, default_values) + self.check_row_hidden(document) + + # finish + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter/tdf141559.py b/sc/qa/uitest/autofilter/tdf141559.py index dc09609f5655..6bce18852ff3 100644 --- a/sc/qa/uitest/autofilter/tdf141559.py +++ b/sc/qa/uitest/autofilter/tdf141559.py @@ -15,77 +15,79 @@ from uitest.uihelper.common import get_state_as_dict class tdf141559(UITestCase): def test_tdf141559_clear_filter(self): - with self.ui_test.create_doc_in_start_center("calc"): - document = self.ui_test.get_component() - calcDoc = self.xUITest.getTopFocusWindow() - gridwin = calcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - enter_text_to_cell(gridwin, "A1", "A") - enter_text_to_cell(gridwin, "A2", "1") - enter_text_to_cell(gridwin, "A3", "2") - enter_text_to_cell(gridwin, "A4", "3") - - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) - - self.xUITest.executeCommand(".uno:DataFilterAutoFilter") - - gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - #Choose Standard Filter... button - xMenu = xFloatWindow.getChild("menu") - - # check last item: 'Standard Filter...' (new menu item 'Clear Filter' is optional) - nLastIdx = int(get_state_as_dict(xMenu)['Children']) - 1 - self.assertEqual(10, nLastIdx) - self.assertEqual('Standard Filter...', get_state_as_dict(xMenu.getChild(str(nLastIdx)))['Text']) - - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - self.assertEqual("Standard Filter...", get_state_as_dict(xMenu)['SelectEntryText']) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) - - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xcond1 = xDialog.getChild("cond1") - xval1 = xDialog.getChild("val1") - - select_by_text(xfield1, "A") - select_by_text(xcond1, ">") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - row = get_row(document, 1) - self.assertFalse(row.getPropertyValue("IsVisible")) - - gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - #Choose Clear Filter button - xMenu = xFloatWindow.getChild("menu") - - # check last item: 'Clear Filter' - nLastIdx = int(get_state_as_dict(xMenu)['Children']) - 1 - self.assertEqual(11, nLastIdx) - self.assertEqual('Clear Filter', get_state_as_dict(xMenu.getChild(str(nLastIdx)))['Text']) - - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - # Use new menu item "Clear Filter" to remove the standard filter condition - self.assertEqual("Clear Filter", get_state_as_dict(xMenu)['SelectEntryText']) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) - - self.assertTrue(row.getPropertyValue("IsVisible")) + self.ui_test.create_doc_in_start_center("calc") + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "A2", "1") + enter_text_to_cell(gridwin, "A3", "2") + enter_text_to_cell(gridwin, "A4", "3") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + #Choose Standard Filter... button + xMenu = xFloatWindow.getChild("menu") + + # check last item: 'Standard Filter...' (new menu item 'Clear Filter' is optional) + nLastIdx = int(get_state_as_dict(xMenu)['Children']) - 1 + self.assertEqual(10, nLastIdx) + self.assertEqual('Standard Filter...', get_state_as_dict(xMenu.getChild(str(nLastIdx)))['Text']) + + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + self.assertEqual("Standard Filter...", get_state_as_dict(xMenu)['SelectEntryText']) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xcond1 = xDialog.getChild("cond1") + xval1 = xDialog.getChild("val1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, ">") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + row = get_row(document, 1) + self.assertFalse(row.getPropertyValue("IsVisible")) + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + #Choose Clear Filter button + xMenu = xFloatWindow.getChild("menu") + + # check last item: 'Clear Filter' + nLastIdx = int(get_state_as_dict(xMenu)['Children']) - 1 + self.assertEqual(11, nLastIdx) + self.assertEqual('Clear Filter', get_state_as_dict(xMenu.getChild(str(nLastIdx)))['Text']) + + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + # Use new menu item "Clear Filter" to remove the standard filter condition + self.assertEqual("Clear Filter", get_state_as_dict(xMenu)['SelectEntryText']) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + self.assertTrue(row.getPropertyValue("IsVisible")) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter/tdf141946.py b/sc/qa/uitest/autofilter/tdf141946.py index 464728e8ef9c..4e45ecfb7d5a 100644 --- a/sc/qa/uitest/autofilter/tdf141946.py +++ b/sc/qa/uitest/autofilter/tdf141946.py @@ -12,62 +12,64 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf141946(UITestCase): def test_tdf141946_inserted_column(self): - with self.ui_test.create_doc_in_start_center("calc"): - document = self.ui_test.get_component() - calcDoc = self.xUITest.getTopFocusWindow() - gridwin = calcDoc.getChild("grid_window") - document = self.ui_test.get_component() + self.ui_test.create_doc_in_start_center("calc") + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "A") - enter_text_to_cell(gridwin, "A2", "1") - enter_text_to_cell(gridwin, "A3", "2") - enter_text_to_cell(gridwin, "A4", "3") + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "A2", "1") + enter_text_to_cell(gridwin, "A3", "2") + enter_text_to_cell(gridwin, "A4", "3") - enter_text_to_cell(gridwin, "B1", "B") - enter_text_to_cell(gridwin, "B2", "4") - enter_text_to_cell(gridwin, "B3", "5") - enter_text_to_cell(gridwin, "B4", "6") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "B2", "4") + enter_text_to_cell(gridwin, "B3", "5") + enter_text_to_cell(gridwin, "B4", "6") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B4"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B4"})) - self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") - gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xCheckListMenu = xFloatWindow.getChild("check_list_menu") - xList = xCheckListMenu.getChild("check_list_box") - xEntry = xList.getChild("1") - xEntry.executeAction("CLICK", tuple()) + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xList = xCheckListMenu.getChild("check_list_box") + xEntry = xList.getChild("1") + xEntry.executeAction("CLICK", tuple()) - xOkButton = xFloatWindow.getChild("ok") - xOkButton.executeAction("CLICK", tuple()) + xOkButton = xFloatWindow.getChild("ok") + xOkButton.executeAction("CLICK", tuple()) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) - self.xUITest.executeCommand(".uno:InsertColumnsBefore") + self.xUITest.executeCommand(".uno:InsertColumnsBefore") - gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xCheckListMenu = xFloatWindow.getChild("check_list_menu") - xList = xCheckListMenu.getChild("check_list_box") - self.assertEqual(2, len(xList.getChildren())) - xCloseBtn = xFloatWindow.getChild("cancel") - xCloseBtn.executeAction("CLICK", tuple()) + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(2, len(xList.getChildren())) + xCloseBtn = xFloatWindow.getChild("cancel") + xCloseBtn.executeAction("CLICK", tuple()) - gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xCheckListMenu = xFloatWindow.getChild("check_list_menu") - xList = xCheckListMenu.getChild("check_list_box") - self.assertEqual(1, len(xList.getChildren())) - xCloseBtn = xFloatWindow.getChild("cancel") - xCloseBtn.executeAction("CLICK", tuple()) + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(1, len(xList.getChildren())) + xCloseBtn = xFloatWindow.getChild("cancel") + xCloseBtn.executeAction("CLICK", tuple()) - gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xCheckListMenu = xFloatWindow.getChild("check_list_menu") - xList = xCheckListMenu.getChild("check_list_box") - self.assertEqual(3, len(xList.getChildren())) - xCloseBtn = xFloatWindow.getChild("cancel") - xCloseBtn.executeAction("CLICK", tuple()) + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(3, len(xList.getChildren())) + xCloseBtn = xFloatWindow.getChild("cancel") + xCloseBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter/tdf36383.py b/sc/qa/uitest/autofilter/tdf36383.py index 9c341845b617..d55db21837b3 100644 --- a/sc/qa/uitest/autofilter/tdf36383.py +++ b/sc/qa/uitest/autofilter/tdf36383.py @@ -13,54 +13,56 @@ from libreoffice.calc.document import get_row class tdf36383(UITestCase): def test_tdf36383_row_height(self): - with self.ui_test.create_doc_in_start_center("calc"): - document = self.ui_test.get_component() - calcDoc = self.xUITest.getTopFocusWindow() - gridwin = calcDoc.getChild("grid_window") - document = self.ui_test.get_component() + self.ui_test.create_doc_in_start_center("calc") + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "A") - enter_text_to_cell(gridwin, "A2", "1") - enter_text_to_cell(gridwin, "A3", "2") - enter_text_to_cell(gridwin, "A4", "3") + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "A2", "1") + enter_text_to_cell(gridwin, "A3", "2") + enter_text_to_cell(gridwin, "A4", "3") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) - self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") - gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xCheckListMenu = xFloatWindow.getChild("check_list_menu") - xList = xCheckListMenu.getChild("check_list_box") - xEntry = xList.getChild("1") - xEntry.executeAction("CLICK", tuple()) + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xList = xCheckListMenu.getChild("check_list_box") + xEntry = xList.getChild("1") + xEntry.executeAction("CLICK", tuple()) - xOkButton = xFloatWindow.getChild("ok") - xOkButton.executeAction("CLICK", tuple()) + xOkButton = xFloatWindow.getChild("ok") + xOkButton.executeAction("CLICK", tuple()) - row = get_row(document, 2) - self.assertFalse(row.getPropertyValue("IsVisible")) + row = get_row(document, 2) + self.assertFalse(row.getPropertyValue("IsVisible")) - #row height - self.ui_test.execute_dialog_through_command(".uno:RowHeight") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + #row height + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) - self.assertFalse(row.getPropertyValue("IsVisible")) + self.assertFalse(row.getPropertyValue("IsVisible")) - #optimal row height - self.ui_test.execute_dialog_through_command(".uno:SetOptimalRowHeight") - xDialog = self.xUITest.getTopFocusWindow() + #optimal row height + self.ui_test.execute_dialog_through_command(".uno:SetOptimalRowHeight") + xDialog = self.xUITest.getTopFocusWindow() - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) - self.assertFalse(row.getPropertyValue("IsVisible")) + self.assertFalse(row.getPropertyValue("IsVisible")) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter/tdf46062.py b/sc/qa/uitest/autofilter/tdf46062.py index 769d20fd31b1..41b42eb0e475 100644 --- a/sc/qa/uitest/autofilter/tdf46062.py +++ b/sc/qa/uitest/autofilter/tdf46062.py @@ -13,35 +13,37 @@ class tdf46062(UITestCase): def test_tdf46062(self): - with self.ui_test.create_doc_in_start_center("calc"): - calcDoc = self.xUITest.getTopFocusWindow() - gridwin = calcDoc.getChild("grid_window") - - enter_text_to_cell(gridwin, "A1", "spaces") - enter_text_to_cell(gridwin, "A2", " ") - enter_text_to_cell(gridwin, "A3", " ") - enter_text_to_cell(gridwin, "A4", " ") - - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) - - self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter") - xDialog = self.xUITest.getTopFocusWindow() - xYesBtn = xDialog.getChild("yes") - self.ui_test.close_dialog_through_button(xYesBtn) - - gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xCheckListMenu = xFloatWindow.getChild("check_list_menu") - xList = xCheckListMenu.getChild("check_list_box") - self.assertEqual(3, len(xList.getChildren())) - - # Without the fix in place, this test would have failed with - # AssertionError: '" "' != ' ' - self.assertEqual('" "', get_state_as_dict(xList.getChild("0"))['Text']) - self.assertEqual('" "', get_state_as_dict(xList.getChild("1"))['Text']) - self.assertEqual('" "', get_state_as_dict(xList.getChild("2"))['Text']) - - xOkButton = xFloatWindow.getChild("ok") - xOkButton.executeAction("CLICK", tuple()) + self.ui_test.create_doc_in_start_center("calc") + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "spaces") + enter_text_to_cell(gridwin, "A2", " ") + enter_text_to_cell(gridwin, "A3", " ") + enter_text_to_cell(gridwin, "A4", " ") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + + self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter") + xDialog = self.xUITest.getTopFocusWindow() + xYesBtn = xDialog.getChild("yes") + self.ui_test.close_dialog_through_button(xYesBtn) + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(3, len(xList.getChildren())) + + # Without the fix in place, this test would have failed with + # AssertionError: '" "' != ' ' + self.assertEqual('" "', get_state_as_dict(xList.getChild("0"))['Text']) + self.assertEqual('" "', get_state_as_dict(xList.getChild("1"))['Text']) + self.assertEqual('" "', get_state_as_dict(xList.getChild("2"))['Text']) + + xOkButton = xFloatWindow.getChild("ok") + xOkButton.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter/tdf48025.py b/sc/qa/uitest/autofilter/tdf48025.py index dbbdefe5ff42..c5d5c711da5f 100644 --- a/sc/qa/uitest/autofilter/tdf48025.py +++ b/sc/qa/uitest/autofilter/tdf48025.py @@ -12,59 +12,61 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf48025(UITestCase): def test_tdf48025_deleted_columns(self): - with self.ui_test.create_doc_in_start_center("calc"): - document = self.ui_test.get_component() - calcDoc = self.xUITest.getTopFocusWindow() - gridwin = calcDoc.getChild("grid_window") - document = self.ui_test.get_component() + self.ui_test.create_doc_in_start_center("calc") + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "A") - enter_text_to_cell(gridwin, "A2", "1") - enter_text_to_cell(gridwin, "A3", "2") - enter_text_to_cell(gridwin, "A4", "3") + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "A2", "1") + enter_text_to_cell(gridwin, "A3", "2") + enter_text_to_cell(gridwin, "A4", "3") - enter_text_to_cell(gridwin, "B1", "B") - enter_text_to_cell(gridwin, "B2", "4") - enter_text_to_cell(gridwin, "B3", "5") - enter_text_to_cell(gridwin, "B4", "6") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "B2", "4") + enter_text_to_cell(gridwin, "B3", "5") + enter_text_to_cell(gridwin, "B4", "6") - enter_text_to_cell(gridwin, "C1", "C") - enter_text_to_cell(gridwin, "C2", "7") - enter_text_to_cell(gridwin, "C3", "8") - enter_text_to_cell(gridwin, "C4", "9") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "C2", "7") + enter_text_to_cell(gridwin, "C3", "8") + enter_text_to_cell(gridwin, "C4", "9") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C4"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C4"})) - self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") - gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xCheckListMenu = xFloatWindow.getChild("check_list_menu") - xList = xCheckListMenu.getChild("check_list_box") - xEntry = xList.getChild("1") - xEntry.executeAction("CLICK", tuple()) + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xList = xCheckListMenu.getChild("check_list_box") + xEntry = xList.getChild("1") + xEntry.executeAction("CLICK", tuple()) - xOkButton = xFloatWindow.getChild("ok") - xOkButton.executeAction("CLICK", tuple()) + xOkButton = xFloatWindow.getChild("ok") + xOkButton.executeAction("CLICK", tuple()) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.xUITest.executeCommand(".uno:DeleteColumns") + self.xUITest.executeCommand(".uno:DeleteColumns") - gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xCheckListMenu = xFloatWindow.getChild("check_list_menu") - xList = xCheckListMenu.getChild("check_list_box") - self.assertEqual(3, len(xList.getChildren())) - xCloseBtn = xFloatWindow.getChild("cancel") - xCloseBtn.executeAction("CLICK", tuple()) + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(3, len(xList.getChildren())) + xCloseBtn = xFloatWindow.getChild("cancel") + xCloseBtn.executeAction("CLICK", tuple()) - gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xCheckListMenu = xFloatWindow.getChild("check_list_menu") - xList = xCheckListMenu.getChild("check_list_box") - self.assertEqual(2, len(xList.getChildren())) - xCloseBtn = xFloatWindow.getChild("cancel") - xCloseBtn.executeAction("CLICK", tuple()) + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(2, len(xList.getChildren())) + xCloseBtn = xFloatWindow.getChild("cancel") + xCloseBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter/tdf68113.py b/sc/qa/uitest/autofilter/tdf68113.py index 5a65398866ef..f62ac9ce95c0 100644 --- a/sc/qa/uitest/autofilter/tdf68113.py +++ b/sc/qa/uitest/autofilter/tdf68113.py @@ -13,63 +13,65 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf68113(UITestCase): def test_tdf68113_empty_notempty_button(self): - with self.ui_test.create_doc_in_start_center("calc"): - document = self.ui_test.get_component() - calcDoc = self.xUITest.getTopFocusWindow() - xGridWin = calcDoc.getChild("grid_window") - document = self.ui_test.get_component() + self.ui_test.create_doc_in_start_center("calc") + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + xGridWin = calcDoc.getChild("grid_window") + document = self.ui_test.get_component() - enter_text_to_cell(xGridWin, "A1", "A") - enter_text_to_cell(xGridWin, "A2", "1") - enter_text_to_cell(xGridWin, "A3", "2") - enter_text_to_cell(xGridWin, "A5", "4") - enter_text_to_cell(xGridWin, "A7", "6") + enter_text_to_cell(xGridWin, "A1", "A") + enter_text_to_cell(xGridWin, "A2", "1") + enter_text_to_cell(xGridWin, "A3", "2") + enter_text_to_cell(xGridWin, "A5", "4") + enter_text_to_cell(xGridWin, "A7", "6") - xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A7"})) + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A7"})) - self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") - # Empty button - xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xMenu = xFloatWindow.getChild("menu") - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + # Empty button + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xMenu = xFloatWindow.getChild("menu") + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) - # Checkbox elements - xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xCheckListMenu = xFloatWindow.getChild("check_list_menu") - xTreeList = xCheckListMenu.getChild("check_list_box") - self.assertEqual(5, len(xTreeList.getChildren())) - self.assertEqual('true', get_state_as_dict(xTreeList.getChild('0'))['IsChecked']) - self.assertEqual('false', get_state_as_dict(xTreeList.getChild('2'))['IsChecked']) - self.assertEqual('false', get_state_as_dict(xTreeList.getChild('4'))['IsChecked']) - xCancelBtn = xFloatWindow.getChild("cancel") - xCancelBtn.executeAction("CLICK", tuple()) + # Checkbox elements + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xTreeList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(5, len(xTreeList.getChildren())) + self.assertEqual('true', get_state_as_dict(xTreeList.getChild('0'))['IsChecked']) + self.assertEqual('false', get_state_as_dict(xTreeList.getChild('2'))['IsChecked']) + self.assertEqual('false', get_state_as_dict(xTreeList.getChild('4'))['IsChecked']) + xCancelBtn = xFloatWindow.getChild("cancel") + xCancelBtn.executeAction("CLICK", tuple()) - # Not Empty button - xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xMenu = xFloatWindow.getChild("menu") - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + # Not Empty button + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xMenu = xFloatWindow.getChild("menu") + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) - # Checkbox elements - xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) - xFloatWindow = self.xUITest.getFloatWindow() - xCheckListMenu = xFloatWindow.getChild("check_list_menu") - xTreeList = xCheckListMenu.getChild("check_list_box") - self.assertEqual(5, len(xTreeList.getChildren())) - self.assertEqual('false', get_state_as_dict(xTreeList.getChild('0'))['IsChecked']) - self.assertEqual('true', get_state_as_dict(xTreeList.getChild('2'))['IsChecked']) - self.assertEqual('true', get_state_as_dict(xTreeList.getChild('4'))['IsChecked']) - xCancelBtn = xFloatWindow.getChild("cancel") - xCancelBtn.executeAction("CLICK", tuple()) + # Checkbox elements + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xTreeList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(5, len(xTreeList.getChildren())) + self.assertEqual('false', get_state_as_dict(xTreeList.getChild('0'))['IsChecked']) + self.assertEqual('true', get_state_as_dict(xTreeList.getChild('2'))['IsChecked']) + self.assertEqual('true', get_state_as_dict(xTreeList.getChild('4'))['IsChecked']) + xCancelBtn = xFloatWindow.getChild("cancel") + xCancelBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/CalcPasteOnly.py b/sc/qa/uitest/calc_tests/CalcPasteOnly.py index 1c567549af66..414f58230a51 100644 --- a/sc/qa/uitest/calc_tests/CalcPasteOnly.py +++ b/sc/qa/uitest/calc_tests/CalcPasteOnly.py @@ -13,28 +13,29 @@ from uitest.uihelper.calc import enter_text_to_cell class CalcPasteOnly(UITestCase): def test_paste_only(self): - with self.ui_test.create_doc_in_start_center("calc"): - xTopWindow = self.xUITest.getTopFocusWindow() - document = self.ui_test.get_component() - gridwin = xTopWindow.getChild("grid_window") - - enter_text_to_cell(gridwin, "A1", "=SUM(A2:A3)") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.xUITest.executeCommand(".uno:Copy") - - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) - self.xUITest.executeCommand(".uno:PasteOnlyText") - self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "") - - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) - self.xUITest.executeCommand(".uno:PasteOnlyValue") - self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "0") - self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 0) - - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"})) - self.xUITest.executeCommand(".uno:PasteOnlyFormula") - self.assertEqual(get_cell_by_position(document, 0, 4, 0).getString(), "0") - self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 4, 0).getFormula(), "=SUM(E2:E3)") - + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xTopWindow = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + gridwin = xTopWindow.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "=SUM(A2:A3)") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:Copy") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + self.xUITest.executeCommand(".uno:PasteOnlyText") + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + self.xUITest.executeCommand(".uno:PasteOnlyValue") + self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "0") + self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 0) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"})) + self.xUITest.executeCommand(".uno:PasteOnlyFormula") + self.assertEqual(get_cell_by_position(document, 0, 4, 0).getString(), "0") + self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 4, 0).getFormula(), "=SUM(E2:E3)") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/CellDropDownItems.py b/sc/qa/uitest/calc_tests/CellDropDownItems.py index ffef1e8c6644..7b089751cff5 100644 --- a/sc/qa/uitest/calc_tests/CellDropDownItems.py +++ b/sc/qa/uitest/calc_tests/CellDropDownItems.py @@ -13,72 +13,74 @@ class CellDropDownItems(UITestCase): def test_dropdownitems(self): #This is to test Dropdown items in grid window - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - #select cell C10 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C10"})) - - #Open Validation Dialog - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - - #Select List option - xallow = xDialog.getChild("allow") - xallow.executeAction("SELECT", mkPropertyValues({"POS": "6"})) - - #Add items to the List - xminlist = xDialog.getChild("minlist") - xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item1"})) - xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item2"})) - xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item3"})) - xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item4"})) - xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item5"})) - - #Close the dialog - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) - - #Launch the Select Menu to view the list ans select first item in the list - gridwin = xCalcDoc.getChild("grid_window") - gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "2", "ROW": "9"})) - - #Select the TreeList UI Object - xWin = self.xUITest.getTopFocusWindow() - xlist = xWin.getChild("list") - - xListItem = xlist.getChild('0') - xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) ) - self.assertEqual(get_cell_by_position(document, 0, 2, 9).getString(), "Item1") - - #Launch the Select Menu to view the list ans select Third item in the list - gridwin = xCalcDoc.getChild("grid_window") - gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "2", "ROW": "9"})) - - #Select the TreeList UI Object - xWin = self.xUITest.getTopFocusWindow() - xlist = xWin.getChild("list") - - xListItem = xlist.getChild('2') - xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) ) - self.assertEqual(get_cell_by_position(document, 0, 2, 9).getString(), "Item3") - - #Launch the Select Menu to view the list ans select Fifth item in the list - gridwin = xCalcDoc.getChild("grid_window") - gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "2", "ROW": "9"})) - - #Select the TreeList UI Object - xWin = self.xUITest.getTopFocusWindow() - xlist = xWin.getChild("list") - - xListItem = xlist.getChild('4') - xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) ) - self.assertEqual(get_cell_by_position(document, 0, 2, 9).getString(), "Item5") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #select cell C10 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C10"})) + + #Open Validation Dialog + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + + #Select List option + xallow = xDialog.getChild("allow") + xallow.executeAction("SELECT", mkPropertyValues({"POS": "6"})) + + #Add items to the List + xminlist = xDialog.getChild("minlist") + xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item1"})) + xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item2"})) + xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item3"})) + xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item4"})) + xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item5"})) + + #Close the dialog + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + + #Launch the Select Menu to view the list ans select first item in the list + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "2", "ROW": "9"})) + + #Select the TreeList UI Object + xWin = self.xUITest.getTopFocusWindow() + xlist = xWin.getChild("list") + + xListItem = xlist.getChild('0') + xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) ) + self.assertEqual(get_cell_by_position(document, 0, 2, 9).getString(), "Item1") + + #Launch the Select Menu to view the list ans select Third item in the list + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "2", "ROW": "9"})) + + #Select the TreeList UI Object + xWin = self.xUITest.getTopFocusWindow() + xlist = xWin.getChild("list") + + xListItem = xlist.getChild('2') + xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) ) + self.assertEqual(get_cell_by_position(document, 0, 2, 9).getString(), "Item3") + + #Launch the Select Menu to view the list ans select Fifth item in the list + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "2", "ROW": "9"})) + + #Select the TreeList UI Object + xWin = self.xUITest.getTopFocusWindow() + xlist = xWin.getChild("list") + + xListItem = xlist.getChild('4') + xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) ) + self.assertEqual(get_cell_by_position(document, 0, 2, 9).getString(), "Item5") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/Comments.py b/sc/qa/uitest/calc_tests/Comments.py index dc06f37f5a28..3841686d99f5 100644 --- a/sc/qa/uitest/calc_tests/Comments.py +++ b/sc/qa/uitest/calc_tests/Comments.py @@ -10,37 +10,39 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class Comments(UITestCase): def test_comment(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - # Select Cell D8 - gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "0"})) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D8"})) - - # Create comment and open it's window - gridwin.executeAction("COMMENT", mkPropertyValues({"OPEN": ""})) - - # Write text in the Comment Window - gridwin.executeAction("TYPE", mkPropertyValues({"TEXT": "First Comment"})) - - # Close Comment Window - gridwin.executeAction("COMMENT", mkPropertyValues({"CLOSE":""})) - - # Check on the comment text - self.assertEqual(get_state_as_dict(gridwin)["CurrentCellCommentText"], "First Comment") - - # Check on comment in another cell - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - gridwin.executeAction("COMMENT", mkPropertyValues({"OPEN": ""})) - gridwin.executeAction("TYPE", mkPropertyValues({"TEXT": "Second Comment"})) - gridwin.executeAction("COMMENT", mkPropertyValues({"CLOSE":""})) - self.assertEqual(get_state_as_dict(gridwin)["CurrentCellCommentText"], "Second Comment") - - # Write Comment without opening Comment window - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B5"})) - gridwin.executeAction("COMMENT", mkPropertyValues({"SETTEXT": "Third Comment"})) - self.assertEqual(get_state_as_dict(gridwin)["CurrentCellCommentText"], "Third Comment") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + # Select Cell D8 + gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "0"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D8"})) + + # Create comment and open it's window + gridwin.executeAction("COMMENT", mkPropertyValues({"OPEN": ""})) + + # Write text in the Comment Window + gridwin.executeAction("TYPE", mkPropertyValues({"TEXT": "First Comment"})) + + # Close Comment Window + gridwin.executeAction("COMMENT", mkPropertyValues({"CLOSE":""})) + + # Check on the comment text + self.assertEqual(get_state_as_dict(gridwin)["CurrentCellCommentText"], "First Comment") + + # Check on comment in another cell + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("COMMENT", mkPropertyValues({"OPEN": ""})) + gridwin.executeAction("TYPE", mkPropertyValues({"TEXT": "Second Comment"})) + gridwin.executeAction("COMMENT", mkPropertyValues({"CLOSE":""})) + self.assertEqual(get_state_as_dict(gridwin)["CurrentCellCommentText"], "Second Comment") + + # Write Comment without opening Comment window + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B5"})) + gridwin.executeAction("COMMENT", mkPropertyValues({"SETTEXT": "Third Comment"})) + self.assertEqual(get_state_as_dict(gridwin)["CurrentCellCommentText"], "Third Comment") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/autofill.py b/sc/qa/uitest/calc_tests/autofill.py index 1c3257573ace..57691ef5c499 100644 --- a/sc/qa/uitest/calc_tests/autofill.py +++ b/sc/qa/uitest/calc_tests/autofill.py @@ -123,21 +123,22 @@ class CalcAutofill(UITestCase): self.assertEqual(get_cell_by_position(document, 0, 15, 11).getString(), "10.64.127.7") def test_autofill_with_suffix(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "1st") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"})) - self.ui_test.execute_dialog_through_command(".uno:FillSeries") - xDialog = self.xUITest.getTopFocusWindow() - xautofill = xDialog.getChild("autofill") - xautofill.executeAction("CLICK", tuple()) - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "1st") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "2nd") - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "3rd") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "1st") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"})) + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xautofill = xDialog.getChild("autofill") + xautofill.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "1st") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "2nd") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "3rd") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/calcSheetDelete.py b/sc/qa/uitest/calc_tests/calcSheetDelete.py index eabc9b5c28c3..ae8867c6f97c 100644 --- a/sc/qa/uitest/calc_tests/calcSheetDelete.py +++ b/sc/qa/uitest/calc_tests/calcSheetDelete.py @@ -13,130 +13,137 @@ class calcSheetDelete(UITestCase): def test_tdf114228_insert_and_delete_sheet(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "L12"})) - nrSheets = document.Sheets.getCount() #default number + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "L12"})) + nrSheets = document.Sheets.getCount() #default number - self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet - xDialog = self.xUITest.getTopFocusWindow() - xOKButton = xDialog.getChild("ok") - xOKButton.executeAction("CLICK", tuple()) + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) - self.assertEqual(document.Sheets.getCount(), nrSheets + 1) + self.assertEqual(document.Sheets.getCount(), nrSheets + 1) - self.ui_test.execute_dialog_through_command(".uno:Remove") #delete sheet - xDialog = self.xUITest.getTopFocusWindow() - xOKButton = xDialog.getChild("yes") - xOKButton.executeAction("CLICK", tuple()) + self.ui_test.execute_dialog_through_command(".uno:Remove") #delete sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("yes") + xOKButton.executeAction("CLICK", tuple()) - self.assertEqual(document.Sheets.getCount(), nrSheets) - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.Sheets.getCount(), nrSheets + 1) - self.xUITest.executeCommand(".uno:Redo") - self.assertEqual(document.Sheets.getCount(), nrSheets) + self.assertEqual(document.Sheets.getCount(), nrSheets) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Sheets.getCount(), nrSheets + 1) + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(document.Sheets.getCount(), nrSheets) + + self.ui_test.close_doc() def test_tdf43078_insert_and_delete_sheet_insert_text(self): - with self.ui_test.create_doc_in_start_center("calc"): - document = self.ui_test.get_component() + self.ui_test.create_doc_in_start_center("calc") + document = self.ui_test.get_component() - nrSheets = document.Sheets.getCount() #default number of sheets + nrSheets = document.Sheets.getCount() #default number of sheets - self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet - xDialog = self.xUITest.getTopFocusWindow() - xOKButton = xDialog.getChild("ok") - xOKButton.executeAction("CLICK", tuple()) + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) - self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet - xDialog = self.xUITest.getTopFocusWindow() - xOKButton = xDialog.getChild("ok") - xOKButton.executeAction("CLICK", tuple()) + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) - self.assertEqual(document.Sheets.getCount(), nrSheets + 2) - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") - enter_text_to_cell(xGridWindow, "B2", "abcd") + self.assertEqual(document.Sheets.getCount(), nrSheets + 2) + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + enter_text_to_cell(xGridWindow, "B2", "abcd") - self.ui_test.execute_dialog_through_command(".uno:Remove") #delete sheet - xDialog = self.xUITest.getTopFocusWindow() - xOKButton = xDialog.getChild("yes") - xOKButton.executeAction("CLICK", tuple()) + self.ui_test.execute_dialog_through_command(".uno:Remove") #delete sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("yes") + xOKButton.executeAction("CLICK", tuple()) - self.assertEqual(document.Sheets.getCount(), nrSheets + 1) - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.Sheets.getCount(), nrSheets + 2) - self.xUITest.executeCommand(".uno:Redo") - self.assertEqual(document.Sheets.getCount(), nrSheets + 1) + self.assertEqual(document.Sheets.getCount(), nrSheets + 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Sheets.getCount(), nrSheets + 2) + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(document.Sheets.getCount(), nrSheets + 1) + + self.ui_test.close_doc() def test_delete_more_sheets_at_once(self): - with self.ui_test.create_doc_in_start_center("calc"): - - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - nrSheets = document.Sheets.getCount() #default number - i = 0 - while i < 6: - self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet - xDialog = self.xUITest.getTopFocusWindow() - xOKButton = xDialog.getChild("ok") - xOKButton.executeAction("CLICK", tuple()) - i = i + 1 - self.assertEqual(document.Sheets.getCount(), nrSheets + 6) - - i = 0 - while i < 5: - self.xUITest.executeCommand(".uno:JumpToNextTableSel") #select next sheet - i = i + 1 - - self.ui_test.execute_dialog_through_command(".uno:Remove") #delete selected sheets + self.ui_test.create_doc_in_start_center("calc") + + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + nrSheets = document.Sheets.getCount() #default number + i = 0 + while i < 6: + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet xDialog = self.xUITest.getTopFocusWindow() - xOKButton = xDialog.getChild("yes") + xOKButton = xDialog.getChild("ok") xOKButton.executeAction("CLICK", tuple()) + i = i + 1 + self.assertEqual(document.Sheets.getCount(), nrSheets + 6) + + i = 0 + while i < 5: + self.xUITest.executeCommand(".uno:JumpToNextTableSel") #select next sheet + i = i + 1 - self.assertEqual(document.Sheets.getCount(), nrSheets) - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.Sheets.getCount(), nrSheets + 6) - self.xUITest.executeCommand(".uno:Redo") - self.assertEqual(document.Sheets.getCount(), nrSheets) + self.ui_test.execute_dialog_through_command(".uno:Remove") #delete selected sheets + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("yes") + xOKButton.executeAction("CLICK", tuple()) + + self.assertEqual(document.Sheets.getCount(), nrSheets) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Sheets.getCount(), nrSheets + 6) + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(document.Sheets.getCount(), nrSheets) + + self.ui_test.close_doc() def test_tdf105105_delete_lots_of_sheets_at_once(self): - with self.ui_test.create_doc_in_start_center("calc"): - - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - nrSheets = document.Sheets.getCount() #default number - i = 0 - while i < 100: - self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet - xDialog = self.xUITest.getTopFocusWindow() - xOKButton = xDialog.getChild("ok") - xOKButton.executeAction("CLICK", tuple()) - i = i + 1 - self.assertEqual(document.Sheets.getCount(), nrSheets + 100) - - i = 0 - while i < 99: - self.xUITest.executeCommand(".uno:JumpToNextTableSel") #select next sheet - i = i + 1 - - self.ui_test.execute_dialog_through_command(".uno:Remove") #delete selected sheets + self.ui_test.create_doc_in_start_center("calc") + + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + nrSheets = document.Sheets.getCount() #default number + i = 0 + while i < 100: + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet xDialog = self.xUITest.getTopFocusWindow() - xOKButton = xDialog.getChild("yes") + xOKButton = xDialog.getChild("ok") xOKButton.executeAction("CLICK", tuple()) - - self.assertEqual(document.Sheets.getCount(), nrSheets) - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.Sheets.getCount(), nrSheets + 100) - self.xUITest.executeCommand(".uno:Redo") - self.assertEqual(document.Sheets.getCount(), nrSheets) - + i = i + 1 + self.assertEqual(document.Sheets.getCount(), nrSheets + 100) + + i = 0 + while i < 99: + self.xUITest.executeCommand(".uno:JumpToNextTableSel") #select next sheet + i = i + 1 + + self.ui_test.execute_dialog_through_command(".uno:Remove") #delete selected sheets + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("yes") + xOKButton.executeAction("CLICK", tuple()) + + self.assertEqual(document.Sheets.getCount(), nrSheets) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Sheets.getCount(), nrSheets + 100) + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(document.Sheets.getCount(), nrSheets) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py b/sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py index b7cb4bc5b335..7d4c2ff089ba 100644 --- a/sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py +++ b/sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py @@ -15,191 +15,195 @@ class CalcCellBackgroundColorSelector(UITestCase): def test_color_selector(self): #This is to test color selection - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "6") #tab Numbers - # click on color btn - xbtncolor = xDialog.getChild("btncolor") - xbtncolor.executeAction("CLICK",tuple()) - xpaletteselector = xDialog.getChild("paletteselector") - - # Now we have the ColorPage that we can get the color selector from it - xColorpage = xDialog.getChild("ColorPage") - color_selector = xColorpage.getChild("colorset") - - # For chart-palettes colors - select_by_text(xpaletteselector, "chart-palettes") - # Select Color with id 2 - color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "2"})) - self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "2") - self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "1") - self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "12") - self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") - self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Chart 2") - self.assertEqual(get_state_as_dict(color_selector)["RGB"], "(255,66,14)") - - # Select Color with id 5 - color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "5"})) - self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "5") - self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "4") - self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Chart 5") - self.assertEqual(get_state_as_dict(color_selector)["RGB"], "(126,0,33)") - - # For libreoffice colors - select_by_text(xpaletteselector, "libreoffice") - # Select Color with id 6 - color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "6"})) - self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "6") - self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "5") - self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "32") - self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") - self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Green Accent") - self.assertEqual(get_state_as_dict(color_selector)["RGB"], "(44,238,14)") - - # Select Color with id 30 - color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "30"})) - self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "30") - self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "29") - self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Yellow Accent") - self.assertEqual(get_state_as_dict(color_selector)["RGB"], "(255,215,76)") - - # For html colors - select_by_text(xpaletteselector, "html") - # Select Color with id 1 - color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "1"})) - self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "1") - self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "0") - self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "139") - self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") - self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "White") - # Select Color with id 120 - color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "120"})) - self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "120") - self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "119") - self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Navy") - - # For freecolour-hlc colors - select_by_text(xpaletteselector, "freecolour-hlc") - # Select Color with id 988 - color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "988"})) - self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "988") - self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "987") - self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "1032") - self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") - self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "HLC 350 60 10") - # Select Color with id 575 - color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "575"})) - self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "575") - self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "574") - self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "HLC 190 50 20") - - # For tonal colors - select_by_text(xpaletteselector, "tonal") - # Select Color with id 17 - color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "17"})) - self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "17") - self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "16") - self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "120") - self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") - self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Cyan 82%") - # Select Color with id 13 - color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "13"})) - self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "13") - self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "12") - self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Magenta 82%") - - # For material colors - select_by_text(xpaletteselector, "material") - # Select Color with id 9 - color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "9"})) - self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "9") - self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "8") - self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "228") - self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") - self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Gray 800") - - # For standard colors - select_by_text(xpaletteselector, "standard") - # Select Color with id 3 - color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "3"})) - self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "3") - self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "2") - self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "120") - self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") - self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Dark Gray 3") - - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "6") #tab Numbers + # click on color btn + xbtncolor = xDialog.getChild("btncolor") + xbtncolor.executeAction("CLICK",tuple()) + xpaletteselector = xDialog.getChild("paletteselector") + + # Now we have the ColorPage that we can get the color selector from it + xColorpage = xDialog.getChild("ColorPage") + color_selector = xColorpage.getChild("colorset") + + # For chart-palettes colors + select_by_text(xpaletteselector, "chart-palettes") + # Select Color with id 2 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "2"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "2") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "1") + self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Chart 2") + self.assertEqual(get_state_as_dict(color_selector)["RGB"], "(255,66,14)") + + # Select Color with id 5 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "5"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "5") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "4") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Chart 5") + self.assertEqual(get_state_as_dict(color_selector)["RGB"], "(126,0,33)") + + # For libreoffice colors + select_by_text(xpaletteselector, "libreoffice") + # Select Color with id 6 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "6"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "6") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "5") + self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "32") + self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Green Accent") + self.assertEqual(get_state_as_dict(color_selector)["RGB"], "(44,238,14)") + + # Select Color with id 30 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "30"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "30") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "29") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Yellow Accent") + self.assertEqual(get_state_as_dict(color_selector)["RGB"], "(255,215,76)") + + # For html colors + select_by_text(xpaletteselector, "html") + # Select Color with id 1 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "1"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "1") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "0") + self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "139") + self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "White") + # Select Color with id 120 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "120"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "120") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "119") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Navy") + + # For freecolour-hlc colors + select_by_text(xpaletteselector, "freecolour-hlc") + # Select Color with id 988 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "988"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "988") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "987") + self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "1032") + self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "HLC 350 60 10") + # Select Color with id 575 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "575"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "575") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "574") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "HLC 190 50 20") + + # For tonal colors + select_by_text(xpaletteselector, "tonal") + # Select Color with id 17 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "17"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "17") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "16") + self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "120") + self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Cyan 82%") + # Select Color with id 13 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "13"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "13") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Magenta 82%") + + # For material colors + select_by_text(xpaletteselector, "material") + # Select Color with id 9 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "9"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "9") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "8") + self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "228") + self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Gray 800") + + # For standard colors + select_by_text(xpaletteselector, "standard") + # Select Color with id 3 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "3"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "3") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "2") + self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "120") + self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Dark Gray 3") + + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + + self.ui_test.close_doc() def test_recent_color_selector(self): #This is to test recent color selection - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #select cell A5 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A5"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "6") #tab Numbers - # click on color btn - xbtncolor = xDialog.getChild("btncolor") - xbtncolor.executeAction("CLICK",tuple()) - - # we will select color for cell A5 to be able to predict the latest color in - # recent color selector - xpaletteselector = xDialog.getChild("paletteselector") - xColorpage = xDialog.getChild("ColorPage") - color_selector = xColorpage.getChild("colorset") - - # For chart-palettes colors - select_by_text(xpaletteselector, "chart-palettes") - # Select Color with id 2 - color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "2"})) - self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "2") - self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "1") - self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "12") - self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") - self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Chart 2") - xrgb = get_state_as_dict(color_selector)["RGB"] - - # close the dialog after selection of the color - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) - - #select cell D3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D3"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "6") #tab Numbers - # click on color btn - xbtncolor = xDialog.getChild("btncolor") - xbtncolor.executeAction("CLICK",tuple()) - - xColorpage = xDialog.getChild("ColorPage") - recent_color_selector = xColorpage.getChild("recentcolorset") - - # Select Color with id 1 - recent_color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "1"})) - self.assertEqual(get_state_as_dict(recent_color_selector)["CurrColorId"], "1") - self.assertEqual(get_state_as_dict(recent_color_selector)["CurrColorPos"], "0") - self.assertEqual(get_state_as_dict(recent_color_selector)["ColorText"], "Chart 2") - self.assertEqual(get_state_as_dict(recent_color_selector)["RGB"], xrgb) - - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select cell A5 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A5"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "6") #tab Numbers + # click on color btn + xbtncolor = xDialog.getChild("btncolor") + xbtncolor.executeAction("CLICK",tuple()) + + # we will select color for cell A5 to be able to predict the latest color in + # recent color selector + xpaletteselector = xDialog.getChild("paletteselector") + xColorpage = xDialog.getChild("ColorPage") + color_selector = xColorpage.getChild("colorset") + + # For chart-palettes colors + select_by_text(xpaletteselector, "chart-palettes") + # Select Color with id 2 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "2"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "2") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "1") + self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Chart 2") + xrgb = get_state_as_dict(color_selector)["RGB"] + + # close the dialog after selection of the color + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + + #select cell D3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D3"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "6") #tab Numbers + # click on color btn + xbtncolor = xDialog.getChild("btncolor") + xbtncolor.executeAction("CLICK",tuple()) + + xColorpage = xDialog.getChild("ColorPage") + recent_color_selector = xColorpage.getChild("recentcolorset") + + # Select Color with id 1 + recent_color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "1"})) + self.assertEqual(get_state_as_dict(recent_color_selector)["CurrColorId"], "1") + self.assertEqual(get_state_as_dict(recent_color_selector)["CurrColorPos"], "0") + self.assertEqual(get_state_as_dict(recent_color_selector)["ColorText"], "Chart 2") + self.assertEqual(get_state_as_dict(recent_color_selector)["RGB"], xrgb) + + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/columns.py b/sc/qa/uitest/calc_tests/columns.py index 7938d5a25c99..28649d07f3c2 100644 --- a/sc/qa/uitest/calc_tests/columns.py +++ b/sc/qa/uitest/calc_tests/columns.py @@ -11,263 +11,275 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class CalcColumns(UITestCase): def test_column_width(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - change_measurement_unit(self, "Centimeter") + change_measurement_unit(self, "Centimeter") - #select A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #column width - self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - xdefault = xDialog.getChild("default") - self.assertEqual(get_state_as_dict(xdefault)["Selected"], "true") #default selected - heightStrOrig = get_state_as_dict(xvalue)["Text"] - heightVal = heightStrOrig[:4] #default 2.26 cm - xvalue.executeAction("UP", tuple()) #2.36 cm - heightStr = get_state_as_dict(xvalue)["Text"] - heightValNew = heightStr[:4] - self.assertEqual(get_state_as_dict(xdefault)["Selected"], "false") #default not selected - self.assertEqual(heightValNew > heightVal, True) #new value is bigger - xdefault.executeAction("CLICK", tuple()) #click default - self.assertEqual(get_state_as_dict(xvalue)["Text"] == heightStrOrig, True) #default value set - #write your own value - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - #verify - self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") - xCancel = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancel) + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #column width + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xdefault = xDialog.getChild("default") + self.assertEqual(get_state_as_dict(xdefault)["Selected"], "true") #default selected + heightStrOrig = get_state_as_dict(xvalue)["Text"] + heightVal = heightStrOrig[:4] #default 2.26 cm + xvalue.executeAction("UP", tuple()) #2.36 cm + heightStr = get_state_as_dict(xvalue)["Text"] + heightValNew = heightStr[:4] + self.assertEqual(get_state_as_dict(xdefault)["Selected"], "false") #default not selected + self.assertEqual(heightValNew > heightVal, True) #new value is bigger + xdefault.executeAction("CLICK", tuple()) #click default + self.assertEqual(get_state_as_dict(xvalue)["Text"] == heightStrOrig, True) #default value set + #write your own value + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #verify + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") + xCancel = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancel) + + self.ui_test.close_doc() def test_column_width_two_columns(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + change_measurement_unit(self, "Centimeter") - change_measurement_unit(self, "Centimeter") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1", "EXTEND":"1"})) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1", "EXTEND":"1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xdefault = xDialog.getChild("default") + #write your own value + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - xdefault = xDialog.getChild("default") - #write your own value - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - #verify - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) - self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + self.ui_test.close_doc() def test_column_width_copy(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + change_measurement_unit(self, "Centimeter") - change_measurement_unit(self, "Centimeter") + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #column width + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #select column 1 + self.xUITest.executeCommand(".uno:SelectColumn") + #copy + self.xUITest.executeCommand(".uno:Copy") + #select C1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + #paste + self.xUITest.executeCommand(".uno:Paste") + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - #select A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #column width - self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - #select column 1 - self.xUITest.executeCommand(".uno:SelectColumn") - #copy - self.xUITest.executeCommand(".uno:Copy") - #select C1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) - #paste - self.xUITest.executeCommand(".uno:Paste") - #verify - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) - self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + self.ui_test.close_doc() def test_column_hide_show(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #select A3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) - self.xUITest.executeCommand(".uno:HideColumn") #uno command moves focus one cell down - #verify D1 - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentColumn"], "3") - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"LEFT"})) - #verify B (column C is hidden) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentColumn"], "1") - #Show hidden column: select B1:D1 - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:D1"})) - self.xUITest.executeCommand(".uno:ShowColumn") - #verify - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentColumn"], "3") - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"LEFT"})) - #verify C1 (COlumn C is not hidden) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentColumn"], "2") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + self.xUITest.executeCommand(".uno:HideColumn") #uno command moves focus one cell down + #verify D1 + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentColumn"], "3") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"LEFT"})) + #verify B (column C is hidden) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentColumn"], "1") + #Show hidden column: select B1:D1 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:D1"})) + self.xUITest.executeCommand(".uno:ShowColumn") + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentColumn"], "3") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"LEFT"})) + #verify C1 (COlumn C is not hidden) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentColumn"], "2") + + self.ui_test.close_doc() def test_column_test_move(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #select C1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentColumn"], "2") - #right - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RIGHT"})) - #verify D1 - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentColumn"], "3") - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"LEFT"})) - #verify C1 - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentColumn"], "2") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select C1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentColumn"], "2") + #right + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RIGHT"})) + #verify D1 + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentColumn"], "3") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"LEFT"})) + #verify C1 + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentColumn"], "2") + + self.ui_test.close_doc() def test_tdf117522_column_width_insert_left(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + change_measurement_unit(self, "Centimeter") - change_measurement_unit(self, "Centimeter") + #select C1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + #column width + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #select D1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + #column width + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"2 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #select E1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"})) + #column width + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"3 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #select columns C-E + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:E1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + #Insert Columns Left + self.xUITest.executeCommand(".uno:InsertColumnsBefore") + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - #select C1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) - #column width - self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - #select D1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) - #column width - self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"2 cm"})) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - #select E1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"})) - #column width - self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"3 cm"})) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - #select columns C-E - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:E1"})) - self.xUITest.executeCommand(".uno:SelectColumn") - #Insert Columns Left - self.xUITest.executeCommand(".uno:InsertColumnsBefore") - #verify - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) - self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "2.0003 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) - self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "2.0003 cm") - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "3.0004 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"})) - self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "3.0004 cm") - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "F1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "F1"})) - self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "G1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "2.0003 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "G1"})) - self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "2.0003 cm") - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "H1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "3.0004 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "H1"})) - self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "3.0004 cm") - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/fillRandomNumber.py b/sc/qa/uitest/calc_tests/fillRandomNumber.py index de70825e5390..800786bbbac0 100644 --- a/sc/qa/uitest/calc_tests/fillRandomNumber.py +++ b/sc/qa/uitest/calc_tests/fillRandomNumber.py @@ -12,46 +12,47 @@ from libreoffice.uno.propertyvalue import mkPropertyValues #randomnumbergenerator.ui class fillRandomNumber(UITestCase): def test_fill_random_number(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") - xDialog = self.xUITest.getTopFocusWindow() - xcellrangeedit = xDialog.getChild("cell-range-edit") - xdistributioncombo = xDialog.getChild("distribution-combo") - xparameter1spin = xDialog.getChild("parameter1-spin") - xparameter2spin = xDialog.getChild("parameter2-spin") - xenableseedcheck = xDialog.getChild("enable-seed-check") - xseedspin = xDialog.getChild("seed-spin") - xenableroundingcheck = xDialog.getChild("enable-rounding-check") - xdecimalplacesspin = xDialog.getChild("decimal-places-spin") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") + xDialog = self.xUITest.getTopFocusWindow() + xcellrangeedit = xDialog.getChild("cell-range-edit") + xdistributioncombo = xDialog.getChild("distribution-combo") + xparameter1spin = xDialog.getChild("parameter1-spin") + xparameter2spin = xDialog.getChild("parameter2-spin") + xenableseedcheck = xDialog.getChild("enable-seed-check") + xseedspin = xDialog.getChild("seed-spin") + xenableroundingcheck = xDialog.getChild("enable-rounding-check") + xdecimalplacesspin = xDialog.getChild("decimal-places-spin") - xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) - select_by_text(xdistributioncombo, "Uniform Integer") + xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) + select_by_text(xdistributioncombo, "Uniform Integer") - xparameter1spin.executeAction("UP", tuple()) - xparameter2spin.executeAction("UP", tuple()) - xenableseedcheck.executeAction("CLICK", tuple()) - xseedspin.executeAction("UP", tuple()) - xenableroundingcheck.executeAction("CLICK", tuple()) - xdecimalplacesspin.executeAction("UP", tuple()) + xparameter1spin.executeAction("UP", tuple()) + xparameter2spin.executeAction("UP", tuple()) + xenableseedcheck.executeAction("CLICK", tuple()) + xseedspin.executeAction("UP", tuple()) + xenableroundingcheck.executeAction("CLICK", tuple()) + xdecimalplacesspin.executeAction("UP", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), True) - self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), True) - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False) - self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False) - #close dialog without doing anything - self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xCloseBtn) - self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False) - self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), True) + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), True) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False) + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False) + #close dialog without doing anything + self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False) + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/formatCells.py b/sc/qa/uitest/calc_tests/formatCells.py index 17a90669596a..f8b5cfd7c30c 100644 --- a/sc/qa/uitest/calc_tests/formatCells.py +++ b/sc/qa/uitest/calc_tests/formatCells.py @@ -14,433 +14,451 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class formatCell(UITestCase): def test_format_cell_numbers_tab(self): #numberingformatpage.ui - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") #tab Numbers - xliststore1 = xDialog.getChild("categorylb") #1st list / Category - xliststore2 = xDialog.getChild("formatlb") #2nd list / Format - xdecimalsed = xDialog.getChild("decimalsed") - xleadzerosed = xDialog.getChild("leadzerosed") - xnegnumred = xDialog.getChild("negnumred") - xthousands = xDialog.getChild("thousands") - xlanguagelb = xDialog.getChild("languagelb") - xformatted = xDialog.getChild("formatted") - #language - select_by_text(xlanguagelb, "English (USA)") - #other properties - xdecimalsed.executeAction("UP", tuple()) - xleadzerosed.executeAction("UP", tuple()) - xnegnumred.executeAction("CLICK", tuple()) - xthousands.executeAction("CLICK", tuple()) - #format #,#00.0;[RED]-#,#00.0 - self.assertEqual(get_state_as_dict(xformatted)["Text"], "#,#00.0;[RED]-#,#00.0") - #save - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) - #verify - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") #tab Numbers - xliststore1 = xDialog.getChild("categorylb") #1st list / Category - xliststore2 = xDialog.getChild("formatlb") #2nd list / Format - xdecimalsed = xDialog.getChild("decimalsed") - xleadzerosed = xDialog.getChild("leadzerosed") - xnegnumred = xDialog.getChild("negnumred") - xthousands = xDialog.getChild("thousands") - xlanguagelb = xDialog.getChild("languagelb") - xformatted = xDialog.getChild("formatted") - - self.assertEqual(get_state_as_dict(xliststore1)["SelectEntryText"], "Number") - self.assertEqual(get_state_as_dict(xlanguagelb)["SelectEntryText"], "English (USA)") - self.assertEqual(get_state_as_dict(xdecimalsed)["Text"], "1") - self.assertEqual(get_state_as_dict(xleadzerosed)["Text"], "2") - self.assertEqual(get_state_as_dict(xnegnumred)["Selected"], "true") - self.assertEqual(get_state_as_dict(xthousands)["Selected"], "true") - self.assertEqual(get_state_as_dict(xformatted)["Text"], "#,#00.0;[RED]-#,#00.0") - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + xliststore1 = xDialog.getChild("categorylb") #1st list / Category + xliststore2 = xDialog.getChild("formatlb") #2nd list / Format + xdecimalsed = xDialog.getChild("decimalsed") + xleadzerosed = xDialog.getChild("leadzerosed") + xnegnumred = xDialog.getChild("negnumred") + xthousands = xDialog.getChild("thousands") + xlanguagelb = xDialog.getChild("languagelb") + xformatted = xDialog.getChild("formatted") + #language + select_by_text(xlanguagelb, "English (USA)") + #other properties + xdecimalsed.executeAction("UP", tuple()) + xleadzerosed.executeAction("UP", tuple()) + xnegnumred.executeAction("CLICK", tuple()) + xthousands.executeAction("CLICK", tuple()) + #format #,#00.0;[RED]-#,#00.0 + self.assertEqual(get_state_as_dict(xformatted)["Text"], "#,#00.0;[RED]-#,#00.0") + #save + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + xliststore1 = xDialog.getChild("categorylb") #1st list / Category + xliststore2 = xDialog.getChild("formatlb") #2nd list / Format + xdecimalsed = xDialog.getChild("decimalsed") + xleadzerosed = xDialog.getChild("leadzerosed") + xnegnumred = xDialog.getChild("negnumred") + xthousands = xDialog.getChild("thousands") + xlanguagelb = xDialog.getChild("languagelb") + xformatted = xDialog.getChild("formatted") + + self.assertEqual(get_state_as_dict(xliststore1)["SelectEntryText"], "Number") + self.assertEqual(get_state_as_dict(xlanguagelb)["SelectEntryText"], "English (USA)") + self.assertEqual(get_state_as_dict(xdecimalsed)["Text"], "1") + self.assertEqual(get_state_as_dict(xleadzerosed)["Text"], "2") + self.assertEqual(get_state_as_dict(xnegnumred)["Selected"], "true") + self.assertEqual(get_state_as_dict(xthousands)["Selected"], "true") + self.assertEqual(get_state_as_dict(xformatted)["Text"], "#,#00.0;[RED]-#,#00.0") + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + + self.ui_test.close_doc() def test_format_cell_font_tab(self): #numberingformatpage.ui - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") #tab Font - xSizeFont = xDialog.getChild("westsizelb-cjk") - xSizeFontEast = xDialog.getChild("eastsizelb") - xSizeFontCTL = xDialog.getChild("ctlsizelb") - xLangFont = xDialog.getChild("westlanglb-cjk") - xLangFontEast = xDialog.getChild("eastlanglb") - xLangFontCTL = xDialog.getChild("ctllanglb") - - xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 - xSizeFontEast.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xSizeFontEast.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 - xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 - select_pos(xLangFont, "0") - select_pos(xLangFontEast, "0") - select_pos(xLangFontCTL, "0") - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - - #Verify - select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") #tab Font - xSizeFont = xDialog.getChild("westsizelb-cjk") - xSizeFontEast = xDialog.getChild("eastsizelb") - xSizeFontCTL = xDialog.getChild("ctlsizelb") - xLangFont = xDialog.getChild("westlanglb-cjk") - xLangFontEast = xDialog.getChild("eastlanglb") - xLangFontCTL = xDialog.getChild("ctllanglb") - - self.assertEqual(get_state_as_dict(xSizeFont)["Text"], "18 pt") - self.assertEqual(get_state_as_dict(xSizeFontEast)["Text"], "18 pt") - self.assertEqual(get_state_as_dict(xSizeFontCTL)["Text"], "18 pt") #check font size - self.assertEqual(get_state_as_dict(xLangFont)["Text"], "[None]") - self.assertEqual(get_state_as_dict(xLangFontEast)["SelectEntryText"], "[None]") - self.assertEqual(get_state_as_dict(xLangFontCTL)["SelectEntryText"], "[None]") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") #tab Font + xSizeFont = xDialog.getChild("westsizelb-cjk") + xSizeFontEast = xDialog.getChild("eastsizelb") + xSizeFontCTL = xDialog.getChild("ctlsizelb") + xLangFont = xDialog.getChild("westlanglb-cjk") + xLangFontEast = xDialog.getChild("eastlanglb") + xLangFontCTL = xDialog.getChild("ctllanglb") + + xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 + xSizeFontEast.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFontEast.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 + xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 + select_pos(xLangFont, "0") + select_pos(xLangFontEast, "0") + select_pos(xLangFontCTL, "0") + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + #Verify - select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") #tab Font + xSizeFont = xDialog.getChild("westsizelb-cjk") + xSizeFontEast = xDialog.getChild("eastsizelb") + xSizeFontCTL = xDialog.getChild("ctlsizelb") + xLangFont = xDialog.getChild("westlanglb-cjk") + xLangFontEast = xDialog.getChild("eastlanglb") + xLangFontCTL = xDialog.getChild("ctllanglb") + + self.assertEqual(get_state_as_dict(xSizeFont)["Text"], "18 pt") + self.assertEqual(get_state_as_dict(xSizeFontEast)["Text"], "18 pt") + self.assertEqual(get_state_as_dict(xSizeFontCTL)["Text"], "18 pt") #check font size + self.assertEqual(get_state_as_dict(xLangFont)["Text"], "[None]") + self.assertEqual(get_state_as_dict(xLangFontEast)["SelectEntryText"], "[None]") + self.assertEqual(get_state_as_dict(xLangFontCTL)["SelectEntryText"], "[None]") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() def test_format_cell_font_effects_tab(self): #numberingformatpage.ui - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "2") #tab Font Effects - xRelief = xDialog.getChild("relieflb") - xOverline = xDialog.getChild("overlinelb") - xStrikeout = xDialog.getChild("strikeoutlb") - xUnderline = xDialog.getChild("underlinelb") - xEmphasis = xDialog.getChild("emphasislb") - xPosition = xDialog.getChild("positionlb") - - select_pos(xRelief, "1") - select_pos(xOverline, "1") - select_pos(xStrikeout, "1") - select_pos(xUnderline, "1") - select_pos(xEmphasis, "1") - select_pos(xPosition, "1") - - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - #Verify- select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "2") - - xRelief = xDialog.getChild("relieflb") - xOverline = xDialog.getChild("overlinelb") - xStrikeout = xDialog.getChild("strikeoutlb") - xUnderline = xDialog.getChild("underlinelb") - xEmphasis = xDialog.getChild("emphasislb") - xPosition = xDialog.getChild("positionlb") - - self.assertEqual(get_state_as_dict(xRelief)["SelectEntryText"], "Embossed") - self.assertEqual(get_state_as_dict(xOverline)["SelectEntryText"], "Single") - self.assertEqual(get_state_as_dict(xStrikeout)["SelectEntryText"], "Single") - self.assertEqual(get_state_as_dict(xUnderline)["SelectEntryText"], "Single") - self.assertEqual(get_state_as_dict(xEmphasis)["SelectEntryText"], "Dot") - self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "Below text") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") #tab Font Effects + xRelief = xDialog.getChild("relieflb") + xOverline = xDialog.getChild("overlinelb") + xStrikeout = xDialog.getChild("strikeoutlb") + xUnderline = xDialog.getChild("underlinelb") + xEmphasis = xDialog.getChild("emphasislb") + xPosition = xDialog.getChild("positionlb") + + select_pos(xRelief, "1") + select_pos(xOverline, "1") + select_pos(xStrikeout, "1") + select_pos(xUnderline, "1") + select_pos(xEmphasis, "1") + select_pos(xPosition, "1") + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + #Verify- select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + + xRelief = xDialog.getChild("relieflb") + xOverline = xDialog.getChild("overlinelb") + xStrikeout = xDialog.getChild("strikeoutlb") + xUnderline = xDialog.getChild("underlinelb") + xEmphasis = xDialog.getChild("emphasislb") + xPosition = xDialog.getChild("positionlb") + + self.assertEqual(get_state_as_dict(xRelief)["SelectEntryText"], "Embossed") + self.assertEqual(get_state_as_dict(xOverline)["SelectEntryText"], "Single") + self.assertEqual(get_state_as_dict(xStrikeout)["SelectEntryText"], "Single") + self.assertEqual(get_state_as_dict(xUnderline)["SelectEntryText"], "Single") + self.assertEqual(get_state_as_dict(xEmphasis)["SelectEntryText"], "Dot") + self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "Below text") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() def test_format_cell_alignment_tab(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "3") #tab Alignment - comboboxHorzAlign = xDialog.getChild("comboboxHorzAlign") - xspinIndentFrom = xDialog.getChild("spinIndentFrom") - xcomboboxVertAlign = xDialog.getChild("comboboxVertAlign") - xcheckVertStack = xDialog.getChild("checkVertStack") - xcheckWrapTextAuto = xDialog.getChild("checkWrapTextAuto") - xcheckHyphActive = xDialog.getChild("checkHyphActive") - xcomboTextDirBox = xDialog.getChild("comboTextDirBox") - - select_by_text(comboboxHorzAlign, "Left") - xspinIndentFrom.executeAction("UP", tuple()) - indentVal = get_state_as_dict(xspinIndentFrom)["Text"] - select_by_text(xcomboboxVertAlign, "Top") - xcheckVertStack.executeAction("CLICK", tuple()) - xcheckWrapTextAuto.executeAction("CLICK", tuple()) - xcheckHyphActive.executeAction("CLICK", tuple()) - select_by_text(xcomboTextDirBox, "Left-to-right (LTR)") - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - #Verify- select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "3") - comboboxHorzAlign = xDialog.getChild("comboboxHorzAlign") - xspinIndentFrom = xDialog.getChild("spinIndentFrom") - xcomboboxVertAlign = xDialog.getChild("comboboxVertAlign") - xcheckVertStack = xDialog.getChild("checkVertStack") - xcheckWrapTextAuto = xDialog.getChild("checkWrapTextAuto") - xcheckHyphActive = xDialog.getChild("checkHyphActive") - xcomboTextDirBox = xDialog.getChild("comboTextDirBox") - - self.assertEqual(get_state_as_dict(comboboxHorzAlign)["SelectEntryText"], "Left") - self.assertEqual(get_state_as_dict(xspinIndentFrom)["Text"] == indentVal, True) - self.assertEqual(get_state_as_dict(xcomboboxVertAlign)["SelectEntryText"], "Top") - self.assertEqual(get_state_as_dict(xcheckVertStack)["Selected"], "true") - self.assertEqual(get_state_as_dict(xcheckWrapTextAuto)["Selected"], "true") - self.assertEqual(get_state_as_dict(xcheckHyphActive)["Selected"], "true") - self.assertEqual(get_state_as_dict(xcomboTextDirBox)["SelectEntryText"], "Left-to-right (LTR)") - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") #tab Alignment + comboboxHorzAlign = xDialog.getChild("comboboxHorzAlign") + xspinIndentFrom = xDialog.getChild("spinIndentFrom") + xcomboboxVertAlign = xDialog.getChild("comboboxVertAlign") + xcheckVertStack = xDialog.getChild("checkVertStack") + xcheckWrapTextAuto = xDialog.getChild("checkWrapTextAuto") + xcheckHyphActive = xDialog.getChild("checkHyphActive") + xcomboTextDirBox = xDialog.getChild("comboTextDirBox") + + select_by_text(comboboxHorzAlign, "Left") + xspinIndentFrom.executeAction("UP", tuple()) + indentVal = get_state_as_dict(xspinIndentFrom)["Text"] + select_by_text(xcomboboxVertAlign, "Top") + xcheckVertStack.executeAction("CLICK", tuple()) + xcheckWrapTextAuto.executeAction("CLICK", tuple()) + xcheckHyphActive.executeAction("CLICK", tuple()) + select_by_text(xcomboTextDirBox, "Left-to-right (LTR)") + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + #Verify- select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + comboboxHorzAlign = xDialog.getChild("comboboxHorzAlign") + xspinIndentFrom = xDialog.getChild("spinIndentFrom") + xcomboboxVertAlign = xDialog.getChild("comboboxVertAlign") + xcheckVertStack = xDialog.getChild("checkVertStack") + xcheckWrapTextAuto = xDialog.getChild("checkWrapTextAuto") + xcheckHyphActive = xDialog.getChild("checkHyphActive") + xcomboTextDirBox = xDialog.getChild("comboTextDirBox") + + self.assertEqual(get_state_as_dict(comboboxHorzAlign)["SelectEntryText"], "Left") + self.assertEqual(get_state_as_dict(xspinIndentFrom)["Text"] == indentVal, True) + self.assertEqual(get_state_as_dict(xcomboboxVertAlign)["SelectEntryText"], "Top") + self.assertEqual(get_state_as_dict(xcheckVertStack)["Selected"], "true") + self.assertEqual(get_state_as_dict(xcheckWrapTextAuto)["Selected"], "true") + self.assertEqual(get_state_as_dict(xcheckHyphActive)["Selected"], "true") + self.assertEqual(get_state_as_dict(xcomboTextDirBox)["SelectEntryText"], "Left-to-right (LTR)") + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() def test_format_cell_asian_typography_tab(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") #tab Asian typography - xcheckForbidList = xDialog.getChild("checkForbidList") - xcheckForbidList.executeAction("CLICK", tuple()) - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - #Verify- select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xcheckForbidList = xDialog.getChild("checkForbidList") - self.assertEqual(get_state_as_dict(xcheckForbidList)["Selected"], "true") - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") #tab Asian typography + xcheckForbidList = xDialog.getChild("checkForbidList") + xcheckForbidList.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + #Verify- select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xcheckForbidList = xDialog.getChild("checkForbidList") + self.assertEqual(get_state_as_dict(xcheckForbidList)["Selected"], "true") + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() def test_minimal_border_width(self): #borderpage.ui, tdf#137790 - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - #set points pt measurement - change_measurement_unit(self, "Point") - - #select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") #tab Borders - - linewidthmf = xDialog.getChild("linewidthmf") - xLineSet = xDialog.getChild('lineset') - - # check line-width for default solid line - self.assertEqual('0', get_state_as_dict(xLineSet)['SelectedItemPos']) - widthVal = get_state_as_dict(linewidthmf)["Text"] - self.assertEqual(widthVal, '0.75 pt') - - # set line style to "double" (minimal width is taken) - xLineSet.executeAction("CHOOSE", mkPropertyValues({"POS": '16'})) - widthVal = get_state_as_dict(linewidthmf)["Text"] - self.assertEqual(widthVal, '1.10 pt') - - # set line style to "solid" - xLineSet.executeAction("CHOOSE", mkPropertyValues({"POS": "1"})) - widthVal = get_state_as_dict(linewidthmf)["Text"] - self.assertEqual(widthVal, '0.75 pt') - - # make custom line width - linewidthmf.executeAction("UP", tuple()) - linewidthmf.executeAction("UP", tuple()) - linewidthmf.executeAction("UP", tuple()) - widthVal = get_state_as_dict(linewidthmf)["Text"] - self.assertEqual(widthVal, '1.50 pt') - - # set line style to "double" (minimal width is not taken) - xLineSet.executeAction("CHOOSE", mkPropertyValues({"POS": "8"})) - widthVal = get_state_as_dict(linewidthmf)["Text"] - self.assertEqual(widthVal, '1.50 pt') - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #set points pt measurement + change_measurement_unit(self, "Point") + + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") #tab Borders + + linewidthmf = xDialog.getChild("linewidthmf") + xLineSet = xDialog.getChild('lineset') + + # check line-width for default solid line + self.assertEqual('0', get_state_as_dict(xLineSet)['SelectedItemPos']) + widthVal = get_state_as_dict(linewidthmf)["Text"] + self.assertEqual(widthVal, '0.75 pt') + + # set line style to "double" (minimal width is taken) + xLineSet.executeAction("CHOOSE", mkPropertyValues({"POS": '16'})) + widthVal = get_state_as_dict(linewidthmf)["Text"] + self.assertEqual(widthVal, '1.10 pt') + + # set line style to "solid" + xLineSet.executeAction("CHOOSE", mkPropertyValues({"POS": "1"})) + widthVal = get_state_as_dict(linewidthmf)["Text"] + self.assertEqual(widthVal, '0.75 pt') + + # make custom line width + linewidthmf.executeAction("UP", tuple()) + linewidthmf.executeAction("UP", tuple()) + linewidthmf.executeAction("UP", tuple()) + widthVal = get_state_as_dict(linewidthmf)["Text"] + self.assertEqual(widthVal, '1.50 pt') + + # set line style to "double" (minimal width is not taken) + xLineSet.executeAction("CHOOSE", mkPropertyValues({"POS": "8"})) + widthVal = get_state_as_dict(linewidthmf)["Text"] + self.assertEqual(widthVal, '1.50 pt') + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() def test_format_cell_borders_tab(self): #borderpage.ui - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - #set points pt measurement - change_measurement_unit(self, "Point") - - #select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") #tab Borders - xsync = xDialog.getChild("sync") - xleftmf = xDialog.getChild("leftmf") - xrightmf = xDialog.getChild("rightmf") - xtopmf = xDialog.getChild("topmf") - xbottommf = xDialog.getChild("bottommf") - - xsync.executeAction("CLICK", tuple()) #uncheck Synchronize - xleftmf.executeAction("UP", tuple()) - xrightmf.executeAction("UP", tuple()) - xrightmf.executeAction("UP", tuple()) - xtopmf.executeAction("UP", tuple()) - xtopmf.executeAction("UP", tuple()) - xtopmf.executeAction("UP", tuple()) - xbottommf.executeAction("UP", tuple()) - xbottommf.executeAction("UP", tuple()) - xbottommf.executeAction("UP", tuple()) - xbottommf.executeAction("UP", tuple()) - - leftVal = get_state_as_dict(xleftmf)["Text"] - rightVal = get_state_as_dict(xrightmf)["Text"] - topVal = get_state_as_dict(xtopmf)["Text"] - bottomVal = get_state_as_dict(xbottommf)["Text"] - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - # Verify select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") #tab Borders - xsync = xDialog.getChild("sync") - xleftmf = xDialog.getChild("leftmf") - xrightmf = xDialog.getChild("rightmf") - xtopmf = xDialog.getChild("topmf") - xbottommf = xDialog.getChild("bottommf") - - self.assertEqual(get_state_as_dict(xsync)["Selected"], "false") - self.assertEqual(get_state_as_dict(xleftmf)["Text"] == leftVal, True) - self.assertEqual(get_state_as_dict(xrightmf)["Text"] == rightVal, True) - self.assertEqual(get_state_as_dict(xtopmf)["Text"] == topVal, True) - self.assertEqual(get_state_as_dict(xbottommf)["Text"] == bottomVal, True) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #set points pt measurement + change_measurement_unit(self, "Point") + + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") #tab Borders + xsync = xDialog.getChild("sync") + xleftmf = xDialog.getChild("leftmf") + xrightmf = xDialog.getChild("rightmf") + xtopmf = xDialog.getChild("topmf") + xbottommf = xDialog.getChild("bottommf") + + xsync.executeAction("CLICK", tuple()) #uncheck Synchronize + xleftmf.executeAction("UP", tuple()) + xrightmf.executeAction("UP", tuple()) + xrightmf.executeAction("UP", tuple()) + xtopmf.executeAction("UP", tuple()) + xtopmf.executeAction("UP", tuple()) + xtopmf.executeAction("UP", tuple()) + xbottommf.executeAction("UP", tuple()) + xbottommf.executeAction("UP", tuple()) + xbottommf.executeAction("UP", tuple()) + xbottommf.executeAction("UP", tuple()) + + leftVal = get_state_as_dict(xleftmf)["Text"] + rightVal = get_state_as_dict(xrightmf)["Text"] + topVal = get_state_as_dict(xtopmf)["Text"] + bottomVal = get_state_as_dict(xbottommf)["Text"] + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + # Verify select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") #tab Borders + xsync = xDialog.getChild("sync") + xleftmf = xDialog.getChild("leftmf") + xrightmf = xDialog.getChild("rightmf") + xtopmf = xDialog.getChild("topmf") + xbottommf = xDialog.getChild("bottommf") + + self.assertEqual(get_state_as_dict(xsync)["Selected"], "false") + self.assertEqual(get_state_as_dict(xleftmf)["Text"] == leftVal, True) + self.assertEqual(get_state_as_dict(xrightmf)["Text"] == rightVal, True) + self.assertEqual(get_state_as_dict(xtopmf)["Text"] == topVal, True) + self.assertEqual(get_state_as_dict(xbottommf)["Text"] == bottomVal, True) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() def test_format_cell_cell_protection_tab(self): #cellprotectionpage.ui - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "6") #tab Cell protection - xcheckHideFormula = xDialog.getChild("checkHideFormula") - xcheckHideAll = xDialog.getChild("checkHideAll") - xcheckHidePrinting = xDialog.getChild("checkHidePrinting") - - xcheckHideFormula.executeAction("CLICK", tuple()) - xcheckHideAll.executeAction("CLICK", tuple()) - xcheckHidePrinting.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - # Verify select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "6") #tab Borders - xcheckHideFormula = xDialog.getChild("checkHideFormula") - xcheckHideAll = xDialog.getChild("checkHideAll") - xcheckHidePrinting = xDialog.getChild("checkHidePrinting") - - self.assertEqual(get_state_as_dict(xcheckHideFormula)["Selected"], "false") - self.assertEqual(get_state_as_dict(xcheckHideAll)["Selected"], "false") - self.assertEqual(get_state_as_dict(xcheckHidePrinting)["Selected"], "false") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "6") #tab Cell protection + xcheckHideFormula = xDialog.getChild("checkHideFormula") + xcheckHideAll = xDialog.getChild("checkHideAll") + xcheckHidePrinting = xDialog.getChild("checkHidePrinting") + + xcheckHideFormula.executeAction("CLICK", tuple()) + xcheckHideAll.executeAction("CLICK", tuple()) + xcheckHidePrinting.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + # Verify select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "6") #tab Borders + xcheckHideFormula = xDialog.getChild("checkHideFormula") + xcheckHideAll = xDialog.getChild("checkHideAll") + xcheckHidePrinting = xDialog.getChild("checkHidePrinting") + + self.assertEqual(get_state_as_dict(xcheckHideFormula)["Selected"], "false") + self.assertEqual(get_state_as_dict(xcheckHideAll)["Selected"], "false") + self.assertEqual(get_state_as_dict(xcheckHidePrinting)["Selected"], "false") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() def test_tdf130762(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "3") #tab Alignment - xspinDegrees = xDialog.getChild("spinDegrees") - self.assertEqual(get_state_as_dict(xspinDegrees)["Text"].replace('°', ''), "0") - xspinDegrees.executeAction("DOWN", tuple()) - self.assertEqual(get_state_as_dict(xspinDegrees)["Text"].replace('°', ''), "355") - xspinDegrees.executeAction("UP", tuple()) - self.assertEqual(get_state_as_dict(xspinDegrees)["Text"].replace('°', ''), "0") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") #tab Alignment + xspinDegrees = xDialog.getChild("spinDegrees") + self.assertEqual(get_state_as_dict(xspinDegrees)["Text"].replace('°', ''), "0") + xspinDegrees.executeAction("DOWN", tuple()) + self.assertEqual(get_state_as_dict(xspinDegrees)["Text"].replace('°', ''), "355") + xspinDegrees.executeAction("UP", tuple()) + self.assertEqual(get_state_as_dict(xspinDegrees)["Text"].replace('°', ''), "0") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/mergedRowsColumns.py b/sc/qa/uitest/calc_tests/mergedRowsColumns.py index 297bfccda421..2bc225d1f84d 100644 --- a/sc/qa/uitest/calc_tests/mergedRowsColumns.py +++ b/sc/qa/uitest/calc_tests/mergedRowsColumns.py @@ -180,17 +180,18 @@ class mergedRowsColumns(UITestCase): self.xUITest.executeCommand(".uno:Undo") def test_move_merged_cells(self): - with self.ui_test.create_doc_in_start_center("calc"): - xTopWindow = self.xUITest.getTopFocusWindow() - gridwin = xTopWindow.getChild("grid_window") - - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:C1"})) - self.xUITest.executeCommand(".uno:ToggleMergeCells") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) - self.xUITest.executeCommand(".uno:GoLeft") - self.xUITest.executeCommand(".uno:GoLeft") - self.assertEqual(get_state_as_dict(gridwin)["CurrentColumn"], "0") - self.assertEqual(get_state_as_dict(gridwin)["CurrentRow"], "0") #position A1 - + self.ui_test.create_doc_in_start_center("calc") + xTopWindow = self.xUITest.getTopFocusWindow() + gridwin = xTopWindow.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:C1"})) + self.xUITest.executeCommand(".uno:ToggleMergeCells") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + self.xUITest.executeCommand(".uno:GoLeft") + self.xUITest.executeCommand(".uno:GoLeft") + self.assertEqual(get_state_as_dict(gridwin)["CurrentColumn"], "0") + self.assertEqual(get_state_as_dict(gridwin)["CurrentRow"], "0") #position A1 + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/printRange.py b/sc/qa/uitest/calc_tests/printRange.py index 143c94658ea3..a08262595035 100644 --- a/sc/qa/uitest/calc_tests/printRange.py +++ b/sc/qa/uitest/calc_tests/printRange.py @@ -10,102 +10,105 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class printRange(UITestCase): def test_printRange(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F20"})) - #Set print range - self.xUITest.executeCommand(".uno:DefinePrintArea") - # Print Range dialog - self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") - xDialog = self.xUITest.getTopFocusWindow() - xlbprintarea = xDialog.getChild("lbprintarea") - xedprintarea = xDialog.getChild("edprintarea") - #verify range - self.assertEqual(get_state_as_dict(xlbprintarea)["SelectEntryText"], "- selection -") - self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") - #set Row - xedrepeatrow = xDialog.getChild("edrepeatrow") - xedrepeatrow.executeAction("TYPE", mkPropertyValues({"TEXT":"$1"})) - #set Column - xedrepeatcol = xDialog.getChild("edrepeatcol") - xedrepeatcol.executeAction("TYPE", mkPropertyValues({"TEXT":"$A"})) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F20"})) + #Set print range + self.xUITest.executeCommand(".uno:DefinePrintArea") + # Print Range dialog + self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") + xDialog = self.xUITest.getTopFocusWindow() + xlbprintarea = xDialog.getChild("lbprintarea") + xedprintarea = xDialog.getChild("edprintarea") + #verify range + self.assertEqual(get_state_as_dict(xlbprintarea)["SelectEntryText"], "- selection -") + self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") + #set Row + xedrepeatrow = xDialog.getChild("edrepeatrow") + xedrepeatrow.executeAction("TYPE", mkPropertyValues({"TEXT":"$1"})) + #set Column + xedrepeatcol = xDialog.getChild("edrepeatcol") + xedrepeatcol.executeAction("TYPE", mkPropertyValues({"TEXT":"$A"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - #Verify Print Range dialog - self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") - xDialog = self.xUITest.getTopFocusWindow() - xedprintarea = xDialog.getChild("edprintarea") - xedrepeatrow = xDialog.getChild("edrepeatrow") - xedrepeatcol = xDialog.getChild("edrepeatcol") - self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") - self.assertEqual(get_state_as_dict(xedrepeatrow)["Text"], "$1") - self.assertEqual(get_state_as_dict(xedrepeatcol)["Text"], "$A") - xCancel = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancel) + #Verify Print Range dialog + self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") + xDialog = self.xUITest.getTopFocusWindow() + xedprintarea = xDialog.getChild("edprintarea") + xedrepeatrow = xDialog.getChild("edrepeatrow") + xedrepeatcol = xDialog.getChild("edrepeatcol") + self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") + self.assertEqual(get_state_as_dict(xedrepeatrow)["Text"], "$1") + self.assertEqual(get_state_as_dict(xedrepeatcol)["Text"], "$A") + xCancel = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancel) - #delete print ranges - self.xUITest.executeCommand(".uno:DeletePrintArea") - #Verify Print Range dialog - self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") - xDialog = self.xUITest.getTopFocusWindow() - xedprintarea = xDialog.getChild("edprintarea") - xlbprintarea = xDialog.getChild("lbprintarea") - xedrepeatrow = xDialog.getChild("edrepeatrow") - xedrepeatcol = xDialog.getChild("edrepeatcol") - self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "") - self.assertEqual(get_state_as_dict(xlbprintarea)["SelectEntryText"], "- entire sheet -") - self.assertEqual(get_state_as_dict(xedrepeatrow)["Text"], "$1") - self.assertEqual(get_state_as_dict(xedrepeatcol)["Text"], "$A") - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + #delete print ranges + self.xUITest.executeCommand(".uno:DeletePrintArea") + #Verify Print Range dialog + self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") + xDialog = self.xUITest.getTopFocusWindow() + xedprintarea = xDialog.getChild("edprintarea") + xlbprintarea = xDialog.getChild("lbprintarea") + xedrepeatrow = xDialog.getChild("edrepeatrow") + xedrepeatcol = xDialog.getChild("edrepeatcol") + self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "") + self.assertEqual(get_state_as_dict(xlbprintarea)["SelectEntryText"], "- entire sheet -") + self.assertEqual(get_state_as_dict(xedrepeatrow)["Text"], "$1") + self.assertEqual(get_state_as_dict(xedrepeatcol)["Text"], "$A") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + self.ui_test.close_doc() def test_tdf33341_copy_sheet_with_print_range(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F20"})) - #Set print range - self.xUITest.executeCommand(".uno:DefinePrintArea") - # Print Range dialog - self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") - xDialog = self.xUITest.getTopFocusWindow() - xlbprintarea = xDialog.getChild("lbprintarea") - xedprintarea = xDialog.getChild("edprintarea") - #verify range - self.assertEqual(get_state_as_dict(xlbprintarea)["SelectEntryText"], "- selection -") - self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") - #set Row - xedrepeatrow = xDialog.getChild("edrepeatrow") - xedrepeatrow.executeAction("TYPE", mkPropertyValues({"TEXT":"$1"})) - #set Column - xedrepeatcol = xDialog.getChild("edrepeatcol") - xedrepeatcol.executeAction("TYPE", mkPropertyValues({"TEXT":"$A"})) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F20"})) + #Set print range + self.xUITest.executeCommand(".uno:DefinePrintArea") + # Print Range dialog + self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") + xDialog = self.xUITest.getTopFocusWindow() + xlbprintarea = xDialog.getChild("lbprintarea") + xedprintarea = xDialog.getChild("edprintarea") + #verify range + self.assertEqual(get_state_as_dict(xlbprintarea)["SelectEntryText"], "- selection -") + self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") + #set Row + xedrepeatrow = xDialog.getChild("edrepeatrow") + xedrepeatrow.executeAction("TYPE", mkPropertyValues({"TEXT":"$1"})) + #set Column + xedrepeatcol = xDialog.getChild("edrepeatcol") + xedrepeatcol.executeAction("TYPE", mkPropertyValues({"TEXT":"$A"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - #Copy sheet - self.ui_test.execute_dialog_through_command(".uno:Move") - xDialog = self.xUITest.getTopFocusWindow() - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - #Verify Print Range dialog on new sheet - self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") - xDialog = self.xUITest.getTopFocusWindow() - xedprintarea = xDialog.getChild("edprintarea") - xedrepeatrow = xDialog.getChild("edrepeatrow") - xedrepeatcol = xDialog.getChild("edrepeatcol") - self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") - self.assertEqual(get_state_as_dict(xedrepeatrow)["Text"], "$1") - self.assertEqual(get_state_as_dict(xedrepeatcol)["Text"], "$A") - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + #Copy sheet + self.ui_test.execute_dialog_through_command(".uno:Move") + xDialog = self.xUITest.getTopFocusWindow() + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #Verify Print Range dialog on new sheet + self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") + xDialog = self.xUITest.getTopFocusWindow() + xedprintarea = xDialog.getChild("edprintarea") + xedrepeatrow = xDialog.getChild("edrepeatrow") + xedrepeatcol = xDialog.getChild("edrepeatcol") + self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") + self.assertEqual(get_state_as_dict(xedrepeatrow)["Text"], "$1") + self.assertEqual(get_state_as_dict(xedrepeatcol)["Text"], "$A") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/rows.py b/sc/qa/uitest/calc_tests/rows.py index 2b3d3413521e..b5e40fa1e327 100644 --- a/sc/qa/uitest/calc_tests/rows.py +++ b/sc/qa/uitest/calc_tests/rows.py @@ -11,209 +11,221 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class CalcRows(UITestCase): def test_row_height(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - change_measurement_unit(self, "Centimeter") - - #select A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #row height - self.ui_test.execute_dialog_through_command(".uno:RowHeight") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - xdefault = xDialog.getChild("default") - self.assertEqual(get_state_as_dict(xdefault)["Selected"], "true") #default selected - heightStrOrig = get_state_as_dict(xvalue)["Text"] - heightVal = heightStrOrig[:4] #default 0.45 cm - xvalue.executeAction("UP", tuple()) #0.50 cm - heightStr = get_state_as_dict(xvalue)["Text"] - heightValNew = heightStr[:4] - self.assertEqual(get_state_as_dict(xdefault)["Selected"], "false") #default not selected - self.assertEqual(heightValNew > heightVal, True) #new value is bigger - xdefault.executeAction("CLICK", tuple()) #click default - self.assertEqual(get_state_as_dict(xvalue)["Text"] == heightStrOrig, True) #default value set - #write your own value - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - #verify - self.ui_test.execute_dialog_through_command(".uno:RowHeight") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") - xCancel = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancel) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + change_measurement_unit(self, "Centimeter") + + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #row height + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xdefault = xDialog.getChild("default") + self.assertEqual(get_state_as_dict(xdefault)["Selected"], "true") #default selected + heightStrOrig = get_state_as_dict(xvalue)["Text"] + heightVal = heightStrOrig[:4] #default 0.45 cm + xvalue.executeAction("UP", tuple()) #0.50 cm + heightStr = get_state_as_dict(xvalue)["Text"] + heightValNew = heightStr[:4] + self.assertEqual(get_state_as_dict(xdefault)["Selected"], "false") #default not selected + self.assertEqual(heightValNew > heightVal, True) #new value is bigger + xdefault.executeAction("CLICK", tuple()) #click default + self.assertEqual(get_state_as_dict(xvalue)["Text"] == heightStrOrig, True) #default value set + #write your own value + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #verify + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") + xCancel = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancel) + + self.ui_test.close_doc() def test_row_height_two_rows(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - change_measurement_unit(self, "Centimeter") - - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3", "EXTEND":"1"})) - - self.ui_test.execute_dialog_through_command(".uno:RowHeight") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - xdefault = xDialog.getChild("default") - #write your own value - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - #verify - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.ui_test.execute_dialog_through_command(".uno:RowHeight") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - self.ui_test.execute_dialog_through_command(".uno:RowHeight") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + change_measurement_unit(self, "Centimeter") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3", "EXTEND":"1"})) + + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xdefault = xDialog.getChild("default") + #write your own value + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.ui_test.close_doc() def test_tdf89140_row_height_copy(self): #Bug 89140 - Calc row paste doesn't keep row height - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - change_measurement_unit(self, "Centimeter") - - #select A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #row height - self.ui_test.execute_dialog_through_command(".uno:RowHeight") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - #select row 1 - self.xUITest.executeCommand(".uno:SelectRow") - #copy - self.xUITest.executeCommand(".uno:Copy") - #select A3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - #paste - self.xUITest.executeCommand(".uno:Paste") - #verify - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - self.ui_test.execute_dialog_through_command(".uno:RowHeight") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + change_measurement_unit(self, "Centimeter") + + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #row height + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #select row 1 + self.xUITest.executeCommand(".uno:SelectRow") + #copy + self.xUITest.executeCommand(".uno:Copy") + #select A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #paste + self.xUITest.executeCommand(".uno:Paste") + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.ui_test.close_doc() def test_row_hide_show(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #select A3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - self.xUITest.executeCommand(".uno:HideRow") #uno command moves focus one cell down - #verify A4 - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "3") - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"UP"})) - #verify A2 (row 3 is hidden) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "1") - #Show hidden row: select A2:A4 - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A4"})) - self.xUITest.executeCommand(".uno:ShowRow") - #verify - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A4"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "3") - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"UP"})) - #verify A3 (row 3 is not hidden) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "2") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + self.xUITest.executeCommand(".uno:HideRow") #uno command moves focus one cell down + #verify A4 + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "3") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"UP"})) + #verify A2 (row 3 is hidden) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "1") + #Show hidden row: select A2:A4 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A4"})) + self.xUITest.executeCommand(".uno:ShowRow") + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A4"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "3") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"UP"})) + #verify A3 (row 3 is not hidden) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + + self.ui_test.close_doc() def test_row_test_move(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #select A3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "2") - #down - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) - #verify A4 - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "3") - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"UP"})) - #verify A2 - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "2") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + #down + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + #verify A4 + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "3") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"UP"})) + #verify A2 + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + + self.ui_test.close_doc() def test_row_height_insert_below(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - change_measurement_unit(self, "Centimeter") - - #select A3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - #row height - self.ui_test.execute_dialog_through_command(".uno:RowHeight") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - #select row 3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - self.xUITest.executeCommand(".uno:SelectRow") - #insert rows below - self.xUITest.executeCommand(".uno:InsertRowsAfter") - - #verify - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - self.ui_test.execute_dialog_through_command(".uno:RowHeight") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A4"})) - self.ui_test.execute_dialog_through_command(".uno:RowHeight") - xDialog = self.xUITest.getTopFocusWindow() - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + change_measurement_unit(self, "Centimeter") + + #select A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #row height + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #select row 3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + self.xUITest.executeCommand(".uno:SelectRow") + #insert rows below + self.xUITest.executeCommand(".uno:InsertRowsAfter") + + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A4"})) + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.0001 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/sheetRename.py b/sc/qa/uitest/calc_tests/sheetRename.py index e175faccde52..0f8478b8454b 100644 --- a/sc/qa/uitest/calc_tests/sheetRename.py +++ b/sc/qa/uitest/calc_tests/sheetRename.py @@ -10,49 +10,53 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class sheetRename(UITestCase): def test_sheet_rename(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - self.ui_test.execute_dialog_through_command(".uno:RenameTable") - xDialog = self.xUITest.getTopFocusWindow() - xname_entry = xDialog.getChild("name_entry") - xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.ui_test.execute_dialog_through_command(".uno:RenameTable") - xDialog = self.xUITest.getTopFocusWindow() - xname_entry = xDialog.getChild("name_entry") - self.assertEqual(get_state_as_dict(xname_entry)["Text"], "NewName") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + self.ui_test.execute_dialog_through_command(".uno:RenameTable") + xDialog = self.xUITest.getTopFocusWindow() + xname_entry = xDialog.getChild("name_entry") + xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.ui_test.execute_dialog_through_command(".uno:RenameTable") + xDialog = self.xUITest.getTopFocusWindow() + xname_entry = xDialog.getChild("name_entry") + self.assertEqual(get_state_as_dict(xname_entry)["Text"], "NewName") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() def test_sheet_rename_invalid_sheet_name(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - self.ui_test.execute_dialog_through_command(".uno:RenameTable") - xDialog = self.xUITest.getTopFocusWindow() - xname_entry = xDialog.getChild("name_entry") - nameVal = get_state_as_dict(xname_entry)["Text"] - xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName**"})) - xOKBtn = xDialog.getChild("ok") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + self.ui_test.execute_dialog_through_command(".uno:RenameTable") + xDialog = self.xUITest.getTopFocusWindow() + xname_entry = xDialog.getChild("name_entry") + nameVal = get_state_as_dict(xname_entry)["Text"] + xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName**"})) + xOKBtn = xDialog.getChild("ok") + + with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ())): + pass - with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ())): - pass + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + #Verify + self.ui_test.execute_dialog_through_command(".uno:RenameTable") + xDialog = self.xUITest.getTopFocusWindow() + xname_entry = xDialog.getChild("name_entry") + self.assertEqual(get_state_as_dict(xname_entry)["Text"], nameVal) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.ui_test.execute_dialog_through_command(".uno:RenameTable") - xDialog = self.xUITest.getTopFocusWindow() - xname_entry = xDialog.getChild("name_entry") - self.assertEqual(get_state_as_dict(xname_entry)["Text"], nameVal) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.close_doc() # def test_tdf81431_rename_sheet_clipboard_content_wiped_out(self): # calc_doc = self.ui_test.create_doc_in_start_center("calc") @@ -94,4 +98,5 @@ class sheetRename(UITestCase): # xOKBtn = xDialog.getChild("ok") # self.ui_test.close_dialog_through_button(xOKBtn) +# self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/zoom.py b/sc/qa/uitest/calc_tests/zoom.py index 15b94914c095..dc4ef64ff5e6 100644 --- a/sc/qa/uitest/calc_tests/zoom.py +++ b/sc/qa/uitest/calc_tests/zoom.py @@ -11,57 +11,59 @@ from uitest.uihelper.common import get_state_as_dict class calcZoom(UITestCase): def test_zoom_calc(self): - with self.ui_test.create_doc_in_start_center("calc"): - MainWindow = self.xUITest.getTopFocusWindow() - gridwin = MainWindow.getChild("grid_window") - gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "0"})) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + MainDoc = self.ui_test.create_doc_in_start_center("calc") + MainWindow = self.xUITest.getTopFocusWindow() + gridwin = MainWindow.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "0"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #Set the Zoom to be 100% - gridwin.executeAction("SET", mkPropertyValues({"ZOOM": "100"})) - self.assertEqual(get_state_as_dict(gridwin)["Zoom"], "100") + #Set the Zoom to be 100% + gridwin.executeAction("SET", mkPropertyValues({"ZOOM": "100"})) + self.assertEqual(get_state_as_dict(gridwin)["Zoom"], "100") - #dialog View-Zoom-Zoom - self.ui_test.execute_dialog_through_command(".uno:Zoom") - xDialog = self.xUITest.getTopFocusWindow() + #dialog View-Zoom-Zoom + self.ui_test.execute_dialog_through_command(".uno:Zoom") + xDialog = self.xUITest.getTopFocusWindow() - #select fit weight & height - OK - open and verify - fitwandh = xDialog.getChild("fitwandh") - fitwandh.executeAction("CLICK",tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + #select fit weight & height - OK - open and verify + fitwandh = xDialog.getChild("fitwandh") + fitwandh.executeAction("CLICK",tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - self.ui_test.execute_dialog_through_command(".uno:Zoom") - xDialog = self.xUITest.getTopFocusWindow() - #select fit weight - OK - open and verify - fitw = xDialog.getChild("fitw") - fitw.executeAction("CLICK",tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.execute_dialog_through_command(".uno:Zoom") + xDialog = self.xUITest.getTopFocusWindow() + #select fit weight - OK - open and verify + fitw = xDialog.getChild("fitw") + fitw.executeAction("CLICK",tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - self.ui_test.execute_dialog_through_command(".uno:Zoom") - xDialog = self.xUITest.getTopFocusWindow() - #select 100% & Automatic - OK - open and verify - x100pc = xDialog.getChild("100pc") - x100pc.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - self.assertEqual(get_state_as_dict(gridwin)["Zoom"], "100") + self.ui_test.execute_dialog_through_command(".uno:Zoom") + xDialog = self.xUITest.getTopFocusWindow() + #select 100% & Automatic - OK - open and verify + x100pc = xDialog.getChild("100pc") + x100pc.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.assertEqual(get_state_as_dict(gridwin)["Zoom"], "100") - #Set the Zoom to be 103% - gridwin.executeAction("SET", mkPropertyValues({"ZOOM": "103"})) - self.assertEqual(get_state_as_dict(gridwin)["Zoom"], "103") + #Set the Zoom to be 103% + gridwin.executeAction("SET", mkPropertyValues({"ZOOM": "103"})) + self.assertEqual(get_state_as_dict(gridwin)["Zoom"], "103") - self.ui_test.execute_dialog_through_command(".uno:Zoom") - xDialog = self.xUITest.getTopFocusWindow() - #select variable option and make zoom 100% again - OK - open and verify - zoomsb = xDialog.getChild("zoomsb") - self.assertEqual(get_state_as_dict(zoomsb)["Text"], "103%") - zoomsb.executeAction("DOWN",tuple()) - zoomsb.executeAction("DOWN",tuple()) - zoomsb.executeAction("DOWN",tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - self.assertEqual(get_state_as_dict(gridwin)["Zoom"], "100") + self.ui_test.execute_dialog_through_command(".uno:Zoom") + xDialog = self.xUITest.getTopFocusWindow() + #select variable option and make zoom 100% again - OK - open and verify + zoomsb = xDialog.getChild("zoomsb") + self.assertEqual(get_state_as_dict(zoomsb)["Text"], "103%") + zoomsb.executeAction("DOWN",tuple()) + zoomsb.executeAction("DOWN",tuple()) + zoomsb.executeAction("DOWN",tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.assertEqual(get_state_as_dict(gridwin)["Zoom"], "100") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/dataform.py b/sc/qa/uitest/calc_tests2/dataform.py index 94634025265a..fedbebc3cd52 100644 --- a/sc/qa/uitest/calc_tests2/dataform.py +++ b/sc/qa/uitest/calc_tests2/dataform.py @@ -9,16 +9,17 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class dataform(UITestCase): def test_dataform(self): - with self.ui_test.create_doc_in_start_center("calc"): + calc_doc = self.ui_test.create_doc_in_start_center("calc") - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A10"})) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A10"})) - self.ui_test.execute_dialog_through_command(".uno:DataForm") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:DataForm") + xDialog = self.xUITest.getTopFocusWindow() - xCloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xCloseBtn) + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/standardFilter.py b/sc/qa/uitest/calc_tests2/standardFilter.py index bd73c7aacf52..25b6373c7e42 100644 --- a/sc/qa/uitest/calc_tests2/standardFilter.py +++ b/sc/qa/uitest/calc_tests2/standardFilter.py @@ -136,541 +136,554 @@ class standardFilter(UITestCase): self.assertEqual(get_cell_by_position(document, 1, 7, 2).getValue(), 4) def test_standard_filter_case_sensitive(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - enter_text_to_cell(gridwin, "A1", "first") - enter_text_to_cell(gridwin, "B1", "second") - enter_text_to_cell(gridwin, "A2", "a1") - enter_text_to_cell(gridwin, "A3", "A1") - enter_text_to_cell(gridwin, "A4", "A1") - enter_text_to_cell(gridwin, "B2", "4") - enter_text_to_cell(gridwin, "B3", "5") - enter_text_to_cell(gridwin, "B4", "6") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B4"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcase = xDialog.getChild("case") - - select_by_text(xfield1, "first") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a1"})) - xcase.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #2x down - should be on row 5 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "4") - #reopen filter and verify - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcase = xDialog.getChild("case") - - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first") - self.assertEqual(get_state_as_dict(xval1)["Text"], "a1") - self.assertEqual(get_state_as_dict(xcase)["Selected"], "true") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "first") + enter_text_to_cell(gridwin, "B1", "second") + enter_text_to_cell(gridwin, "A2", "a1") + enter_text_to_cell(gridwin, "A3", "A1") + enter_text_to_cell(gridwin, "A4", "A1") + enter_text_to_cell(gridwin, "B2", "4") + enter_text_to_cell(gridwin, "B3", "5") + enter_text_to_cell(gridwin, "B4", "6") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B4"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcase = xDialog.getChild("case") + + select_by_text(xfield1, "first") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a1"})) + xcase.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #2x down - should be on row 5 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "4") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcase = xDialog.getChild("case") + + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first") + self.assertEqual(get_state_as_dict(xval1)["Text"], "a1") + self.assertEqual(get_state_as_dict(xcase)["Selected"], "true") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.close_doc() def test_standard_filter_regular_expression(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - enter_text_to_cell(gridwin, "A1", "first") - enter_text_to_cell(gridwin, "B1", "second") - enter_text_to_cell(gridwin, "A2", "aa") - enter_text_to_cell(gridwin, "A3", "aaa") - enter_text_to_cell(gridwin, "A4", "abbb") - enter_text_to_cell(gridwin, "A5", "accc") - enter_text_to_cell(gridwin, "A6", "a*") - enter_text_to_cell(gridwin, "B2", "1") - enter_text_to_cell(gridwin, "B3", "2") - enter_text_to_cell(gridwin, "B4", "3") - enter_text_to_cell(gridwin, "B5", "4") - enter_text_to_cell(gridwin, "B6", "5") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B6"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xregexp = xDialog.getChild("regexp") - - select_by_text(xfield1, "first") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a*"})) - xregexp.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #3x down - should be on row 7 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "6") - #reopen filter and verify - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xregexp = xDialog.getChild("regexp") - - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first") - self.assertEqual(get_state_as_dict(xval1)["Text"], "a*") - self.assertEqual(get_state_as_dict(xregexp)["Selected"], "true") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "first") + enter_text_to_cell(gridwin, "B1", "second") + enter_text_to_cell(gridwin, "A2", "aa") + enter_text_to_cell(gridwin, "A3", "aaa") + enter_text_to_cell(gridwin, "A4", "abbb") + enter_text_to_cell(gridwin, "A5", "accc") + enter_text_to_cell(gridwin, "A6", "a*") + enter_text_to_cell(gridwin, "B2", "1") + enter_text_to_cell(gridwin, "B3", "2") + enter_text_to_cell(gridwin, "B4", "3") + enter_text_to_cell(gridwin, "B5", "4") + enter_text_to_cell(gridwin, "B6", "5") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B6"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xregexp = xDialog.getChild("regexp") + + select_by_text(xfield1, "first") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a*"})) + xregexp.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #3x down - should be on row 7 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "6") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xregexp = xDialog.getChild("regexp") + + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first") + self.assertEqual(get_state_as_dict(xval1)["Text"], "a*") + self.assertEqual(get_state_as_dict(xregexp)["Selected"], "true") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.close_doc() def test_standard_filter_condition_contains(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - enter_text_to_cell(gridwin, "A1", "first") - enter_text_to_cell(gridwin, "B1", "second") - enter_text_to_cell(gridwin, "A2", "aa") - enter_text_to_cell(gridwin, "A3", "aaa") - enter_text_to_cell(gridwin, "A4", "abbb") - enter_text_to_cell(gridwin, "A5", "accc") - enter_text_to_cell(gridwin, "A6", "a*") - enter_text_to_cell(gridwin, "B2", "1") - enter_text_to_cell(gridwin, "B3", "2") - enter_text_to_cell(gridwin, "B4", "3") - enter_text_to_cell(gridwin, "B5", "4") - enter_text_to_cell(gridwin, "B6", "5") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B6"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xregexp = xDialog.getChild("regexp") - - select_by_text(xfield1, "first") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a*"})) - xregexp.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #3x down - should be on row 7 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "6") - #reopen filter and verify - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xregexp = xDialog.getChild("regexp") - - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first") - self.assertEqual(get_state_as_dict(xval1)["Text"], "a*") - self.assertEqual(get_state_as_dict(xregexp)["Selected"], "true") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "first") + enter_text_to_cell(gridwin, "B1", "second") + enter_text_to_cell(gridwin, "A2", "aa") + enter_text_to_cell(gridwin, "A3", "aaa") + enter_text_to_cell(gridwin, "A4", "abbb") + enter_text_to_cell(gridwin, "A5", "accc") + enter_text_to_cell(gridwin, "A6", "a*") + enter_text_to_cell(gridwin, "B2", "1") + enter_text_to_cell(gridwin, "B3", "2") + enter_text_to_cell(gridwin, "B4", "3") + enter_text_to_cell(gridwin, "B5", "4") + enter_text_to_cell(gridwin, "B6", "5") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B6"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xregexp = xDialog.getChild("regexp") + + select_by_text(xfield1, "first") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a*"})) + xregexp.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #3x down - should be on row 7 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "6") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xregexp = xDialog.getChild("regexp") + + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first") + self.assertEqual(get_state_as_dict(xval1)["Text"], "a*") + self.assertEqual(get_state_as_dict(xregexp)["Selected"], "true") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.close_doc() #from testcasespecification OOo def test_standard_filter_condition_contains2(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - enter_text_to_cell(gridwin, "A1", "A") - enter_text_to_cell(gridwin, "B1", "B") - enter_text_to_cell(gridwin, "C1", "C") - enter_text_to_cell(gridwin, "D1", "D") - enter_text_to_cell(gridwin, "A2", "economics") - enter_text_to_cell(gridwin, "B2", "34") - enter_text_to_cell(gridwin, "C2", "67") - enter_text_to_cell(gridwin, "D2", "122") - enter_text_to_cell(gridwin, "A3", "socioeconomic") - enter_text_to_cell(gridwin, "B3", "45") - enter_text_to_cell(gridwin, "C3", "77") - enter_text_to_cell(gridwin, "D3", "333") - enter_text_to_cell(gridwin, "A4", "sociology") - enter_text_to_cell(gridwin, "B4", "78") - enter_text_to_cell(gridwin, "C4", "89") - enter_text_to_cell(gridwin, "D4", "56") - enter_text_to_cell(gridwin, "A5", "humanities") - enter_text_to_cell(gridwin, "B5", "45") - enter_text_to_cell(gridwin, "C5", "67") - enter_text_to_cell(gridwin, "D5", "89") - #Select - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) - #Choose DATA-FILTER-STANDARDFILTER - #Choose field name "A"/ Choose condition "Contains"/Enter value "cio"/Press OK button - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - - select_by_text(xfield1, "A") - select_by_text(xcond1, "Contains") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"cio"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - #Verify that row 1,3, 4 are visible (2 and 5 are hidden) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "2") - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "3") - #reopen filter and verify - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") - self.assertEqual(get_state_as_dict(xval1)["Text"], "cio") - self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Contains") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "D1", "D") + enter_text_to_cell(gridwin, "A2", "economics") + enter_text_to_cell(gridwin, "B2", "34") + enter_text_to_cell(gridwin, "C2", "67") + enter_text_to_cell(gridwin, "D2", "122") + enter_text_to_cell(gridwin, "A3", "socioeconomic") + enter_text_to_cell(gridwin, "B3", "45") + enter_text_to_cell(gridwin, "C3", "77") + enter_text_to_cell(gridwin, "D3", "333") + enter_text_to_cell(gridwin, "A4", "sociology") + enter_text_to_cell(gridwin, "B4", "78") + enter_text_to_cell(gridwin, "C4", "89") + enter_text_to_cell(gridwin, "D4", "56") + enter_text_to_cell(gridwin, "A5", "humanities") + enter_text_to_cell(gridwin, "B5", "45") + enter_text_to_cell(gridwin, "C5", "67") + enter_text_to_cell(gridwin, "D5", "89") + #Select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "A"/ Choose condition "Contains"/Enter value "cio"/Press OK button + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Contains") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"cio"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #Verify that row 1,3, 4 are visible (2 and 5 are hidden) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "3") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "cio") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Contains") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.close_doc() def test_standard_filter_condition_does_not_contains(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - enter_text_to_cell(gridwin, "A1", "A") - enter_text_to_cell(gridwin, "B1", "B") - enter_text_to_cell(gridwin, "C1", "C") - enter_text_to_cell(gridwin, "D1", "D") - enter_text_to_cell(gridwin, "A2", "economics") - enter_text_to_cell(gridwin, "B2", "34") - enter_text_to_cell(gridwin, "C2", "67") - enter_text_to_cell(gridwin, "D2", "122") - enter_text_to_cell(gridwin, "A3", "socioeconomic") - enter_text_to_cell(gridwin, "B3", "45") - enter_text_to_cell(gridwin, "C3", "77") - enter_text_to_cell(gridwin, "D3", "333") - enter_text_to_cell(gridwin, "A4", "sociology") - enter_text_to_cell(gridwin, "B4", "78") - enter_text_to_cell(gridwin, "C4", "89") - enter_text_to_cell(gridwin, "D4", "56") - enter_text_to_cell(gridwin, "A5", "humanities") - enter_text_to_cell(gridwin, "B5", "45") - enter_text_to_cell(gridwin, "C5", "67") - enter_text_to_cell(gridwin, "D5", "89") - #Select - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) - #Choose DATA-FILTER-STANDARDFILTER - #Choose field name "A"/ Choose condition "Does not contain"/Enter value "cio"/Press OK button - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - - select_by_text(xfield1, "A") - select_by_text(xcond1, "Does not contain") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"cio"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - #Verify that row 1,2, 5 are visible (3 and 4 are hidden) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "1") - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "4") - #reopen filter and verify - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") - self.assertEqual(get_state_as_dict(xval1)["Text"], "cio") - self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not contain") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "D1", "D") + enter_text_to_cell(gridwin, "A2", "economics") + enter_text_to_cell(gridwin, "B2", "34") + enter_text_to_cell(gridwin, "C2", "67") + enter_text_to_cell(gridwin, "D2", "122") + enter_text_to_cell(gridwin, "A3", "socioeconomic") + enter_text_to_cell(gridwin, "B3", "45") + enter_text_to_cell(gridwin, "C3", "77") + enter_text_to_cell(gridwin, "D3", "333") + enter_text_to_cell(gridwin, "A4", "sociology") + enter_text_to_cell(gridwin, "B4", "78") + enter_text_to_cell(gridwin, "C4", "89") + enter_text_to_cell(gridwin, "D4", "56") + enter_text_to_cell(gridwin, "A5", "humanities") + enter_text_to_cell(gridwin, "B5", "45") + enter_text_to_cell(gridwin, "C5", "67") + enter_text_to_cell(gridwin, "D5", "89") + #Select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "A"/ Choose condition "Does not contain"/Enter value "cio"/Press OK button + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Does not contain") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"cio"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #Verify that row 1,2, 5 are visible (3 and 4 are hidden) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "1") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "4") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "cio") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not contain") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() def test_standard_filter_condition_Begins_with(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - enter_text_to_cell(gridwin, "A1", "A") - enter_text_to_cell(gridwin, "B1", "B") - enter_text_to_cell(gridwin, "C1", "C") - enter_text_to_cell(gridwin, "D1", "D") - enter_text_to_cell(gridwin, "A2", "economics") - enter_text_to_cell(gridwin, "B2", "34") - enter_text_to_cell(gridwin, "C2", "67") - enter_text_to_cell(gridwin, "D2", "122") - enter_text_to_cell(gridwin, "A3", "socioeconomic") - enter_text_to_cell(gridwin, "B3", "45") - enter_text_to_cell(gridwin, "C3", "77") - enter_text_to_cell(gridwin, "D3", "333") - enter_text_to_cell(gridwin, "A4", "sociology") - enter_text_to_cell(gridwin, "B4", "78") - enter_text_to_cell(gridwin, "C4", "89") - enter_text_to_cell(gridwin, "D4", "56") - enter_text_to_cell(gridwin, "A5", "humanities") - enter_text_to_cell(gridwin, "B5", "45") - enter_text_to_cell(gridwin, "C5", "67") - enter_text_to_cell(gridwin, "D5", "89") - #Select - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) - #Choose DATA-FILTER-STANDARDFILTER - #Choose field name "A"/ Choose condition "Begins with"/Enter value "si"/Press OK button - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - - select_by_text(xfield1, "A") - select_by_text(xcond1, "Begins with") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"so"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - #Verify that row 1,3, 4 are visible (2 and 5 are hidden) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "2") - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "3") - #reopen filter and verify - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") - self.assertEqual(get_state_as_dict(xval1)["Text"], "so") - self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Begins with") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "D1", "D") + enter_text_to_cell(gridwin, "A2", "economics") + enter_text_to_cell(gridwin, "B2", "34") + enter_text_to_cell(gridwin, "C2", "67") + enter_text_to_cell(gridwin, "D2", "122") + enter_text_to_cell(gridwin, "A3", "socioeconomic") + enter_text_to_cell(gridwin, "B3", "45") + enter_text_to_cell(gridwin, "C3", "77") + enter_text_to_cell(gridwin, "D3", "333") + enter_text_to_cell(gridwin, "A4", "sociology") + enter_text_to_cell(gridwin, "B4", "78") + enter_text_to_cell(gridwin, "C4", "89") + enter_text_to_cell(gridwin, "D4", "56") + enter_text_to_cell(gridwin, "A5", "humanities") + enter_text_to_cell(gridwin, "B5", "45") + enter_text_to_cell(gridwin, "C5", "67") + enter_text_to_cell(gridwin, "D5", "89") + #Select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "A"/ Choose condition "Begins with"/Enter value "si"/Press OK button + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Begins with") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"so"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #Verify that row 1,3, 4 are visible (2 and 5 are hidden) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "3") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "so") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Begins with") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() def test_standard_filter_condition_Does_not_begin_with(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - enter_text_to_cell(gridwin, "A1", "A") - enter_text_to_cell(gridwin, "B1", "B") - enter_text_to_cell(gridwin, "C1", "C") - enter_text_to_cell(gridwin, "D1", "D") - enter_text_to_cell(gridwin, "A2", "economics") - enter_text_to_cell(gridwin, "B2", "34") - enter_text_to_cell(gridwin, "C2", "67") - enter_text_to_cell(gridwin, "D2", "122") - enter_text_to_cell(gridwin, "A3", "socioeconomic") - enter_text_to_cell(gridwin, "B3", "45") - enter_text_to_cell(gridwin, "C3", "77") - enter_text_to_cell(gridwin, "D3", "333") - enter_text_to_cell(gridwin, "A4", "sociology") - enter_text_to_cell(gridwin, "B4", "78") - enter_text_to_cell(gridwin, "C4", "89") - enter_text_to_cell(gridwin, "D4", "56") - enter_text_to_cell(gridwin, "A5", "humanities") - enter_text_to_cell(gridwin, "B5", "45") - enter_text_to_cell(gridwin, "C5", "67") - enter_text_to_cell(gridwin, "D5", "89") - #Select - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) - #Choose DATA-FILTER-STANDARDFILTER - #Choose field name "A"/ Choose condition "Does not contain"/Enter value "cio"/Press OK button - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - - select_by_text(xfield1, "A") - select_by_text(xcond1, "Does not begin with") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"so"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - #Verify that row 1,2, 5 are visible (3 and 4 are hidden) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "1") - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "4") - #reopen filter and verify - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") - self.assertEqual(get_state_as_dict(xval1)["Text"], "so") - self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not begin with") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "D1", "D") + enter_text_to_cell(gridwin, "A2", "economics") + enter_text_to_cell(gridwin, "B2", "34") + enter_text_to_cell(gridwin, "C2", "67") + enter_text_to_cell(gridwin, "D2", "122") + enter_text_to_cell(gridwin, "A3", "socioeconomic") + enter_text_to_cell(gridwin, "B3", "45") + enter_text_to_cell(gridwin, "C3", "77") + enter_text_to_cell(gridwin, "D3", "333") + enter_text_to_cell(gridwin, "A4", "sociology") + enter_text_to_cell(gridwin, "B4", "78") + enter_text_to_cell(gridwin, "C4", "89") + enter_text_to_cell(gridwin, "D4", "56") + enter_text_to_cell(gridwin, "A5", "humanities") + enter_text_to_cell(gridwin, "B5", "45") + enter_text_to_cell(gridwin, "C5", "67") + enter_text_to_cell(gridwin, "D5", "89") + #Select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "A"/ Choose condition "Does not contain"/Enter value "cio"/Press OK button + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Does not begin with") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"so"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #Verify that row 1,2, 5 are visible (3 and 4 are hidden) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "1") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "4") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "so") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not begin with") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() def test_standard_filter_condition_Ends_with(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - enter_text_to_cell(gridwin, "A1", "A") - enter_text_to_cell(gridwin, "B1", "B") - enter_text_to_cell(gridwin, "C1", "C") - enter_text_to_cell(gridwin, "D1", "D") - enter_text_to_cell(gridwin, "A2", "economics") - enter_text_to_cell(gridwin, "B2", "34") - enter_text_to_cell(gridwin, "C2", "67") - enter_text_to_cell(gridwin, "D2", "122") - enter_text_to_cell(gridwin, "A3", "socioeconomic") - enter_text_to_cell(gridwin, "B3", "45") - enter_text_to_cell(gridwin, "C3", "77") - enter_text_to_cell(gridwin, "D3", "333") - enter_text_to_cell(gridwin, "A4", "sociology") - enter_text_to_cell(gridwin, "B4", "78") - enter_text_to_cell(gridwin, "C4", "89") - enter_text_to_cell(gridwin, "D4", "56") - enter_text_to_cell(gridwin, "A5", "humanities") - enter_text_to_cell(gridwin, "B5", "45") - enter_text_to_cell(gridwin, "C5", "67") - enter_text_to_cell(gridwin, "D5", "89") - #Select - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) - #Choose DATA-FILTER-STANDARDFILTER - #Choose field name "A"/ Choose condition "Does not contain"/Enter value "cio"/Press OK button - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - - select_by_text(xfield1, "A") - select_by_text(xcond1, "Ends with") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"s"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - #Verify that row 1,2, 5 are visible (3 and 4 are hidden) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "1") - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "4") - #reopen filter and verify - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") - self.assertEqual(get_state_as_dict(xval1)["Text"], "s") - self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Ends with") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "D1", "D") + enter_text_to_cell(gridwin, "A2", "economics") + enter_text_to_cell(gridwin, "B2", "34") + enter_text_to_cell(gridwin, "C2", "67") + enter_text_to_cell(gridwin, "D2", "122") + enter_text_to_cell(gridwin, "A3", "socioeconomic") + enter_text_to_cell(gridwin, "B3", "45") + enter_text_to_cell(gridwin, "C3", "77") + enter_text_to_cell(gridwin, "D3", "333") + enter_text_to_cell(gridwin, "A4", "sociology") + enter_text_to_cell(gridwin, "B4", "78") + enter_text_to_cell(gridwin, "C4", "89") + enter_text_to_cell(gridwin, "D4", "56") + enter_text_to_cell(gridwin, "A5", "humanities") + enter_text_to_cell(gridwin, "B5", "45") + enter_text_to_cell(gridwin, "C5", "67") + enter_text_to_cell(gridwin, "D5", "89") + #Select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "A"/ Choose condition "Does not contain"/Enter value "cio"/Press OK button + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Ends with") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"s"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #Verify that row 1,2, 5 are visible (3 and 4 are hidden) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "1") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "4") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "s") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Ends with") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() def test_standard_filter_condition_Does_not_end_with(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - enter_text_to_cell(gridwin, "A1", "A") - enter_text_to_cell(gridwin, "B1", "B") - enter_text_to_cell(gridwin, "C1", "C") - enter_text_to_cell(gridwin, "D1", "D") - enter_text_to_cell(gridwin, "A2", "economics") - enter_text_to_cell(gridwin, "B2", "34") - enter_text_to_cell(gridwin, "C2", "67") - enter_text_to_cell(gridwin, "D2", "122") - enter_text_to_cell(gridwin, "A3", "socioeconomic") - enter_text_to_cell(gridwin, "B3", "45") - enter_text_to_cell(gridwin, "C3", "77") - enter_text_to_cell(gridwin, "D3", "333") - enter_text_to_cell(gridwin, "A4", "sociology") - enter_text_to_cell(gridwin, "B4", "78") - enter_text_to_cell(gridwin, "C4", "89") - enter_text_to_cell(gridwin, "D4", "56") - enter_text_to_cell(gridwin, "A5", "humanities") - enter_text_to_cell(gridwin, "B5", "45") - enter_text_to_cell(gridwin, "C5", "67") - enter_text_to_cell(gridwin, "D5", "89") - #Select - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) - #Choose DATA-FILTER-STANDARDFILTER - #Choose field name "A"/ Choose condition "Begins with"/Enter value "si"/Press OK button - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - - select_by_text(xfield1, "A") - select_by_text(xcond1, "Does not end with") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"s"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - #Verify that row 1,3, 4 are visible (2 and 5 are hidden) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "2") - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["CurrentRow"], "3") - #reopen filter and verify - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") - self.assertEqual(get_state_as_dict(xval1)["Text"], "s") - self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not end with") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "D1", "D") + enter_text_to_cell(gridwin, "A2", "economics") + enter_text_to_cell(gridwin, "B2", "34") + enter_text_to_cell(gridwin, "C2", "67") + enter_text_to_cell(gridwin, "D2", "122") + enter_text_to_cell(gridwin, "A3", "socioeconomic") + enter_text_to_cell(gridwin, "B3", "45") + enter_text_to_cell(gridwin, "C3", "77") + enter_text_to_cell(gridwin, "D3", "333") + enter_text_to_cell(gridwin, "A4", "sociology") + enter_text_to_cell(gridwin, "B4", "78") + enter_text_to_cell(gridwin, "C4", "89") + enter_text_to_cell(gridwin, "D4", "56") + enter_text_to_cell(gridwin, "A5", "humanities") + enter_text_to_cell(gridwin, "B5", "45") + enter_text_to_cell(gridwin, "C5", "67") + enter_text_to_cell(gridwin, "D5", "89") + #Select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "A"/ Choose condition "Begins with"/Enter value "si"/Press OK button + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Does not end with") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"s"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #Verify that row 1,3, 4 are visible (2 and 5 are hidden) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "3") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "s") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not end with") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf104117.py b/sc/qa/uitest/calc_tests2/tdf104117.py index 610e133249d6..a226427311ee 100644 --- a/sc/qa/uitest/calc_tests2/tdf104117.py +++ b/sc/qa/uitest/calc_tests2/tdf104117.py @@ -12,35 +12,36 @@ from libreoffice.uno.propertyvalue import mkPropertyValues #Bug 104117 - Crash in Calc when selecting "Uniform Integer" with an max value "100000000000000" in "Random Number Generator class tdf104117(UITestCase): def test_tdf104117(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") - xDialog = self.xUITest.getTopFocusWindow() - xcellrangeedit = xDialog.getChild("cell-range-edit") - xdistributioncombo = xDialog.getChild("distribution-combo") - xparameter1spin = xDialog.getChild("parameter1-spin") - xparameter2spin = xDialog.getChild("parameter2-spin") - xenableseedcheck = xDialog.getChild("enable-seed-check") - xseedspin = xDialog.getChild("seed-spin") - xenableroundingcheck = xDialog.getChild("enable-rounding-check") - xdecimalplacesspin = xDialog.getChild("decimal-places-spin") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") + xDialog = self.xUITest.getTopFocusWindow() + xcellrangeedit = xDialog.getChild("cell-range-edit") + xdistributioncombo = xDialog.getChild("distribution-combo") + xparameter1spin = xDialog.getChild("parameter1-spin") + xparameter2spin = xDialog.getChild("parameter2-spin") + xenableseedcheck = xDialog.getChild("enable-seed-check") + xseedspin = xDialog.getChild("seed-spin") + xenableroundingcheck = xDialog.getChild("enable-rounding-check") + xdecimalplacesspin = xDialog.getChild("decimal-places-spin") - xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) - select_by_text(xdistributioncombo, "Uniform Integer") - xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xparameter2spin.executeAction("TYPE", mkPropertyValues({"TEXT":"1000000000000000000000000000000000000000000000"})) + xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) + select_by_text(xdistributioncombo, "Uniform Integer") + xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"TEXT":"1000000000000000000000000000000000000000000000"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), True) - self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), True) - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False) - self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), True) + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), True) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False) + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf117367.py b/sc/qa/uitest/calc_tests2/tdf117367.py index 86804907f2e6..47ee214f14de 100644 --- a/sc/qa/uitest/calc_tests2/tdf117367.py +++ b/sc/qa/uitest/calc_tests2/tdf117367.py @@ -12,39 +12,41 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf117367(UITestCase): def test_tdf117367_merge_cells_radio_buttons(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - enter_text_to_cell(gridwin, "A1", "AAA") - enter_text_to_cell(gridwin, "A2", "BBB") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B4"})) - - #Right-click - Merge cells /Select all three options - self.ui_test.execute_dialog_through_command(".uno:MergeCells") - xDialog = self.xUITest.getTopFocusWindow() - xmoveCellsRadio = xDialog.getChild("move-cells-radio") - xemptyCellsRadio = xDialog.getChild("empty-cells-radio") - xkeepContentRadio = xDialog.getChild("keep-content-radio") - xmoveCellsRadio.executeAction("CLICK", tuple()) - xmoveCellsRadio.executeAction("CLICK", tuple()) - #Issue: I think these should be exclusive, not possible to select more than one. It is also impossible to uncheck any of the buttons. - self.assertEqual(get_state_as_dict(xmoveCellsRadio)["Checked"], "true") - self.assertEqual(get_state_as_dict(xemptyCellsRadio)["Checked"], "false") - self.assertEqual(get_state_as_dict(xkeepContentRadio)["Checked"], "false") - - xemptyCellsRadio.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(xmoveCellsRadio)["Checked"], "false") - self.assertEqual(get_state_as_dict(xemptyCellsRadio)["Checked"], "true") - self.assertEqual(get_state_as_dict(xkeepContentRadio)["Checked"], "false") - - xkeepContentRadio.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(xmoveCellsRadio)["Checked"], "false") - self.assertEqual(get_state_as_dict(xemptyCellsRadio)["Checked"], "false") - self.assertEqual(get_state_as_dict(xkeepContentRadio)["Checked"], "true") - - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "AAA") + enter_text_to_cell(gridwin, "A2", "BBB") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B4"})) + + #Right-click - Merge cells /Select all three options + self.ui_test.execute_dialog_through_command(".uno:MergeCells") + xDialog = self.xUITest.getTopFocusWindow() + xmoveCellsRadio = xDialog.getChild("move-cells-radio") + xemptyCellsRadio = xDialog.getChild("empty-cells-radio") + xkeepContentRadio = xDialog.getChild("keep-content-radio") + xmoveCellsRadio.executeAction("CLICK", tuple()) + xmoveCellsRadio.executeAction("CLICK", tuple()) + #Issue: I think these should be exclusive, not possible to select more than one. It is also impossible to uncheck any of the buttons. + self.assertEqual(get_state_as_dict(xmoveCellsRadio)["Checked"], "true") + self.assertEqual(get_state_as_dict(xemptyCellsRadio)["Checked"], "false") + self.assertEqual(get_state_as_dict(xkeepContentRadio)["Checked"], "false") + + xemptyCellsRadio.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xmoveCellsRadio)["Checked"], "false") + self.assertEqual(get_state_as_dict(xemptyCellsRadio)["Checked"], "true") + self.assertEqual(get_state_as_dict(xkeepContentRadio)["Checked"], "false") + + xkeepContentRadio.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xmoveCellsRadio)["Checked"], "false") + self.assertEqual(get_state_as_dict(xemptyCellsRadio)["Checked"], "false") + self.assertEqual(get_state_as_dict(xkeepContentRadio)["Checked"], "true") + + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf120174.py b/sc/qa/uitest/calc_tests2/tdf120174.py index a5c6efe3e82f..752d276c5db5 100644 --- a/sc/qa/uitest/calc_tests2/tdf120174.py +++ b/sc/qa/uitest/calc_tests2/tdf120174.py @@ -11,19 +11,20 @@ from uitest.uihelper.calc import enter_text_to_cell class tdf120174(UITestCase): def test_tdf120174(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "121") - enter_text_to_cell(gridwin, "B1", "=A1") - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 121) # B1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - # Delete contents of A1 - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"})) - # Before the fix the result would be still 121. - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 0) # B1 - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 121) # B1 + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "121") + enter_text_to_cell(gridwin, "B1", "=A1") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 121) # B1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + # Delete contents of A1 + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"})) + # Before the fix the result would be still 121. + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 0) # B1 + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 121) # B1 + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf126577.py b/sc/qa/uitest/calc_tests2/tdf126577.py index c7f983ac38cd..2e994aca7fd3 100644 --- a/sc/qa/uitest/calc_tests2/tdf126577.py +++ b/sc/qa/uitest/calc_tests2/tdf126577.py @@ -12,34 +12,36 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf126577(UITestCase): def test_tdf126577(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A20"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A20"})) - self.ui_test.execute_dialog_through_command(".uno:FillSeries") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() - self.assertEqual("true", get_state_as_dict(xDialog.getChild("down"))['Checked']) - self.assertEqual("true", get_state_as_dict(xDialog.getChild("linear"))['Checked']) + self.assertEqual("true", get_state_as_dict(xDialog.getChild("down"))['Checked']) + self.assertEqual("true", get_state_as_dict(xDialog.getChild("linear"))['Checked']) - xStart = xDialog.getChild("startValue") - xStart.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + xStart = xDialog.getChild("startValue") + xStart.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - xEnd = xDialog.getChild("endValue") - xEnd.executeAction("TYPE", mkPropertyValues({"TEXT":"10"})) + xEnd = xDialog.getChild("endValue") + xEnd.executeAction("TYPE", mkPropertyValues({"TEXT":"10"})) - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - for i in range(10): - self.assertEqual(str(i + 1), get_cell_by_position(document, 0, 0, i).getString()) + for i in range(10): + self.assertEqual(str(i + 1), get_cell_by_position(document, 0, 0, i).getString()) - for i in range(10, 20): - # Without the fix in place, this test would have failed with - # AssertionError: '' != '#NUM!' - self.assertEqual("", get_cell_by_position(document, 0, 0, i).getString()) + for i in range(10, 20): + # Without the fix in place, this test would have failed with + # AssertionError: '' != '#NUM!' + self.assertEqual("", get_cell_by_position(document, 0, 0, i).getString()) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf46138.py b/sc/qa/uitest/calc_tests2/tdf46138.py index f584490639a7..244e1634a1ec 100644 --- a/sc/qa/uitest/calc_tests2/tdf46138.py +++ b/sc/qa/uitest/calc_tests2/tdf46138.py @@ -11,23 +11,24 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf46138(UITestCase): def test_tdf46138(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #Choose a column, - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.xUITest.executeCommand(".uno:SelectColumn") - #select 'edit'>'fill'>'series'>Starting Value '1' then "OK", - self.ui_test.execute_dialog_through_command(".uno:FillSeries") - xDialog = self.xUITest.getTopFocusWindow() - xStart = xDialog.getChild("startValue") - xStart.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "1") - #then "Ctrl+Z"/ undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #Choose a column, + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + #select 'edit'>'fill'>'series'>Starting Value '1' then "OK", + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xStart = xDialog.getChild("startValue") + xStart.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "1") + #then "Ctrl+Z"/ undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf51700.py b/sc/qa/uitest/calc_tests2/tdf51700.py index a3fc638ff39d..00eadf1469bd 100644 --- a/sc/qa/uitest/calc_tests2/tdf51700.py +++ b/sc/qa/uitest/calc_tests2/tdf51700.py @@ -13,40 +13,42 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf51700(UITestCase): def test_tdf51700_text_to_columns(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - #Add data - enter_text_to_cell(gridwin, "A2", "3242,43242,3242,2342") - enter_text_to_cell(gridwin, "A3", "fdsfa,afsdfa,adfdas,fsad") - enter_text_to_cell(gridwin, "A4", "21312,1111,1111,111") - #select column A - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.xUITest.executeCommand(".uno:SelectColumn") - # Data - Text to Columns - self.ui_test.execute_dialog_through_command(".uno:TextToColumns") - xDialog = self.xUITest.getTopFocusWindow() - xcomma = xDialog.getChild("comma") - if (get_state_as_dict(xcomma)["Selected"]) == "false": - xcomma.executeAction("CLICK", tuple()) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + #Add data + enter_text_to_cell(gridwin, "A2", "3242,43242,3242,2342") + enter_text_to_cell(gridwin, "A3", "fdsfa,afsdfa,adfdas,fsad") + enter_text_to_cell(gridwin, "A4", "21312,1111,1111,111") + #select column A + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + # Data - Text to Columns + self.ui_test.execute_dialog_through_command(".uno:TextToColumns") + xDialog = self.xUITest.getTopFocusWindow() + xcomma = xDialog.getChild("comma") + if (get_state_as_dict(xcomma)["Selected"]) == "false": + xcomma.executeAction("CLICK", tuple()) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 3242) - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "fdsfa") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 21312) - self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 43242) - self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "afsdfa") - self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 1111) - self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3242) - self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "adfdas") - self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 1111) - self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 2342) - self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "fsad") - self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 111) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 3242) + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "fdsfa") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 21312) + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 43242) + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "afsdfa") + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 1111) + self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3242) + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "adfdas") + self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 1111) + self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 2342) + self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "fsad") + self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 111) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/clearCells.py b/sc/qa/uitest/calc_tests3/clearCells.py index ad45f5a6f829..7df66ef7f93f 100644 --- a/sc/qa/uitest/calc_tests3/clearCells.py +++ b/sc/qa/uitest/calc_tests3/clearCells.py @@ -14,283 +14,295 @@ from libreoffice.uno.propertyvalue import mkPropertyValues #+ Bug 101904 - Delete Contents dialog -- won't delete cell content "Date & time" class clearCells(UITestCase): def test_clear_cells_text(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "aa") - enter_text_to_cell(gridwin, "A2", "1") - - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) - self.ui_test.execute_dialog_through_command(".uno:Delete") - xDialog = self.xUITest.getTopFocusWindow() - xdeleteall = xDialog.getChild("deleteall") - xtext = xDialog.getChild("text") - xdatetime = xDialog.getChild("datetime") - xcomments = xDialog.getChild("comments") - xobjects = xDialog.getChild("objects") - xnumbers = xDialog.getChild("numbers") - xformulas = xDialog.getChild("formulas") - xformats = xDialog.getChild("formats") - - if (get_state_as_dict(xdeleteall)["Selected"]) == "true": - xdeleteall.executeAction("CLICK", tuple()) - if (get_state_as_dict(xtext)["Selected"]) == "false": - xtext.executeAction("CLICK", tuple()) - if (get_state_as_dict(xdatetime)["Selected"]) == "true": - xdatetime.executeAction("CLICK", tuple()) - if (get_state_as_dict(xcomments)["Selected"]) == "true": - xcomments.executeAction("CLICK", tuple()) - if (get_state_as_dict(xobjects)["Selected"]) == "true": - xobjects.executeAction("CLICK", tuple()) - if (get_state_as_dict(xnumbers)["Selected"]) == "true": - xnumbers.executeAction("CLICK", tuple()) - if (get_state_as_dict(xformulas)["Selected"]) == "true": - xformulas.executeAction("CLICK", tuple()) - if (get_state_as_dict(xformats)["Selected"]) == "true": - xformats.executeAction("CLICK", tuple()) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue() , 1) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "aa") + enter_text_to_cell(gridwin, "A2", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.ui_test.execute_dialog_through_command(".uno:Delete") + xDialog = self.xUITest.getTopFocusWindow() + xdeleteall = xDialog.getChild("deleteall") + xtext = xDialog.getChild("text") + xdatetime = xDialog.getChild("datetime") + xcomments = xDialog.getChild("comments") + xobjects = xDialog.getChild("objects") + xnumbers = xDialog.getChild("numbers") + xformulas = xDialog.getChild("formulas") + xformats = xDialog.getChild("formats") + + if (get_state_as_dict(xdeleteall)["Selected"]) == "true": + xdeleteall.executeAction("CLICK", tuple()) + if (get_state_as_dict(xtext)["Selected"]) == "false": + xtext.executeAction("CLICK", tuple()) + if (get_state_as_dict(xdatetime)["Selected"]) == "true": + xdatetime.executeAction("CLICK", tuple()) + if (get_state_as_dict(xcomments)["Selected"]) == "true": + xcomments.executeAction("CLICK", tuple()) + if (get_state_as_dict(xobjects)["Selected"]) == "true": + xobjects.executeAction("CLICK", tuple()) + if (get_state_as_dict(xnumbers)["Selected"]) == "true": + xnumbers.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformulas)["Selected"]) == "true": + xformulas.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformats)["Selected"]) == "true": + xformats.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue() , 1) + + self.ui_test.close_doc() def test_clear_cells_date_tdf101904(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "01/01/2000") - enter_text_to_cell(gridwin, "A2", "1") - - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) - self.ui_test.execute_dialog_through_command(".uno:Delete") - xDialog = self.xUITest.getTopFocusWindow() - xdeleteall = xDialog.getChild("deleteall") - xtext = xDialog.getChild("text") - xdatetime = xDialog.getChild("datetime") - xcomments = xDialog.getChild("comments") - xobjects = xDialog.getChild("objects") - xnumbers = xDialog.getChild("numbers") - xformulas = xDialog.getChild("formulas") - xformats = xDialog.getChild("formats") - - if (get_state_as_dict(xdeleteall)["Selected"]) == "true": - xdeleteall.executeAction("CLICK", tuple()) - if (get_state_as_dict(xtext)["Selected"]) == "true": - xtext.executeAction("CLICK", tuple()) - if (get_state_as_dict(xdatetime)["Selected"]) == "false": - xdatetime.executeAction("CLICK", tuple()) - if (get_state_as_dict(xcomments)["Selected"]) == "true": - xcomments.executeAction("CLICK", tuple()) - if (get_state_as_dict(xobjects)["Selected"]) == "true": - xobjects.executeAction("CLICK", tuple()) - if (get_state_as_dict(xnumbers)["Selected"]) == "true": - xnumbers.executeAction("CLICK", tuple()) - if (get_state_as_dict(xformulas)["Selected"]) == "true": - xformulas.executeAction("CLICK", tuple()) - if (get_state_as_dict(xformats)["Selected"]) == "true": - xformats.executeAction("CLICK", tuple()) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue() , 1) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "01/01/2000") + enter_text_to_cell(gridwin, "A2", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.ui_test.execute_dialog_through_command(".uno:Delete") + xDialog = self.xUITest.getTopFocusWindow() + xdeleteall = xDialog.getChild("deleteall") + xtext = xDialog.getChild("text") + xdatetime = xDialog.getChild("datetime") + xcomments = xDialog.getChild("comments") + xobjects = xDialog.getChild("objects") + xnumbers = xDialog.getChild("numbers") + xformulas = xDialog.getChild("formulas") + xformats = xDialog.getChild("formats") + + if (get_state_as_dict(xdeleteall)["Selected"]) == "true": + xdeleteall.executeAction("CLICK", tuple()) + if (get_state_as_dict(xtext)["Selected"]) == "true": + xtext.executeAction("CLICK", tuple()) + if (get_state_as_dict(xdatetime)["Selected"]) == "false": + xdatetime.executeAction("CLICK", tuple()) + if (get_state_as_dict(xcomments)["Selected"]) == "true": + xcomments.executeAction("CLICK", tuple()) + if (get_state_as_dict(xobjects)["Selected"]) == "true": + xobjects.executeAction("CLICK", tuple()) + if (get_state_as_dict(xnumbers)["Selected"]) == "true": + xnumbers.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformulas)["Selected"]) == "true": + xformulas.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformats)["Selected"]) == "true": + xformats.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue() , 1) + + self.ui_test.close_doc() def test_clear_cells_number(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "aa") - enter_text_to_cell(gridwin, "A2", "1") - - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) - self.ui_test.execute_dialog_through_command(".uno:Delete") - xDialog = self.xUITest.getTopFocusWindow() - xdeleteall = xDialog.getChild("deleteall") - xtext = xDialog.getChild("text") - xdatetime = xDialog.getChild("datetime") - xcomments = xDialog.getChild("comments") - xobjects = xDialog.getChild("objects") - xnumbers = xDialog.getChild("numbers") - xformulas = xDialog.getChild("formulas") - xformats = xDialog.getChild("formats") - - if (get_state_as_dict(xdeleteall)["Selected"]) == "true": - xdeleteall.executeAction("CLICK", tuple()) - if (get_state_as_dict(xtext)["Selected"]) == "true": - xtext.executeAction("CLICK", tuple()) - if (get_state_as_dict(xdatetime)["Selected"]) == "true": - xdatetime.executeAction("CLICK", tuple()) - if (get_state_as_dict(xcomments)["Selected"]) == "true": - xcomments.executeAction("CLICK", tuple()) - if (get_state_as_dict(xobjects)["Selected"]) == "true": - xobjects.executeAction("CLICK", tuple()) - if (get_state_as_dict(xnumbers)["Selected"]) == "false": - xnumbers.executeAction("CLICK", tuple()) - if (get_state_as_dict(xformulas)["Selected"]) == "true": - xformulas.executeAction("CLICK", tuple()) - if (get_state_as_dict(xformats)["Selected"]) == "true": - xformats.executeAction("CLICK", tuple()) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "aa") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue() , 0) - + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "aa") + enter_text_to_cell(gridwin, "A2", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.ui_test.execute_dialog_through_command(".uno:Delete") + xDialog = self.xUITest.getTopFocusWindow() + xdeleteall = xDialog.getChild("deleteall") + xtext = xDialog.getChild("text") + xdatetime = xDialog.getChild("datetime") + xcomments = xDialog.getChild("comments") + xobjects = xDialog.getChild("objects") + xnumbers = xDialog.getChild("numbers") + xformulas = xDialog.getChild("formulas") + xformats = xDialog.getChild("formats") + + if (get_state_as_dict(xdeleteall)["Selected"]) == "true": + xdeleteall.executeAction("CLICK", tuple()) + if (get_state_as_dict(xtext)["Selected"]) == "true": + xtext.executeAction("CLICK", tuple()) + if (get_state_as_dict(xdatetime)["Selected"]) == "true": + xdatetime.executeAction("CLICK", tuple()) + if (get_state_as_dict(xcomments)["Selected"]) == "true": + xcomments.executeAction("CLICK", tuple()) + if (get_state_as_dict(xobjects)["Selected"]) == "true": + xobjects.executeAction("CLICK", tuple()) + if (get_state_as_dict(xnumbers)["Selected"]) == "false": + xnumbers.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformulas)["Selected"]) == "true": + xformulas.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformats)["Selected"]) == "true": + xformats.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "aa") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue() , 0) + + self.ui_test.close_doc() def test_clear_cells_formulas(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "1") - enter_text_to_cell(gridwin, "A2", "=A1+1") - - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) - self.ui_test.execute_dialog_through_command(".uno:Delete") - xDialog = self.xUITest.getTopFocusWindow() - xdeleteall = xDialog.getChild("deleteall") - xtext = xDialog.getChild("text") - xdatetime = xDialog.getChild("datetime") - xcomments = xDialog.getChild("comments") - xobjects = xDialog.getChild("objects") - xnumbers = xDialog.getChild("numbers") - xformulas = xDialog.getChild("formulas") - xformats = xDialog.getChild("formats") - - if (get_state_as_dict(xdeleteall)["Selected"]) == "true": - xdeleteall.executeAction("CLICK", tuple()) - if (get_state_as_dict(xtext)["Selected"]) == "true": - xtext.executeAction("CLICK", tuple()) - if (get_state_as_dict(xdatetime)["Selected"]) == "true": - xdatetime.executeAction("CLICK", tuple()) - if (get_state_as_dict(xcomments)["Selected"]) == "true": - xcomments.executeAction("CLICK", tuple()) - if (get_state_as_dict(xobjects)["Selected"]) == "true": - xobjects.executeAction("CLICK", tuple()) - if (get_state_as_dict(xnumbers)["Selected"]) == "true": - xnumbers.executeAction("CLICK", tuple()) - if (get_state_as_dict(xformulas)["Selected"]) == "false": - xformulas.executeAction("CLICK", tuple()) - if (get_state_as_dict(xformats)["Selected"]) == "true": - xformats.executeAction("CLICK", tuple()) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "1") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString() , "") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "=A1+1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.ui_test.execute_dialog_through_command(".uno:Delete") + xDialog = self.xUITest.getTopFocusWindow() + xdeleteall = xDialog.getChild("deleteall") + xtext = xDialog.getChild("text") + xdatetime = xDialog.getChild("datetime") + xcomments = xDialog.getChild("comments") + xobjects = xDialog.getChild("objects") + xnumbers = xDialog.getChild("numbers") + xformulas = xDialog.getChild("formulas") + xformats = xDialog.getChild("formats") + + if (get_state_as_dict(xdeleteall)["Selected"]) == "true": + xdeleteall.executeAction("CLICK", tuple()) + if (get_state_as_dict(xtext)["Selected"]) == "true": + xtext.executeAction("CLICK", tuple()) + if (get_state_as_dict(xdatetime)["Selected"]) == "true": + xdatetime.executeAction("CLICK", tuple()) + if (get_state_as_dict(xcomments)["Selected"]) == "true": + xcomments.executeAction("CLICK", tuple()) + if (get_state_as_dict(xobjects)["Selected"]) == "true": + xobjects.executeAction("CLICK", tuple()) + if (get_state_as_dict(xnumbers)["Selected"]) == "true": + xnumbers.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformulas)["Selected"]) == "false": + xformulas.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformats)["Selected"]) == "true": + xformats.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "1") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString() , "") + + self.ui_test.close_doc() def test_clear_cells_formats(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "aa") - enter_text_to_cell(gridwin, "A2", "1") - - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) - self.xUITest.executeCommand(".uno:Bold") - self.ui_test.execute_dialog_through_command(".uno:Delete") - xDialog = self.xUITest.getTopFocusWindow() - xdeleteall = xDialog.getChild("deleteall") - xtext = xDialog.getChild("text") - xdatetime = xDialog.getChild("datetime") - xcomments = xDialog.getChild("comments") - xobjects = xDialog.getChild("objects") - xnumbers = xDialog.getChild("numbers") - xformulas = xDialog.getChild("formulas") - xformats = xDialog.getChild("formats") - - if (get_state_as_dict(xdeleteall)["Selected"]) == "true": - xdeleteall.executeAction("CLICK", tuple()) - if (get_state_as_dict(xtext)["Selected"]) == "true": - xtext.executeAction("CLICK", tuple()) - if (get_state_as_dict(xdatetime)["Selected"]) == "true": - xdatetime.executeAction("CLICK", tuple()) - if (get_state_as_dict(xcomments)["Selected"]) == "true": - xcomments.executeAction("CLICK", tuple()) - if (get_state_as_dict(xobjects)["Selected"]) == "true": - xobjects.executeAction("CLICK", tuple()) - if (get_state_as_dict(xnumbers)["Selected"]) == "true": - xnumbers.executeAction("CLICK", tuple()) - if (get_state_as_dict(xformulas)["Selected"]) == "true": - xformulas.executeAction("CLICK", tuple()) - if (get_state_as_dict(xformats)["Selected"]) == "false": - xformats.executeAction("CLICK", tuple()) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") #tab Font - - xstylelb = xDialog.getChild("weststylelb-cjk") - print(get_state_as_dict(xstylelb)) - - - self.assertEqual(get_state_as_dict(xstylelb)["Text"], "Regular") - - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "aa") + enter_text_to_cell(gridwin, "A2", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.xUITest.executeCommand(".uno:Bold") + self.ui_test.execute_dialog_through_command(".uno:Delete") + xDialog = self.xUITest.getTopFocusWindow() + xdeleteall = xDialog.getChild("deleteall") + xtext = xDialog.getChild("text") + xdatetime = xDialog.getChild("datetime") + xcomments = xDialog.getChild("comments") + xobjects = xDialog.getChild("objects") + xnumbers = xDialog.getChild("numbers") + xformulas = xDialog.getChild("formulas") + xformats = xDialog.getChild("formats") + + if (get_state_as_dict(xdeleteall)["Selected"]) == "true": + xdeleteall.executeAction("CLICK", tuple()) + if (get_state_as_dict(xtext)["Selected"]) == "true": + xtext.executeAction("CLICK", tuple()) + if (get_state_as_dict(xdatetime)["Selected"]) == "true": + xdatetime.executeAction("CLICK", tuple()) + if (get_state_as_dict(xcomments)["Selected"]) == "true": + xcomments.executeAction("CLICK", tuple()) + if (get_state_as_dict(xobjects)["Selected"]) == "true": + xobjects.executeAction("CLICK", tuple()) + if (get_state_as_dict(xnumbers)["Selected"]) == "true": + xnumbers.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformulas)["Selected"]) == "true": + xformulas.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformats)["Selected"]) == "false": + xformats.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") #tab Font + + xstylelb = xDialog.getChild("weststylelb-cjk") + print(get_state_as_dict(xstylelb)) + + + self.assertEqual(get_state_as_dict(xstylelb)["Text"], "Regular") + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() def test_clear_cells_all(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "aa") - enter_text_to_cell(gridwin, "A2", "1") - - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) - self.xUITest.executeCommand(".uno:Bold") - self.ui_test.execute_dialog_through_command(".uno:Delete") - xDialog = self.xUITest.getTopFocusWindow() - xdeleteall = xDialog.getChild("deleteall") - xtext = xDialog.getChild("text") - xdatetime = xDialog.getChild("datetime") - xcomments = xDialog.getChild("comments") - xobjects = xDialog.getChild("objects") - xnumbers = xDialog.getChild("numbers") - xformulas = xDialog.getChild("formulas") - xformats = xDialog.getChild("formats") - - if (get_state_as_dict(xdeleteall)["Selected"]) == "false": - xdeleteall.executeAction("CLICK", tuple()) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString() , "") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "aa") + enter_text_to_cell(gridwin, "A2", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.xUITest.executeCommand(".uno:Bold") + self.ui_test.execute_dialog_through_command(".uno:Delete") + xDialog = self.xUITest.getTopFocusWindow() + xdeleteall = xDialog.getChild("deleteall") + xtext = xDialog.getChild("text") + xdatetime = xDialog.getChild("datetime") + xcomments = xDialog.getChild("comments") + xobjects = xDialog.getChild("objects") + xnumbers = xDialog.getChild("numbers") + xformulas = xDialog.getChild("formulas") + xformats = xDialog.getChild("formats") + + if (get_state_as_dict(xdeleteall)["Selected"]) == "false": + xdeleteall.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString() , "") + + self.ui_test.close_doc() def test_cancel_clear_cells_all(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "aa") - enter_text_to_cell(gridwin, "A2", "1") - - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) - self.ui_test.execute_dialog_through_command(".uno:Delete") - xDialog = self.xUITest.getTopFocusWindow() - xdeleteall = xDialog.getChild("deleteall") - - if (get_state_as_dict(xdeleteall)["Selected"]) == "false": - xdeleteall.executeAction("CLICK", tuple()) - - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "aa") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString() , "1") - + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "aa") + enter_text_to_cell(gridwin, "A2", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.ui_test.execute_dialog_through_command(".uno:Delete") + xDialog = self.xUITest.getTopFocusWindow() + xdeleteall = xDialog.getChild("deleteall") + + if (get_state_as_dict(xdeleteall)["Selected"]) == "false": + xdeleteall.executeAction("CLICK", tuple()) + + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "aa") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString() , "1") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/insertQrCodeGen.py b/sc/qa/uitest/calc_tests3/insertQrCodeGen.py index 3896de55958d..691eadcbea29 100644 --- a/sc/qa/uitest/calc_tests3/insertQrCodeGen.py +++ b/sc/qa/uitest/calc_tests3/insertQrCodeGen.py @@ -11,67 +11,70 @@ from com.sun.star.lang import IndexOutOfBoundsException class insertQrCode(UITestCase): def test_insert_qr_code_gen(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - # cancel the dialog without doing anything - self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") - xDialog = self.xUITest.getTopFocusWindow() - - xURL = xDialog.getChild("edit_text") - type_text(xURL, "www.libreoffice.org") - - xCloseBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCloseBtn) - with self.assertRaises(IndexOutOfBoundsException): - document.Sheets.getByIndex(0).DrawPage.getByIndex(0) - - # Reopen the dialog box - self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") - xDialog = self.xUITest.getTopFocusWindow() - - # Get elements in the Dialog Box - xURL = xDialog.getChild("edit_text") - xECC_Low = xDialog.getChild("button_low") #How radio button input is written in text. - xBorder = xDialog.getChild("edit_margin") - - type_text(xURL, "www.libreoffice.org") #set the QR code - xECC_Low.executeAction("CLICK", tuple()) - xBorder.executeAction("UP", tuple()) - xBorder.executeAction("DOWN", tuple()) - xOKBtn = xDialog.getChild("ok") - xOKBtn.executeAction("CLICK", tuple()) - - # check the QR code in the document - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).QRCodeProperties.Payload, "www.libreoffice.org") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).QRCodeProperties.ErrorCorrection, 1) - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).QRCodeProperties.Border, 1) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + # cancel the dialog without doing anything + self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") + xDialog = self.xUITest.getTopFocusWindow() + + xURL = xDialog.getChild("edit_text") + type_text(xURL, "www.libreoffice.org") + + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + with self.assertRaises(IndexOutOfBoundsException): + document.Sheets.getByIndex(0).DrawPage.getByIndex(0) + + # Reopen the dialog box + self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") + xDialog = self.xUITest.getTopFocusWindow() + + # Get elements in the Dialog Box + xURL = xDialog.getChild("edit_text") + xECC_Low = xDialog.getChild("button_low") #How radio button input is written in text. + xBorder = xDialog.getChild("edit_margin") + + type_text(xURL, "www.libreoffice.org") #set the QR code + xECC_Low.executeAction("CLICK", tuple()) + xBorder.executeAction("UP", tuple()) + xBorder.executeAction("DOWN", tuple()) + xOKBtn = xDialog.getChild("ok") + xOKBtn.executeAction("CLICK", tuple()) + + # check the QR code in the document + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).QRCodeProperties.Payload, "www.libreoffice.org") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).QRCodeProperties.ErrorCorrection, 1) + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).QRCodeProperties.Border, 1) + + self.ui_test.close_doc() def test_insert_qr_code_gen2(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") - xDialog = self.xUITest.getTopFocusWindow() - - xURL = xDialog.getChild("edit_text") - xECC_Low = xDialog.getChild("button_low") - xBorder = xDialog.getChild("edit_margin") - - type_text(xURL, "www.libreoffice.org") #set the QR code - xECC_Low.executeAction("CLICK", tuple()) - xBorder.executeAction("UP", tuple()) - xBorder.executeAction("DOWN", tuple()) - xOKBtn = xDialog.getChild("ok") - xOKBtn.executeAction("CLICK", tuple()) - - #check the QR Code in the document - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).QRCodeProperties.Payload, "www.libreoffice.org") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).QRCodeProperties.ErrorCorrection, 1) - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).QRCodeProperties.Border, 1) - + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") + xDialog = self.xUITest.getTopFocusWindow() + + xURL = xDialog.getChild("edit_text") + xECC_Low = xDialog.getChild("button_low") + xBorder = xDialog.getChild("edit_margin") + + type_text(xURL, "www.libreoffice.org") #set the QR code + xECC_Low.executeAction("CLICK", tuple()) + xBorder.executeAction("UP", tuple()) + xBorder.executeAction("DOWN", tuple()) + xOKBtn = xDialog.getChild("ok") + xOKBtn.executeAction("CLICK", tuple()) + + #check the QR Code in the document + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).QRCodeProperties.Payload, "www.libreoffice.org") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).QRCodeProperties.ErrorCorrection, 1) + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).QRCodeProperties.Border, 1) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/tdf69450.py b/sc/qa/uitest/calc_tests3/tdf69450.py index f19eb36d02e1..2951b385b8ca 100644 --- a/sc/qa/uitest/calc_tests3/tdf69450.py +++ b/sc/qa/uitest/calc_tests3/tdf69450.py @@ -12,48 +12,49 @@ from libreoffice.calc.document import get_cell_by_position class tdf69450(UITestCase): def test_tdf69450(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - #add text to A1 and B1 - enter_text_to_cell(gridwin, "A1", "A") - enter_text_to_cell(gridwin, "B1", "B") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.xUITest.executeCommand(".uno:Copy") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) - self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") - xDialog = self.xUITest.getTopFocusWindow() - - xtext = xDialog.getChild("text") - xnumbers = xDialog.getChild("numbers") - xdatetime = xDialog.getChild("datetime") - xformats = xDialog.getChild("formats") - - xtext.executeAction("CLICK", tuple()) - xnumbers.executeAction("CLICK", tuple()) - xdatetime.executeAction("CLICK", tuple()) - xformats.executeAction("CLICK", tuple()) - - xOkBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) - - #check B1 text - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "B") - - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) - self.xUITest.executeCommand(".uno:Bold") - self.xUITest.executeCommand(".uno:Copy") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) - self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") - xDialog = self.xUITest.getTopFocusWindow() #previous settings should be remembered (only format) - - xOkBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) - - #check B1 text - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "B") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #add text to A1 and B1 + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + xDialog = self.xUITest.getTopFocusWindow() + + xtext = xDialog.getChild("text") + xnumbers = xDialog.getChild("numbers") + xdatetime = xDialog.getChild("datetime") + xformats = xDialog.getChild("formats") + + xtext.executeAction("CLICK", tuple()) + xnumbers.executeAction("CLICK", tuple()) + xdatetime.executeAction("CLICK", tuple()) + xformats.executeAction("CLICK", tuple()) + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + #check B1 text + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "B") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + self.xUITest.executeCommand(".uno:Bold") + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + xDialog = self.xUITest.getTopFocusWindow() #previous settings should be remembered (only format) + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + #check B1 text + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "B") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/tdf73006.py b/sc/qa/uitest/calc_tests3/tdf73006.py index a81ff470c042..558367e6e6fb 100644 --- a/sc/qa/uitest/calc_tests3/tdf73006.py +++ b/sc/qa/uitest/calc_tests3/tdf73006.py @@ -13,28 +13,30 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf73006(UITestCase): def test_tdf73006_text_to_columns(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - #Add data - enter_text_to_cell(gridwin, "A2", "A B") - #select column A - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.xUITest.executeCommand(".uno:SelectColumn") - # Data - Text to Columns - self.ui_test.execute_dialog_through_command(".uno:TextToColumns") - xDialog = self.xUITest.getTopFocusWindow() - xspace = xDialog.getChild("space") - if (get_state_as_dict(xspace)["Selected"]) == "false": - xspace.executeAction("CLICK", tuple()) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + #Add data + enter_text_to_cell(gridwin, "A2", "A B") + #select column A + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + # Data - Text to Columns + self.ui_test.execute_dialog_through_command(".uno:TextToColumns") + xDialog = self.xUITest.getTopFocusWindow() + xspace = xDialog.getChild("space") + if (get_state_as_dict(xspace)["Selected"]) == "false": + xspace.executeAction("CLICK", tuple()) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "A") - self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "B") + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "A") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "B") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/tdf79983.py b/sc/qa/uitest/calc_tests3/tdf79983.py index 777af1e1a027..c90561cee034 100644 --- a/sc/qa/uitest/calc_tests3/tdf79983.py +++ b/sc/qa/uitest/calc_tests3/tdf79983.py @@ -13,58 +13,60 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf79983(UITestCase): def test_tdf79983_sort_list_case_sensitive(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "AAA") - enter_text_to_cell(gridwin, "A2", "BBB") - enter_text_to_cell(gridwin, "A3", "CCC") - enter_text_to_cell(gridwin, "A4", "DDD") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + enter_text_to_cell(gridwin, "A1", "AAA") + enter_text_to_cell(gridwin, "A2", "BBB") + enter_text_to_cell(gridwin, "A3", "CCC") + enter_text_to_cell(gridwin, "A4", "DDD") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) - #Tools / Options / LibreOffice Calc / Sort Lists - self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog - xDialogOpt = self.xUITest.getTopFocusWindow() + #Tools / Options / LibreOffice Calc / Sort Lists + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialogOpt = self.xUITest.getTopFocusWindow() - xPages = xDialogOpt.getChild("pages") - xCalcEntry = xPages.getChild('3') # Calc - xCalcEntry.executeAction("EXPAND", tuple()) - xCalcSortEntry = xCalcEntry.getChild('5') - xCalcSortEntry.executeAction("SELECT", tuple()) #Sort List - #copy new list from selected cells - xcopy = xDialogOpt.getChild("copy") - xcopy.executeAction("CLICK", tuple()) + xPages = xDialogOpt.getChild("pages") + xCalcEntry = xPages.getChild('3') # Calc + xCalcEntry.executeAction("EXPAND", tuple()) + xCalcSortEntry = xCalcEntry.getChild('5') + xCalcSortEntry.executeAction("SELECT", tuple()) #Sort List + #copy new list from selected cells + xcopy = xDialogOpt.getChild("copy") + xcopy.executeAction("CLICK", tuple()) - self.assertEqual("AAA\nBBB\nCCC\nDDD", get_state_as_dict(xDialogOpt.getChild("entries"))['Text']) + self.assertEqual("AAA\nBBB\nCCC\nDDD", get_state_as_dict(xDialogOpt.getChild("entries"))['Text']) - xOKBtn = xDialogOpt.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"})) - enter_text_to_cell(gridwin, "A1", "AAA") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) - #fill down - self.ui_test.execute_dialog_through_command(".uno:FillSeries") - xDialog = self.xUITest.getTopFocusWindow() - xautofill = xDialog.getChild("autofill") - xautofill.executeAction("CLICK", tuple()) - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - #verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "AAA") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "BBB") - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "CCC") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "DDD") - #UNDO - self.xUITest.executeCommand(".uno:Undo") - #verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "AAA") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "") - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "") + enter_text_to_cell(gridwin, "A1", "AAA") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + #fill down + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xautofill = xDialog.getChild("autofill") + xautofill.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "AAA") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "BBB") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "CCC") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "DDD") + #UNDO + self.xUITest.executeCommand(".uno:Undo") + #verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "AAA") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/tdf80693.py b/sc/qa/uitest/calc_tests3/tdf80693.py index 5e687e01da23..8b16978c95f9 100644 --- a/sc/qa/uitest/calc_tests3/tdf80693.py +++ b/sc/qa/uitest/calc_tests3/tdf80693.py @@ -12,39 +12,40 @@ from libreoffice.uno.propertyvalue import mkPropertyValues #Bug 80693 - EDITING: fill cell with random numbers with min = max class tdf80693(UITestCase): def test_tdf80693_random_numbers_min_max(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") - xDialog = self.xUITest.getTopFocusWindow() - xcellrangeedit = xDialog.getChild("cell-range-edit") - xdistributioncombo = xDialog.getChild("distribution-combo") - xparameter1spin = xDialog.getChild("parameter1-spin") - xparameter2spin = xDialog.getChild("parameter2-spin") - xenableseedcheck = xDialog.getChild("enable-seed-check") - xseedspin = xDialog.getChild("seed-spin") - xenableroundingcheck = xDialog.getChild("enable-rounding-check") - xdecimalplacesspin = xDialog.getChild("decimal-places-spin") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") + xDialog = self.xUITest.getTopFocusWindow() + xcellrangeedit = xDialog.getChild("cell-range-edit") + xdistributioncombo = xDialog.getChild("distribution-combo") + xparameter1spin = xDialog.getChild("parameter1-spin") + xparameter2spin = xDialog.getChild("parameter2-spin") + xenableseedcheck = xDialog.getChild("enable-seed-check") + xseedspin = xDialog.getChild("seed-spin") + xenableroundingcheck = xDialog.getChild("enable-rounding-check") + xdecimalplacesspin = xDialog.getChild("decimal-places-spin") - xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) - select_by_text(xdistributioncombo, "Uniform") + xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) + select_by_text(xdistributioncombo, "Uniform") - xparameter1spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xparameter1spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xparameter1spin.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) - xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xparameter2spin.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + xparameter1spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xparameter1spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xparameter1spin.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 2) - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue() , 2) - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False) - self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue() , 2) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False) + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/tdf82398.py b/sc/qa/uitest/calc_tests3/tdf82398.py index e5c74198b19c..6cf2e8c671d0 100644 --- a/sc/qa/uitest/calc_tests3/tdf82398.py +++ b/sc/qa/uitest/calc_tests3/tdf82398.py @@ -13,48 +13,50 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf82398(UITestCase): def test_tdf82398_text_to_columns(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - #Add data - enter_text_to_cell(gridwin, "A1", "afasdfs.fdfasd.fsadf.fasd") - enter_text_to_cell(gridwin, "A2", "3242.43242.3242.2342") - enter_text_to_cell(gridwin, "A3", "fdsfa.afsdfa.adfdas.fsad") - enter_text_to_cell(gridwin, "A4", "21312.1111.1111.111") - #select column A1:A4 / .uno:NumberFormatDate - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) - self.xUITest.executeCommand(".uno:NumberFormatDate") - # Data - Text to Columns - self.ui_test.execute_dialog_through_command(".uno:TextToColumns") - xDialog = self.xUITest.getTopFocusWindow() - xother = xDialog.getChild("other") - xinputother = xDialog.getChild("inputother") + #Add data + enter_text_to_cell(gridwin, "A1", "afasdfs.fdfasd.fsadf.fasd") + enter_text_to_cell(gridwin, "A2", "3242.43242.3242.2342") + enter_text_to_cell(gridwin, "A3", "fdsfa.afsdfa.adfdas.fsad") + enter_text_to_cell(gridwin, "A4", "21312.1111.1111.111") + #select column A1:A4 / .uno:NumberFormatDate + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + self.xUITest.executeCommand(".uno:NumberFormatDate") + # Data - Text to Columns + self.ui_test.execute_dialog_through_command(".uno:TextToColumns") + xDialog = self.xUITest.getTopFocusWindow() + xother = xDialog.getChild("other") + xinputother = xDialog.getChild("inputother") - if (get_state_as_dict(xother)["Selected"]) == "false": - xother.executeAction("CLICK", tuple()) - xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"."})) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + if (get_state_as_dict(xother)["Selected"]) == "false": + xother.executeAction("CLICK", tuple()) + xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"."})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "afasdfs") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 3242) - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "fdsfa") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 21312) - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "fdfasd") - self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 43242) - self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "afsdfa") - self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 1111) - self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "fsadf") - self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3242) - self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "adfdas") - self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 1111) - self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "fasd") - self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 2342) - self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "fsad") - self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 111) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "afasdfs") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 3242) + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "fdsfa") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 21312) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "fdfasd") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 43242) + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "afsdfa") + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 1111) + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "fsadf") + self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3242) + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "adfdas") + self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 1111) + self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "fasd") + self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 2342) + self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "fsad") + self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 111) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests4/tdf88999.py b/sc/qa/uitest/calc_tests4/tdf88999.py index bcd7b166dd0d..4f27a34d85f5 100644 --- a/sc/qa/uitest/calc_tests4/tdf88999.py +++ b/sc/qa/uitest/calc_tests4/tdf88999.py @@ -14,34 +14,36 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf88999(UITestCase): def test_tdf88999_scientific_format_decimal_value(self): #numberingformatpage.ui - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "1e-2") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) - #select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") #tab Numbers - xliststore1 = xDialog.getChild("categorylb") #1st list / Category - xliststore2 = xDialog.getChild("formatlb") #2nd list / Format - xdecimalsed = xDialog.getChild("decimalsed") - xleadzerosed = xDialog.getChild("leadzerosed") - xnegnumred = xDialog.getChild("negnumred") - xthousands = xDialog.getChild("thousands") - xlanguagelb = xDialog.getChild("languagelb") - xformatted = xDialog.getChild("formatted") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "1e-2") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + xliststore1 = xDialog.getChild("categorylb") #1st list / Category + xliststore2 = xDialog.getChild("formatlb") #2nd list / Format + xdecimalsed = xDialog.getChild("decimalsed") + xleadzerosed = xDialog.getChild("leadzerosed") + xnegnumred = xDialog.getChild("negnumred") + xthousands = xDialog.getChild("thousands") + xlanguagelb = xDialog.getChild("languagelb") + xformatted = xDialog.getChild("formatted") - self.assertEqual(get_state_as_dict(xliststore1)["SelectEntryText"], "Scientific") - self.assertEqual(get_state_as_dict(xdecimalsed)["Text"], "2") - self.assertEqual(get_state_as_dict(xdecimalsed)["Enabled"], "true") - self.assertEqual(get_state_as_dict(xleadzerosed)["Text"], "1") - self.assertEqual(get_state_as_dict(xformatted)["Text"], "0.00E+00") - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) + self.assertEqual(get_state_as_dict(xliststore1)["SelectEntryText"], "Scientific") + self.assertEqual(get_state_as_dict(xdecimalsed)["Text"], "2") + self.assertEqual(get_state_as_dict(xdecimalsed)["Enabled"], "true") + self.assertEqual(get_state_as_dict(xleadzerosed)["Text"], "1") + self.assertEqual(get_state_as_dict(xformatted)["Text"], "0.00E+00") + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests4/tdf89907.py b/sc/qa/uitest/calc_tests4/tdf89907.py index 5d93409b354c..5e0cde458670 100644 --- a/sc/qa/uitest/calc_tests4/tdf89907.py +++ b/sc/qa/uitest/calc_tests4/tdf89907.py @@ -13,49 +13,51 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf89907(UITestCase): def test_tdf89907_text_to_columns(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - #Add data - enter_text_to_cell(gridwin, "A1", "afasdfs.fdfasd.fsadf.fasd") - enter_text_to_cell(gridwin, "A2", "3242.43242.3242.2342") - enter_text_to_cell(gridwin, "A3", "fdsfa.afsdfa.adfdas.fsad") - enter_text_to_cell(gridwin, "A4", "21312.1111.1111.111") - #select column A - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.xUITest.executeCommand(".uno:SelectColumn") - #Optimal Width - self.xUITest.executeCommand(".uno:SetOptimalColumnWidthDirect") - # Data - Text to Columns - self.ui_test.execute_dialog_through_command(".uno:TextToColumns") - xDialog = self.xUITest.getTopFocusWindow() - xother = xDialog.getChild("other") - xinputother = xDialog.getChild("inputother") - if (get_state_as_dict(xother)["Selected"]) == "false": - xother.executeAction("CLICK", tuple()) - xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"."})) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + #Add data + enter_text_to_cell(gridwin, "A1", "afasdfs.fdfasd.fsadf.fasd") + enter_text_to_cell(gridwin, "A2", "3242.43242.3242.2342") + enter_text_to_cell(gridwin, "A3", "fdsfa.afsdfa.adfdas.fsad") + enter_text_to_cell(gridwin, "A4", "21312.1111.1111.111") + #select column A + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + #Optimal Width + self.xUITest.executeCommand(".uno:SetOptimalColumnWidthDirect") + # Data - Text to Columns + self.ui_test.execute_dialog_through_command(".uno:TextToColumns") + xDialog = self.xUITest.getTopFocusWindow() + xother = xDialog.getChild("other") + xinputother = xDialog.getChild("inputother") + if (get_state_as_dict(xother)["Selected"]) == "false": + xother.executeAction("CLICK", tuple()) + xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"."})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "afasdfs") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 3242) - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "fdsfa") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 21312) - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "fdfasd") - self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 43242) - self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "afsdfa") - self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 1111) - self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "fsadf") - self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3242) - self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "adfdas") - self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 1111) - self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "fasd") - self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 2342) - self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "fsad") - self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 111) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "afasdfs") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 3242) + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "fdsfa") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 21312) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "fdfasd") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 43242) + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "afsdfa") + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 1111) + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "fsadf") + self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3242) + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "adfdas") + self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 1111) + self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "fasd") + self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 2342) + self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "fsad") + self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 111) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests4/tdf92423.py b/sc/qa/uitest/calc_tests4/tdf92423.py index 1590373c9630..c5bde52e2468 100644 --- a/sc/qa/uitest/calc_tests4/tdf92423.py +++ b/sc/qa/uitest/calc_tests4/tdf92423.py @@ -13,59 +13,61 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf92423(UITestCase): def test_tdf92423_text_to_columns(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged. - self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog - xDialogOpt = self.xUITest.getTopFocusWindow() + #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged. + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialogOpt = self.xUITest.getTopFocusWindow() - xPages = xDialogOpt.getChild("pages") - xWriterEntry = xPages.getChild('3') # Calc - xWriterEntry.executeAction("EXPAND", tuple()) - xWriterGeneralEntry = xWriterEntry.getChild('0') - xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb - xreplwarncb = xDialogOpt.getChild("replwarncb") - if (get_state_as_dict(xreplwarncb)["Selected"]) == "false": - xreplwarncb.executeAction("CLICK", tuple()) - xOKBtn = xDialogOpt.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #enter data - enter_text_to_cell(gridwin, "A1", "1;2") - enter_text_to_cell(gridwin, "A2", "2;3") - enter_text_to_cell(gridwin, "A3", "3;4") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"})) - #copy data - self.xUITest.executeCommand(".uno:Copy") - #move down - self.xUITest.executeCommand(".uno:GoDown") - self.xUITest.executeCommand(".uno:GoDown") - self.xUITest.executeCommand(".uno:GoDown") - self.xUITest.executeCommand(".uno:GoDown") - self.xUITest.executeCommand(".uno:GoDown") - self.xUITest.executeCommand(".uno:GoDown") - #paste data, should be selected - self.xUITest.executeCommand(".uno:Paste") #A7:A9 - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A7:Sheet1.A9") - # Data - Text to Columns - self.ui_test.execute_dialog_through_command(".uno:TextToColumns") - xDialog = self.xUITest.getTopFocusWindow() - xSemicolon = xDialog.getChild("semicolon") #check semicolon checkbox - if (get_state_as_dict(xSemicolon)["Selected"]) == "false": - xSemicolon.executeAction("CLICK", tuple()) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + xPages = xDialogOpt.getChild("pages") + xWriterEntry = xPages.getChild('3') # Calc + xWriterEntry.executeAction("EXPAND", tuple()) + xWriterGeneralEntry = xWriterEntry.getChild('0') + xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb + xreplwarncb = xDialogOpt.getChild("replwarncb") + if (get_state_as_dict(xreplwarncb)["Selected"]) == "false": + xreplwarncb.executeAction("CLICK", tuple()) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #enter data + enter_text_to_cell(gridwin, "A1", "1;2") + enter_text_to_cell(gridwin, "A2", "2;3") + enter_text_to_cell(gridwin, "A3", "3;4") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"})) + #copy data + self.xUITest.executeCommand(".uno:Copy") + #move down + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + #paste data, should be selected + self.xUITest.executeCommand(".uno:Paste") #A7:A9 + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A7:Sheet1.A9") + # Data - Text to Columns + self.ui_test.execute_dialog_through_command(".uno:TextToColumns") + xDialog = self.xUITest.getTopFocusWindow() + xSemicolon = xDialog.getChild("semicolon") #check semicolon checkbox + if (get_state_as_dict(xSemicolon)["Selected"]) == "false": + xSemicolon.executeAction("CLICK", tuple()) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 6).getValue(), 1) - self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 2) - self.assertEqual(get_cell_by_position(document, 0, 0, 8).getValue(), 3) - self.assertEqual(get_cell_by_position(document, 0, 1, 6).getValue(), 2) - self.assertEqual(get_cell_by_position(document, 0, 1, 7).getValue(), 3) - self.assertEqual(get_cell_by_position(document, 0, 1, 8).getValue(), 4) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 6).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 0, 8).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 1, 6).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 1, 7).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 1, 8).getValue(), 4) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests4/tdf94208.py b/sc/qa/uitest/calc_tests4/tdf94208.py index fa7a06f02076..542b8a2daa91 100644 --- a/sc/qa/uitest/calc_tests4/tdf94208.py +++ b/sc/qa/uitest/calc_tests4/tdf94208.py @@ -13,33 +13,35 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf94208(UITestCase): def test_tdf94208_Undo_fill_down_rows_selected(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - #1 - Fill data - enter_text_to_cell(gridwin, "A3", "Range") - enter_text_to_cell(gridwin, "A4", "Range") - enter_text_to_cell(gridwin, "A5", "Range") - enter_text_to_cell(gridwin, "A6", "Range") - enter_text_to_cell(gridwin, "A7", "Range") - enter_text_to_cell(gridwin, "A8", "Range") - enter_text_to_cell(gridwin, "B6", "test") - #2 - Select rows three though eight. - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A3:A8"})) - self.xUITest.executeCommand(".uno:SelectRow") - #3 - type Control-D/Fill Down - self.xUITest.executeCommand(".uno:FillDown") - #4 - undo. - self.xUITest.executeCommand(".uno:Undo") - #5 - Ouch! The data isn't right. - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "Range") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Range") - self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "Range") - self.assertEqual(get_cell_by_position(document, 0, 0, 5).getString(), "Range") - self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "Range") - self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "Range") - self.assertEqual(get_cell_by_position(document, 0, 1, 5).getString(), "test") + #1 - Fill data + enter_text_to_cell(gridwin, "A3", "Range") + enter_text_to_cell(gridwin, "A4", "Range") + enter_text_to_cell(gridwin, "A5", "Range") + enter_text_to_cell(gridwin, "A6", "Range") + enter_text_to_cell(gridwin, "A7", "Range") + enter_text_to_cell(gridwin, "A8", "Range") + enter_text_to_cell(gridwin, "B6", "test") + #2 - Select rows three though eight. + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A3:A8"})) + self.xUITest.executeCommand(".uno:SelectRow") + #3 - type Control-D/Fill Down + self.xUITest.executeCommand(".uno:FillDown") + #4 - undo. + self.xUITest.executeCommand(".uno:Undo") + #5 - Ouch! The data isn't right. + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "Range") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Range") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "Range") + self.assertEqual(get_cell_by_position(document, 0, 0, 5).getString(), "Range") + self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "Range") + self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "Range") + self.assertEqual(get_cell_by_position(document, 0, 1, 5).getString(), "test") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests4/trackedChanges.py b/sc/qa/uitest/calc_tests4/trackedChanges.py index 6cc99974cfda..e9e54206faa7 100644 --- a/sc/qa/uitest/calc_tests4/trackedChanges.py +++ b/sc/qa/uitest/calc_tests4/trackedChanges.py @@ -40,251 +40,257 @@ class CalcTrackedChanges(UITestCase): xCancBtn.executeAction("CLICK", tuple()) def test_tdf66263_Protect_Records(self): - with self.ui_test.create_doc_in_start_center("calc"): - self.ui_test.wait_until_child_is_available("grid_window") - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - self.xUITest.executeCommand(".uno:TraceChangeMode") - #protect dialog - self.ui_test.execute_dialog_through_command(".uno:ProtectTraceChangeMode") - xDialog = self.xUITest.getTopFocusWindow() - xpass = xDialog.getChild("pass1ed") - xpass.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) - xconfirm = xDialog.getChild("confirm1ed") - xconfirm.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - #verify password - self.ui_test.execute_dialog_through_command(".uno:ProtectTraceChangeMode") - xDialog = self.xUITest.getTopFocusWindow() - xpass = xDialog.getChild("pass1ed") - xpass.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + self.ui_test.wait_until_child_is_available("grid_window") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + self.xUITest.executeCommand(".uno:TraceChangeMode") + #protect dialog + self.ui_test.execute_dialog_through_command(".uno:ProtectTraceChangeMode") + xDialog = self.xUITest.getTopFocusWindow() + xpass = xDialog.getChild("pass1ed") + xpass.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) + xconfirm = xDialog.getChild("confirm1ed") + xconfirm.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + #verify password + self.ui_test.execute_dialog_through_command(".uno:ProtectTraceChangeMode") + xDialog = self.xUITest.getTopFocusWindow() + xpass = xDialog.getChild("pass1ed") + xpass.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() def test_tracked_changes_accept(self): - with self.ui_test.create_doc_in_start_center("calc"): - self.ui_test.wait_until_child_is_available("grid_window") - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #track changes; enter text to cell - self.xUITest.executeCommand(".uno:TraceChangeMode") - enter_text_to_cell(gridwin, "A1", "Test LibreOffice") - enter_text_to_cell(gridwin, "A2", "Test LibreOffice") - #accept tracked changes - self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges") - xTrackDlg = self.xUITest.getTopFocusWindow() - - xChangesList = xTrackDlg.getChild("calcchanges") - self.assertEqual(2, len(xChangesList.getChildren())) - - textStart = "Changed contents\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") - textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')" - textStart2 = "Changed contents\tSheet1.A2\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") - textEnd2 = "(Cell A2 changed from '<empty>' to 'Test LibreOffice')" - self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].startswith(textStart2)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].endswith(textEnd2)) - - xAccBtn = xTrackDlg.getChild("accept") - xAccBtn.executeAction("CLICK", tuple()) - - self.assertEqual(2, len(xChangesList.getChildren())) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart2)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd2)) - self.assertEqual(get_state_as_dict(xChangesList.getChild('1'))["Text"], "Accepted") - - xAccBtn = xTrackDlg.getChild("accept") - xAccBtn.executeAction("CLICK", tuple()) - - self.assertEqual(1, len(xChangesList.getChildren())) - self.assertEqual(get_state_as_dict(xChangesList.getChild('0'))["Text"], "Accepted") - xChangesList.getChild('0').executeAction("EXPAND", tuple()) - - self.assertEqual(2, len(xChangesList.getChild('0').getChildren())) - - self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].startswith(textStart)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].endswith(textEnd)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].startswith(textStart2)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].endswith(textEnd2)) - - xCancBtn = xTrackDlg.getChild("close") - xCancBtn.executeAction("CLICK", tuple()) - - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Test LibreOffice") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + self.ui_test.wait_until_child_is_available("grid_window") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #track changes; enter text to cell + self.xUITest.executeCommand(".uno:TraceChangeMode") + enter_text_to_cell(gridwin, "A1", "Test LibreOffice") + enter_text_to_cell(gridwin, "A2", "Test LibreOffice") + #accept tracked changes + self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges") + xTrackDlg = self.xUITest.getTopFocusWindow() + + xChangesList = xTrackDlg.getChild("calcchanges") + self.assertEqual(2, len(xChangesList.getChildren())) + + textStart = "Changed contents\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") + textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')" + textStart2 = "Changed contents\tSheet1.A2\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") + textEnd2 = "(Cell A2 changed from '<empty>' to 'Test LibreOffice')" + self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].startswith(textStart2)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].endswith(textEnd2)) + + xAccBtn = xTrackDlg.getChild("accept") + xAccBtn.executeAction("CLICK", tuple()) + + self.assertEqual(2, len(xChangesList.getChildren())) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart2)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd2)) + self.assertEqual(get_state_as_dict(xChangesList.getChild('1'))["Text"], "Accepted") + + xAccBtn = xTrackDlg.getChild("accept") + xAccBtn.executeAction("CLICK", tuple()) + + self.assertEqual(1, len(xChangesList.getChildren())) + self.assertEqual(get_state_as_dict(xChangesList.getChild('0'))["Text"], "Accepted") + xChangesList.getChild('0').executeAction("EXPAND", tuple()) + + self.assertEqual(2, len(xChangesList.getChild('0').getChildren())) + + self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].startswith(textStart)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].endswith(textEnd)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].startswith(textStart2)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].endswith(textEnd2)) + + xCancBtn = xTrackDlg.getChild("close") + xCancBtn.executeAction("CLICK", tuple()) + + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Test LibreOffice") + self.ui_test.close_doc() def test_tracked_changes_acceptall(self): - with self.ui_test.create_doc_in_start_center("calc"): - self.ui_test.wait_until_child_is_available("grid_window") - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #track changes; enter text to cell - self.xUITest.executeCommand(".uno:TraceChangeMode") - enter_text_to_cell(gridwin, "A1", "Test LibreOffice") - enter_text_to_cell(gridwin, "A2", "Test LibreOffice") - #accept All tracked changes - self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges") - xTrackDlg = self.xUITest.getTopFocusWindow() - - xChangesList = xTrackDlg.getChild("calcchanges") - self.assertEqual(2, len(xChangesList.getChildren())) - - textStart = "Changed contents\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") - textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')" - textStart2 = "Changed contents\tSheet1.A2\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") - textEnd2 = "(Cell A2 changed from '<empty>' to 'Test LibreOffice')" - self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].startswith(textStart2)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].endswith(textEnd2)) - - xAccBtn = xTrackDlg.getChild("acceptall") - xAccBtn.executeAction("CLICK", tuple()) - - self.assertEqual(1, len(xChangesList.getChildren())) - self.assertEqual(get_state_as_dict(xChangesList.getChild('0'))["Text"], "Accepted") - xChangesList.getChild('0').executeAction("EXPAND", tuple()) - - self.assertEqual(2, len(xChangesList.getChild('0').getChildren())) - - self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].startswith(textStart)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].endswith(textEnd)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].startswith(textStart2)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].endswith(textEnd2)) - - xCancBtn = xTrackDlg.getChild("close") - xCancBtn.executeAction("CLICK", tuple()) - - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Test LibreOffice") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + self.ui_test.wait_until_child_is_available("grid_window") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #track changes; enter text to cell + self.xUITest.executeCommand(".uno:TraceChangeMode") + enter_text_to_cell(gridwin, "A1", "Test LibreOffice") + enter_text_to_cell(gridwin, "A2", "Test LibreOffice") + #accept All tracked changes + self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges") + xTrackDlg = self.xUITest.getTopFocusWindow() + + xChangesList = xTrackDlg.getChild("calcchanges") + self.assertEqual(2, len(xChangesList.getChildren())) + + textStart = "Changed contents\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") + textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')" + textStart2 = "Changed contents\tSheet1.A2\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") + textEnd2 = "(Cell A2 changed from '<empty>' to 'Test LibreOffice')" + self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].startswith(textStart2)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].endswith(textEnd2)) + + xAccBtn = xTrackDlg.getChild("acceptall") + xAccBtn.executeAction("CLICK", tuple()) + + self.assertEqual(1, len(xChangesList.getChildren())) + self.assertEqual(get_state_as_dict(xChangesList.getChild('0'))["Text"], "Accepted") + xChangesList.getChild('0').executeAction("EXPAND", tuple()) + + self.assertEqual(2, len(xChangesList.getChild('0').getChildren())) + + self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].startswith(textStart)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].endswith(textEnd)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].startswith(textStart2)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].endswith(textEnd2)) + + xCancBtn = xTrackDlg.getChild("close") + xCancBtn.executeAction("CLICK", tuple()) + + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Test LibreOffice") + self.ui_test.close_doc() def test_tracked_changes_reject(self): - with self.ui_test.create_doc_in_start_center("calc"): - self.ui_test.wait_until_child_is_available("grid_window") - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #track changes; enter text to cell - self.xUITest.executeCommand(".uno:TraceChangeMode") - enter_text_to_cell(gridwin, "A1", "Test LibreOffice") - enter_text_to_cell(gridwin, "A2", "Test LibreOffice") - #accept tracked changes - self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges") - xTrackDlg = self.xUITest.getTopFocusWindow() - - xChangesList = xTrackDlg.getChild("calcchanges") - self.assertEqual(2, len(xChangesList.getChildren())) - - textStart = "Changed contents\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") - textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')" - textStart2 = "Changed contents\tSheet1.A2\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") - textEnd2 = "(Cell A2 changed from '<empty>' to 'Test LibreOffice')" - self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].startswith(textStart2)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].endswith(textEnd2)) - - xRejBtn = xTrackDlg.getChild("reject") - xRejBtn.executeAction("CLICK", tuple()) - - self.assertEqual(3, len(xChangesList.getChildren())) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart2)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd2)) - self.assertEqual(get_state_as_dict(xChangesList.getChild('1'))["Text"], "Accepted") - self.assertEqual(get_state_as_dict(xChangesList.getChild('2'))["Text"], "Rejected") - - xAccBtn = xTrackDlg.getChild("reject") - xAccBtn.executeAction("CLICK", tuple()) - - self.assertEqual(2, len(xChangesList.getChildren())) - self.assertEqual(get_state_as_dict(xChangesList.getChild('0'))["Text"], "Accepted") - self.assertEqual(get_state_as_dict(xChangesList.getChild('1'))["Text"], "Rejected") - - xChangesList.getChild('0').executeAction("EXPAND", tuple()) - self.assertEqual(2, len(xChangesList.getChild('0').getChildren())) - - textEnd3 = "(Cell A1 changed from 'Test LibreOffice' to '<empty>')" - textEnd4 = "(Cell A2 changed from 'Test LibreOffice' to '<empty>')" - self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].startswith(textStart)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].endswith(textEnd3)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].startswith(textStart2)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].endswith(textEnd4)) - - xChangesList.getChild('1').executeAction("EXPAND", tuple()) - self.assertEqual(2, len(xChangesList.getChild('1').getChildren())) - - self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('0'))["Text"].startswith(textStart)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('0'))["Text"].endswith(textEnd)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('1'))["Text"].startswith(textStart2)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('1'))["Text"].endswith(textEnd2)) - - xCancBtn = xTrackDlg.getChild("close") - xCancBtn.executeAction("CLICK", tuple()) - - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + self.ui_test.wait_until_child_is_available("grid_window") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #track changes; enter text to cell + self.xUITest.executeCommand(".uno:TraceChangeMode") + enter_text_to_cell(gridwin, "A1", "Test LibreOffice") + enter_text_to_cell(gridwin, "A2", "Test LibreOffice") + #accept tracked changes + self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges") + xTrackDlg = self.xUITest.getTopFocusWindow() + + xChangesList = xTrackDlg.getChild("calcchanges") + self.assertEqual(2, len(xChangesList.getChildren())) + + textStart = "Changed contents\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") + textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')" + textStart2 = "Changed contents\tSheet1.A2\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") + textEnd2 = "(Cell A2 changed from '<empty>' to 'Test LibreOffice')" + self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].startswith(textStart2)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].endswith(textEnd2)) + + xRejBtn = xTrackDlg.getChild("reject") + xRejBtn.executeAction("CLICK", tuple()) + + self.assertEqual(3, len(xChangesList.getChildren())) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart2)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd2)) + self.assertEqual(get_state_as_dict(xChangesList.getChild('1'))["Text"], "Accepted") + self.assertEqual(get_state_as_dict(xChangesList.getChild('2'))["Text"], "Rejected") + + xAccBtn = xTrackDlg.getChild("reject") + xAccBtn.executeAction("CLICK", tuple()) + + self.assertEqual(2, len(xChangesList.getChildren())) + self.assertEqual(get_state_as_dict(xChangesList.getChild('0'))["Text"], "Accepted") + self.assertEqual(get_state_as_dict(xChangesList.getChild('1'))["Text"], "Rejected") + + xChangesList.getChild('0').executeAction("EXPAND", tuple()) + self.assertEqual(2, len(xChangesList.getChild('0').getChildren())) + + textEnd3 = "(Cell A1 changed from 'Test LibreOffice' to '<empty>')" + textEnd4 = "(Cell A2 changed from 'Test LibreOffice' to '<empty>')" + self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].startswith(textStart)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].endswith(textEnd3)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].startswith(textStart2)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].endswith(textEnd4)) + + xChangesList.getChild('1').executeAction("EXPAND", tuple()) + self.assertEqual(2, len(xChangesList.getChild('1').getChildren())) + + self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('0'))["Text"].startswith(textStart)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('0'))["Text"].endswith(textEnd)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('1'))["Text"].startswith(textStart2)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('1'))["Text"].endswith(textEnd2)) + + xCancBtn = xTrackDlg.getChild("close") + xCancBtn.executeAction("CLICK", tuple()) + + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "") + self.ui_test.close_doc() def test_tracked_changes_rejectall(self): - with self.ui_test.create_doc_in_start_center("calc"): - self.ui_test.wait_until_child_is_available("grid_window") - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #track changes; enter text to cell - self.xUITest.executeCommand(".uno:TraceChangeMode") - enter_text_to_cell(gridwin, "A1", "Test LibreOffice") - enter_text_to_cell(gridwin, "A2", "Test LibreOffice") - #accept tracked changes - self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges") - xTrackDlg = self.xUITest.getTopFocusWindow() - - xChangesList = xTrackDlg.getChild("calcchanges") - self.assertEqual(2, len(xChangesList.getChildren())) - - textStart = "Changed contents\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") - textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')" - textStart2 = "Changed contents\tSheet1.A2\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") - textEnd2 = "(Cell A2 changed from '<empty>' to 'Test LibreOffice')" - self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].startswith(textStart2)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].endswith(textEnd2)) - - xAccBtn = xTrackDlg.getChild("rejectall") - xAccBtn.executeAction("CLICK", tuple()) - - self.assertEqual(2, len(xChangesList.getChildren())) - self.assertEqual(get_state_as_dict(xChangesList.getChild('0'))["Text"], "Accepted") - self.assertEqual(get_state_as_dict(xChangesList.getChild('1'))["Text"], "Rejected") - - xChangesList.getChild('0').executeAction("EXPAND", tuple()) - self.assertEqual(2, len(xChangesList.getChild('0').getChildren())) - - textEnd3 = "(Cell A1 changed from 'Test LibreOffice' to '<empty>')" - textEnd4 = "(Cell A2 changed from 'Test LibreOffice' to '<empty>')" - self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].startswith(textStart2)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].endswith(textEnd4)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].startswith(textStart)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].endswith(textEnd3)) - - xChangesList.getChild('1').executeAction("EXPAND", tuple()) - self.assertEqual(2, len(xChangesList.getChild('1').getChildren())) - - self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('0'))["Text"].startswith(textStart)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('0'))["Text"].endswith(textEnd)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('1'))["Text"].startswith(textStart2)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('1'))["Text"].endswith(textEnd2)) - - xCancBtn = xTrackDlg.getChild("close") - xCancBtn.executeAction("CLICK", tuple()) - - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + self.ui_test.wait_until_child_is_available("grid_window") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #track changes; enter text to cell + self.xUITest.executeCommand(".uno:TraceChangeMode") + enter_text_to_cell(gridwin, "A1", "Test LibreOffice") + enter_text_to_cell(gridwin, "A2", "Test LibreOffice") + #accept tracked changes + self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges") + xTrackDlg = self.xUITest.getTopFocusWindow() + + xChangesList = xTrackDlg.getChild("calcchanges") + self.assertEqual(2, len(xChangesList.getChildren())) + + textStart = "Changed contents\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") + textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')" + textStart2 = "Changed contents\tSheet1.A2\t \t" + datetime.datetime.now().strftime("%m/%d/%Y") + textEnd2 = "(Cell A2 changed from '<empty>' to 'Test LibreOffice')" + self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].startswith(textStart2)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].endswith(textEnd2)) + + xAccBtn = xTrackDlg.getChild("rejectall") + xAccBtn.executeAction("CLICK", tuple()) + + self.assertEqual(2, len(xChangesList.getChildren())) + self.assertEqual(get_state_as_dict(xChangesList.getChild('0'))["Text"], "Accepted") + self.assertEqual(get_state_as_dict(xChangesList.getChild('1'))["Text"], "Rejected") + + xChangesList.getChild('0').executeAction("EXPAND", tuple()) + self.assertEqual(2, len(xChangesList.getChild('0').getChildren())) + + textEnd3 = "(Cell A1 changed from 'Test LibreOffice' to '<empty>')" + textEnd4 = "(Cell A2 changed from 'Test LibreOffice' to '<empty>')" + self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].startswith(textStart2)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].endswith(textEnd4)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].startswith(textStart)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].endswith(textEnd3)) + + xChangesList.getChild('1').executeAction("EXPAND", tuple()) + self.assertEqual(2, len(xChangesList.getChild('1').getChildren())) + + self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('0'))["Text"].startswith(textStart)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('0'))["Text"].endswith(textEnd)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('1'))["Text"].startswith(textStart2)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('1'))["Text"].endswith(textEnd2)) + + xCancBtn = xTrackDlg.getChild("close") + xCancBtn.executeAction("CLICK", tuple()) + + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "") + self.ui_test.close_doc() def test_tdf136062(self): diff --git a/sc/qa/uitest/calc_tests6/autoFormat.py b/sc/qa/uitest/calc_tests6/autoFormat.py index 52d9b7d9c253..362a42a6a411 100644 --- a/sc/qa/uitest/calc_tests6/autoFormat.py +++ b/sc/qa/uitest/calc_tests6/autoFormat.py @@ -11,63 +11,65 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class autoFormat(UITestCase): def test_autoformat_styles(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #select A1:C5 - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C5"})) - #AutoFormat Styles - self.ui_test.execute_dialog_through_command(".uno:AutoFormat") - xDialog = self.xUITest.getTopFocusWindow() + writer_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select A1:C5 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C5"})) + #AutoFormat Styles + self.ui_test.execute_dialog_through_command(".uno:AutoFormat") + xDialog = self.xUITest.getTopFocusWindow() - formatlb = xDialog.getChild("formatlb") - numformatcb = xDialog.getChild("numformatcb") - bordercb = xDialog.getChild("bordercb") - fontcb = xDialog.getChild("fontcb") - patterncb = xDialog.getChild("patterncb") - alignmentcb = xDialog.getChild("alignmentcb") - autofitcb = xDialog.getChild("autofitcb") + formatlb = xDialog.getChild("formatlb") + numformatcb = xDialog.getChild("numformatcb") + bordercb = xDialog.getChild("bordercb") + fontcb = xDialog.getChild("fontcb") + patterncb = xDialog.getChild("patterncb") + alignmentcb = xDialog.getChild("alignmentcb") + autofitcb = xDialog.getChild("autofitcb") - entry = formatlb.getChild("7") #Financial - entry.executeAction("SELECT", tuple()) - numformatcb.executeAction("CLICK", tuple()) - bordercb.executeAction("CLICK", tuple()) - fontcb.executeAction("CLICK", tuple()) - patterncb.executeAction("CLICK", tuple()) - alignmentcb.executeAction("CLICK", tuple()) - autofitcb.executeAction("CLICK", tuple()) + entry = formatlb.getChild("7") #Financial + entry.executeAction("SELECT", tuple()) + numformatcb.executeAction("CLICK", tuple()) + bordercb.executeAction("CLICK", tuple()) + fontcb.executeAction("CLICK", tuple()) + patterncb.executeAction("CLICK", tuple()) + alignmentcb.executeAction("CLICK", tuple()) + autofitcb.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) - #verify - self.ui_test.execute_dialog_through_command(".uno:AutoFormat") - xDialog = self.xUITest.getTopFocusWindow() + #verify + self.ui_test.execute_dialog_through_command(".uno:AutoFormat") + xDialog = self.xUITest.getTopFocusWindow() - formatlb = xDialog.getChild("formatlb") - numformatcb = xDialog.getChild("numformatcb") - bordercb = xDialog.getChild("bordercb") - fontcb = xDialog.getChild("fontcb") - patterncb = xDialog.getChild("patterncb") - alignmentcb = xDialog.getChild("alignmentcb") - autofitcb = xDialog.getChild("autofitcb") + formatlb = xDialog.getChild("formatlb") + numformatcb = xDialog.getChild("numformatcb") + bordercb = xDialog.getChild("bordercb") + fontcb = xDialog.getChild("fontcb") + patterncb = xDialog.getChild("patterncb") + alignmentcb = xDialog.getChild("alignmentcb") + autofitcb = xDialog.getChild("autofitcb") - entry = formatlb.getChild("7") #Financial - entry.executeAction("SELECT", tuple()) - self.assertEqual(get_state_as_dict(numformatcb)["Selected"], "false") - self.assertEqual(get_state_as_dict(bordercb)["Selected"], "false") - self.assertEqual(get_state_as_dict(fontcb)["Selected"], "false") - self.assertEqual(get_state_as_dict(patterncb)["Selected"], "false") - self.assertEqual(get_state_as_dict(alignmentcb)["Selected"], "false") - self.assertEqual(get_state_as_dict(autofitcb)["Selected"], "false") - numformatcb.executeAction("CLICK", tuple()) - bordercb.executeAction("CLICK", tuple()) - fontcb.executeAction("CLICK", tuple()) - patterncb.executeAction("CLICK", tuple()) - alignmentcb.executeAction("CLICK", tuple()) - autofitcb.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + entry = formatlb.getChild("7") #Financial + entry.executeAction("SELECT", tuple()) + self.assertEqual(get_state_as_dict(numformatcb)["Selected"], "false") + self.assertEqual(get_state_as_dict(bordercb)["Selected"], "false") + self.assertEqual(get_state_as_dict(fontcb)["Selected"], "false") + self.assertEqual(get_state_as_dict(patterncb)["Selected"], "false") + self.assertEqual(get_state_as_dict(alignmentcb)["Selected"], "false") + self.assertEqual(get_state_as_dict(autofitcb)["Selected"], "false") + numformatcb.executeAction("CLICK", tuple()) + bordercb.executeAction("CLICK", tuple()) + fontcb.executeAction("CLICK", tuple()) + patterncb.executeAction("CLICK", tuple()) + alignmentcb.executeAction("CLICK", tuple()) + autofitcb.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/autocorrectOptions.py b/sc/qa/uitest/calc_tests6/autocorrectOptions.py index cbe43f0e5214..8daa3e537bfb 100644 --- a/sc/qa/uitest/calc_tests6/autocorrectOptions.py +++ b/sc/qa/uitest/calc_tests6/autocorrectOptions.py @@ -12,88 +12,90 @@ from uitest.uihelper.common import select_pos class autocorrectOptions(UITestCase): def test_autocorrect_options_calc(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") #tab replace - origtext = xDialog.getChild("origtext") - newtext = xDialog.getChild("newtext") - xnew = xDialog.getChild("new") - xdelete = xDialog.getChild("delete") - xtabview = xDialog.getChild("tabview") - xreset = xDialog.getChild("reset") - nrRows = get_state_as_dict(xtabview)["VisibleCount"] - - self.assertTrue(int(nrRows) > 0) - - #add new rule - origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) - newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) - xnew.executeAction("CLICK", tuple()) - nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"] - nrRowsDiff = int(nrRowsNew) - int(nrRows) - self.assertEqual(nrRowsDiff, 1) #we have +1 rule - #delete rule - origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) - newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) - xdelete.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules - - select_pos(xTabs, "1") #tab Exceptions - #abbreviations - abbrev = xDialog.getChild("abbrev") - newabbrev = xDialog.getChild("newabbrev") - delabbrev = xDialog.getChild("delabbrev") - abbrevlist = xDialog.getChild("abbrevlist") - - nrRowsAbb = get_state_as_dict(abbrevlist)["VisibleCount"] - - self.assertTrue(int(nrRowsAbb) > 0) - - abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"})) - newabbrev.executeAction("CLICK", tuple()) - nrRowsAbbNew = get_state_as_dict(abbrevlist)["VisibleCount"] - nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb) - self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule - delabbrev.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(abbrevlist)["VisibleCount"], nrRowsAbb) #we have default nr of rules - - #words with two initial capitals - double = xDialog.getChild("double") - newdouble = xDialog.getChild("newdouble") - deldouble = xDialog.getChild("deldouble") - doublelist = xDialog.getChild("doublelist") - - nrRowsDouble = get_state_as_dict(doublelist)["VisibleCount"] - - self.assertTrue(int(nrRowsDouble) > 0) - - double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"})) - newdouble.executeAction("CLICK", tuple()) - nrRowsDoubleNew = get_state_as_dict(doublelist)["VisibleCount"] - nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and - self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule - deldouble.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(doublelist)["VisibleCount"], nrRowsDouble) #we have default nr of rules - - xCancelButton = xDialog.getChild("cancel") - xCancelButton.executeAction("CLICK", tuple()) + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab replace + origtext = xDialog.getChild("origtext") + newtext = xDialog.getChild("newtext") + xnew = xDialog.getChild("new") + xdelete = xDialog.getChild("delete") + xtabview = xDialog.getChild("tabview") + xreset = xDialog.getChild("reset") + nrRows = get_state_as_dict(xtabview)["VisibleCount"] + + self.assertTrue(int(nrRows) > 0) + + #add new rule + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) + xnew.executeAction("CLICK", tuple()) + nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"] + nrRowsDiff = int(nrRowsNew) - int(nrRows) + self.assertEqual(nrRowsDiff, 1) #we have +1 rule + #delete rule + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) + xdelete.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules + + select_pos(xTabs, "1") #tab Exceptions + #abbreviations + abbrev = xDialog.getChild("abbrev") + newabbrev = xDialog.getChild("newabbrev") + delabbrev = xDialog.getChild("delabbrev") + abbrevlist = xDialog.getChild("abbrevlist") + + nrRowsAbb = get_state_as_dict(abbrevlist)["VisibleCount"] + + self.assertTrue(int(nrRowsAbb) > 0) + + abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"})) + newabbrev.executeAction("CLICK", tuple()) + nrRowsAbbNew = get_state_as_dict(abbrevlist)["VisibleCount"] + nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb) + self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule + delabbrev.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(abbrevlist)["VisibleCount"], nrRowsAbb) #we have default nr of rules + + #words with two initial capitals + double = xDialog.getChild("double") + newdouble = xDialog.getChild("newdouble") + deldouble = xDialog.getChild("deldouble") + doublelist = xDialog.getChild("doublelist") + + nrRowsDouble = get_state_as_dict(doublelist)["VisibleCount"] + + self.assertTrue(int(nrRowsDouble) > 0) + + double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"})) + newdouble.executeAction("CLICK", tuple()) + nrRowsDoubleNew = get_state_as_dict(doublelist)["VisibleCount"] + nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and + self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule + deldouble.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(doublelist)["VisibleCount"], nrRowsDouble) #we have default nr of rules + + xCancelButton = xDialog.getChild("cancel") + xCancelButton.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/hideShowSheet.py b/sc/qa/uitest/calc_tests6/hideShowSheet.py index 9d4ea336ff4f..c6fccd92561b 100644 --- a/sc/qa/uitest/calc_tests6/hideShowSheet.py +++ b/sc/qa/uitest/calc_tests6/hideShowSheet.py @@ -11,43 +11,45 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class hideShowSheet(UITestCase): def test_hide_show_sheet(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #insert sheet - self.ui_test.execute_dialog_through_command(".uno:Insert") - current_dialog = self.xUITest.getTopFocusWindow() - xOkButton = current_dialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOkButton) - #select sheet - gridwin.executeAction("SELECT", mkPropertyValues({"TABLE":"1"})) - self.assertEqual(get_state_as_dict(gridwin)["SelectedTable"], "1") - #hide sheet - self.xUITest.executeCommand(".uno:Hide") - #show sheet Dialog - self.ui_test.execute_dialog_through_command(".uno:Show") - xDialog = self.xUITest.getTopFocusWindow() - treeview = xDialog.getChild("treeview") - self.assertEqual(get_state_as_dict(treeview)["Children"], "1") - xcancel = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xcancel) - #insert 2nd sheet - self.ui_test.execute_dialog_through_command(".uno:Insert") - current_dialog = self.xUITest.getTopFocusWindow() - xOkButton = current_dialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOkButton) - #select sheet - gridwin.executeAction("SELECT", mkPropertyValues({"TABLE":"2"})) - self.assertEqual(get_state_as_dict(gridwin)["SelectedTable"], "1") - #hide sheet - self.xUITest.executeCommand(".uno:Hide") - #show sheet Dialog - self.ui_test.execute_dialog_through_command(".uno:Show") - xDialog = self.xUITest.getTopFocusWindow() - treeview = xDialog.getChild("treeview") - self.assertEqual(get_state_as_dict(treeview)["Children"], "2") - xcancel = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xcancel) + writer_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #insert sheet + self.ui_test.execute_dialog_through_command(".uno:Insert") + current_dialog = self.xUITest.getTopFocusWindow() + xOkButton = current_dialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkButton) + #select sheet + gridwin.executeAction("SELECT", mkPropertyValues({"TABLE":"1"})) + self.assertEqual(get_state_as_dict(gridwin)["SelectedTable"], "1") + #hide sheet + self.xUITest.executeCommand(".uno:Hide") + #show sheet Dialog + self.ui_test.execute_dialog_through_command(".uno:Show") + xDialog = self.xUITest.getTopFocusWindow() + treeview = xDialog.getChild("treeview") + self.assertEqual(get_state_as_dict(treeview)["Children"], "1") + xcancel = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancel) + #insert 2nd sheet + self.ui_test.execute_dialog_through_command(".uno:Insert") + current_dialog = self.xUITest.getTopFocusWindow() + xOkButton = current_dialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkButton) + #select sheet + gridwin.executeAction("SELECT", mkPropertyValues({"TABLE":"2"})) + self.assertEqual(get_state_as_dict(gridwin)["SelectedTable"], "1") + #hide sheet + self.xUITest.executeCommand(".uno:Hide") + #show sheet Dialog + self.ui_test.execute_dialog_through_command(".uno:Show") + xDialog = self.xUITest.getTopFocusWindow() + treeview = xDialog.getChild("treeview") + self.assertEqual(get_state_as_dict(treeview)["Children"], "2") + xcancel = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancel) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/moveCopySheet.py b/sc/qa/uitest/calc_tests6/moveCopySheet.py index 7c63b76672b8..8a0465c376e8 100644 --- a/sc/qa/uitest/calc_tests6/moveCopySheet.py +++ b/sc/qa/uitest/calc_tests6/moveCopySheet.py @@ -11,68 +11,70 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class moveCopySheet(UITestCase): def test_copy_move_sheet(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #default - 1 sheet; select the sheet (is selected), dialog move/copy sheet - self.ui_test.execute_dialog_through_command(".uno:Move") - xDialog = self.xUITest.getTopFocusWindow() - #new name = newName - newName = xDialog.getChild("newName") - newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - newName.executeAction("TYPE", mkPropertyValues({"TEXT":"newName"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #verify, the file has 2 sheets; first one "newName" is selected - self.assertEqual(document.Sheets.getCount(), 2) - # dialog move/copy sheet ; Move is selected; select -move to end position - ; New Name = moveName - self.ui_test.execute_dialog_through_command(".uno:Move") - xDialog = self.xUITest.getTopFocusWindow() - insertBefore = xDialog.getChild("insertBefore") + writer_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #default - 1 sheet; select the sheet (is selected), dialog move/copy sheet + self.ui_test.execute_dialog_through_command(".uno:Move") + xDialog = self.xUITest.getTopFocusWindow() + #new name = newName + newName = xDialog.getChild("newName") + newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newName.executeAction("TYPE", mkPropertyValues({"TEXT":"newName"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify, the file has 2 sheets; first one "newName" is selected + self.assertEqual(document.Sheets.getCount(), 2) + # dialog move/copy sheet ; Move is selected; select -move to end position - ; New Name = moveName + self.ui_test.execute_dialog_through_command(".uno:Move") + xDialog = self.xUITest.getTopFocusWindow() + insertBefore = xDialog.getChild("insertBefore") - xTreeEntry = insertBefore.getChild('2') - xTreeEntry.executeAction("SELECT", tuple()) + xTreeEntry = insertBefore.getChild('2') + xTreeEntry.executeAction("SELECT", tuple()) - newName = xDialog.getChild("newName") - self.assertEqual(get_state_as_dict(newName)["Text"], "newName") - newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - newName.executeAction("TYPE", mkPropertyValues({"TEXT":"moveName"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - # Verify, the file has 2 sheets; first one is "Sheet1" ; second one is "moveName" - self.assertEqual(document.Sheets.getCount(), 2) + newName = xDialog.getChild("newName") + self.assertEqual(get_state_as_dict(newName)["Text"], "newName") + newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newName.executeAction("TYPE", mkPropertyValues({"TEXT":"moveName"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + # Verify, the file has 2 sheets; first one is "Sheet1" ; second one is "moveName" + self.assertEqual(document.Sheets.getCount(), 2) - self.assertEqual(document.Sheets[0].Name, "Sheet1") - self.assertEqual(document.Sheets[1].Name, "moveName") + self.assertEqual(document.Sheets[0].Name, "Sheet1") + self.assertEqual(document.Sheets[1].Name, "moveName") - # Verify that the cancel button does not do anything - self.ui_test.execute_dialog_through_command(".uno:Move") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + # Verify that the cancel button does not do anything + self.ui_test.execute_dialog_through_command(".uno:Move") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) - self.assertEqual(document.Sheets.getCount(), 2) - self.assertEqual(document.Sheets[0].Name, "Sheet1") - self.assertEqual(document.Sheets[1].Name, "moveName") + self.assertEqual(document.Sheets.getCount(), 2) + self.assertEqual(document.Sheets[0].Name, "Sheet1") + self.assertEqual(document.Sheets[1].Name, "moveName") - #Check copy option - self.ui_test.execute_dialog_through_command(".uno:Move") - xDialog = self.xUITest.getTopFocusWindow() - xCopy = xDialog.getChild("copy") - xCopy.executeAction("CLICK", tuple()) - sheetName = "moveName_2" - newName = xDialog.getChild("newName") - self.assertEqual(get_state_as_dict(newName)["Text"], sheetName) + #Check copy option + self.ui_test.execute_dialog_through_command(".uno:Move") + xDialog = self.xUITest.getTopFocusWindow() + xCopy = xDialog.getChild("copy") + xCopy.executeAction("CLICK", tuple()) + sheetName = "moveName_2" + newName = xDialog.getChild("newName") + self.assertEqual(get_state_as_dict(newName)["Text"], sheetName) - 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(document.Sheets.getCount(), 3) - self.assertEqual(document.Sheets[0].Name, sheetName) - self.assertEqual(document.Sheets[1].Name, "Sheet1") - self.assertEqual(document.Sheets[2].Name, "moveName") + self.assertEqual(document.Sheets.getCount(), 3) + self.assertEqual(document.Sheets[0].Name, sheetName) + self.assertEqual(document.Sheets[1].Name, "Sheet1") + self.assertEqual(document.Sheets[2].Name, "moveName") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/multipleOperations.py b/sc/qa/uitest/calc_tests6/multipleOperations.py index fc5f40882939..1f60937b056a 100644 --- a/sc/qa/uitest/calc_tests6/multipleOperations.py +++ b/sc/qa/uitest/calc_tests6/multipleOperations.py @@ -14,109 +14,112 @@ from uitest.uihelper.calc import enter_text_to_cell class multipleOperations(UITestCase): def test_multiple_operations_one_variable(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - #enter data - enter_text_to_cell(xGridWindow, "B1", "10") - enter_text_to_cell(xGridWindow, "B2", "2") - enter_text_to_cell(xGridWindow, "B3", "10000") - enter_text_to_cell(xGridWindow, "B4", "2000") - enter_text_to_cell(xGridWindow, "B5", "=B4*(B1-B2)-B3") + #enter data + enter_text_to_cell(xGridWindow, "B1", "10") + enter_text_to_cell(xGridWindow, "B2", "2") + enter_text_to_cell(xGridWindow, "B3", "10000") + enter_text_to_cell(xGridWindow, "B4", "2000") + enter_text_to_cell(xGridWindow, "B5", "=B4*(B1-B2)-B3") - enter_text_to_cell(xGridWindow, "D2", "500") - enter_text_to_cell(xGridWindow, "D3", "1000") - enter_text_to_cell(xGridWindow, "D4", "1500") - enter_text_to_cell(xGridWindow, "D5", "2000") - enter_text_to_cell(xGridWindow, "D6", "2500") - enter_text_to_cell(xGridWindow, "D7", "3000") - enter_text_to_cell(xGridWindow, "D8", "3500") - enter_text_to_cell(xGridWindow, "D9", "4000") - enter_text_to_cell(xGridWindow, "D10", "4500") - enter_text_to_cell(xGridWindow, "D11", "5000") - #Select the range D2:E11 - xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:E11"})) - #Choose Data > Multiple Operations. - self.ui_test.execute_modeless_dialog_through_command(".uno:TableOperationDialog") - xDialog = self.xUITest.getTopFocusWindow() - #Formulas = B5 ; Column input cell = B4 - formulas = xDialog.getChild("formulas") - col = xDialog.getChild("col") - formulas.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$5"})) - col.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$4"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #verify - self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), -6000) - self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), -2000) - self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 2000) - self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 6000) - self.assertEqual(get_cell_by_position(document, 0, 4, 5).getValue(), 10000) - self.assertEqual(get_cell_by_position(document, 0, 4, 6).getValue(), 14000) - self.assertEqual(get_cell_by_position(document, 0, 4, 7).getValue(), 18000) - self.assertEqual(get_cell_by_position(document, 0, 4, 8).getValue(), 22000) - self.assertEqual(get_cell_by_position(document, 0, 4, 9).getValue(), 26000) - self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 30000) + enter_text_to_cell(xGridWindow, "D2", "500") + enter_text_to_cell(xGridWindow, "D3", "1000") + enter_text_to_cell(xGridWindow, "D4", "1500") + enter_text_to_cell(xGridWindow, "D5", "2000") + enter_text_to_cell(xGridWindow, "D6", "2500") + enter_text_to_cell(xGridWindow, "D7", "3000") + enter_text_to_cell(xGridWindow, "D8", "3500") + enter_text_to_cell(xGridWindow, "D9", "4000") + enter_text_to_cell(xGridWindow, "D10", "4500") + enter_text_to_cell(xGridWindow, "D11", "5000") + #Select the range D2:E11 + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:E11"})) + #Choose Data > Multiple Operations. + self.ui_test.execute_modeless_dialog_through_command(".uno:TableOperationDialog") + xDialog = self.xUITest.getTopFocusWindow() + #Formulas = B5 ; Column input cell = B4 + formulas = xDialog.getChild("formulas") + col = xDialog.getChild("col") + formulas.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$5"})) + col.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$4"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), -6000) + self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), -2000) + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 2000) + self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 6000) + self.assertEqual(get_cell_by_position(document, 0, 4, 5).getValue(), 10000) + self.assertEqual(get_cell_by_position(document, 0, 4, 6).getValue(), 14000) + self.assertEqual(get_cell_by_position(document, 0, 4, 7).getValue(), 18000) + self.assertEqual(get_cell_by_position(document, 0, 4, 8).getValue(), 22000) + self.assertEqual(get_cell_by_position(document, 0, 4, 9).getValue(), 26000) + self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 30000) + self.ui_test.close_doc() def test_multiple_operations_several_formulas(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - #enter data - enter_text_to_cell(xGridWindow, "B1", "10") - enter_text_to_cell(xGridWindow, "B2", "2") - enter_text_to_cell(xGridWindow, "B3", "10000") - enter_text_to_cell(xGridWindow, "B4", "2000") - enter_text_to_cell(xGridWindow, "B5", "=B4*(B1-B2)-B3") - enter_text_to_cell(xGridWindow, "C5", "=B5/B4") + #enter data + enter_text_to_cell(xGridWindow, "B1", "10") + enter_text_to_cell(xGridWindow, "B2", "2") + enter_text_to_cell(xGridWindow, "B3", "10000") + enter_text_to_cell(xGridWindow, "B4", "2000") + enter_text_to_cell(xGridWindow, "B5", "=B4*(B1-B2)-B3") + enter_text_to_cell(xGridWindow, "C5", "=B5/B4") - enter_text_to_cell(xGridWindow, "D2", "500") - enter_text_to_cell(xGridWindow, "D3", "1000") - enter_text_to_cell(xGridWindow, "D4", "1500") - enter_text_to_cell(xGridWindow, "D5", "2000") - enter_text_to_cell(xGridWindow, "D6", "2500") - enter_text_to_cell(xGridWindow, "D7", "3000") - enter_text_to_cell(xGridWindow, "D8", "3500") - enter_text_to_cell(xGridWindow, "D9", "4000") - enter_text_to_cell(xGridWindow, "D10", "4500") - enter_text_to_cell(xGridWindow, "D11", "5000") - #Select the range D2:F11 - xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:F11"})) - #Choose Data > Multiple Operations. - self.ui_test.execute_modeless_dialog_through_command(".uno:TableOperationDialog") - xDialog = self.xUITest.getTopFocusWindow() - #Formulas = B5 ; Column input cell = B4 - formulas = xDialog.getChild("formulas") - col = xDialog.getChild("col") - formulas.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$5:$C$5"})) - col.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$4"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #verify - self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), -6000) - self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), -2000) - self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 2000) - self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 6000) - self.assertEqual(get_cell_by_position(document, 0, 4, 5).getValue(), 10000) - self.assertEqual(get_cell_by_position(document, 0, 4, 6).getValue(), 14000) - self.assertEqual(get_cell_by_position(document, 0, 4, 7).getValue(), 18000) - self.assertEqual(get_cell_by_position(document, 0, 4, 8).getValue(), 22000) - self.assertEqual(get_cell_by_position(document, 0, 4, 9).getValue(), 26000) - self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 30000) + enter_text_to_cell(xGridWindow, "D2", "500") + enter_text_to_cell(xGridWindow, "D3", "1000") + enter_text_to_cell(xGridWindow, "D4", "1500") + enter_text_to_cell(xGridWindow, "D5", "2000") + enter_text_to_cell(xGridWindow, "D6", "2500") + enter_text_to_cell(xGridWindow, "D7", "3000") + enter_text_to_cell(xGridWindow, "D8", "3500") + enter_text_to_cell(xGridWindow, "D9", "4000") + enter_text_to_cell(xGridWindow, "D10", "4500") + enter_text_to_cell(xGridWindow, "D11", "5000") + #Select the range D2:F11 + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:F11"})) + #Choose Data > Multiple Operations. + self.ui_test.execute_modeless_dialog_through_command(".uno:TableOperationDialog") + xDialog = self.xUITest.getTopFocusWindow() + #Formulas = B5 ; Column input cell = B4 + formulas = xDialog.getChild("formulas") + col = xDialog.getChild("col") + formulas.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$5:$C$5"})) + col.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$4"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), -6000) + self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), -2000) + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 2000) + self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 6000) + self.assertEqual(get_cell_by_position(document, 0, 4, 5).getValue(), 10000) + self.assertEqual(get_cell_by_position(document, 0, 4, 6).getValue(), 14000) + self.assertEqual(get_cell_by_position(document, 0, 4, 7).getValue(), 18000) + self.assertEqual(get_cell_by_position(document, 0, 4, 8).getValue(), 22000) + self.assertEqual(get_cell_by_position(document, 0, 4, 9).getValue(), 26000) + self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 30000) - self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), -12) - self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), -2) - self.assertEqual(round(get_cell_by_position(document, 0, 5, 3).getValue(),2), 1.33) - self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 3) - self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 4) - self.assertEqual(round(get_cell_by_position(document, 0, 5, 6).getValue(),2), 4.67) - self.assertEqual(round(get_cell_by_position(document, 0, 5, 7).getValue(),2), 5.14) - self.assertEqual(get_cell_by_position(document, 0, 5, 8).getValue(), 5.5) - self.assertEqual(round(get_cell_by_position(document, 0, 5, 9).getValue(),2), 5.78) - self.assertEqual(get_cell_by_position(document, 0, 5, 10).getValue(), 6) + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), -12) + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), -2) + self.assertEqual(round(get_cell_by_position(document, 0, 5, 3).getValue(),2), 1.33) + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 4) + self.assertEqual(round(get_cell_by_position(document, 0, 5, 6).getValue(),2), 4.67) + self.assertEqual(round(get_cell_by_position(document, 0, 5, 7).getValue(),2), 5.14) + self.assertEqual(get_cell_by_position(document, 0, 5, 8).getValue(), 5.5) + self.assertEqual(round(get_cell_by_position(document, 0, 5, 9).getValue(),2), 5.78) + self.assertEqual(get_cell_by_position(document, 0, 5, 10).getValue(), 6) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/scenarios.py b/sc/qa/uitest/calc_tests6/scenarios.py index f0ba6dd3f1e2..64469be7a2ea 100644 --- a/sc/qa/uitest/calc_tests6/scenarios.py +++ b/sc/qa/uitest/calc_tests6/scenarios.py @@ -13,37 +13,38 @@ from uitest.uihelper.calc import enter_text_to_cell class scenarios(UITestCase): def test_scenarios(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - #fill B1:B4 with 1, select B1:B4; - enter_text_to_cell(xGridWindow, "B1", "1") - enter_text_to_cell(xGridWindow, "B2", "1") - enter_text_to_cell(xGridWindow, "B3", "1") - enter_text_to_cell(xGridWindow, "B4", "1") - xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B4"})) - #scenarios - scenario A1 - self.ui_test.execute_dialog_through_command(".uno:ScenarioManager") - xDialog = self.xUITest.getTopFocusWindow() - - name = xDialog.getChild("name") - name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - name.executeAction("TYPE", mkPropertyValues({"TEXT":"A1"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - #next scenarios - scenario B1 - self.ui_test.execute_dialog_through_command(".uno:ScenarioManager") - xDialog = self.xUITest.getTopFocusWindow() - - name = xDialog.getChild("name") - name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - name.executeAction("TYPE", mkPropertyValues({"TEXT":"B1"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #fill B1:B4 with 1, select B1:B4; + enter_text_to_cell(xGridWindow, "B1", "1") + enter_text_to_cell(xGridWindow, "B2", "1") + enter_text_to_cell(xGridWindow, "B3", "1") + enter_text_to_cell(xGridWindow, "B4", "1") + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B4"})) + #scenarios - scenario A1 + self.ui_test.execute_dialog_through_command(".uno:ScenarioManager") + xDialog = self.xUITest.getTopFocusWindow() + + name = xDialog.getChild("name") + name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + name.executeAction("TYPE", mkPropertyValues({"TEXT":"A1"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #next scenarios - scenario B1 + self.ui_test.execute_dialog_through_command(".uno:ScenarioManager") + xDialog = self.xUITest.getTopFocusWindow() + + name = xDialog.getChild("name") + name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + name.executeAction("TYPE", mkPropertyValues({"TEXT":"B1"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/shareSpreadsheet.py b/sc/qa/uitest/calc_tests6/shareSpreadsheet.py index cdded955a851..032b32271e9a 100644 --- a/sc/qa/uitest/calc_tests6/shareSpreadsheet.py +++ b/sc/qa/uitest/calc_tests6/shareSpreadsheet.py @@ -12,20 +12,21 @@ from uitest.uihelper.common import get_state_as_dict class shareSpreadsheet(UITestCase): def test_share_spreadsheet(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - #dialog shareSpreadsheet - self.ui_test.execute_dialog_through_command(".uno:ShareDocument") - xDialog = self.xUITest.getTopFocusWindow() + #dialog shareSpreadsheet + self.ui_test.execute_dialog_through_command(".uno:ShareDocument") + xDialog = self.xUITest.getTopFocusWindow() - share = xDialog.getChild("share") - share.executeAction("CLICK", tuple()) - users = xDialog.getChild("users") - self.assertEqual(get_state_as_dict(users)["Children"], "1") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + share = xDialog.getChild("share") + share.executeAction("CLICK", tuple()) + users = xDialog.getChild("users") + self.assertEqual(get_state_as_dict(users)["Children"], "1") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/tdf104378.py b/sc/qa/uitest/calc_tests6/tdf104378.py index 317b0eeb13d3..44c786019636 100644 --- a/sc/qa/uitest/calc_tests6/tdf104378.py +++ b/sc/qa/uitest/calc_tests6/tdf104378.py @@ -11,24 +11,26 @@ from libreoffice.calc.document import get_cell_by_position class tdf104378(UITestCase): def test_tdf104378(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") - enter_text_to_cell(gridwin, "A1", "遠程MySQL連接遠程MySQL連接遠程MySQL連接") + enter_text_to_cell(gridwin, "A1", "遠程MySQL連接遠程MySQL連接遠程MySQL連接") - self.ui_test.execute_dialog_through_command(".uno:ChineseConversion") + self.ui_test.execute_dialog_through_command(".uno:ChineseConversion") - xDialog = self.xUITest.getTopFocusWindow() - xOKBtn = xDialog.getChild('ok') - self.ui_test.close_dialog_through_button(xOKBtn) + xDialog = self.xUITest.getTopFocusWindow() + xOKBtn = xDialog.getChild('ok') + self.ui_test.close_dialog_through_button(xOKBtn) - document = self.ui_test.get_component() + document = self.ui_test.get_component() - # Without the fix in place, this test would have failed with - # - 远程MySQL連接遠程MySQL連接遠程MySQL連接 - # + 远程MySQL连接远程MySQL连接远程MySQL连接 - self.assertEqual(get_cell_by_position( - document, 0, 0, 0).getString(), "远程MySQL连接远程MySQL连接远程MySQL连接") + # Without the fix in place, this test would have failed with + # - 远程MySQL連接遠程MySQL連接遠程MySQL連接 + # + 远程MySQL连接远程MySQL连接远程MySQL连接 + self.assertEqual(get_cell_by_position( + document, 0, 0, 0).getString(), "远程MySQL连接远程MySQL连接远程MySQL连接") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/tdf116996.py b/sc/qa/uitest/calc_tests6/tdf116996.py index 44b71325b0d2..31cde88f909b 100644 --- a/sc/qa/uitest/calc_tests6/tdf116996.py +++ b/sc/qa/uitest/calc_tests6/tdf116996.py @@ -11,42 +11,43 @@ from uitest.uihelper.common import get_state_as_dict class tdf116996(UITestCase): def test_tdf116996_enable_experimental_feature(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog - xDialogOpt = self.xUITest.getTopFocusWindow() - - xPages = xDialogOpt.getChild("pages") - xLOEntry = xPages.getChild('0') # Libreoffice - xLOEntry.executeAction("EXPAND", tuple()) - xAdvancedEntry = xLOEntry.getChild('10') - xAdvancedEntry.executeAction("SELECT", tuple()) #Libreoffice / Advanced - xexperimental = xDialogOpt.getChild("experimental") - xexperimental.executeAction("CLICK", tuple()) #enable experimental features - - xOKBtn = xDialogOpt.getChild("ok") - - with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="no"): - pass - - #reopen options dialog and verify - self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog - xDialogOpt = self.xUITest.getTopFocusWindow() - xPages = xDialogOpt.getChild("pages") - xLOEntry = xPages.getChild('0') # Libreoffice - xLOEntry.executeAction("EXPAND", tuple()) - xAdvancedEntry = xLOEntry.getChild('10') - xAdvancedEntry.executeAction("SELECT", tuple()) #Libreoffice / Advanced - xexperimental = xDialogOpt.getChild("experimental") - - self.assertEqual(get_state_as_dict(xexperimental)["Selected"], "true") - xexperimental.executeAction("CLICK", tuple()) #disable experimental features - xOKBtn = xDialogOpt.getChild("ok") - - with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="no"): - pass - + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialogOpt = self.xUITest.getTopFocusWindow() + + xPages = xDialogOpt.getChild("pages") + xLOEntry = xPages.getChild('0') # Libreoffice + xLOEntry.executeAction("EXPAND", tuple()) + xAdvancedEntry = xLOEntry.getChild('10') + xAdvancedEntry.executeAction("SELECT", tuple()) #Libreoffice / Advanced + xexperimental = xDialogOpt.getChild("experimental") + xexperimental.executeAction("CLICK", tuple()) #enable experimental features + + xOKBtn = xDialogOpt.getChild("ok") + + with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="no"): + pass + + #reopen options dialog and verify + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialogOpt = self.xUITest.getTopFocusWindow() + xPages = xDialogOpt.getChild("pages") + xLOEntry = xPages.getChild('0') # Libreoffice + xLOEntry.executeAction("EXPAND", tuple()) + xAdvancedEntry = xLOEntry.getChild('10') + xAdvancedEntry.executeAction("SELECT", tuple()) #Libreoffice / Advanced + xexperimental = xDialogOpt.getChild("experimental") + + self.assertEqual(get_state_as_dict(xexperimental)["Selected"], "true") + xexperimental.executeAction("CLICK", tuple()) #disable experimental features + xOKBtn = xDialogOpt.getChild("ok") + + with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="no"): + pass + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/tdf121263.py b/sc/qa/uitest/calc_tests6/tdf121263.py index 73677e42f9db..9d80fc24c64d 100644 --- a/sc/qa/uitest/calc_tests6/tdf121263.py +++ b/sc/qa/uitest/calc_tests6/tdf121263.py @@ -13,33 +13,34 @@ from uitest.uihelper.common import get_state_as_dict class tdf121263(UITestCase): def test_tdf121263_hide_more_sheets(self): - with self.ui_test.create_doc_in_start_center("calc"): - xTopWindow = self.xUITest.getTopFocusWindow() - document = self.ui_test.get_component() - gridwin = xTopWindow.getChild("grid_window") - - self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet - xDialog = self.xUITest.getTopFocusWindow() - xOKButton = xDialog.getChild("ok") - xOKButton.executeAction("CLICK", tuple()) - self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet - xDialog = self.xUITest.getTopFocusWindow() - xOKButton = xDialog.getChild("ok") - xOKButton.executeAction("CLICK", tuple()) - - gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "2"})) - #select previous sheet - self.xUITest.executeCommand(".uno:JumpToPrevTableSel") - - #hide sheet - self.xUITest.executeCommand(".uno:Hide") - - #show sheet Dialog - self.ui_test.execute_dialog_through_command(".uno:Show") - xDialog = self.xUITest.getTopFocusWindow() - treeview = xDialog.getChild("treeview") - self.assertEqual(get_state_as_dict(treeview)["Children"], "2") - xcancel = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xcancel) - + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xTopWindow = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + gridwin = xTopWindow.getChild("grid_window") + + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) + + gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "2"})) + #select previous sheet + self.xUITest.executeCommand(".uno:JumpToPrevTableSel") + + #hide sheet + self.xUITest.executeCommand(".uno:Hide") + + #show sheet Dialog + self.ui_test.execute_dialog_through_command(".uno:Show") + xDialog = self.xUITest.getTopFocusWindow() + treeview = xDialog.getChild("treeview") + self.assertEqual(get_state_as_dict(treeview)["Children"], "2") + xcancel = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancel) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/tdf91726.py b/sc/qa/uitest/calc_tests6/tdf91726.py index 6c720e240629..bc134547aaf8 100644 --- a/sc/qa/uitest/calc_tests6/tdf91726.py +++ b/sc/qa/uitest/calc_tests6/tdf91726.py @@ -11,39 +11,41 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf91726(UITestCase): def test_tdf91726_new_style(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #select A1:E9 - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:E9"})) - #AutoFormat Styles - self.ui_test.execute_dialog_through_command(".uno:AutoFormat") - xDialog = self.xUITest.getTopFocusWindow() - #add new style "Default" - xadd = xDialog.getChild("add") + writer_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select A1:E9 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:E9"})) + #AutoFormat Styles + self.ui_test.execute_dialog_through_command(".uno:AutoFormat") + xDialog = self.xUITest.getTopFocusWindow() + #add new style "Default" + xadd = xDialog.getChild("add") + + # Use empty close_button to open consecutive dialogs + with self.ui_test.execute_blocking_action( + xadd.executeAction, args=('CLICK', ()), close_button="") as dialog: + nameEntry = dialog.getChild("name_entry") + nameEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"Default"})) + xOKBtn = dialog.getChild("ok") - # Use empty close_button to open consecutive dialogs with self.ui_test.execute_blocking_action( - xadd.executeAction, args=('CLICK', ()), close_button="") as dialog: - nameEntry = dialog.getChild("name_entry") - nameEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"Default"})) - xOKBtn = dialog.getChild("ok") + xOKBtn.executeAction, args=('CLICK', ()), close_button="") as dialog2: + #Error message: You have entered an invalid name. + #AutoFormat could not be created. + #Try again using a different name. + xOKBtn2 = dialog2.getChild("ok") with self.ui_test.execute_blocking_action( - xOKBtn.executeAction, args=('CLICK', ()), close_button="") as dialog2: - #Error message: You have entered an invalid name. - #AutoFormat could not be created. - #Try again using a different name. - xOKBtn2 = dialog2.getChild("ok") + xOKBtn2.executeAction, args=('CLICK', ()), close_button="cancel") as dialog3: + nameEntry = dialog3.getChild("name_entry") + #back to name dialog, LO should not crash + self.assertEqual(get_state_as_dict(nameEntry)["Text"], "Default") - with self.ui_test.execute_blocking_action( - xOKBtn2.executeAction, args=('CLICK', ()), close_button="cancel") as dialog3: - nameEntry = dialog3.getChild("name_entry") - #back to name dialog, LO should not crash - self.assertEqual(get_state_as_dict(nameEntry)["Text"], "Default") + xCanceltn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanceltn) - xCanceltn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanceltn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf106667.py b/sc/qa/uitest/calc_tests7/tdf106667.py index 16c6dfa14add..6c2792d1b403 100644 --- a/sc/qa/uitest/calc_tests7/tdf106667.py +++ b/sc/qa/uitest/calc_tests7/tdf106667.py @@ -13,23 +13,24 @@ from libreoffice.calc.document import get_cell_by_position class tdf106667(UITestCase): def test_tdf106667_about_dlg_all(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "A") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A1000"})) + enter_text_to_cell(gridwin, "A1", "A") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A1000"})) - self.xUITest.executeCommand(".uno:FillDown") + self.xUITest.executeCommand(".uno:FillDown") - self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:SelectAll") - self.ui_test.execute_dialog_through_command(".uno:About") - xAboutDlg = self.xUITest.getTopFocusWindow() - xCloseBtn = xAboutDlg.getChild("btnClose") - self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.execute_dialog_through_command(".uno:About") + xAboutDlg = self.xUITest.getTopFocusWindow() + xCloseBtn = xAboutDlg.getChild("btnClose") + self.ui_test.close_dialog_through_button(xCloseBtn) - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf117987.py b/sc/qa/uitest/calc_tests7/tdf117987.py index e2a655222b15..3de0b176ed01 100644 --- a/sc/qa/uitest/calc_tests7/tdf117987.py +++ b/sc/qa/uitest/calc_tests7/tdf117987.py @@ -10,15 +10,16 @@ from libreoffice.calc.document import get_cell_by_position class tdf117987(UITestCase): def test_highlight_cell_after_moving_cursor(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") - colorProperty = mkPropertyValues({"BackgroundColor": 16776960}) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.xUITest.executeCommandWithParameters(".uno:BackgroundColor", colorProperty) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - self.xUITest.executeCommandWithParameters(".uno:BackgroundColor", colorProperty) + colorProperty = mkPropertyValues({"BackgroundColor": 16776960}) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommandWithParameters(".uno:BackgroundColor", colorProperty) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + self.xUITest.executeCommandWithParameters(".uno:BackgroundColor", colorProperty) - document = self.ui_test.get_component() - self.assertEqual(get_cell_by_position(document, 0, 0, 1).CellBackColor, 16776960) + document = self.ui_test.get_component() + self.assertEqual(get_cell_by_position(document, 0, 0, 1).CellBackColor, 16776960) + self.ui_test.close_doc() diff --git a/sc/qa/uitest/calc_tests7/tdf123122.py b/sc/qa/uitest/calc_tests7/tdf123122.py index 537664d584f1..d8d845b6c6e2 100644 --- a/sc/qa/uitest/calc_tests7/tdf123122.py +++ b/sc/qa/uitest/calc_tests7/tdf123122.py @@ -14,53 +14,54 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf123122(UITestCase): def test_tdf123122_format_cell_datetime(self): #numberingformatpage.ui - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") #tab Numbers - xliststore1 = xDialog.getChild("categorylb") #1st list / Category - xliststore2 = xDialog.getChild("formatlb") #2nd list / Format - xdecimalsed = xDialog.getChild("decimalsed") - xleadzerosed = xDialog.getChild("leadzerosed") - xnegnumred = xDialog.getChild("negnumred") - xthousands = xDialog.getChild("thousands") - xlanguagelb = xDialog.getChild("languagelb") - xformatted = xDialog.getChild("formatted") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + xliststore1 = xDialog.getChild("categorylb") #1st list / Category + xliststore2 = xDialog.getChild("formatlb") #2nd list / Format + xdecimalsed = xDialog.getChild("decimalsed") + xleadzerosed = xDialog.getChild("leadzerosed") + xnegnumred = xDialog.getChild("negnumred") + xthousands = xDialog.getChild("thousands") + xlanguagelb = xDialog.getChild("languagelb") + xformatted = xDialog.getChild("formatted") - #Format cells and enter NN MMM DD YYYY HH:MM as format code - xformatted.executeAction("CLEAR", tuple()) #clear textbox - xformatted.executeAction("TYPE", mkPropertyValues({"TEXT":"NN MMM DD YYYY HH:MM"})) - #save - OK - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) + #Format cells and enter NN MMM DD YYYY HH:MM as format code + xformatted.executeAction("CLEAR", tuple()) #clear textbox + xformatted.executeAction("TYPE", mkPropertyValues({"TEXT":"NN MMM DD YYYY HH:MM"})) + #save - OK + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) - #verify - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") #tab Numbers - xliststore1 = xDialog.getChild("categorylb") #1st list / Category - xliststore2 = xDialog.getChild("formatlb") #2nd list / Format - xdecimalsed = xDialog.getChild("decimalsed") - xleadzerosed = xDialog.getChild("leadzerosed") - xnegnumred = xDialog.getChild("negnumred") - xthousands = xDialog.getChild("thousands") - xlanguagelb = xDialog.getChild("languagelb") - xformatted = xDialog.getChild("formatted") + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + xliststore1 = xDialog.getChild("categorylb") #1st list / Category + xliststore2 = xDialog.getChild("formatlb") #2nd list / Format + xdecimalsed = xDialog.getChild("decimalsed") + xleadzerosed = xDialog.getChild("leadzerosed") + xnegnumred = xDialog.getChild("negnumred") + xthousands = xDialog.getChild("thousands") + xlanguagelb = xDialog.getChild("languagelb") + xformatted = xDialog.getChild("formatted") - self.assertEqual(get_state_as_dict(xliststore1)["SelectEntryText"], "Date") - self.assertEqual(get_state_as_dict(xformatted)["Text"], "NN MMM DD YYYY HH:MM") - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) + self.assertEqual(get_state_as_dict(xliststore1)["SelectEntryText"], "Date") + self.assertEqual(get_state_as_dict(xformatted)["Text"], "NN MMM DD YYYY HH:MM") + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf125030.py b/sc/qa/uitest/calc_tests7/tdf125030.py index c8c931d302f9..51d9cb292a77 100644 --- a/sc/qa/uitest/calc_tests7/tdf125030.py +++ b/sc/qa/uitest/calc_tests7/tdf125030.py @@ -13,20 +13,21 @@ from uitest.uihelper.calc import enter_text_to_cell class tdf125030(UITestCase): def test_tdf125030_repeat_crash(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #enter data - enter_text_to_cell(gridwin, "A1", "aaaa") - enter_text_to_cell(gridwin, "B1", "bbbb") - #select A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%201&FamilyName:string=CellStyles") - #focus on A2 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) - #repeat (Ctrl+Shft+Y) - self.xUITest.executeCommand(".uno:Repeat") - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "aaaa") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #enter data + enter_text_to_cell(gridwin, "A1", "aaaa") + enter_text_to_cell(gridwin, "B1", "bbbb") + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%201&FamilyName:string=CellStyles") + #focus on A2 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + #repeat (Ctrl+Shft+Y) + self.xUITest.executeCommand(".uno:Repeat") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "aaaa") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf45020.py b/sc/qa/uitest/calc_tests7/tdf45020.py index b588d2122903..48ca97fe51a5 100644 --- a/sc/qa/uitest/calc_tests7/tdf45020.py +++ b/sc/qa/uitest/calc_tests7/tdf45020.py @@ -11,25 +11,26 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf45020(UITestCase): def test_tdf45020_hide_rows_select(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #in cell A1-A4: apple pear melon mango - enter_text_to_cell(gridwin, "A1", "apple") - enter_text_to_cell(gridwin, "A1", "pear") - enter_text_to_cell(gridwin, "A1", "melon") - enter_text_to_cell(gridwin, "A1", "mango") - #select A2 and A3 - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A3"})) - #format > Row > Hide - self.ui_test._xUITest.executeCommand(".uno:HideRow") - #select A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #press Shift+down - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+DOWN"})) - #verify A1:A4 selected - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A1:Sheet1.A4") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #in cell A1-A4: apple pear melon mango + enter_text_to_cell(gridwin, "A1", "apple") + enter_text_to_cell(gridwin, "A1", "pear") + enter_text_to_cell(gridwin, "A1", "melon") + enter_text_to_cell(gridwin, "A1", "mango") + #select A2 and A3 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A3"})) + #format > Row > Hide + self.ui_test._xUITest.executeCommand(".uno:HideRow") + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #press Shift+down + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+DOWN"})) + #verify A1:A4 selected + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A1:Sheet1.A4") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/navigator.py b/sc/qa/uitest/calc_tests8/navigator.py index e2cb99ad7f68..d92226771eb5 100644 --- a/sc/qa/uitest/calc_tests8/navigator.py +++ b/sc/qa/uitest/calc_tests8/navigator.py @@ -114,38 +114,40 @@ class navigator(UITestCase): def test_tdf134390(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWin = xCalcDoc.getChild("grid_window") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWin = xCalcDoc.getChild("grid_window") - self.xUITest.executeCommand(".uno:Sidebar") - xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"})) + self.xUITest.executeCommand(".uno:Sidebar") + xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"})) - xCalcDoc = self.xUITest.getTopFocusWindow() - xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel") - xToolBar = xNavigatorPanel.getChild("toolbox2") - xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'toggle' button + xCalcDoc = self.xUITest.getTopFocusWindow() + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel") + xToolBar = xNavigatorPanel.getChild("toolbox2") + xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'toggle' button - xRow = xNavigatorPanel.getChild('row') - xColumn = xNavigatorPanel.getChild('column') - self.assertEqual(get_state_as_dict(xColumn)['Value'], '1') - self.assertEqual(get_state_as_dict(xRow)['Value'], '1') - self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "0") - self.assertEqual(get_state_as_dict(xGridWin)["CurrentColumn"], "0") + xRow = xNavigatorPanel.getChild('row') + xColumn = xNavigatorPanel.getChild('column') + self.assertEqual(get_state_as_dict(xColumn)['Value'], '1') + self.assertEqual(get_state_as_dict(xRow)['Value'], '1') + self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "0") + self.assertEqual(get_state_as_dict(xGridWin)["CurrentColumn"], "0") - xRow.executeAction("UP", tuple()) - xColumn.executeAction("UP", tuple()) + xRow.executeAction("UP", tuple()) + xColumn.executeAction("UP", tuple()) - # Use return to update the current cell - xColumn.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + # Use return to update the current cell + xColumn.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) - self.assertEqual(get_state_as_dict(xColumn)['Value'], '2') - self.assertEqual(get_state_as_dict(xRow)['Value'], '2') + self.assertEqual(get_state_as_dict(xColumn)['Value'], '2') + self.assertEqual(get_state_as_dict(xRow)['Value'], '2') - self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "1") - self.assertEqual(get_state_as_dict(xGridWin)["CurrentColumn"], "1") + self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "1") + self.assertEqual(get_state_as_dict(xGridWin)["CurrentColumn"], "1") - self.xUITest.executeCommand(".uno:Sidebar") + self.xUITest.executeCommand(".uno:Sidebar") + + self.ui_test.close_doc() def test_tdf141973(self): with self.ui_test.load_file(get_url_for_data_file("tdf141973.ods")): diff --git a/sc/qa/uitest/calc_tests8/tdf114710.py b/sc/qa/uitest/calc_tests8/tdf114710.py index 6bddee42a85b..a4989a72de58 100644 --- a/sc/qa/uitest/calc_tests8/tdf114710.py +++ b/sc/qa/uitest/calc_tests8/tdf114710.py @@ -21,7 +21,7 @@ class tdf114710(UITestCase): self.xUITest.executeCommand(".uno:CloseDoc") - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") self.xUITest.getTopFocusWindow() diff --git a/sc/qa/uitest/calc_tests8/tdf118308.py b/sc/qa/uitest/calc_tests8/tdf118308.py index 80c79eedb1c9..2c38cd11394d 100644 --- a/sc/qa/uitest/calc_tests8/tdf118308.py +++ b/sc/qa/uitest/calc_tests8/tdf118308.py @@ -13,48 +13,49 @@ from libreoffice.calc.document import get_cell_by_position class tdf118308(UITestCase): def test_tdf118308(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "A") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.xUITest.executeCommand(".uno:Copy") + enter_text_to_cell(gridwin, "A1", "A") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:Copy") - self.ui_test.execute_dialog_through_command(".uno:CloseDoc") - xDialog = self.xUITest.getTopFocusWindow() - xDiscardBtn = xDialog.getChild("discard") - self.ui_test.close_dialog_through_button(xDiscardBtn) + self.ui_test.execute_dialog_through_command(".uno:CloseDoc") + xDialog = self.xUITest.getTopFocusWindow() + xDiscardBtn = xDialog.getChild("discard") + self.ui_test.close_dialog_through_button(xDiscardBtn) - with self.ui_test.create_doc_in_start_center("calc"): + calc_doc = self.ui_test.create_doc_in_start_center("calc") - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + xDialog = self.xUITest.getTopFocusWindow() - # Without the fix in place, this test would have failed here - # since a different dialog would have been opened and the children - # wouldn't have been found - xText = xDialog.getChild("text") - xNumbers = xDialog.getChild("numbers") - xDatetime = xDialog.getChild("datetime") - xFormats = xDialog.getChild("formats") + # Without the fix in place, this test would have failed here + # since a different dialog would have been opened and the children + # wouldn't have been found + xText = xDialog.getChild("text") + xNumbers = xDialog.getChild("numbers") + xDatetime = xDialog.getChild("datetime") + xFormats = xDialog.getChild("formats") - self.assertEqual("true", get_state_as_dict(xText)["Selected"]) - self.assertEqual("true", get_state_as_dict(xNumbers)["Selected"]) - self.assertEqual("true", get_state_as_dict(xDatetime)["Selected"]) - self.assertEqual("false", get_state_as_dict(xFormats)["Selected"]) + self.assertEqual("true", get_state_as_dict(xText)["Selected"]) + self.assertEqual("true", get_state_as_dict(xNumbers)["Selected"]) + self.assertEqual("true", get_state_as_dict(xDatetime)["Selected"]) + self.assertEqual("false", get_state_as_dict(xFormats)["Selected"]) - 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("A", get_cell_by_position(document, 0, 0, 0).getString()) + self.assertEqual("A", get_cell_by_position(document, 0, 0, 0).getString()) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf125051.py b/sc/qa/uitest/calc_tests8/tdf125051.py index 8cc02ff2d67e..5ebd02446450 100644 --- a/sc/qa/uitest/calc_tests8/tdf125051.py +++ b/sc/qa/uitest/calc_tests8/tdf125051.py @@ -15,30 +15,32 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf125051(UITestCase): def test_tdf125051_crash_spelling_dialog(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "text") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.ui_test.execute_dialog_through_command(".uno:SpellDialog") - xDialog = self.xUITest.getTopFocusWindow() #Spelling dialog - - xDialog2 = self.xUITest.getTopFocusWindow() # info dialog "The spellcheck of this sheet has been completed.-> OK" - okBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(okBtn) - - xDialog = self.xUITest.getTopFocusWindow() #Spelling dialog - #open options - optionsBtn = xDialog.getChild("options") - - with self.ui_test.execute_blocking_action(optionsBtn.executeAction, args=('CLICK', ()), close_button="cancel"): - pass - - closeBtn = xDialog.getChild("close") #close Spelling dialog - self.ui_test.close_dialog_through_button(closeBtn) - - #verify, we didn't crash - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "text") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "text") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.ui_test.execute_dialog_through_command(".uno:SpellDialog") + xDialog = self.xUITest.getTopFocusWindow() #Spelling dialog + + xDialog2 = self.xUITest.getTopFocusWindow() # info dialog "The spellcheck of this sheet has been completed.-> OK" + okBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) + + xDialog = self.xUITest.getTopFocusWindow() #Spelling dialog + #open options + optionsBtn = xDialog.getChild("options") + + with self.ui_test.execute_blocking_action(optionsBtn.executeAction, args=('CLICK', ()), close_button="cancel"): + pass + + closeBtn = xDialog.getChild("close") #close Spelling dialog + self.ui_test.close_dialog_through_button(closeBtn) + + #verify, we didn't crash + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "text") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf126248.py b/sc/qa/uitest/calc_tests8/tdf126248.py index 8cc43708c72d..27482acd0cde 100644 --- a/sc/qa/uitest/calc_tests8/tdf126248.py +++ b/sc/qa/uitest/calc_tests8/tdf126248.py @@ -49,7 +49,7 @@ class tdf126248(UITestCase): def test_tdf126248(self): - with self.ui_test.create_doc_in_start_center("calc"): + with guarded.create_doc_in_start_center(self, "calc"): self.changeLocalSetting("Chinese (traditional)") diff --git a/sc/qa/uitest/calc_tests8/tdf137726.py b/sc/qa/uitest/calc_tests8/tdf137726.py index 0d6cd00f8b00..8256a778ba26 100644 --- a/sc/qa/uitest/calc_tests8/tdf137726.py +++ b/sc/qa/uitest/calc_tests8/tdf137726.py @@ -9,18 +9,20 @@ from uitest.framework import UITestCase class tdf137726(UITestCase): def test_tdf137726(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") - self.ui_test.execute_dialog_through_command(".uno:DataDataPilotRun") + self.ui_test.execute_dialog_through_command(".uno:DataDataPilotRun") - # three dialogs are displayed one after the other, click OK in all of them - for i in range(3): - xDialog = self.xUITest.getTopFocusWindow() - xOKBtn = xDialog.getChild('ok') - self.ui_test.close_dialog_through_button(xOKBtn) + # three dialogs are displayed one after the other, click OK in all of them + for i in range(3): + xDialog = self.xUITest.getTopFocusWindow() + xOKBtn = xDialog.getChild('ok') + self.ui_test.close_dialog_through_button(xOKBtn) - # Without the fix in place, this test would have hung here + # Without the fix in place, this test would have hung here + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf113571.py b/sc/qa/uitest/calc_tests9/tdf113571.py index 213c521244d9..48657e37e60d 100644 --- a/sc/qa/uitest/calc_tests9/tdf113571.py +++ b/sc/qa/uitest/calc_tests9/tdf113571.py @@ -23,7 +23,7 @@ class Tdf113571(UITestCase): # Close the document self.xUITest.executeCommand(".uno:CloseDoc") - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") self.xUITest.executeCommand(".uno:PasteUnformatted") diff --git a/sc/qa/uitest/calc_tests9/tdf117879.py b/sc/qa/uitest/calc_tests9/tdf117879.py index e880d0dbb31b..b67e27ff4c89 100644 --- a/sc/qa/uitest/calc_tests9/tdf117879.py +++ b/sc/qa/uitest/calc_tests9/tdf117879.py @@ -13,30 +13,32 @@ class tdf117879(UITestCase): def test_tdf117879(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - calcDoc = self.xUITest.getTopFocusWindow() - gridwin = calcDoc.getChild("grid_window") + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - type_text(gridwin, "=SUM({A1},2,3,4,5}") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + type_text(gridwin, "=SUM({A1},2,3,4,5}") - # Without the fix in place, this dialog wouldn't have been displayed - with self.ui_test.execute_blocking_action(gridwin.executeAction, - args=("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})), close_button="yes"): - pass + # Without the fix in place, this dialog wouldn't have been displayed + with self.ui_test.execute_blocking_action(gridwin.executeAction, + args=("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})), close_button="yes"): + pass - document = self.ui_test.get_component() - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getFormula(), "=SUM({A1};2;3;4;5)") + document = self.ui_test.get_component() + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getFormula(), "=SUM({A1};2;3;4;5)") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - type_text(gridwin, "=SUM({A1},2,3,4,5}") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + type_text(gridwin, "=SUM({A1},2,3,4,5}") - with self.ui_test.execute_blocking_action(gridwin.executeAction, - args=("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})), close_button="no"): - pass + with self.ui_test.execute_blocking_action(gridwin.executeAction, + args=("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})), close_button="no"): + pass - document = self.ui_test.get_component() - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getFormula(), "=SUM({A1};2;3;4;5})") + document = self.ui_test.get_component() + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getFormula(), "=SUM({A1};2;3;4;5})") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf121949.py b/sc/qa/uitest/calc_tests9/tdf121949.py index 26b5aa373f53..92dd66866510 100644 --- a/sc/qa/uitest/calc_tests9/tdf121949.py +++ b/sc/qa/uitest/calc_tests9/tdf121949.py @@ -10,19 +10,21 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf121949 (UITestCase): def test_tdf121949_copy_block_with_single_cell_not_included(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") - # mark a range with a single cell left our and copy to clipboard - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"})) - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B1", "EXTEND":"1"})) - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B3:B3", "EXTEND":"1"})) - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:C3", "EXTEND":"1"})) - self.ui_test.execute_dialog_through_command(".uno:Copy") - xDialog = self.xUITest.getTopFocusWindow() - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + # mark a range with a single cell left our and copy to clipboard + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B1", "EXTEND":"1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B3:B3", "EXTEND":"1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:C3", "EXTEND":"1"})) + self.ui_test.execute_dialog_through_command(".uno:Copy") + xDialog = self.xUITest.getTopFocusWindow() + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf125440.py b/sc/qa/uitest/calc_tests9/tdf125440.py index 75c82d18e592..82accfb11942 100644 --- a/sc/qa/uitest/calc_tests9/tdf125440.py +++ b/sc/qa/uitest/calc_tests9/tdf125440.py @@ -22,7 +22,7 @@ class Tdf1254400(UITestCase): # Close the document self.xUITest.executeCommand(".uno:CloseDoc") - with self.ui_test.create_doc_in_start_center("calc"): + calc_doc = self.ui_test.create_doc_in_start_center("calc") xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") diff --git a/sc/qa/uitest/calc_tests9/tdf133629.py b/sc/qa/uitest/calc_tests9/tdf133629.py index 4362219e3ee4..2b13645420ec 100644 --- a/sc/qa/uitest/calc_tests9/tdf133629.py +++ b/sc/qa/uitest/calc_tests9/tdf133629.py @@ -11,53 +11,55 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf133629(UITestCase): def test_tdf133629(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - self.ui_test.execute_dialog_through_command(".uno:Insert") - xDialog = self.xUITest.getTopFocusWindow() - xOKButton = xDialog.getChild("ok") - xOKButton.executeAction("CLICK", tuple()) - - self.xUITest.executeCommand(".uno:TableSelectAll") - - self.xUITest.executeCommand(".uno:SelectAll") - - # Check selection - self.assertIsNotNone(getattr(document.CurrentSelection, 'Sheet1.A1:AMJ1048576')) - self.assertIsNotNone(getattr(document.CurrentSelection, 'Sheet1.A2:AMJ1048576')) - - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") - - xPresets = xDialog.getChild("presets") - xPresets.executeAction("CHOOSE", mkPropertyValues({"POS": "4"})) - - # Change width - xLineWidth = xDialog.getChild("linewidthmf") - xLineWidth.executeAction("UP", tuple()) - xLineWidth.executeAction("UP", tuple()) - self.assertEqual("1.25 pt", get_state_as_dict(xLineWidth)['Text']) - - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) - - # Without the fix in place, this test would have crash here - - xA1Sheet1 = document.Sheets[0].getCellRangeByName("A1") - self.assertEqual(44, xA1Sheet1.BottomBorder.OuterLineWidth) - self.assertEqual(44, xA1Sheet1.TopBorder.OuterLineWidth) - self.assertEqual(44, xA1Sheet1.LeftBorder.OuterLineWidth) - self.assertEqual(44, xA1Sheet1.RightBorder.OuterLineWidth) - - xA1Sheet2 = document.Sheets[1].getCellRangeByName("A1") - self.assertEqual(44, xA1Sheet2.BottomBorder.OuterLineWidth) - self.assertEqual(44, xA1Sheet2.TopBorder.OuterLineWidth) - self.assertEqual(44, xA1Sheet2.LeftBorder.OuterLineWidth) - self.assertEqual(44, xA1Sheet2.RightBorder.OuterLineWidth) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:Insert") + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) + + self.xUITest.executeCommand(".uno:TableSelectAll") + + self.xUITest.executeCommand(".uno:SelectAll") + + # Check selection + self.assertIsNotNone(getattr(document.CurrentSelection, 'Sheet1.A1:AMJ1048576')) + self.assertIsNotNone(getattr(document.CurrentSelection, 'Sheet1.A2:AMJ1048576')) + + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xPresets = xDialog.getChild("presets") + xPresets.executeAction("CHOOSE", mkPropertyValues({"POS": "4"})) + + # Change width + xLineWidth = xDialog.getChild("linewidthmf") + xLineWidth.executeAction("UP", tuple()) + xLineWidth.executeAction("UP", tuple()) + self.assertEqual("1.25 pt", get_state_as_dict(xLineWidth)['Text']) + + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + + # Without the fix in place, this test would have crash here + + xA1Sheet1 = document.Sheets[0].getCellRangeByName("A1") + self.assertEqual(44, xA1Sheet1.BottomBorder.OuterLineWidth) + self.assertEqual(44, xA1Sheet1.TopBorder.OuterLineWidth) + self.assertEqual(44, xA1Sheet1.LeftBorder.OuterLineWidth) + self.assertEqual(44, xA1Sheet1.RightBorder.OuterLineWidth) + + xA1Sheet2 = document.Sheets[1].getCellRangeByName("A1") + self.assertEqual(44, xA1Sheet2.BottomBorder.OuterLineWidth) + self.assertEqual(44, xA1Sheet2.TopBorder.OuterLineWidth) + self.assertEqual(44, xA1Sheet2.LeftBorder.OuterLineWidth) + self.assertEqual(44, xA1Sheet2.RightBorder.OuterLineWidth) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf141244.py b/sc/qa/uitest/calc_tests9/tdf141244.py index c4755545b512..402215fdf333 100644 --- a/sc/qa/uitest/calc_tests9/tdf141244.py +++ b/sc/qa/uitest/calc_tests9/tdf141244.py @@ -13,29 +13,31 @@ class tdf141244(UITestCase): def test_tdf141244(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - calcDoc = self.xUITest.getTopFocusWindow() - gridwin = calcDoc.getChild("grid_window") + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") - enter_text_to_cell(gridwin, "A1", '=DDE("soffice";"data1.ods";"sheet1.A1")') + enter_text_to_cell(gridwin, "A1", '=DDE("soffice";"data1.ods";"sheet1.A1")') - self.ui_test.execute_dialog_through_command(".uno:EditLinks") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:EditLinks") + xDialog = self.xUITest.getTopFocusWindow() - xLinks = xDialog.getChild("TB_LINKS") - self.assertEqual(1, len(xLinks.getChildren())) + xLinks = xDialog.getChild("TB_LINKS") + self.assertEqual(1, len(xLinks.getChildren())) - xChangeBtn = xDialog.getChild("CHANGE_SOURCE") + xChangeBtn = xDialog.getChild("CHANGE_SOURCE") - with self.ui_test.execute_blocking_action(xChangeBtn.executeAction, args=('CLICK', ()), close_button="cancel") as dialog: - self.assertEqual("soffice", get_state_as_dict(dialog.getChild("app"))['Text']) - self.assertEqual("data1.ods", get_state_as_dict(dialog.getChild("file"))['Text']) - self.assertEqual("sheet1.A1", get_state_as_dict(dialog.getChild("category"))['Text']) + with self.ui_test.execute_blocking_action(xChangeBtn.executeAction, args=('CLICK', ()), close_button="cancel") as dialog: + self.assertEqual("soffice", get_state_as_dict(dialog.getChild("app"))['Text']) + self.assertEqual("data1.ods", get_state_as_dict(dialog.getChild("file"))['Text']) + self.assertEqual("sheet1.A1", get_state_as_dict(dialog.getChild("category"))['Text']) - # tdf#141770: Without the fix in place, the cancel button wouldn't have worked here + # tdf#141770: Without the fix in place, the cancel button wouldn't have worked here - xClose = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xClose) + xClose = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xClose) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/copyPaste.py b/sc/qa/uitest/chart/copyPaste.py index c0d90d2069dd..5294022bfdac 100644 --- a/sc/qa/uitest/chart/copyPaste.py +++ b/sc/qa/uitest/chart/copyPaste.py @@ -39,7 +39,7 @@ class CopyPaste(UITestCase): self.xUITest.executeCommand(".uno:CloseDoc") - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") document = self.ui_test.get_component() # Rename the sheet to match the same name as the first document diff --git a/sc/qa/uitest/chart/create_chart.py b/sc/qa/uitest/chart/create_chart.py index 8ac21bbacbcf..cced0ac63d37 100644 --- a/sc/qa/uitest/chart/create_chart.py +++ b/sc/qa/uitest/chart/create_chart.py @@ -35,103 +35,114 @@ class CalcChartUIDemo(UITestCase): def test_cancel_immediately(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.fill_spreadsheet() + self.fill_spreadsheet() - xChartDlg = self.create_insert_chart_dialog(); + xChartDlg = self.create_insert_chart_dialog(); - xCancelBtn = xChartDlg.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + xCancelBtn = xChartDlg.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() def test_create_from_first_page(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") + + self.fill_spreadsheet() - self.fill_spreadsheet() + xChartDlg = self.create_insert_chart_dialog(); - xChartDlg = self.create_insert_chart_dialog(); + xOkBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xOkBtn) - xOkBtn = xChartDlg.getChild("finish") - self.ui_test.close_dialog_through_button(xOkBtn) + self.ui_test.close_doc() def test_create_from_second_page(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") + + self.fill_spreadsheet() - self.fill_spreadsheet() + xChartDlg = self.create_insert_chart_dialog(); - xChartDlg = self.create_insert_chart_dialog(); + xNextBtn = xChartDlg.getChild("next") + xNextBtn.executeAction("CLICK", tuple()) - xNextBtn = xChartDlg.getChild("next") - xNextBtn.executeAction("CLICK", tuple()) + xDataInRows = xChartDlg.getChild("RB_DATAROWS") + xDataInRows.executeAction("CLICK", tuple()) - xDataInRows = xChartDlg.getChild("RB_DATAROWS") - xDataInRows.executeAction("CLICK", tuple()) + xDataInCols = xChartDlg.getChild("RB_DATACOLS") + xDataInCols.executeAction("CLICK", tuple()) - xDataInCols = xChartDlg.getChild("RB_DATACOLS") - xDataInCols.executeAction("CLICK", tuple()) + xCancelBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xCancelBtn) - xCancelBtn = xChartDlg.getChild("finish") - self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.close_doc() def test_deselect_chart(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.fill_spreadsheet() + self.fill_spreadsheet() + + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") + xChartDlg = self.create_insert_chart_dialog(); - xChartDlg = self.create_insert_chart_dialog(); + xNextBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xNextBtn) - xNextBtn = xChartDlg.getChild("finish") - self.ui_test.close_dialog_through_button(xNextBtn) + xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) - xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + time.sleep(2) - time.sleep(2) + self.ui_test.close_doc() def test_activate_chart(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.fill_spreadsheet() + self.fill_spreadsheet() - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + xChartDlg = self.create_insert_chart_dialog(); - xChartDlg = self.create_insert_chart_dialog(); + xNextBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xNextBtn) - xNextBtn = xChartDlg.getChild("finish") - self.ui_test.close_dialog_through_button(xNextBtn) + xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) - xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + xGridWindow.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + xGridWindow.executeAction("ACTIVATE", tuple()) - xGridWindow.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) - xGridWindow.executeAction("ACTIVATE", tuple()) + xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) - xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + self.ui_test.close_doc() def select_chart_element(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.fill_spreadsheet() + self.fill_spreadsheet() - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") - xChartDlg = self.create_insert_chart_dialog(); + xChartDlg = self.create_insert_chart_dialog(); - xNextBtn = xChartDlg.getChild("finish") - self.ui_test.close_dialog_through_button(xNextBtn) + xNextBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xNextBtn) - xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) - xGridWindow.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) - xGridWindow.executeAction("ACTIVATE", tuple()) + xGridWindow.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + xGridWindow.executeAction("ACTIVATE", tuple()) - xCalcDoc = self.xUITest.getTopFocusWindow() + xCalcDoc = self.xUITest.getTopFocusWindow() + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/edit_chart.py b/sc/qa/uitest/chart/edit_chart.py index 54eaaabe43bc..d74a8c2eced3 100644 --- a/sc/qa/uitest/chart/edit_chart.py +++ b/sc/qa/uitest/chart/edit_chart.py @@ -29,39 +29,41 @@ class CalcChartEditUIDemo(UITestCase): def test_select_secondary_axis(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.fill_spreadsheet() + self.fill_spreadsheet() - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") - self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + xChartDlg = self.xUITest.getTopFocusWindow() - xChartDlg = self.xUITest.getTopFocusWindow() + xNextBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xNextBtn) - xNextBtn = xChartDlg.getChild("finish") - self.ui_test.close_dialog_through_button(xNextBtn) + xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) - xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + xGridWindow.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) - xGridWindow.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + xGridWindow.executeAction("ACTIVATE", tuple()) - xGridWindow.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") - xChartMainTop = self.xUITest.getTopFocusWindow() - xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) - xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") - self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) + xSeriesFormatDlg = self.xUITest.getTopFocusWindow() + xAxis2 = xSeriesFormatDlg.getChild("RBT_OPT_AXIS_2") + xAxis2.executeAction("CLICK", tuple()) - xSeriesFormatDlg = self.xUITest.getTopFocusWindow() - xAxis2 = xSeriesFormatDlg.getChild("RBT_OPT_AXIS_2") - xAxis2.executeAction("CLICK", tuple()) + xCancelBtn = xSeriesFormatDlg.getChild("ok") + xCancelBtn.executeAction("CLICK", tuple()) - xCancelBtn = xSeriesFormatDlg.getChild("ok") - xCancelBtn.executeAction("CLICK", tuple()) + xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) - xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/tdf107097.py b/sc/qa/uitest/chart/tdf107097.py index 65764422ae21..09db67f197cc 100644 --- a/sc/qa/uitest/chart/tdf107097.py +++ b/sc/qa/uitest/chart/tdf107097.py @@ -33,7 +33,7 @@ class tdf107097(UITestCase): self.xUITest.executeCommand(".uno:CloseDoc") - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") document = self.ui_test.get_component() diff --git a/sc/qa/uitest/chart/tdf120348.py b/sc/qa/uitest/chart/tdf120348.py index 2b6236a9f3ba..0685ab7c0f63 100644 --- a/sc/qa/uitest/chart/tdf120348.py +++ b/sc/qa/uitest/chart/tdf120348.py @@ -32,7 +32,7 @@ class tdf120348(UITestCase): self.xUITest.executeCommand(".uno:CloseDoc") - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") document = self.ui_test.get_component() diff --git a/sc/qa/uitest/chart/tdf124295.py b/sc/qa/uitest/chart/tdf124295.py index 849f7c35f78a..a3fda3f03b46 100644 --- a/sc/qa/uitest/chart/tdf124295.py +++ b/sc/qa/uitest/chart/tdf124295.py @@ -15,20 +15,22 @@ class tdf124295(UITestCase): def test_tdf124295(self): # Open spreadsheet and insert chart - with self.ui_test.create_doc_in_start_center("calc"): - self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") - xChartDlg = self.xUITest.getTopFocusWindow() + self.ui_test.create_doc_in_start_center("calc") + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + xChartDlg = self.xUITest.getTopFocusWindow() - # Click 3D look check button - x3DCheckBtn = xChartDlg.getChild("3dlook") - x3DCheckBtn.executeAction("CLICK", tuple()) + # Click 3D look check button + x3DCheckBtn = xChartDlg.getChild("3dlook") + x3DCheckBtn.executeAction("CLICK", tuple()) - x3DSchemeLstBox = xChartDlg.getChild("3dscheme") - # Without the fix in place, this test would have failed with: - # AssertionError: 'Realistic' != '' - self.assertEqual("Realistic", get_state_as_dict(x3DSchemeLstBox)["SelectEntryText"]) + x3DSchemeLstBox = xChartDlg.getChild("3dscheme") + # Without the fix in place, this test would have failed with: + # AssertionError: 'Realistic' != '' + self.assertEqual("Realistic", get_state_as_dict(x3DSchemeLstBox)["SelectEntryText"]) - xCancelBtn = xChartDlg.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + xCancelBtn = xChartDlg.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/tdf131715.py b/sc/qa/uitest/chart/tdf131715.py index 3845f076e5ba..380aac21e964 100644 --- a/sc/qa/uitest/chart/tdf131715.py +++ b/sc/qa/uitest/chart/tdf131715.py @@ -10,18 +10,19 @@ from uitest.uihelper.common import select_pos class tdf131715(UITestCase): def test_tdf131715(self): - with self.ui_test.create_doc_in_start_center("calc"): - self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") - xChartDlg = self.xUITest.getTopFocusWindow() + self.ui_test.create_doc_in_start_center("calc") + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + xChartDlg = self.xUITest.getTopFocusWindow() - xWizard = xChartDlg.getChild('Wizard') + xWizard = xChartDlg.getChild('Wizard') - for i in range(10): - #without the fix in place, it would crash here - select_pos(xWizard, "2") + for i in range(10): + #without the fix in place, it would crash here + select_pos(xWizard, "2") - self.assertEqual(get_state_as_dict(xWizard)['CurrentStep'], "2") + self.assertEqual(get_state_as_dict(xWizard)['CurrentStep'], "2") - xOkBtn = xChartDlg.getChild("finish") - self.ui_test.close_dialog_through_button(xOkBtn) + xOkBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xOkBtn) + self.ui_test.close_doc() diff --git a/sc/qa/uitest/chart/tdf136011.py b/sc/qa/uitest/chart/tdf136011.py index 96fe00f2602a..a523b8ecaa0e 100644 --- a/sc/qa/uitest/chart/tdf136011.py +++ b/sc/qa/uitest/chart/tdf136011.py @@ -38,7 +38,7 @@ class tdf136011(UITestCase): self.xUITest.executeCommand(".uno:CloseDoc") - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") document = self.ui_test.get_component() diff --git a/sc/qa/uitest/chart/tdf46885.py b/sc/qa/uitest/chart/tdf46885.py index 95e7b199854d..c629058d605b 100644 --- a/sc/qa/uitest/chart/tdf46885.py +++ b/sc/qa/uitest/chart/tdf46885.py @@ -15,38 +15,41 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf46885(UITestCase): def test_tdf46885_crash_chart_no_cell_selected_nextButton(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A10", "col1") - #When you start a new chart and have one empty cell selected LibO will crash when you select the Next>> button. - self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") - xChartDlg = self.xUITest.getTopFocusWindow() - xNextBtn = xChartDlg.getChild("next") - xNextBtn.executeAction("CLICK", tuple()) - xOkBtn = xChartDlg.getChild("finish") - self.ui_test.close_dialog_through_button(xOkBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A10", "col1") + #When you start a new chart and have one empty cell selected LibO will crash when you select the Next>> button. + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + xChartDlg = self.xUITest.getTopFocusWindow() + xNextBtn = xChartDlg.getChild("next") + xNextBtn.executeAction("CLICK", tuple()) + xOkBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xOkBtn) - #verify, we didn't crash - self.assertEqual(get_cell_by_position(document, 0, 0, 9).getString(), "col1") + #verify, we didn't crash + self.assertEqual(get_cell_by_position(document, 0, 0, 9).getString(), "col1") + + self.ui_test.close_doc() def test_tdf46885_crash_chart_multiple_empty_cells_selected(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A10", "col1") - #If you select multiple empty cells and then start a new chart LibO will crash immediately. - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C4"})) - self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") - xChartDlg = self.xUITest.getTopFocusWindow() - xNextBtn = xChartDlg.getChild("next") - xNextBtn.executeAction("CLICK", tuple()) - xOkBtn = xChartDlg.getChild("finish") - self.ui_test.close_dialog_through_button(xOkBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A10", "col1") + #If you select multiple empty cells and then start a new chart LibO will crash immediately. + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C4"})) + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + xChartDlg = self.xUITest.getTopFocusWindow() + xNextBtn = xChartDlg.getChild("next") + xNextBtn.executeAction("CLICK", tuple()) + xOkBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xOkBtn) - #verify, we didn't crash - self.assertEqual(get_cell_by_position(document, 0, 0, 9).getString(), "col1") + #verify, we didn't crash + self.assertEqual(get_cell_by_position(document, 0, 0, 9).getString(), "col1") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/tdf62057.py b/sc/qa/uitest/chart/tdf62057.py index 530f530de012..6cb1ef8cdd21 100644 --- a/sc/qa/uitest/chart/tdf62057.py +++ b/sc/qa/uitest/chart/tdf62057.py @@ -35,7 +35,7 @@ class tdf62057(UITestCase): self.xUITest.executeCommand(".uno:CloseDoc") - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") document = self.ui_test.get_component() diff --git a/sc/qa/uitest/chart/tdf98690.py b/sc/qa/uitest/chart/tdf98690.py index 8d0fd5ebd50b..f99009206bb4 100644 --- a/sc/qa/uitest/chart/tdf98690.py +++ b/sc/qa/uitest/chart/tdf98690.py @@ -21,7 +21,7 @@ class tdf98690(UITestCase): self.xUITest.executeCommand(".uno:CloseDoc") - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") document = self.ui_test.get_component() diff --git a/sc/qa/uitest/conditional_format/tdf105351.py b/sc/qa/uitest/conditional_format/tdf105351.py index 58e2d2ab3bd6..53e68a343a86 100644 --- a/sc/qa/uitest/conditional_format/tdf105351.py +++ b/sc/qa/uitest/conditional_format/tdf105351.py @@ -15,48 +15,50 @@ from uitest.debug import sleep #Bug 105351 - FORMATTING: Unable to change Data Bar conditional formatting class tdf105351(UITestCase): def test_tdf105351_cond_format_data_bar(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #2. Set the value of cell A1 to 5 - enter_text_to_cell(gridwin, "A1", "5") - #3. Select cell A1, then choose from the menus Format -> Conditional Formatting -> Data Bar - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataBarFormatDialog") - xDialog = self.xUITest.getTopFocusWindow() - xcolscalemin = xDialog.getChild("colscalemin") - xedcolscalemin = xDialog.getChild("edcolscalemin") - xcolscalemax = xDialog.getChild("colscalemax") - xedcolscalemax = xDialog.getChild("edcolscalemax") - #4. In the conditional formatting window, select the dropdown on the left that says "Automatic" - #and change it to "Value". In the text field below it enter 0. - #5. Select the dropdown on the right that says "Automatic" and change it to "Value". In the text field below it enter 10 - select_by_text(xcolscalemin, "Value") - xedcolscalemin.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #2. Set the value of cell A1 to 5 + enter_text_to_cell(gridwin, "A1", "5") + #3. Select cell A1, then choose from the menus Format -> Conditional Formatting -> Data Bar + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataBarFormatDialog") + xDialog = self.xUITest.getTopFocusWindow() + xcolscalemin = xDialog.getChild("colscalemin") + xedcolscalemin = xDialog.getChild("edcolscalemin") + xcolscalemax = xDialog.getChild("colscalemax") + xedcolscalemax = xDialog.getChild("edcolscalemax") + #4. In the conditional formatting window, select the dropdown on the left that says "Automatic" + #and change it to "Value". In the text field below it enter 0. + #5. Select the dropdown on the right that says "Automatic" and change it to "Value". In the text field below it enter 10 + select_by_text(xcolscalemin, "Value") + xedcolscalemin.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) - select_by_text(xcolscalemax, "Value") - xedcolscalemax.executeAction("TYPE", mkPropertyValues({"TEXT":"10"})) + select_by_text(xcolscalemax, "Value") + xedcolscalemax.executeAction("TYPE", mkPropertyValues({"TEXT":"10"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify : The conditions set for cell A1 should be shown and editable. - self.ui_test.execute_modeless_dialog_through_command(".uno:DataBarFormatDialog") - xDialog = self.xUITest.getTopFocusWindow() - xcolscalemin = xDialog.getChild("colscalemin") - xedcolscalemin = xDialog.getChild("edcolscalemin") - xcolscalemax = xDialog.getChild("colscalemax") - xedcolscalemax = xDialog.getChild("edcolscalemax") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify : The conditions set for cell A1 should be shown and editable. + self.ui_test.execute_modeless_dialog_through_command(".uno:DataBarFormatDialog") + xDialog = self.xUITest.getTopFocusWindow() + xcolscalemin = xDialog.getChild("colscalemin") + xedcolscalemin = xDialog.getChild("edcolscalemin") + xcolscalemax = xDialog.getChild("colscalemax") + xedcolscalemax = xDialog.getChild("edcolscalemax") - self.assertEqual(get_state_as_dict(xcolscalemin)["SelectEntryText"], "Value") - self.assertEqual(get_state_as_dict(xedcolscalemin)["Text"], "0") - self.assertEqual(get_state_as_dict(xcolscalemax)["SelectEntryText"], "Value") - self.assertEqual(get_state_as_dict(xedcolscalemax)["Text"], "10") - #editable - change value and then verify - xedcolscalemax.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - self.assertEqual(get_state_as_dict(xedcolscalemax)["Text"], "110") + self.assertEqual(get_state_as_dict(xcolscalemin)["SelectEntryText"], "Value") + self.assertEqual(get_state_as_dict(xedcolscalemin)["Text"], "0") + self.assertEqual(get_state_as_dict(xcolscalemax)["SelectEntryText"], "Value") + self.assertEqual(get_state_as_dict(xedcolscalemax)["Text"], "10") + #editable - change value and then verify + xedcolscalemax.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + self.assertEqual(get_state_as_dict(xedcolscalemax)["Text"], "110") - 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.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/conditional_format/tdf105411.py b/sc/qa/uitest/conditional_format/tdf105411.py index 6d796dbe2324..8f08c2f22fb5 100644 --- a/sc/qa/uitest/conditional_format/tdf105411.py +++ b/sc/qa/uitest/conditional_format/tdf105411.py @@ -11,23 +11,25 @@ class tdf105411(UITestCase): def test_delete_conditional_format(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.ui_test.execute_modeless_dialog_through_command(".uno:ConditionalFormatDialog") + self.ui_test.execute_modeless_dialog_through_command(".uno:ConditionalFormatDialog") - xCondFormatDlg = self.xUITest.getTopFocusWindow() + xCondFormatDlg = self.xUITest.getTopFocusWindow() - xDeleteBtn = xCondFormatDlg.getChild("delete") - xDeleteBtn.executeAction("CLICK", tuple()) + xDeleteBtn = xCondFormatDlg.getChild("delete") + xDeleteBtn.executeAction("CLICK", tuple()) - xCondFormatDlg = self.xUITest.getTopFocusWindow() + xCondFormatDlg = self.xUITest.getTopFocusWindow() - xDeleteBtn = xCondFormatDlg.getChild("add") - xDeleteBtn.executeAction("CLICK", tuple()) + xDeleteBtn = xCondFormatDlg.getChild("add") + xDeleteBtn.executeAction("CLICK", tuple()) - xCondFormatDlg = self.xUITest.getTopFocusWindow() + xCondFormatDlg = self.xUITest.getTopFocusWindow() - xOkBtn = xCondFormatDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + xOkBtn = xCondFormatDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/conditional_format/tdf105466.py b/sc/qa/uitest/conditional_format/tdf105466.py index 5165dde15335..fa7db7e49698 100644 --- a/sc/qa/uitest/conditional_format/tdf105466.py +++ b/sc/qa/uitest/conditional_format/tdf105466.py @@ -15,19 +15,21 @@ class tdf105466(UITestCase): @unittest.skip("issue with floating windows") def test_changing_conditional_format(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.ui_test.execute_modeless_dialog_through_command(".uno:ConditionalFormatDialog") + self.ui_test.execute_modeless_dialog_through_command(".uno:ConditionalFormatDialog") - for i in range(0,4): - with self.subTest(i = i): - xCondFormatDlg = self.xUITest.getTopFocusWindow() - xTypeLstBox = xCondFormatDlg.getChild("type") - xTypeLstBox.executeAction("SELECT", mkPropertyValues({"POS": str(i)})) + for i in range(0,4): + with self.subTest(i = i): + xCondFormatDlg = self.xUITest.getTopFocusWindow() + xTypeLstBox = xCondFormatDlg.getChild("type") + xTypeLstBox.executeAction("SELECT", mkPropertyValues({"POS": str(i)})) - xCondFormatDlg = self.xUITest.getTopFocusWindow() - xOkBtn = xCondFormatDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + xCondFormatDlg = self.xUITest.getTopFocusWindow() + xOkBtn = xCondFormatDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/conditional_format/tdf117899.py b/sc/qa/uitest/conditional_format/tdf117899.py index 3f6b1544c44c..bec007993e6c 100644 --- a/sc/qa/uitest/conditional_format/tdf117899.py +++ b/sc/qa/uitest/conditional_format/tdf117899.py @@ -42,23 +42,26 @@ class Tdf117899(UITestCase): with TemporaryDirectory() as tempdir: xFilePath = os.path.join(tempdir, "tdf117899-temp.ods") - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - # Paste as an OLE spreadsheet - formatProperty = mkPropertyValues({"SelectedFormat": 85}) - self.xUITest.executeCommandWithParameters(".uno:ClipboardFormatItems", formatProperty) + # Paste as an OLE spreadsheet + formatProperty = mkPropertyValues({"SelectedFormat": 85}) + self.xUITest.executeCommandWithParameters(".uno:ClipboardFormatItems", formatProperty) - # Save Copy as - self.ui_test.execute_dialog_through_command(".uno:ObjectMenue?VerbID:short=-8") - xDialog = self.xUITest.getTopFocusWindow() + # Save Copy as + self.ui_test.execute_dialog_through_command(".uno:ObjectMenue?VerbID:short=-8") + 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() with self.ui_test.load_file(systemPathToFileUrl(xFilePath)): diff --git a/sc/qa/uitest/function_wizard/function_wizard.py b/sc/qa/uitest/function_wizard/function_wizard.py index e4315e0985c7..13b83350927f 100644 --- a/sc/qa/uitest/function_wizard/function_wizard.py +++ b/sc/qa/uitest/function_wizard/function_wizard.py @@ -12,16 +12,18 @@ from uitest.framework import UITestCase class FunctionWizardTest(UITestCase): # tdf#98427 def test_open_function_wizard(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") + self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") - xFunctionDlg = self.xUITest.getTopFocusWindow() + xFunctionDlg = self.xUITest.getTopFocusWindow() - xArrayChkBox = xFunctionDlg.getChild("array") - xArrayChkBox.executeAction("CLICK", tuple()) + xArrayChkBox = xFunctionDlg.getChild("array") + xArrayChkBox.executeAction("CLICK", tuple()) - xCancelBtn = xFunctionDlg.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + xCancelBtn = xFunctionDlg.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/function_wizard/tdf132173.py b/sc/qa/uitest/function_wizard/tdf132173.py index d1c467e7a77f..d74f7dc744ca 100644 --- a/sc/qa/uitest/function_wizard/tdf132173.py +++ b/sc/qa/uitest/function_wizard/tdf132173.py @@ -11,21 +11,23 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf132173(UITestCase): def test_tdf132173(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") - xDialog = self.xUITest.getTopFocusWindow() - xFormula = xDialog.getChild("ed_formula") - xFormula.executeAction("TYPE", mkPropertyValues({"TEXT": 'FIND({"A";"B";"C"},"SAMPLE TEXT")'})) + self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") + xDialog = self.xUITest.getTopFocusWindow() + xFormula = xDialog.getChild("ed_formula") + xFormula.executeAction("TYPE", mkPropertyValues({"TEXT": 'FIND({"A";"B";"C"},"SAMPLE TEXT")'})) - self.assertEqual(get_state_as_dict(xFormula)["Text"], '=FIND({"A";"B";"C"},"SAMPLE TEXT")') + self.assertEqual(get_state_as_dict(xFormula)["Text"], '=FIND({"A";"B";"C"},"SAMPLE TEXT")') - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) - document = self.ui_test.get_component() + document = self.ui_test.get_component() - #Without the fix in place, cell's value would have been #NAME? - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "2") + #Without the fix in place, cell's value would have been #NAME? + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "2") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/hide_cols/tdf95306.py b/sc/qa/uitest/hide_cols/tdf95306.py index cb1c2195ab26..63f976849ee3 100644 --- a/sc/qa/uitest/hide_cols/tdf95306.py +++ b/sc/qa/uitest/hide_cols/tdf95306.py @@ -20,21 +20,23 @@ def get_column_hidden(doc, index): class HideDisjointColumns(UITestCase): def test_hide_columns(self): - with self.ui_test.create_doc_in_start_center("calc"): - xTopWindow = self.xUITest.getTopFocusWindow() - - gridwin = xTopWindow.getChild("grid_window") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1", "EXTEND":"true"})) - - doc = self.ui_test.get_component() - self.assertFalse(get_column_hidden(doc, 1)) - self.assertFalse(get_column_hidden(doc, 3)) - self.ui_test._xUITest.executeCommand(".uno:HideColumn") - self.assertTrue(get_column_hidden(doc, 1)) - self.assertTrue(get_column_hidden(doc, 3)) - self.ui_test._xUITest.executeCommand(".uno:Undo") - self.assertFalse(get_column_hidden(doc, 1)) - self.assertFalse(get_column_hidden(doc, 3)) + self.ui_test.create_doc_in_start_center("calc") + xTopWindow = self.xUITest.getTopFocusWindow() + + gridwin = xTopWindow.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1", "EXTEND":"true"})) + + doc = self.ui_test.get_component() + self.assertFalse(get_column_hidden(doc, 1)) + self.assertFalse(get_column_hidden(doc, 3)) + self.ui_test._xUITest.executeCommand(".uno:HideColumn") + self.assertTrue(get_column_hidden(doc, 1)) + self.assertTrue(get_column_hidden(doc, 3)) + self.ui_test._xUITest.executeCommand(".uno:Undo") + self.assertFalse(get_column_hidden(doc, 1)) + self.assertFalse(get_column_hidden(doc, 3)) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/inputLine/tdf54197.py b/sc/qa/uitest/inputLine/tdf54197.py index dabab33555d9..54f2c5f56861 100644 --- a/sc/qa/uitest/inputLine/tdf54197.py +++ b/sc/qa/uitest/inputLine/tdf54197.py @@ -18,19 +18,21 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf54197(UITestCase): def test_tdf54197_CTRL_D_input_line_change(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - # 1. go to cell A1 enter any text - enter_text_to_cell(gridwin, "A1", "t") - # 2. go to cell A2 press Ctrl+D - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) - self.xUITest.executeCommand(".uno:FillDown") - # The same text as above is displayed at cell A2, BUT input line is still blank - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "t") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "t") - xInputWin = xCalcDoc.getChild("sc_input_window") - self.assertEqual(get_state_as_dict(xInputWin)["Text"], "t") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + # 1. go to cell A1 enter any text + enter_text_to_cell(gridwin, "A1", "t") + # 2. go to cell A2 press Ctrl+D + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + self.xUITest.executeCommand(".uno:FillDown") + # The same text as above is displayed at cell A2, BUT input line is still blank + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "t") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "t") + xInputWin = xCalcDoc.getChild("sc_input_window") + self.assertEqual(get_state_as_dict(xInputWin)["Text"], "t") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/inputLine/tdf67346.py b/sc/qa/uitest/inputLine/tdf67346.py index fa7dbca3e653..324d8ca6384c 100644 --- a/sc/qa/uitest/inputLine/tdf67346.py +++ b/sc/qa/uitest/inputLine/tdf67346.py @@ -18,26 +18,28 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf67346(UITestCase): def test_tdf67346_undo_paste_text_input_line(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - # type 'Apple' in A1 - enter_text_to_cell(gridwin, "A1", "Apple") - # input line: copy the text from there - xInputWin = xCalcDoc.getChild("sc_input_window") - xInputWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - self.xUITest.executeCommand(".uno:Copy") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) - # Ctrl-V - self.xUITest.executeCommand(".uno:Paste") - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Apple") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Apple") - self.assertEqual(get_state_as_dict(xInputWin)["Text"], "Apple") - #Ctrl-Z - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Apple") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "") - self.assertEqual(get_state_as_dict(xInputWin)["Text"], "") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + # type 'Apple' in A1 + enter_text_to_cell(gridwin, "A1", "Apple") + # input line: copy the text from there + xInputWin = xCalcDoc.getChild("sc_input_window") + xInputWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + # Ctrl-V + self.xUITest.executeCommand(".uno:Paste") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Apple") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Apple") + self.assertEqual(get_state_as_dict(xInputWin)["Text"], "Apple") + #Ctrl-Z + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Apple") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "") + self.assertEqual(get_state_as_dict(xInputWin)["Text"], "") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/key_f4/f4.py b/sc/qa/uitest/key_f4/f4.py index fb40fe4ec631..ede0b2fdef9c 100644 --- a/sc/qa/uitest/key_f4/f4.py +++ b/sc/qa/uitest/key_f4/f4.py @@ -15,118 +15,121 @@ from uitest.uihelper.calc import enter_text_to_cell class keyF4(UITestCase): def test_f4(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #enter data - enter_text_to_cell(gridwin, "A1", "1") - enter_text_to_cell(gridwin, "A2", "2") - enter_text_to_cell(gridwin, "A3", "3") - enter_text_to_cell(gridwin, "B1", "=A1") - enter_text_to_cell(gridwin, "B2", "=A2") - enter_text_to_cell(gridwin, "B3", "=A3") - #select B1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) - #F4 - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) - #verify - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 1) - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getFormula(), "=$A$1") - #F4 - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) - #verify - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 1) - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getFormula(), "=A$1") - #F4 - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) - #verify - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 1) - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getFormula(), "=$A1") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #enter data + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "2") + enter_text_to_cell(gridwin, "A3", "3") + enter_text_to_cell(gridwin, "B1", "=A1") + enter_text_to_cell(gridwin, "B2", "=A2") + enter_text_to_cell(gridwin, "B3", "=A3") + #select B1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + #F4 + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) + #verify + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getFormula(), "=$A$1") + #F4 + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) + #verify + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getFormula(), "=A$1") + #F4 + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) + #verify + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getFormula(), "=$A1") - #non continuous select - #enter data - enter_text_to_cell(gridwin, "C1", "=A1") - enter_text_to_cell(gridwin, "C2", "=A2") - enter_text_to_cell(gridwin, "C3", "=A3") + #non continuous select + #enter data + enter_text_to_cell(gridwin, "C1", "=A1") + enter_text_to_cell(gridwin, "C2", "=A2") + enter_text_to_cell(gridwin, "C3", "=A3") - #select C1 and C3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C3", "EXTEND":"1"})) - #F4 - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) - #verify - self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 1) - self.assertEqual(get_cell_by_position(document, 0, 2, 0).getFormula(), "=$A$1") - self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3) - self.assertEqual(get_cell_by_position(document, 0, 2, 2).getFormula(), "=$A$3") - #F4 - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) - #verify - self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 1) - self.assertEqual(get_cell_by_position(document, 0, 2, 0).getFormula(), "=A$1") - self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3) - self.assertEqual(get_cell_by_position(document, 0, 2, 2).getFormula(), "=A$3") - #F4 - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) - #verify - self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 1) - self.assertEqual(get_cell_by_position(document, 0, 2, 0).getFormula(), "=$A1") - self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3) - self.assertEqual(get_cell_by_position(document, 0, 2, 2).getFormula(), "=$A3") + #select C1 and C3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C3", "EXTEND":"1"})) + #F4 + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) + #verify + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getFormula(), "=$A$1") + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getFormula(), "=$A$3") + #F4 + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) + #verify + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getFormula(), "=A$1") + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getFormula(), "=A$3") + #F4 + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) + #verify + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getFormula(), "=$A1") + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getFormula(), "=$A3") + + self.ui_test.close_doc() def test_tdf39650_F4_R1C1(self): #Bug 39650 - Shift+F4 conversion from relative to absolute does not work for R1C1 syntax - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #* Tools --> Options --> Calc --> Formula --> Syntax = Excel R1C1 - self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog - xDialogOpt = self.xUITest.getTopFocusWindow() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #* Tools --> Options --> Calc --> Formula --> Syntax = Excel R1C1 + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialogOpt = self.xUITest.getTopFocusWindow() - xPages = xDialogOpt.getChild("pages") - xCalcEntry = xPages.getChild('3') # Calc - xCalcEntry.executeAction("EXPAND", tuple()) - xCalcFormulaEntry = xCalcEntry.getChild('4') - xCalcFormulaEntry.executeAction("SELECT", tuple()) #Formula + xPages = xDialogOpt.getChild("pages") + xCalcEntry = xPages.getChild('3') # Calc + xCalcEntry.executeAction("EXPAND", tuple()) + xCalcFormulaEntry = xCalcEntry.getChild('4') + xCalcFormulaEntry.executeAction("SELECT", tuple()) #Formula - formulasyntax = xDialogOpt.getChild("formulasyntax") - #Excel R1C1 - select_by_text(formulasyntax, "Excel R1C1") + formulasyntax = xDialogOpt.getChild("formulasyntax") + #Excel R1C1 + select_by_text(formulasyntax, "Excel R1C1") - xOKBtn = xDialogOpt.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - #In cell R3C3 enter "xxx". - enter_text_to_cell(gridwin, "C3", "xxx") - # In cell R2C2 type = and then click on the xxx in R3C3. - enter_text_to_cell(gridwin, "B2", "=R[1]C[1]") - # With cell R2C2 still selected, type Shift-F4. - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) + #In cell R3C3 enter "xxx". + enter_text_to_cell(gridwin, "C3", "xxx") + # In cell R2C2 type = and then click on the xxx in R3C3. + enter_text_to_cell(gridwin, "B2", "=R[1]C[1]") + # With cell R2C2 still selected, type Shift-F4. + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) - #F4 - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) + #F4 + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) - #This should change the formula in R2C2 from =R[1]C[1] to =R3C3. - self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "xxx") - enter_text_to_cell(gridwin, "A1", "=FORMULA(R[1]C[1])") - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "=R3C3") + #This should change the formula in R2C2 from =R[1]C[1] to =R3C3. + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "xxx") + enter_text_to_cell(gridwin, "A1", "=FORMULA(R[1]C[1])") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "=R3C3") - #Give it back Tools --> Options --> Calc --> Formula --> Syntax = Calc A1 - self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog - xDialogOpt = self.xUITest.getTopFocusWindow() + #Give it back Tools --> Options --> Calc --> Formula --> Syntax = Calc A1 + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialogOpt = self.xUITest.getTopFocusWindow() - xPages = xDialogOpt.getChild("pages") - xCalcEntry = xPages.getChild('3') # Calc - xCalcEntry.executeAction("EXPAND", tuple()) - xCalcFormulaEntry = xCalcEntry.getChild('4') - xCalcFormulaEntry.executeAction("SELECT", tuple()) #Formula + xPages = xDialogOpt.getChild("pages") + xCalcEntry = xPages.getChild('3') # Calc + xCalcEntry.executeAction("EXPAND", tuple()) + xCalcFormulaEntry = xCalcEntry.getChild('4') + xCalcFormulaEntry.executeAction("SELECT", tuple()) #Formula - formulasyntax = xDialogOpt.getChild("formulasyntax") - #Excel R1C1 - select_by_text(formulasyntax, "Calc A1") + formulasyntax = xDialogOpt.getChild("formulasyntax") + #Excel R1C1 + select_by_text(formulasyntax, "Calc A1") - xOKBtn = xDialogOpt.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/manual_tests/calc.py b/sc/qa/uitest/manual_tests/calc.py index 506e2b8000ac..247f7028e2ae 100644 --- a/sc/qa/uitest/manual_tests/calc.py +++ b/sc/qa/uitest/manual_tests/calc.py @@ -16,147 +16,155 @@ class ManualCalcTests(UITestCase): # http://manual-test.libreoffice.org/manage/case/189/ def test_define_database_range(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - # Select range A1:D10 - xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") - xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D10"})) + # Select range A1:D10 + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D10"})) + + # Execute "Define DB Range dialog" + self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") - # Execute "Define DB Range dialog" - self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") + xDefineNameDlg = self.xUITest.getTopFocusWindow() - xDefineNameDlg = self.xUITest.getTopFocusWindow() + xEntryBox = xDefineNameDlg.getChild("entry") + type_text(xEntryBox, "my_database") - xEntryBox = xDefineNameDlg.getChild("entry") - type_text(xEntryBox, "my_database") + xOkBtn = xDefineNameDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) - xOkBtn = xDefineNameDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + # Deselect range + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - # Deselect range - xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + # Execute "Select DB Range dialog" + self.ui_test.execute_dialog_through_command(".uno:SelectDB") + xSelectNameDlg = self.xUITest.getTopFocusWindow() - # Execute "Select DB Range dialog" - self.ui_test.execute_dialog_through_command(".uno:SelectDB") - xSelectNameDlg = self.xUITest.getTopFocusWindow() + xListBox = xSelectNameDlg.getChild("treeview") + xListBoxState = get_state_as_dict(xListBox) + self.assertEqual(xListBoxState["SelectionCount"], "1") + self.assertEqual(xListBoxState["SelectEntryText"], "my_database") - xListBox = xSelectNameDlg.getChild("treeview") - xListBoxState = get_state_as_dict(xListBox) - self.assertEqual(xListBoxState["SelectionCount"], "1") - self.assertEqual(xListBoxState["SelectEntryText"], "my_database") + xOkBtn = xSelectNameDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) - xOkBtn = xSelectNameDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + # Assert that the correct range has been selected + gridWinState = get_state_as_dict(xGridWin) + self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A1:Sheet1.D10") - # Assert that the correct range has been selected - gridWinState = get_state_as_dict(xGridWin) - self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A1:Sheet1.D10") + self.ui_test.close_doc() # http://manual-test.libreoffice.org/manage/case/190/ def test_sort_data(self): - with self.ui_test.create_doc_in_start_center("calc"): - - # Insert data - xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") - enter_text_to_cell(xGridWin, "B1", "3") - enter_text_to_cell(xGridWin, "B2", "25") - enter_text_to_cell(xGridWin, "B3", "17") - enter_text_to_cell(xGridWin, "B4", "9") - enter_text_to_cell(xGridWin, "B5", "19") - enter_text_to_cell(xGridWin, "B6", "0") - enter_text_to_cell(xGridWin, "B7", "107") - enter_text_to_cell(xGridWin, "B8", "89") - enter_text_to_cell(xGridWin, "B9", "8") - enter_text_to_cell(xGridWin, "B10", "33") - - xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B10"})) - - # Execute "Sort" dialog - self.ui_test.execute_dialog_through_command(".uno:DataSort") - xSortDlg = self.xUITest.getTopFocusWindow() - - xOkBtn = xSortDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) - - document = self.ui_test.get_component() - - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 3) - self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 8) - self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 9) - self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 17) - self.assertEqual(get_cell_by_position(document, 0, 1, 5).getValue(), 19) - self.assertEqual(get_cell_by_position(document, 0, 1, 6).getValue(), 25) - self.assertEqual(get_cell_by_position(document, 0, 1, 7).getValue(), 33) - self.assertEqual(get_cell_by_position(document, 0, 1, 8).getValue(), 89) - self.assertEqual(get_cell_by_position(document, 0, 1, 9).getValue(), 107) + self.ui_test.create_doc_in_start_center("calc") + + # Insert data + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + enter_text_to_cell(xGridWin, "B1", "3") + enter_text_to_cell(xGridWin, "B2", "25") + enter_text_to_cell(xGridWin, "B3", "17") + enter_text_to_cell(xGridWin, "B4", "9") + enter_text_to_cell(xGridWin, "B5", "19") + enter_text_to_cell(xGridWin, "B6", "0") + enter_text_to_cell(xGridWin, "B7", "107") + enter_text_to_cell(xGridWin, "B8", "89") + enter_text_to_cell(xGridWin, "B9", "8") + enter_text_to_cell(xGridWin, "B10", "33") + + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B10"})) + + # Execute "Sort" dialog + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xSortDlg = self.xUITest.getTopFocusWindow() + + xOkBtn = xSortDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + document = self.ui_test.get_component() + + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 8) + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 9) + self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 17) + self.assertEqual(get_cell_by_position(document, 0, 1, 5).getValue(), 19) + self.assertEqual(get_cell_by_position(document, 0, 1, 6).getValue(), 25) + self.assertEqual(get_cell_by_position(document, 0, 1, 7).getValue(), 33) + self.assertEqual(get_cell_by_position(document, 0, 1, 8).getValue(), 89) + self.assertEqual(get_cell_by_position(document, 0, 1, 9).getValue(), 107) + + self.ui_test.close_doc() # http://manual-test.libreoffice.org/manage/case/191/ def test_validation(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") - xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C10"})) + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C10"})) + + self.ui_test.execute_dialog_through_command(".uno:Validation") + xValidationDlg = self.xUITest.getTopFocusWindow() - self.ui_test.execute_dialog_through_command(".uno:Validation") - xValidationDlg = self.xUITest.getTopFocusWindow() + xAllowList = xValidationDlg.getChild("allow") + xAllowList.executeAction("SELECT", mkPropertyValues({"POS": "1"})) - xAllowList = xValidationDlg.getChild("allow") - xAllowList.executeAction("SELECT", mkPropertyValues({"POS": "1"})) + xData = xValidationDlg.getChild("data") + xData.executeAction("SELECT", mkPropertyValues({"POS": "5"})) - xData = xValidationDlg.getChild("data") - xData.executeAction("SELECT", mkPropertyValues({"POS": "5"})) + xVal = xValidationDlg.getChild("max") + xVal.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) - xVal = xValidationDlg.getChild("max") - xVal.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) + xOkBtn = xValidationDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) - xOkBtn = xValidationDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + def enter_text(cell, text): + enter_text_to_cell(xGridWin, cell, text) - def enter_text(cell, text): - enter_text_to_cell(xGridWin, cell, text) + with self.ui_test.execute_blocking_action(enter_text, args=("A1", "abc")): + pass + with self.ui_test.execute_blocking_action(enter_text, args=("B6", "2.18")): + pass - with self.ui_test.execute_blocking_action(enter_text, args=("A1", "abc")): - pass - with self.ui_test.execute_blocking_action(enter_text, args=("B6", "2.18")): - pass + enter_text_to_cell(xGridWin, "C2", "24") - enter_text_to_cell(xGridWin, "C2", "24") + self.ui_test.close_doc() # http://manual-test.libreoffice.org/manage/case/187/ def test_transpose(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") - enter_text_to_cell(xGridWin, "B3", "abcd") - enter_text_to_cell(xGridWin, "B4", "edfg") - enter_text_to_cell(xGridWin, "C3", "35") - enter_text_to_cell(xGridWin, "C4", "5678") + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + enter_text_to_cell(xGridWin, "B3", "abcd") + enter_text_to_cell(xGridWin, "B4", "edfg") + enter_text_to_cell(xGridWin, "C3", "35") + enter_text_to_cell(xGridWin, "C4", "5678") - xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C10"})) + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C10"})) - self.xUITest.executeCommand(".uno:Cut") + self.xUITest.executeCommand(".uno:Cut") + + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") - self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + xPasteSpecialDlg = self.xUITest.getTopFocusWindow() - xPasteSpecialDlg = self.xUITest.getTopFocusWindow() + xAllChkBox = xPasteSpecialDlg.getChild("paste_all") + xAllChkBox.executeAction("CLICK", tuple()) - xAllChkBox = xPasteSpecialDlg.getChild("paste_all") - xAllChkBox.executeAction("CLICK", tuple()) + xTransposeChkBox = xPasteSpecialDlg.getChild("transpose") + xTransposeChkBox.executeAction("CLICK", tuple()) - xTransposeChkBox = xPasteSpecialDlg.getChild("transpose") - xTransposeChkBox.executeAction("CLICK", tuple()) + xOkBtn = xPasteSpecialDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) - xOkBtn = xPasteSpecialDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + document = self.ui_test.get_component() + self.assertEqual(get_cell_by_position(document, 0, 2, 1).getString(), "abcd") + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 35) + self.assertEqual(get_cell_by_position(document, 0, 3, 1).getString(), "edfg") + self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 5678) - document = self.ui_test.get_component() - self.assertEqual(get_cell_by_position(document, 0, 2, 1).getString(), "abcd") - self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 35) - self.assertEqual(get_cell_by_position(document, 0, 3, 1).getString(), "edfg") - self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 5678) + self.ui_test.close_doc() # http://manual-test.libreoffice.org/manage/case/151/ def test_cell_recalc(self): @@ -177,39 +185,41 @@ class ManualCalcTests(UITestCase): # http://manual-test.libreoffice.org/manage/case/143/ def test_random_numbers(self): - with self.ui_test.create_doc_in_start_center("calc"): - xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + self.ui_test.create_doc_in_start_center("calc") + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A10"})) - xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A10"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") + xRandomNumberDlg = self.xUITest.getTopFocusWindow() + xDistributionLstBox = xRandomNumberDlg.getChild("distribution-combo") + xDistributionLstBox.executeAction("SELECT", mkPropertyValues({"POS": "1"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") - xRandomNumberDlg = self.xUITest.getTopFocusWindow() - xDistributionLstBox = xRandomNumberDlg.getChild("distribution-combo") - xDistributionLstBox.executeAction("SELECT", mkPropertyValues({"POS": "1"})) + xMin = xRandomNumberDlg.getChild("parameter1-spin") + xMin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) + xMin.executeAction("TYPE", mkPropertyValues({"TEXT": "-2"})) + xMax = xRandomNumberDlg.getChild("parameter2-spin") + xMax.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) + xMax.executeAction("TYPE", mkPropertyValues({"TEXT": "10"})) - xMin = xRandomNumberDlg.getChild("parameter1-spin") - xMin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) - xMin.executeAction("TYPE", mkPropertyValues({"TEXT": "-2"})) - xMax = xRandomNumberDlg.getChild("parameter2-spin") - xMax.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) - xMax.executeAction("TYPE", mkPropertyValues({"TEXT": "10"})) + xApplyBtn = xRandomNumberDlg.getChild("apply") + xApplyBtn.executeAction("CLICK", tuple()) - xApplyBtn = xRandomNumberDlg.getChild("apply") - xApplyBtn.executeAction("CLICK", tuple()) + doc = self.ui_test.get_component() - doc = self.ui_test.get_component() + def check_random_values(): + for i in range(1, 9): + val = get_cell_by_position(doc, 0, 0, i).getValue() + self.assertTrue(val <= 10 and val >= -2) - def check_random_values(): - for i in range(1, 9): - val = get_cell_by_position(doc, 0, 0, i).getValue() - self.assertTrue(val <= 10 and val >= -2) + check_random_values() - check_random_values() + xOkBtn = xRandomNumberDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) - xOkBtn = xRandomNumberDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + # we might want to check that clicking 'ok' actually changes the values + check_random_values() - # we might want to check that clicking 'ok' actually changes the values - check_random_values() + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/manual_tests/more_calc.py b/sc/qa/uitest/manual_tests/more_calc.py index bc389be56a0d..08aeb654e449 100644 --- a/sc/qa/uitest/manual_tests/more_calc.py +++ b/sc/qa/uitest/manual_tests/more_calc.py @@ -21,31 +21,32 @@ class ManualCalcTests(UITestCase): # This test is to check that paste special combined with some options and link is ok. # Refers to tdf#84810 - with self.ui_test.create_doc_in_start_center("calc"): - - # Write text to cell A1 - xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") - enter_text_to_cell(xGridWin, "A1", "abcd") - - # Copy cell A1 to clipboard - xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.xUITest.executeCommand(".uno:Copy") - - # Set cursor to cell A3 - xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - - # Choose Paste Special Options and paste data - self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") - xPasteSpecialDlg = self.xUITest.getTopFocusWindow() - xAllChkBox = xPasteSpecialDlg.getChild("paste_all") - xAllChkBox.executeAction("CLICK", tuple()) - xLinkChkBox = xPasteSpecialDlg.getChild("link") - xLinkChkBox.executeAction("CLICK", tuple()) - xOkBtn = xPasteSpecialDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) - - # Assert successful paste - document = self.ui_test.get_component() - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "abcd") + self.ui_test.create_doc_in_start_center("calc") + + # Write text to cell A1 + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + enter_text_to_cell(xGridWin, "A1", "abcd") + + # Copy cell A1 to clipboard + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:Copy") + + # Set cursor to cell A3 + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + + # Choose Paste Special Options and paste data + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + xPasteSpecialDlg = self.xUITest.getTopFocusWindow() + xAllChkBox = xPasteSpecialDlg.getChild("paste_all") + xAllChkBox.executeAction("CLICK", tuple()) + xLinkChkBox = xPasteSpecialDlg.getChild("link") + xLinkChkBox.executeAction("CLICK", tuple()) + xOkBtn = xPasteSpecialDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + # Assert successful paste + document = self.ui_test.get_component() + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "abcd") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/options/tdf122977.py b/sc/qa/uitest/options/tdf122977.py index 417427ad8928..b81adbc2616a 100644 --- a/sc/qa/uitest/options/tdf122977.py +++ b/sc/qa/uitest/options/tdf122977.py @@ -15,45 +15,47 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class chartDefaultColors(UITestCase): def test_tdf122977_crash_chart_default_colors_options(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - #Go to Tools -> Options -> Charts -> Default Colors - self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog - xDialogOpt = self.xUITest.getTopFocusWindow() - - xPages = xDialogOpt.getChild("pages") - xChartEntry = xPages.getChild('5') # Charts - xChartEntry.executeAction("EXPAND", tuple()) - xChartGeneralEntry = xChartEntry.getChild('0') - xChartGeneralEntry.executeAction("SELECT", tuple()) #Default Colors - xColors = xDialogOpt.getChild("colors") - xAdd = xDialogOpt.getChild("add") - xDelete = xDialogOpt.getChild("delete") - xDefault = xDialogOpt.getChild("default") - - #click Default - reset - xDefault.executeAction("CLICK", tuple()) - nrDefaultColors = get_state_as_dict(xColors)["Children"] - nrDefaultColors1 = int(nrDefaultColors) + 1 - xAdd.executeAction("CLICK", tuple()) #add new color - self.assertEqual(get_state_as_dict(xColors)["Children"], str(nrDefaultColors1)) - - #delete new color - with self.ui_test.execute_blocking_action(xDelete.executeAction, args=('CLICK', ()), close_button="yes"): - pass - - self.assertEqual(get_state_as_dict(xColors)["Children"], nrDefaultColors) - - xAdd.executeAction("CLICK", tuple()) #add new color - self.assertEqual(get_state_as_dict(xColors)["Children"], str(nrDefaultColors1)) - #click Default - xDefault.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(xColors)["Children"], nrDefaultColors) - - xCancelBtn = xDialogOpt.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #Go to Tools -> Options -> Charts -> Default Colors + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialogOpt = self.xUITest.getTopFocusWindow() + + xPages = xDialogOpt.getChild("pages") + xChartEntry = xPages.getChild('5') # Charts + xChartEntry.executeAction("EXPAND", tuple()) + xChartGeneralEntry = xChartEntry.getChild('0') + xChartGeneralEntry.executeAction("SELECT", tuple()) #Default Colors + xColors = xDialogOpt.getChild("colors") + xAdd = xDialogOpt.getChild("add") + xDelete = xDialogOpt.getChild("delete") + xDefault = xDialogOpt.getChild("default") + + #click Default - reset + xDefault.executeAction("CLICK", tuple()) + nrDefaultColors = get_state_as_dict(xColors)["Children"] + nrDefaultColors1 = int(nrDefaultColors) + 1 + xAdd.executeAction("CLICK", tuple()) #add new color + self.assertEqual(get_state_as_dict(xColors)["Children"], str(nrDefaultColors1)) + + #delete new color + with self.ui_test.execute_blocking_action(xDelete.executeAction, args=('CLICK', ()), close_button="yes"): + pass + + self.assertEqual(get_state_as_dict(xColors)["Children"], nrDefaultColors) + + xAdd.executeAction("CLICK", tuple()) #add new color + self.assertEqual(get_state_as_dict(xColors)["Children"], str(nrDefaultColors1)) + #click Default + xDefault.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xColors)["Children"], nrDefaultColors) + + xCancelBtn = xDialogOpt.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/protect/protectSheet.py b/sc/qa/uitest/protect/protectSheet.py index 4f24e9e68fca..90030b5322e7 100644 --- a/sc/qa/uitest/protect/protectSheet.py +++ b/sc/qa/uitest/protect/protectSheet.py @@ -16,45 +16,47 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class protectSheet(UITestCase): def test_protect_sheet(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #enter password - lock - self.ui_test.execute_dialog_through_command(".uno:Protect") - xDialog = self.xUITest.getTopFocusWindow() - xprotect = xDialog.getChild("protect") - xpassword1 = xDialog.getChild("password1") - xpassword2 = xDialog.getChild("password2") - - if (get_state_as_dict(xprotect)["Selected"]) == "false": - xprotect.executeAction("CLICK", tuple()) - xpassword1.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) - xpassword2.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) - - xOKBtn = xDialog.getChild("ok") - # self.ui_test.close_dialog_through_button(xOKBtn) - xOKBtn.executeAction("CLICK", tuple()) - #Unlock - - self.ui_test.execute_dialog_through_command(".uno:Protect") - xDialog = self.xUITest.getTopFocusWindow() - xpass1ed = xDialog.getChild("pass1ed") - - xpass1ed.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - the sheet is unlocked - enter_text_to_cell(gridwin, "B2", "A") - self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "A") - - # test cancel button - self.ui_test.execute_dialog_through_command(".uno:Protect") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - enter_text_to_cell(gridwin, "B2", "B") - self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "B") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #enter password - lock + self.ui_test.execute_dialog_through_command(".uno:Protect") + xDialog = self.xUITest.getTopFocusWindow() + xprotect = xDialog.getChild("protect") + xpassword1 = xDialog.getChild("password1") + xpassword2 = xDialog.getChild("password2") + + if (get_state_as_dict(xprotect)["Selected"]) == "false": + xprotect.executeAction("CLICK", tuple()) + xpassword1.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) + xpassword2.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) + + xOKBtn = xDialog.getChild("ok") +# self.ui_test.close_dialog_through_button(xOKBtn) + xOKBtn.executeAction("CLICK", tuple()) + #Unlock + + self.ui_test.execute_dialog_through_command(".uno:Protect") + xDialog = self.xUITest.getTopFocusWindow() + xpass1ed = xDialog.getChild("pass1ed") + + xpass1ed.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify - the sheet is unlocked + enter_text_to_cell(gridwin, "B2", "A") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "A") + + # test cancel button + self.ui_test.execute_dialog_through_command(".uno:Protect") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + enter_text_to_cell(gridwin, "B2", "B") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "B") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/protect/protectSpreadsheet.py b/sc/qa/uitest/protect/protectSpreadsheet.py index 7aa53f19fbc8..c0b78943fa05 100644 --- a/sc/qa/uitest/protect/protectSpreadsheet.py +++ b/sc/qa/uitest/protect/protectSpreadsheet.py @@ -16,29 +16,31 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class protectSpreadsheet(UITestCase): def test_protect_spreadsheet(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #enter password - self.ui_test.execute_dialog_through_command(".uno:ToolProtectionDocument") - xDialog = self.xUITest.getTopFocusWindow() - xpass1ed = xDialog.getChild("pass1ed") - xconfirm1ed = xDialog.getChild("confirm1ed") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #enter password + self.ui_test.execute_dialog_through_command(".uno:ToolProtectionDocument") + xDialog = self.xUITest.getTopFocusWindow() + xpass1ed = xDialog.getChild("pass1ed") + xconfirm1ed = xDialog.getChild("confirm1ed") - xpass1ed.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) - xconfirm1ed.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) + xpass1ed.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) + xconfirm1ed.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.ui_test.execute_dialog_through_command(".uno:ToolProtectionDocument") - xDialog = self.xUITest.getTopFocusWindow() - xpass1ed = xDialog.getChild("pass1ed") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.ui_test.execute_dialog_through_command(".uno:ToolProtectionDocument") + xDialog = self.xUITest.getTopFocusWindow() + xpass1ed = xDialog.getChild("pass1ed") - xpass1ed.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) + xpass1ed.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/range_name/create_range_name.py b/sc/qa/uitest/range_name/create_range_name.py index 135df5153312..989532bf5643 100644 --- a/sc/qa/uitest/range_name/create_range_name.py +++ b/sc/qa/uitest/range_name/create_range_name.py @@ -17,165 +17,171 @@ class CreateRangeNameTest(UITestCase): def test_create_range_name(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - calcDoc = self.xUITest.getTopFocusWindow() - xPosWindow = calcDoc.getChild('pos_window') - self.assertEqual('A1', get_state_as_dict(xPosWindow)['Text']) + calcDoc = self.xUITest.getTopFocusWindow() + xPosWindow = calcDoc.getChild('pos_window') + self.assertEqual('A1', get_state_as_dict(xPosWindow)['Text']) - self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") + self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") - xAddNameDlg = self.xUITest.getTopFocusWindow() + xAddNameDlg = self.xUITest.getTopFocusWindow() - xEdit = xAddNameDlg.getChild("edit") - type_text(xEdit, "globalRangeName") + xEdit = xAddNameDlg.getChild("edit") + type_text(xEdit, "globalRangeName") - xAddBtn = xAddNameDlg.getChild("add") - self.ui_test.close_dialog_through_button(xAddBtn) + xAddBtn = xAddNameDlg.getChild("add") + self.ui_test.close_dialog_through_button(xAddBtn) - self.assertEqual('globalRangeName', get_state_as_dict(xPosWindow)['Text']) + self.assertEqual('globalRangeName', get_state_as_dict(xPosWindow)['Text']) + + self.ui_test.close_doc() def test_create_range_name_from_ui(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") + + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") - calcDoc = self.xUITest.getTopFocusWindow() - gridwin = calcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "B1", "1") + enter_text_to_cell(gridwin, "C1", "1") - enter_text_to_cell(gridwin, "A1", "1") - enter_text_to_cell(gridwin, "B1", "1") - enter_text_to_cell(gridwin, "C1", "1") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C1"})) + xPosWindow = calcDoc.getChild('pos_window') + self.assertEqual('A1:C1', get_state_as_dict(xPosWindow)['Text']) - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C1"})) - xPosWindow = calcDoc.getChild('pos_window') - self.assertEqual('A1:C1', get_state_as_dict(xPosWindow)['Text']) + xPosWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xPosWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xPosWindow.executeAction("TYPE", mkPropertyValues({"TEXT":"RANGE1"})) + xPosWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) - xPosWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xPosWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xPosWindow.executeAction("TYPE", mkPropertyValues({"TEXT":"RANGE1"})) - xPosWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + self.assertEqual('RANGE1', get_state_as_dict(xPosWindow)['Text']) - self.assertEqual('RANGE1', get_state_as_dict(xPosWindow)['Text']) + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") - calcDoc = self.xUITest.getTopFocusWindow() - gridwin = calcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A2", "=SUM(RANGE1)") + self.assertEqual(3.0, get_cell_by_position(document, 0, 0, 1).getValue()) - document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A2", "=SUM(RANGE1)") - self.assertEqual(3.0, get_cell_by_position(document, 0, 0, 1).getValue()) + # Change the name + self.ui_test.execute_dialog_through_command(".uno:DefineName") + xDialog = self.xUITest.getTopFocusWindow() + xNamesList = xDialog.getChild('names') + self.assertEqual(1, len(xNamesList.getChildren())) - # Change the name - self.ui_test.execute_dialog_through_command(".uno:DefineName") - xDialog = self.xUITest.getTopFocusWindow() - xNamesList = xDialog.getChild('names') - self.assertEqual(1, len(xNamesList.getChildren())) + xName = xDialog.getChild('name') + self.assertEqual( 'RANGE1', get_state_as_dict(xName)["Text"]) - xName = xDialog.getChild('name') - self.assertEqual( 'RANGE1', get_state_as_dict(xName)["Text"]) + xName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xName.executeAction("TYPE", mkPropertyValues({"TEXT":"RANGE2"})) - xName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xName.executeAction("TYPE", mkPropertyValues({"TEXT":"RANGE2"})) + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + # tdf#87474 check the formula is updated after changing the name + self.assertEqual("=SUM(RANGE2)", get_cell_by_position(document, 0, 0, 1).getFormula()) - # tdf#87474 check the formula is updated after changing the name - self.assertEqual("=SUM(RANGE2)", get_cell_by_position(document, 0, 0, 1).getFormula()) + self.xUITest.executeCommand(".uno:Undo") - self.xUITest.executeCommand(".uno:Undo") + self.assertEqual("=SUM(RANGE1)", get_cell_by_position(document, 0, 0, 1).getFormula()) - self.assertEqual("=SUM(RANGE1)", get_cell_by_position(document, 0, 0, 1).getFormula()) + self.ui_test.close_doc() def test_create_local_range_name(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") + + calcDoc = self.xUITest.getTopFocusWindow() + xPosWindow = calcDoc.getChild('pos_window') + self.assertEqual('A1', get_state_as_dict(xPosWindow)['Text']) - calcDoc = self.xUITest.getTopFocusWindow() - xPosWindow = calcDoc.getChild('pos_window') - self.assertEqual('A1', get_state_as_dict(xPosWindow)['Text']) + self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") - self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") + xAddNameDlg = self.xUITest.getTopFocusWindow() - xAddNameDlg = self.xUITest.getTopFocusWindow() + xEdit = xAddNameDlg.getChild("edit") + type_text(xEdit, "localRangeName") - xEdit = xAddNameDlg.getChild("edit") - type_text(xEdit, "localRangeName") + xScope = xAddNameDlg.getChild("scope") + select_pos(xScope, "1") - xScope = xAddNameDlg.getChild("scope") - select_pos(xScope, "1") + xAddBtn = xAddNameDlg.getChild("add") + self.ui_test.close_dialog_through_button(xAddBtn) - xAddBtn = xAddNameDlg.getChild("add") - self.ui_test.close_dialog_through_button(xAddBtn) + # tdf#67007: Without the fix in place, this test would have failed with + # AssertionError: 'localRangeName' != 'A1' + # Additionally, newly check a sheet-local scoped name has " (sheetname)" appended. + self.assertEqual('localRangeName (Sheet1)', get_state_as_dict(xPosWindow)['Text']) - # tdf#67007: Without the fix in place, this test would have failed with - # AssertionError: 'localRangeName' != 'A1' - # Additionally, newly check a sheet-local scoped name has " (sheetname)" appended. - self.assertEqual('localRangeName (Sheet1)', get_state_as_dict(xPosWindow)['Text']) + gridwin = calcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A1", "1") - gridwin = calcDoc.getChild("grid_window") - enter_text_to_cell(gridwin, "A1", "1") + # Use the name range in the current sheet + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) - # Use the name range in the current sheet - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + self.ui_test.execute_dialog_through_command(".uno:InsertName") + xDialog = self.xUITest.getTopFocusWindow() - self.ui_test.execute_dialog_through_command(".uno:InsertName") - xDialog = self.xUITest.getTopFocusWindow() + xCtrl = xDialog.getChild('ctrl') + self.assertEqual(1, len(xCtrl.getChildren())) + self.assertEqual("localRangeName\t$Sheet1.$A$1\tSheet1", get_state_as_dict(xCtrl.getChild('0'))['Text']) + xCtrl.getChild('0').executeAction("SELECT", tuple()) - xCtrl = xDialog.getChild('ctrl') - self.assertEqual(1, len(xCtrl.getChildren())) - self.assertEqual("localRangeName\t$Sheet1.$A$1\tSheet1", get_state_as_dict(xCtrl.getChild('0'))['Text']) - xCtrl.getChild('0').executeAction("SELECT", tuple()) + xPasteBtn = xDialog.getChild("paste") + self.ui_test.close_dialog_through_button(xPasteBtn) - xPasteBtn = xDialog.getChild("paste") - self.ui_test.close_dialog_through_button(xPasteBtn) + # use return key to paste the name range + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - # use return key to paste the name range - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + document = self.ui_test.get_component() + self.assertEqual("1", get_cell_by_position(document, 0, 1, 0).getString()) + self.assertEqual("=localRangeName", get_cell_by_position(document, 0, 1, 0).getFormula()) - document = self.ui_test.get_component() - self.assertEqual("1", get_cell_by_position(document, 0, 1, 0).getString()) - self.assertEqual("=localRangeName", get_cell_by_position(document, 0, 1, 0).getFormula()) + # Insert a new sheet + self.ui_test.execute_dialog_through_command(".uno:Insert") + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) - # Insert a new sheet - self.ui_test.execute_dialog_through_command(".uno:Insert") - xDialog = self.xUITest.getTopFocusWindow() - xOKButton = xDialog.getChild("ok") - xOKButton.executeAction("CLICK", tuple()) + # Use the name range in the new sheet + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) - # Use the name range in the new sheet - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + self.ui_test.execute_dialog_through_command(".uno:InsertName") + xDialog = self.xUITest.getTopFocusWindow() - self.ui_test.execute_dialog_through_command(".uno:InsertName") - xDialog = self.xUITest.getTopFocusWindow() + xCtrl = xDialog.getChild('ctrl') + self.assertEqual(1, len(xCtrl.getChildren())) + self.assertEqual("localRangeName\t$Sheet1.$A$1\tSheet1", get_state_as_dict(xCtrl.getChild('0'))['Text']) + xCtrl.getChild('0').executeAction("SELECT", tuple()) - xCtrl = xDialog.getChild('ctrl') - self.assertEqual(1, len(xCtrl.getChildren())) - self.assertEqual("localRangeName\t$Sheet1.$A$1\tSheet1", get_state_as_dict(xCtrl.getChild('0'))['Text']) - xCtrl.getChild('0').executeAction("SELECT", tuple()) + xPasteBtn = xDialog.getChild("paste") + self.ui_test.close_dialog_through_button(xPasteBtn) - xPasteBtn = xDialog.getChild("paste") - self.ui_test.close_dialog_through_button(xPasteBtn) + # use return key to paste the name range + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - # use return key to paste the name range - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + # tdf#137896: Without the fix in place, this test would have failed with + # AssertionError: '1' != '#NAME?' + self.assertEqual("1", get_cell_by_position(document, 0, 1, 0).getString()) - # tdf#137896: Without the fix in place, this test would have failed with - # AssertionError: '1' != '#NAME?' - self.assertEqual("1", get_cell_by_position(document, 0, 1, 0).getString()) + # and AssertionError: '=Sheet1.localRangeName' != '=localrangename' + self.assertEqual("=Sheet1.localRangeName", get_cell_by_position(document, 0, 1, 0).getFormula()) - # and AssertionError: '=Sheet1.localRangeName' != '=localrangename' - self.assertEqual("=Sheet1.localRangeName", get_cell_by_position(document, 0, 1, 0).getFormula()) + self.ui_test.execute_dialog_through_command(".uno:DefineName") + xDialog = self.xUITest.getTopFocusWindow() - self.ui_test.execute_dialog_through_command(".uno:DefineName") - xDialog = self.xUITest.getTopFocusWindow() + # tdf#138851: Without the fix in place, this test would have failed with + # AssertionError: 'Sheet1' != 'Document (Global)' + xScope = xDialog.getChild("scope") + self.assertEqual("Sheet1", get_state_as_dict(xScope)['SelectEntryText']) - # tdf#138851: Without the fix in place, this test would have failed with - # AssertionError: 'Sheet1' != 'Document (Global)' - xScope = xDialog.getChild("scope") - self.assertEqual("Sheet1", get_state_as_dict(xScope)['SelectEntryText']) + 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.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/range_name/tdf137617.py b/sc/qa/uitest/range_name/tdf137617.py index db90aa93128b..54c458823fe6 100644 --- a/sc/qa/uitest/range_name/tdf137617.py +++ b/sc/qa/uitest/range_name/tdf137617.py @@ -15,96 +15,98 @@ class tdf137617(UITestCase): def test_tdf137617(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - calcDoc = self.xUITest.getTopFocusWindow() - gridwin = calcDoc.getChild("grid_window") + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") - enter_text_to_cell(gridwin, "A1", "Result1") - enter_text_to_cell(gridwin, "A2", "Result2") + enter_text_to_cell(gridwin, "A1", "Result1") + enter_text_to_cell(gridwin, "A2", "Result2") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B2"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B2"})) - self.ui_test.execute_dialog_through_command(".uno:CreateNames") + self.ui_test.execute_dialog_through_command(".uno:CreateNames") - xDialog = self.xUITest.getTopFocusWindow() + xDialog = self.xUITest.getTopFocusWindow() - # Only left is selected - self.assertEqual('true', get_state_as_dict(xDialog.getChild('left'))['Selected']) - self.assertEqual('false', get_state_as_dict(xDialog.getChild('right'))['Selected']) - self.assertEqual('false', get_state_as_dict(xDialog.getChild('bottom'))['Selected']) - self.assertEqual('false', get_state_as_dict(xDialog.getChild('top'))['Selected']) + # Only left is selected + self.assertEqual('true', get_state_as_dict(xDialog.getChild('left'))['Selected']) + self.assertEqual('false', get_state_as_dict(xDialog.getChild('right'))['Selected']) + self.assertEqual('false', get_state_as_dict(xDialog.getChild('bottom'))['Selected']) + self.assertEqual('false', get_state_as_dict(xDialog.getChild('top'))['Selected']) - xOkBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) - xPosWindow = calcDoc.getChild('pos_window') - self.assertEqual('Result1', get_state_as_dict(xPosWindow)['Text']) + xPosWindow = calcDoc.getChild('pos_window') + self.assertEqual('Result1', get_state_as_dict(xPosWindow)['Text']) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) - self.assertEqual('Result2', get_state_as_dict(xPosWindow)['Text']) + self.assertEqual('Result2', get_state_as_dict(xPosWindow)['Text']) - # Change formula syntax to "Excel R1C1" - self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") - xDialogOpt = self.xUITest.getTopFocusWindow() + # Change formula syntax to "Excel R1C1" + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") + xDialogOpt = self.xUITest.getTopFocusWindow() - xPages = xDialogOpt.getChild("pages") - xCalcEntry = xPages.getChild('3') - xCalcEntry.executeAction("EXPAND", tuple()) - xCalcFormulaEntry = xCalcEntry.getChild('4') - xCalcFormulaEntry.executeAction("SELECT", tuple()) + xPages = xDialogOpt.getChild("pages") + xCalcEntry = xPages.getChild('3') + xCalcEntry.executeAction("EXPAND", tuple()) + xCalcFormulaEntry = xCalcEntry.getChild('4') + xCalcFormulaEntry.executeAction("SELECT", tuple()) - xFormulaSyntax = xDialogOpt.getChild('formulasyntax') - select_by_text(xFormulaSyntax, "Excel R1C1") + xFormulaSyntax = xDialogOpt.getChild('formulasyntax') + select_by_text(xFormulaSyntax, "Excel R1C1") - xOKBtn = xDialogOpt.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - enter_text_to_cell(gridwin, "C1", "Result3") - enter_text_to_cell(gridwin, "D1", "Result4") + enter_text_to_cell(gridwin, "C1", "Result3") + enter_text_to_cell(gridwin, "D1", "Result4") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:D2"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:D2"})) - self.ui_test.execute_dialog_through_command(".uno:CreateNames") + self.ui_test.execute_dialog_through_command(".uno:CreateNames") - xDialog = self.xUITest.getTopFocusWindow() + xDialog = self.xUITest.getTopFocusWindow() - # Only top is selected - self.assertEqual('false', get_state_as_dict(xDialog.getChild('left'))['Selected']) - self.assertEqual('false', get_state_as_dict(xDialog.getChild('right'))['Selected']) - self.assertEqual('false', get_state_as_dict(xDialog.getChild('bottom'))['Selected']) - self.assertEqual('true', get_state_as_dict(xDialog.getChild('top'))['Selected']) + # Only top is selected + self.assertEqual('false', get_state_as_dict(xDialog.getChild('left'))['Selected']) + self.assertEqual('false', get_state_as_dict(xDialog.getChild('right'))['Selected']) + self.assertEqual('false', get_state_as_dict(xDialog.getChild('bottom'))['Selected']) + self.assertEqual('true', get_state_as_dict(xDialog.getChild('top'))['Selected']) - xOkBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C2"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C2"})) - # Without the fix in place, this test would have failed with - # AssertionError: 'Result3' != 'R2C3' - self.assertEqual('Result3', get_state_as_dict(xPosWindow)['Text']) + # Without the fix in place, this test would have failed with + # AssertionError: 'Result3' != 'R2C3' + self.assertEqual('Result3', get_state_as_dict(xPosWindow)['Text']) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D2"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D2"})) - self.assertEqual('Result4', get_state_as_dict(xPosWindow)['Text']) + self.assertEqual('Result4', get_state_as_dict(xPosWindow)['Text']) - # Change formula syntax back to "Calc A1" - self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") - xDialogOpt = self.xUITest.getTopFocusWindow() + # Change formula syntax back to "Calc A1" + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") + xDialogOpt = self.xUITest.getTopFocusWindow() - xPages = xDialogOpt.getChild("pages") - xCalcEntry = xPages.getChild('3') - xCalcEntry.executeAction("EXPAND", tuple()) - xCalcFormulaEntry = xCalcEntry.getChild('4') - xCalcFormulaEntry.executeAction("SELECT", tuple()) + xPages = xDialogOpt.getChild("pages") + xCalcEntry = xPages.getChild('3') + xCalcEntry.executeAction("EXPAND", tuple()) + xCalcFormulaEntry = xCalcEntry.getChild('4') + xCalcFormulaEntry.executeAction("SELECT", tuple()) - xFormulaSyntax = xDialogOpt.getChild('formulasyntax') - select_by_text(xFormulaSyntax, "Calc A1") + xFormulaSyntax = xDialogOpt.getChild('formulasyntax') + select_by_text(xFormulaSyntax, "Calc A1") - xOKBtn = xDialogOpt.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/range_name/tdf138822.py b/sc/qa/uitest/range_name/tdf138822.py index cd0a5bb220ed..361cc379e828 100644 --- a/sc/qa/uitest/range_name/tdf138822.py +++ b/sc/qa/uitest/range_name/tdf138822.py @@ -11,51 +11,53 @@ from uitest.uihelper.common import type_text class tdf138822(UITestCase): def test_tdf138822(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - calcDoc = self.xUITest.getTopFocusWindow() - xPosWindow = calcDoc.getChild('pos_window') - self.assertEqual('A1', get_state_as_dict(xPosWindow)['Text']) + calcDoc = self.xUITest.getTopFocusWindow() + xPosWindow = calcDoc.getChild('pos_window') + self.assertEqual('A1', get_state_as_dict(xPosWindow)['Text']) - self.ui_test.execute_modeless_dialog_through_command(".uno:DefineName") + self.ui_test.execute_modeless_dialog_through_command(".uno:DefineName") - xManageNamesDialog = self.xUITest.getTopFocusWindow() + xManageNamesDialog = self.xUITest.getTopFocusWindow() - xAddBtn = xManageNamesDialog.getChild("add") - self.ui_test.close_dialog_through_button(xAddBtn) + xAddBtn = xManageNamesDialog.getChild("add") + self.ui_test.close_dialog_through_button(xAddBtn) - xDefineNamesDialog = self.xUITest.getTopFocusWindow() + xDefineNamesDialog = self.xUITest.getTopFocusWindow() - xAddBtn = xDefineNamesDialog.getChild("add") - self.assertEqual("false", get_state_as_dict(xAddBtn)['Enabled']) + xAddBtn = xDefineNamesDialog.getChild("add") + self.assertEqual("false", get_state_as_dict(xAddBtn)['Enabled']) - xEdit = xDefineNamesDialog.getChild("edit") - type_text(xEdit, "rangeName") + xEdit = xDefineNamesDialog.getChild("edit") + type_text(xEdit, "rangeName") - self.assertEqual("true", get_state_as_dict(xAddBtn)['Enabled']) + self.assertEqual("true", get_state_as_dict(xAddBtn)['Enabled']) - self.ui_test.close_dialog_through_button(xAddBtn) + self.ui_test.close_dialog_through_button(xAddBtn) - xManageNamesDialog = self.xUITest.getTopFocusWindow() + xManageNamesDialog = self.xUITest.getTopFocusWindow() - xNamesList = xManageNamesDialog.getChild('names') - self.assertEqual(1, len(xNamesList.getChildren())) - self.assertEqual(get_state_as_dict(xNamesList.getChild('0'))["Text"], "rangeName\t$Sheet1.$A$1\tDocument (Global)") + xNamesList = xManageNamesDialog.getChild('names') + self.assertEqual(1, len(xNamesList.getChildren())) + self.assertEqual(get_state_as_dict(xNamesList.getChild('0'))["Text"], "rangeName\t$Sheet1.$A$1\tDocument (Global)") - xCancelBtn = xManageNamesDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + xCancelBtn = xManageNamesDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) - # Open the dialog again - self.ui_test.execute_modeless_dialog_through_command(".uno:DefineName") + # Open the dialog again + self.ui_test.execute_modeless_dialog_through_command(".uno:DefineName") - xManageNamesDialog = self.xUITest.getTopFocusWindow() - xNamesList = xManageNamesDialog.getChild('names') + xManageNamesDialog = self.xUITest.getTopFocusWindow() + xNamesList = xManageNamesDialog.getChild('names') - # Without the fix in place, this test would have failed with - # AssertionError: 0 != 1 - self.assertEqual(0, len(xNamesList.getChildren())) + # Without the fix in place, this test would have failed with + # AssertionError: 0 != 1 + self.assertEqual(0, len(xNamesList.getChildren())) - xOkBtn = xManageNamesDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + xOkBtn = xManageNamesDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/range_name/tdf86214.py b/sc/qa/uitest/range_name/tdf86214.py index 4130bbca108e..48817e0bcc64 100644 --- a/sc/qa/uitest/range_name/tdf86214.py +++ b/sc/qa/uitest/range_name/tdf86214.py @@ -15,44 +15,46 @@ class InvalidNames(UITestCase): def test_invalid_names(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") + self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") - xAddNameDlg = self.xUITest.getTopFocusWindow() + xAddNameDlg = self.xUITest.getTopFocusWindow() - invalid_names = ["A1", "12", "1.2", "A1:B2", "test.a", \ - "test+", "test-", "test*", "test!abc", "test#", \ - "test^", "test°", "test$", "test§", "test%", \ - "test&", "test/", "test(", "test)", "test[", "test]", \ - "test\\", "test`", "test´", "test'", "test~", "test<", \ - "tst>", "test|", "test:t", "test;z"] + invalid_names = ["A1", "12", "1.2", "A1:B2", "test.a", \ + "test+", "test-", "test*", "test!abc", "test#", \ + "test^", "test°", "test$", "test§", "test%", \ + "test&", "test/", "test(", "test)", "test[", "test]", \ + "test\\", "test`", "test´", "test'", "test~", "test<", \ + "tst>", "test|", "test:t", "test;z"] - xLabel = xAddNameDlg.getChild("label") - xAddBtn = xAddNameDlg.getChild("add") - xEdit = xAddNameDlg.getChild("edit") + xLabel = xAddNameDlg.getChild("label") + xAddBtn = xAddNameDlg.getChild("add") + xEdit = xAddNameDlg.getChild("edit") - success_text = get_state_as_dict(xLabel)["Text"] + success_text = get_state_as_dict(xLabel)["Text"] - for name in invalid_names: - with self.subTest(name = name): - select_all(xEdit) - type_text(xEdit, name) + for name in invalid_names: + with self.subTest(name = name): + select_all(xEdit) + type_text(xEdit, name) - # tdf#132869 - Without the fix in place, this test would have failed with - # - Expected: "Invalid name. Start with a letter, use only letters, numbers and underscore." - # - Actual : "" - self.assertNotEqual(success_text, get_state_as_dict(xEdit)["QuickHelpText"]) - self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "false") + # tdf#132869 - Without the fix in place, this test would have failed with + # - Expected: "Invalid name. Start with a letter, use only letters, numbers and underscore." + # - Actual : "" + self.assertNotEqual(success_text, get_state_as_dict(xEdit)["QuickHelpText"]) + self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "false") - select_all(xEdit) - type_text(xEdit, "valid_name") + select_all(xEdit) + type_text(xEdit, "valid_name") - self.assertEqual(success_text, get_state_as_dict(xLabel)["Text"]) - self.assertEqual(success_text, get_state_as_dict(xEdit)["QuickHelpText"]) - self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "true") + self.assertEqual(success_text, get_state_as_dict(xLabel)["Text"]) + self.assertEqual(success_text, get_state_as_dict(xEdit)["QuickHelpText"]) + self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "true") - self.ui_test.close_dialog_through_button(xAddBtn) + self.ui_test.close_dialog_through_button(xAddBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/tdf132097.py b/sc/qa/uitest/search_replace/tdf132097.py index 104737d23793..5585befb6da3 100644 --- a/sc/qa/uitest/search_replace/tdf132097.py +++ b/sc/qa/uitest/search_replace/tdf132097.py @@ -11,27 +11,29 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf132097(UITestCase): def test_tdf132097(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCols = xDialog.getChild('cols') - xSearchTerm = xDialog.getChild("searchterm") - xBackSearch = xDialog.getChild("backsearch") - xSeachLabel = xDialog.getChild("searchlabel") + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCols = xDialog.getChild('cols') + xSearchTerm = xDialog.getChild("searchterm") + xBackSearch = xDialog.getChild("backsearch") + xSeachLabel = xDialog.getChild("searchlabel") - xCols.executeAction("CLICK", tuple()) - xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT":"TEST"})) + xCols.executeAction("CLICK", tuple()) + xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT":"TEST"})) - for i in range(10): - # without the fix in place it would crash here. - # Sometimes it doesn't crash at first so try a few times to be sure - xBackSearch.executeAction("CLICK", tuple()) + for i in range(10): + # without the fix in place it would crash here. + # Sometimes it doesn't crash at first so try a few times to be sure + xBackSearch.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(xSeachLabel)["Text"], "Search key not found") + self.assertEqual(get_state_as_dict(xSeachLabel)["Text"], "Search key not found") - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/tdf39917.py b/sc/qa/uitest/search_replace/tdf39917.py index 011ed267bb15..456e4a4acf12 100644 --- a/sc/qa/uitest/search_replace/tdf39917.py +++ b/sc/qa/uitest/search_replace/tdf39917.py @@ -18,90 +18,91 @@ from uitest.debug import sleep class tdf39917(UITestCase): def test_tdf39917_find_replace_R1C1(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #* Tools --> Options --> Calc --> Formula --> Syntax = Excel R1C1 - self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog - xDialogOpt = self.xUITest.getTopFocusWindow() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #* Tools --> Options --> Calc --> Formula --> Syntax = Excel R1C1 + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialogOpt = self.xUITest.getTopFocusWindow() - xPages = xDialogOpt.getChild("pages") - xCalcEntry = xPages.getChild('3') # Calc - xCalcEntry.executeAction("EXPAND", tuple()) - xCalcFormulaEntry = xCalcEntry.getChild('4') - xCalcFormulaEntry.executeAction("SELECT", tuple()) #Formula + xPages = xDialogOpt.getChild("pages") + xCalcEntry = xPages.getChild('3') # Calc + xCalcEntry.executeAction("EXPAND", tuple()) + xCalcFormulaEntry = xCalcEntry.getChild('4') + xCalcFormulaEntry.executeAction("SELECT", tuple()) #Formula - formulasyntax = xDialogOpt.getChild("formulasyntax") - #Excel R1C1 - select_by_text(formulasyntax, "Excel R1C1") + formulasyntax = xDialogOpt.getChild("formulasyntax") + #Excel R1C1 + select_by_text(formulasyntax, "Excel R1C1") - xOKBtn = xDialogOpt.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - #1. Create a workbook with 3 sheets: Page1, Page2, Page3. - # 2. Tools -> Options -> LibreOffice Calc -> Formula: Set syntax to Excel A1 - # 5. Fill fields: + #1. Create a workbook with 3 sheets: Page1, Page2, Page3. + # 2. Tools -> Options -> LibreOffice Calc -> Formula: Set syntax to Excel A1 + # 5. Fill fields: - self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet - xDialog = self.xUITest.getTopFocusWindow() - after = xDialog.getChild("after") - after.executeAction("CLICK", tuple()) - nameed = xDialog.getChild("nameed") - nameed.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - nameed.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - nameed.executeAction("TYPE", mkPropertyValues({"TEXT":"Page2"})) - xOKButton = xDialog.getChild("ok") - xOKButton.executeAction("CLICK", tuple()) - self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet - xDialog = self.xUITest.getTopFocusWindow() - after = xDialog.getChild("after") - after.executeAction("CLICK", tuple()) - nameed = xDialog.getChild("nameed") - nameed.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - nameed.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - nameed.executeAction("TYPE", mkPropertyValues({"TEXT":"Page3"})) - xOKButton = xDialog.getChild("ok") - xOKButton.executeAction("CLICK", tuple()) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RIGHT"})) - # 3. Type in (for example) B4: =Page2!B4 - enter_text_to_cell(gridwin, "B4", "=Page2!RC") - # 4. Edit -> Find and Replace - # Find: Page2 - # Replace: Page3 - # 6. Press Replace all - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - searchterm = xDialog.getChild("searchterm") - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Page2"})) - replaceterm = xDialog.getChild("replaceterm") - replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Page3"})) #replace textbox - replace = xDialog.getChild("replace") - replace.executeAction("CLICK", tuple()) - replace.executeAction("CLICK", tuple()) - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet + xDialog = self.xUITest.getTopFocusWindow() + after = xDialog.getChild("after") + after.executeAction("CLICK", tuple()) + nameed = xDialog.getChild("nameed") + nameed.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + nameed.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + nameed.executeAction("TYPE", mkPropertyValues({"TEXT":"Page2"})) + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet + xDialog = self.xUITest.getTopFocusWindow() + after = xDialog.getChild("after") + after.executeAction("CLICK", tuple()) + nameed = xDialog.getChild("nameed") + nameed.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + nameed.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + nameed.executeAction("TYPE", mkPropertyValues({"TEXT":"Page3"})) + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RIGHT"})) + # 3. Type in (for example) B4: =Page2!B4 + enter_text_to_cell(gridwin, "B4", "=Page2!RC") + # 4. Edit -> Find and Replace + # Find: Page2 + # Replace: Page3 + # 6. Press Replace all + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Page2"})) + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Page3"})) #replace textbox + replace = xDialog.getChild("replace") + replace.executeAction("CLICK", tuple()) + replace.executeAction("CLICK", tuple()) + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) - #verify - enter_text_to_cell(gridwin, "A1", "=FORMULA(R[3]C[1])") - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "=Page3!RC") - #Give it back Tools --> Options --> Calc --> Formula --> Syntax = Calc A1 - self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog - xDialogOpt = self.xUITest.getTopFocusWindow() + #verify + enter_text_to_cell(gridwin, "A1", "=FORMULA(R[3]C[1])") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "=Page3!RC") + #Give it back Tools --> Options --> Calc --> Formula --> Syntax = Calc A1 + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialogOpt = self.xUITest.getTopFocusWindow() - xPages = xDialogOpt.getChild("pages") - xCalcEntry = xPages.getChild('3') # Calc - xCalcEntry.executeAction("EXPAND", tuple()) - xCalcFormulaEntry = xCalcEntry.getChild('4') - xCalcFormulaEntry.executeAction("SELECT", tuple()) #Formula + xPages = xDialogOpt.getChild("pages") + xCalcEntry = xPages.getChild('3') # Calc + xCalcEntry.executeAction("EXPAND", tuple()) + xCalcFormulaEntry = xCalcEntry.getChild('4') + xCalcFormulaEntry.executeAction("SELECT", tuple()) #Formula - formulasyntax = xDialogOpt.getChild("formulasyntax") - #Excel R1C1 - select_by_text(formulasyntax, "Calc A1") + formulasyntax = xDialogOpt.getChild("formulasyntax") + #Excel R1C1 + select_by_text(formulasyntax, "Calc A1") - xOKBtn = xDialogOpt.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/tdf44398.py b/sc/qa/uitest/search_replace/tdf44398.py index 0925293b9b06..c44305cb01d1 100644 --- a/sc/qa/uitest/search_replace/tdf44398.py +++ b/sc/qa/uitest/search_replace/tdf44398.py @@ -17,74 +17,77 @@ from uitest.debug import sleep class tdf44398(UITestCase): def test_tdf44398_find_replace_regexp(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - # 1. A1 => 123456 - enter_text_to_cell(gridwin, "A1", "123456") - # 2. ctrl-h, in dialog - # Search: ([0-9]) - # Replace: $1 - # check regular expression - # hit replace all + # 1. A1 => 123456 + enter_text_to_cell(gridwin, "A1", "123456") + # 2. ctrl-h, in dialog + # Search: ([0-9]) + # Replace: $1 + # check regular expression + # hit replace all - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - searchterm = xDialog.getChild("searchterm") - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"([0-9])"})) - replaceterm = xDialog.getChild("replaceterm") - replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"$1"})) #replace textbox - regexp = xDialog.getChild("regexp") - regexp.executeAction("CLICK", tuple()) #regular expressions - replaceall = xDialog.getChild("replaceall") - replaceall.executeAction("CLICK", tuple()) - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"([0-9])"})) + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"$1"})) #replace textbox + regexp = xDialog.getChild("regexp") + regexp.executeAction("CLICK", tuple()) #regular expressions + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + #verify 3. A1 => 123456 + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "123456") - #verify 3. A1 => 123456 - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "123456") + self.ui_test.close_doc() def test_tdf44398_find_replace_regexp_string(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - # 1. A1 => VarNumberA - enter_text_to_cell(gridwin, "A1", "VarNumberA") - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RIGHT"})) - # 2. ctrl-h, in dialog - # Search: ([A-Z]) - # Replace: <space>$1 - # check regular expression - # check case - # hit replace all + # 1. A1 => VarNumberA + enter_text_to_cell(gridwin, "A1", "VarNumberA") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RIGHT"})) + # 2. ctrl-h, in dialog + # Search: ([A-Z]) + # Replace: <space>$1 + # check regular expression + # check case + # hit replace all - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - searchterm = xDialog.getChild("searchterm") - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"([A-Z])"})) - replaceterm = xDialog.getChild("replaceterm") - replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":" $1"})) #replace textbox - regexp = xDialog.getChild("regexp") - if (get_state_as_dict(regexp)["Selected"]) == "false": - regexp.executeAction("CLICK", tuple()) #regular expressions - matchcase = xDialog.getChild("matchcase") - matchcase.executeAction("CLICK", tuple()) #case + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"([A-Z])"})) + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":" $1"})) #replace textbox + regexp = xDialog.getChild("regexp") + if (get_state_as_dict(regexp)["Selected"]) == "false": + regexp.executeAction("CLICK", tuple()) #regular expressions + matchcase = xDialog.getChild("matchcase") + matchcase.executeAction("CLICK", tuple()) #case - replaceall = xDialog.getChild("replaceall") - replaceall.executeAction("CLICK", tuple()) + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) - #verify A1 => ' Var Number A' - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), " Var Number A") + #verify A1 => ' Var Number A' + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), " Var Number A") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/tdf57523.py b/sc/qa/uitest/search_replace/tdf57523.py index 7b6eed088f9c..36159dd7133a 100644 --- a/sc/qa/uitest/search_replace/tdf57523.py +++ b/sc/qa/uitest/search_replace/tdf57523.py @@ -13,40 +13,42 @@ from uitest.uihelper.common import get_state_as_dict class tdf57523(UITestCase): def test_tdf57523(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "AAA") - enter_text_to_cell(gridwin, "A4", "AAA") + enter_text_to_cell(gridwin, "A1", "AAA") + enter_text_to_cell(gridwin, "A4", "AAA") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - searchterm = xDialog.getChild("searchterm") - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"^$"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"^$"})) - replaceterm = xDialog.getChild("replaceterm") - replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"BBB"})) - regexp = xDialog.getChild("regexp") + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"BBB"})) + regexp = xDialog.getChild("regexp") - if get_state_as_dict(regexp)['Selected'] == 'false': - regexp.executeAction("CLICK", tuple()) - self.assertEqual("true", get_state_as_dict(regexp)['Selected']) + if get_state_as_dict(regexp)['Selected'] == 'false': + regexp.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(regexp)['Selected']) - replaceall = xDialog.getChild("replaceall") - replaceall.executeAction("CLICK", tuple()) + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) - # Without the fix in place, this test would have failed with - # AssertionError: '' != 'BBB' - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "BBB") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "BBB") + # Without the fix in place, this test would have failed with + # AssertionError: '' != 'BBB' + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "BBB") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "BBB") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/signatureLine/insertSignatureLine.py b/sc/qa/uitest/signatureLine/insertSignatureLine.py index 93d725bbc99f..51a321b34a64 100644 --- a/sc/qa/uitest/signatureLine/insertSignatureLine.py +++ b/sc/qa/uitest/signatureLine/insertSignatureLine.py @@ -15,82 +15,85 @@ from com.sun.star.lang import IndexOutOfBoundsException class insertSignatureLineCalc(UITestCase): def test_insert_signature_line_calc(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - # cancel the dialog without doing anything - self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") - xDialog = self.xUITest.getTopFocusWindow() - - xName = xDialog.getChild("edit_name") - xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line - - xCloseBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCloseBtn) - with self.assertRaises(IndexOutOfBoundsException): - document.Sheets.getByIndex(0).DrawPage.getByIndex(0) - - # set the signature line - self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") - xDialog = self.xUITest.getTopFocusWindow() - - xName = xDialog.getChild("edit_name") - xTitle = xDialog.getChild("edit_title") - xEmail = xDialog.getChild("edit_email") - xComment = xDialog.getChild("checkbox_can_add_comments") - xInstructions = xDialog.getChild("edit_instructions") - - xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line - xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"})) - xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"})) - xComment.executeAction("CLICK", tuple()) - xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"})) - xOKBtn = xDialog.getChild("ok") - xOKBtn.executeAction("CLICK", tuple()) - - #check the signature Line in the document - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerName, "Name") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerEmail, "Email") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineCanAddComment, False) - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineShowSignDate, True) - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSigningInstructions, "Instructions") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + # cancel the dialog without doing anything + self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") + xDialog = self.xUITest.getTopFocusWindow() + + xName = xDialog.getChild("edit_name") + xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line + + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + with self.assertRaises(IndexOutOfBoundsException): + document.Sheets.getByIndex(0).DrawPage.getByIndex(0) + + # set the signature line + self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") + xDialog = self.xUITest.getTopFocusWindow() + + xName = xDialog.getChild("edit_name") + xTitle = xDialog.getChild("edit_title") + xEmail = xDialog.getChild("edit_email") + xComment = xDialog.getChild("checkbox_can_add_comments") + xInstructions = xDialog.getChild("edit_instructions") + + xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line + xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"})) + xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"})) + xComment.executeAction("CLICK", tuple()) + xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"})) + xOKBtn = xDialog.getChild("ok") + xOKBtn.executeAction("CLICK", tuple()) + + #check the signature Line in the document + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerName, "Name") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerEmail, "Email") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineCanAddComment, False) + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineShowSignDate, True) + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSigningInstructions, "Instructions") + + self.ui_test.close_doc() def test_insert_signature_line2_calc(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") - xDialog = self.xUITest.getTopFocusWindow() - - xName = xDialog.getChild("edit_name") - xTitle = xDialog.getChild("edit_title") - xEmail = xDialog.getChild("edit_email") - xComment = xDialog.getChild("checkbox_can_add_comments") - xDate = xDialog.getChild("checkbox_show_sign_date") - xInstructions = xDialog.getChild("edit_instructions") - - xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line - xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"})) - xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"})) - xDate.executeAction("CLICK", tuple()) - xComment.executeAction("CLICK", tuple()) - xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"})) - xOKBtn = xDialog.getChild("ok") - xOKBtn.executeAction("CLICK", tuple()) - - #check the signature Line in the document - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerName, "Name") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerEmail, "Email") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineCanAddComment, False) - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineShowSignDate, False) - self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSigningInstructions, "Instructions") - + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") + xDialog = self.xUITest.getTopFocusWindow() + + xName = xDialog.getChild("edit_name") + xTitle = xDialog.getChild("edit_title") + xEmail = xDialog.getChild("edit_email") + xComment = xDialog.getChild("checkbox_can_add_comments") + xDate = xDialog.getChild("checkbox_show_sign_date") + xInstructions = xDialog.getChild("edit_instructions") + + xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line + xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"})) + xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"})) + xDate.executeAction("CLICK", tuple()) + xComment.executeAction("CLICK", tuple()) + xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"})) + xOKBtn = xDialog.getChild("ok") + xOKBtn.executeAction("CLICK", tuple()) + + #check the signature Line in the document + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerName, "Name") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerEmail, "Email") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineCanAddComment, False) + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineShowSignDate, False) + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSigningInstructions, "Instructions") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/naturalSort.py b/sc/qa/uitest/sort/naturalSort.py index bd182f9a016f..bd583a3c9a2c 100644 --- a/sc/qa/uitest/sort/naturalSort.py +++ b/sc/qa/uitest/sort/naturalSort.py @@ -18,93 +18,96 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class CalcNaturalSorting(UITestCase): def test_natural_sorting_rows(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #enter data - enter_text_to_cell(gridwin, "A1", "MW100SSMOU456.996JIL4") - enter_text_to_cell(gridwin, "A2", "MW180SSMOU456.996JIL4") - enter_text_to_cell(gridwin, "A3", "MW110SSMOU456.993JIL4") - enter_text_to_cell(gridwin, "A4", "MW180SSMOU456.994JIL4") - enter_text_to_cell(gridwin, "A5", "MW101SSMOU456.996JIL4") - #Open sort dialog by DATA - SORT - self.ui_test.execute_dialog_through_command(".uno:DataSort") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xNatural = xDialog.getChild("naturalsort") - xNatural.executeAction("CLICK", tuple()) - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "MW100SSMOU456.996JIL4") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "MW101SSMOU456.996JIL4") - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "MW110SSMOU456.993JIL4") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "MW180SSMOU456.994JIL4") - self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "MW180SSMOU456.996JIL4") - #UNDO - self.xUITest.executeCommand(".uno:Undo") - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "MW100SSMOU456.996JIL4") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "MW180SSMOU456.996JIL4") - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "MW110SSMOU456.993JIL4") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "MW180SSMOU456.994JIL4") - self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "MW101SSMOU456.996JIL4") - #enter data - enter_text_to_cell(gridwin, "D1", "MW-2") - enter_text_to_cell(gridwin, "D2", "MW-20") - enter_text_to_cell(gridwin, "D3", "MW-1") - enter_text_to_cell(gridwin, "D4", "MW-18") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #enter data + enter_text_to_cell(gridwin, "A1", "MW100SSMOU456.996JIL4") + enter_text_to_cell(gridwin, "A2", "MW180SSMOU456.996JIL4") + enter_text_to_cell(gridwin, "A3", "MW110SSMOU456.993JIL4") + enter_text_to_cell(gridwin, "A4", "MW180SSMOU456.994JIL4") + enter_text_to_cell(gridwin, "A5", "MW101SSMOU456.996JIL4") + #Open sort dialog by DATA - SORT + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xNatural = xDialog.getChild("naturalsort") + xNatural.executeAction("CLICK", tuple()) + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "MW100SSMOU456.996JIL4") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "MW101SSMOU456.996JIL4") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "MW110SSMOU456.993JIL4") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "MW180SSMOU456.994JIL4") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "MW180SSMOU456.996JIL4") + #UNDO + self.xUITest.executeCommand(".uno:Undo") + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "MW100SSMOU456.996JIL4") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "MW180SSMOU456.996JIL4") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "MW110SSMOU456.993JIL4") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "MW180SSMOU456.994JIL4") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "MW101SSMOU456.996JIL4") + #enter data + enter_text_to_cell(gridwin, "D1", "MW-2") + enter_text_to_cell(gridwin, "D2", "MW-20") + enter_text_to_cell(gridwin, "D3", "MW-1") + enter_text_to_cell(gridwin, "D4", "MW-18") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D1:D4"})) - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D1:D4"})) + #Open sort dialog by DATA - SORT + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + xNatural = xDialog.getChild("naturalsort") + if (get_state_as_dict(xNatural)["Selected"]) == "false": + xNatural.executeAction("CLICK", tuple()) + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) - #Open sort dialog by DATA - SORT - self.ui_test.execute_dialog_through_command(".uno:DataSort") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - xNatural = xDialog.getChild("naturalsort") - if (get_state_as_dict(xNatural)["Selected"]) == "false": - xNatural.executeAction("CLICK", tuple()) - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) + self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "MW-1") + self.assertEqual(get_cell_by_position(document, 0, 3, 1).getString(), "MW-2") + self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "MW-18") + self.assertEqual(get_cell_by_position(document, 0, 3, 3).getString(), "MW-20") - self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "MW-1") - self.assertEqual(get_cell_by_position(document, 0, 3, 1).getString(), "MW-2") - self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "MW-18") - self.assertEqual(get_cell_by_position(document, 0, 3, 3).getString(), "MW-20") + self.ui_test.close_doc() def test_natural_sorting_columns(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #enter data - enter_text_to_cell(gridwin, "A1", "MW-2") - enter_text_to_cell(gridwin, "B1", "MW-20") - enter_text_to_cell(gridwin, "C1", "MW-1") - enter_text_to_cell(gridwin, "D1", "MW-18") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #enter data + enter_text_to_cell(gridwin, "A1", "MW-2") + enter_text_to_cell(gridwin, "B1", "MW-20") + enter_text_to_cell(gridwin, "C1", "MW-1") + enter_text_to_cell(gridwin, "D1", "MW-18") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D1"})) - #Open sort dialog by DATA - SORT - self.ui_test.execute_dialog_through_command(".uno:DataSort") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - xleftright = xDialog.getChild("leftright") - select_pos(xTabs, "1") - xNatural = xDialog.getChild("naturalsort") - xleftright.executeAction("CLICK", tuple()) - if (get_state_as_dict(xNatural)["Selected"]) == "false": - xNatural.executeAction("CLICK", tuple()) - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) + #Open sort dialog by DATA - SORT + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + xleftright = xDialog.getChild("leftright") + select_pos(xTabs, "1") + xNatural = xDialog.getChild("naturalsort") + xleftright.executeAction("CLICK", tuple()) + if (get_state_as_dict(xNatural)["Selected"]) == "false": + xNatural.executeAction("CLICK", tuple()) + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "MW-1") - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "MW-2") - self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "MW-18") - self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "MW-20") + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "MW-1") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "MW-2") + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "MW-18") + self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "MW-20") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/sorting.py b/sc/qa/uitest/sort/sorting.py index 91a2458b12b8..59c00c7b258a 100644 --- a/sc/qa/uitest/sort/sorting.py +++ b/sc/qa/uitest/sort/sorting.py @@ -18,277 +18,286 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class CalcSorting(UITestCase): def test_Sortingbuttons_detect_columnheaders(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #In column A enter: Number; 3; 4; 6; 2 / In column B enter: Misc; s; d; f; g - enter_text_to_cell(gridwin, "A1", "Number") - enter_text_to_cell(gridwin, "A2", "3") - enter_text_to_cell(gridwin, "A3", "4") - enter_text_to_cell(gridwin, "A4", "6") - enter_text_to_cell(gridwin, "A5", "2") - enter_text_to_cell(gridwin, "B1", "Misc") - enter_text_to_cell(gridwin, "B2", "s") - enter_text_to_cell(gridwin, "B3", "d") - enter_text_to_cell(gridwin, "B4", "f") - enter_text_to_cell(gridwin, "B5", "g") - #Select cell A3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - #Press toolbarbutton for descending sorting .uno:SortDescending - self.xUITest.executeCommand(".uno:SortDescending") - #Verify that cell A1 still contains "Number" and B1 "Misc" - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Number") - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Misc") - #UNDO - self.xUITest.executeCommand(".uno:Undo") - #Select cell B3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"})) - #Press toolbar button for ascending sorting - self.xUITest.executeCommand(".uno:SortAscending") - #Verify that cell A1 still contains "Number" and B1 "Misc" - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Number") - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Misc") - #UNDO - self.xUITest.executeCommand(".uno:Undo") - #Select cell A3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - #Open sort dialog by DATA - SORT /Switch to tabpage Options - self.ui_test.execute_dialog_through_command(".uno:DataSort") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - #Verify that option "Range contains column labels" is set - xHeader = xDialog.getChild("header") - self.assertEqual(get_state_as_dict(xHeader)["Selected"], "true") - #Cancel dialog - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) - #Select Range A1:B5 - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B5"})) - #Press toolbarbutton for descending sorting - self.xUITest.executeCommand(".uno:SortDescending") - #Verify that cell A1 still contains "Number" and B1 "Misc" - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Number") - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Misc") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #In column A enter: Number; 3; 4; 6; 2 / In column B enter: Misc; s; d; f; g + enter_text_to_cell(gridwin, "A1", "Number") + enter_text_to_cell(gridwin, "A2", "3") + enter_text_to_cell(gridwin, "A3", "4") + enter_text_to_cell(gridwin, "A4", "6") + enter_text_to_cell(gridwin, "A5", "2") + enter_text_to_cell(gridwin, "B1", "Misc") + enter_text_to_cell(gridwin, "B2", "s") + enter_text_to_cell(gridwin, "B3", "d") + enter_text_to_cell(gridwin, "B4", "f") + enter_text_to_cell(gridwin, "B5", "g") + #Select cell A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #Press toolbarbutton for descending sorting .uno:SortDescending + self.xUITest.executeCommand(".uno:SortDescending") + #Verify that cell A1 still contains "Number" and B1 "Misc" + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Number") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Misc") + #UNDO + self.xUITest.executeCommand(".uno:Undo") + #Select cell B3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"})) + #Press toolbar button for ascending sorting + self.xUITest.executeCommand(".uno:SortAscending") + #Verify that cell A1 still contains "Number" and B1 "Misc" + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Number") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Misc") + #UNDO + self.xUITest.executeCommand(".uno:Undo") + #Select cell A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #Open sort dialog by DATA - SORT /Switch to tabpage Options + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + #Verify that option "Range contains column labels" is set + xHeader = xDialog.getChild("header") + self.assertEqual(get_state_as_dict(xHeader)["Selected"], "true") + #Cancel dialog + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + #Select Range A1:B5 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B5"})) + #Press toolbarbutton for descending sorting + self.xUITest.executeCommand(".uno:SortDescending") + #Verify that cell A1 still contains "Number" and B1 "Misc" + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Number") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Misc") + self.ui_test.close_doc() def test_Sortingbuttons_list_has_not_columnheaders(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #In column A enter: 5; 3; 4; 6; 2 / In column B enter: e; s; d; f; g - enter_text_to_cell(gridwin, "A1", "5") - enter_text_to_cell(gridwin, "A2", "3") - enter_text_to_cell(gridwin, "A3", "4") - enter_text_to_cell(gridwin, "A4", "6") - enter_text_to_cell(gridwin, "A5", "2") - enter_text_to_cell(gridwin, "B1", "e") - enter_text_to_cell(gridwin, "B2", "s") - enter_text_to_cell(gridwin, "B3", "d") - enter_text_to_cell(gridwin, "B4", "f") - enter_text_to_cell(gridwin, "B5", "g") - #Select cell A3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - #Press toolbar button for ascending sorting - self.xUITest.executeCommand(".uno:SortAscending") - #Verify that cell A1 no longer contains "5" and B1 no longer contains "e" - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() != "5", True) - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString() != "e", True) - #UNDO - self.xUITest.executeCommand(".uno:Undo") - #Select cell B3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"})) - #Open sort dialog by DATA - SORT /Switch to tabpage Options - self.ui_test.execute_dialog_through_command(".uno:DataSort") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - #Verify that option "Range contains column labels" is not set - xHeader = xDialog.getChild("header") - self.assertEqual(get_state_as_dict(xHeader)["Selected"], "false") - #Cancel dialog - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #In column A enter: 5; 3; 4; 6; 2 / In column B enter: e; s; d; f; g + enter_text_to_cell(gridwin, "A1", "5") + enter_text_to_cell(gridwin, "A2", "3") + enter_text_to_cell(gridwin, "A3", "4") + enter_text_to_cell(gridwin, "A4", "6") + enter_text_to_cell(gridwin, "A5", "2") + enter_text_to_cell(gridwin, "B1", "e") + enter_text_to_cell(gridwin, "B2", "s") + enter_text_to_cell(gridwin, "B3", "d") + enter_text_to_cell(gridwin, "B4", "f") + enter_text_to_cell(gridwin, "B5", "g") + #Select cell A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #Press toolbar button for ascending sorting + self.xUITest.executeCommand(".uno:SortAscending") + #Verify that cell A1 no longer contains "5" and B1 no longer contains "e" + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() != "5", True) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString() != "e", True) + #UNDO + self.xUITest.executeCommand(".uno:Undo") + #Select cell B3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"})) + #Open sort dialog by DATA - SORT /Switch to tabpage Options + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + #Verify that option "Range contains column labels" is not set + xHeader = xDialog.getChild("header") + self.assertEqual(get_state_as_dict(xHeader)["Selected"], "false") + #Cancel dialog + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + self.ui_test.close_doc() def test_Sorting_default_to_selected_column(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #In column A enter: Number; 3; 4; 6; 2 / In column B enter: Misc; s; d; f; g - enter_text_to_cell(gridwin, "A1", "Number") - enter_text_to_cell(gridwin, "A2", "3") - enter_text_to_cell(gridwin, "A3", "4") - enter_text_to_cell(gridwin, "A4", "6") - enter_text_to_cell(gridwin, "A5", "2") - enter_text_to_cell(gridwin, "B1", "Misc") - enter_text_to_cell(gridwin, "B2", "s") - enter_text_to_cell(gridwin, "B3", "d") - enter_text_to_cell(gridwin, "B4", "f") - enter_text_to_cell(gridwin, "B5", "g") - #Select cell A3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - #Press toolbarbutton for descending sorting .uno:SortDescending - self.xUITest.executeCommand(".uno:SortDescending") - #Verify that the sortorder was determined for column A (Number;2;3;4;6) - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Number") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 6) - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 4) - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 3) - self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 2) - #UNDO - self.xUITest.executeCommand(".uno:Undo") - #Select cell B3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"})) - #Press toolbar button for ascending sorting - self.xUITest.executeCommand(".uno:SortAscending") - #Verify that the sortorder was determined for column B (Misc;s;g;f;d) - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Misc") - self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "d") - self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "f") - self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "g") - self.assertEqual(get_cell_by_position(document, 0, 1, 4).getString(), "s") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #In column A enter: Number; 3; 4; 6; 2 / In column B enter: Misc; s; d; f; g + enter_text_to_cell(gridwin, "A1", "Number") + enter_text_to_cell(gridwin, "A2", "3") + enter_text_to_cell(gridwin, "A3", "4") + enter_text_to_cell(gridwin, "A4", "6") + enter_text_to_cell(gridwin, "A5", "2") + enter_text_to_cell(gridwin, "B1", "Misc") + enter_text_to_cell(gridwin, "B2", "s") + enter_text_to_cell(gridwin, "B3", "d") + enter_text_to_cell(gridwin, "B4", "f") + enter_text_to_cell(gridwin, "B5", "g") + #Select cell A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #Press toolbarbutton for descending sorting .uno:SortDescending + self.xUITest.executeCommand(".uno:SortDescending") + #Verify that the sortorder was determined for column A (Number;2;3;4;6) + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Number") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 6) + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 4) + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 2) + #UNDO + self.xUITest.executeCommand(".uno:Undo") + #Select cell B3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"})) + #Press toolbar button for ascending sorting + self.xUITest.executeCommand(".uno:SortAscending") + #Verify that the sortorder was determined for column B (Misc;s;g;f;d) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Misc") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "d") + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "f") + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "g") + self.assertEqual(get_cell_by_position(document, 0, 1, 4).getString(), "s") + + self.ui_test.close_doc() def test_Sorting_default_to_selected_TAB_A_column(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #In column A enter: Number; 3; 4; 6; 2 / In column B enter: Misc; s; d; f; g - enter_text_to_cell(gridwin, "A1", "Number") - enter_text_to_cell(gridwin, "A2", "3") - enter_text_to_cell(gridwin, "A3", "4") - enter_text_to_cell(gridwin, "A4", "6") - enter_text_to_cell(gridwin, "A5", "2") - enter_text_to_cell(gridwin, "B1", "Misc") - enter_text_to_cell(gridwin, "B2", "s") - enter_text_to_cell(gridwin, "B3", "d") - enter_text_to_cell(gridwin, "B4", "f") - enter_text_to_cell(gridwin, "B5", "g") - #Select Range A1:B5 - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B5"})) - #Move the active cell inside the range to column A by using the TAB key - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) - #Press toolbar button for ascending sorting - self.xUITest.executeCommand(".uno:SortAscending") - #Verify that the sortorder was determined for column A (Number;2;3;4;6) - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Number") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2) - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3) - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4) - self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 6) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #In column A enter: Number; 3; 4; 6; 2 / In column B enter: Misc; s; d; f; g + enter_text_to_cell(gridwin, "A1", "Number") + enter_text_to_cell(gridwin, "A2", "3") + enter_text_to_cell(gridwin, "A3", "4") + enter_text_to_cell(gridwin, "A4", "6") + enter_text_to_cell(gridwin, "A5", "2") + enter_text_to_cell(gridwin, "B1", "Misc") + enter_text_to_cell(gridwin, "B2", "s") + enter_text_to_cell(gridwin, "B3", "d") + enter_text_to_cell(gridwin, "B4", "f") + enter_text_to_cell(gridwin, "B5", "g") + #Select Range A1:B5 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B5"})) + #Move the active cell inside the range to column A by using the TAB key + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + #Press toolbar button for ascending sorting + self.xUITest.executeCommand(".uno:SortAscending") + #Verify that the sortorder was determined for column A (Number;2;3;4;6) + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Number") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4) + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 6) + + self.ui_test.close_doc() def test_Sorting_default_to_selected_TAB_B_column(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #In column A enter: Number; 3; 4; 6; 2 / In column B enter: Misc; s; d; f; g - enter_text_to_cell(gridwin, "A1", "Number") - enter_text_to_cell(gridwin, "A2", "3") - enter_text_to_cell(gridwin, "A3", "4") - enter_text_to_cell(gridwin, "A4", "6") - enter_text_to_cell(gridwin, "A5", "2") - enter_text_to_cell(gridwin, "B1", "Misc") - enter_text_to_cell(gridwin, "B2", "s") - enter_text_to_cell(gridwin, "B3", "d") - enter_text_to_cell(gridwin, "B4", "f") - enter_text_to_cell(gridwin, "B5", "g") - #Select Range A1:B5 - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B5"})) - #Move the active cell inside the range to column B by using the TAB key - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) - #Press toolbar button for ascending sorting - self.xUITest.executeCommand(".uno:SortAscending") - #Verify that the sortorder was determined for column B (Misc;d;f;g;s) - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Misc") - self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "d") - self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "f") - self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "g") - self.assertEqual(get_cell_by_position(document, 0, 1, 4).getString(), "s") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #In column A enter: Number; 3; 4; 6; 2 / In column B enter: Misc; s; d; f; g + enter_text_to_cell(gridwin, "A1", "Number") + enter_text_to_cell(gridwin, "A2", "3") + enter_text_to_cell(gridwin, "A3", "4") + enter_text_to_cell(gridwin, "A4", "6") + enter_text_to_cell(gridwin, "A5", "2") + enter_text_to_cell(gridwin, "B1", "Misc") + enter_text_to_cell(gridwin, "B2", "s") + enter_text_to_cell(gridwin, "B3", "d") + enter_text_to_cell(gridwin, "B4", "f") + enter_text_to_cell(gridwin, "B5", "g") + #Select Range A1:B5 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B5"})) + #Move the active cell inside the range to column B by using the TAB key + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + #Press toolbar button for ascending sorting + self.xUITest.executeCommand(".uno:SortAscending") + #Verify that the sortorder was determined for column B (Misc;d;f;g;s) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Misc") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "d") + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "f") + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "g") + self.assertEqual(get_cell_by_position(document, 0, 1, 4).getString(), "s") + + self.ui_test.close_doc() def test_Sorting_sort_criteria(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #In column A enter: Number; 3; 4; 6; 2 / In column B enter: Misc; s; d; f; g - enter_text_to_cell(gridwin, "A1", "Number") - enter_text_to_cell(gridwin, "A2", "3") - enter_text_to_cell(gridwin, "A3", "4") - enter_text_to_cell(gridwin, "A4", "6") - enter_text_to_cell(gridwin, "A5", "2") - enter_text_to_cell(gridwin, "B1", "Misc") - enter_text_to_cell(gridwin, "B2", "s") - enter_text_to_cell(gridwin, "B3", "d") - enter_text_to_cell(gridwin, "B4", "f") - enter_text_to_cell(gridwin, "B5", "g") - #Select cell A3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - #Open sort dialog by DATA - SORT - self.ui_test.execute_dialog_through_command(".uno:DataSort") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - #Verify that the first sort criteria is set to "Number(ascending)" - xSortKey1 = xDialog.getChild("sortlb") - xAsc = xDialog.getChild("up") - self.assertEqual(get_state_as_dict(xSortKey1)["SelectEntryText"], "Number") - self.assertEqual(get_state_as_dict(xAsc)["Checked"], "true") - #Cancel dialog - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) - #Select cell B3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"})) - #Open sort dialog by DATA - SORT - self.ui_test.execute_dialog_through_command(".uno:DataSort") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - #Verify that the first sort criteria is set to "Misc (ascending)" - xSortKey1 = xDialog.getChild("sortlb") - xAsc = xDialog.getChild("up") - self.assertEqual(get_state_as_dict(xSortKey1)["SelectEntryText"], "Misc") - self.assertEqual(get_state_as_dict(xAsc)["Checked"], "true") - #Cancel dialog - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) - #Select Range A1:B5 - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B5"})) - #Move the active cell inside the range to column A by using the TAB key - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) - #Open sort dialog by DATA - SORT - self.ui_test.execute_dialog_through_command(".uno:DataSort") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - #Verify that the first sort criteria is set to "Number(ascending)" - xSortKey1 = xDialog.getChild("sortlb") - xAsc = xDialog.getChild("up") - self.assertEqual(get_state_as_dict(xSortKey1)["SelectEntryText"], "Number") - self.assertEqual(get_state_as_dict(xAsc)["Checked"], "true") - #Cancel dialog - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) - #Select Range A1:B5 - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B5"})) - #Move the active cell inside the range to column B by using the TAB key - gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) - #Open sort dialog by DATA - SORT - self.ui_test.execute_dialog_through_command(".uno:DataSort") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - #Verify that the first sort criteria is set to "Misc (ascending)" - xSortKey1 = xDialog.getChild("sortlb") - xAsc = xDialog.getChild("up") - self.assertEqual(get_state_as_dict(xSortKey1)["SelectEntryText"], "Misc") - self.assertEqual(get_state_as_dict(xAsc)["Checked"], "true") - #Cancel dialog - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #In column A enter: Number; 3; 4; 6; 2 / In column B enter: Misc; s; d; f; g + enter_text_to_cell(gridwin, "A1", "Number") + enter_text_to_cell(gridwin, "A2", "3") + enter_text_to_cell(gridwin, "A3", "4") + enter_text_to_cell(gridwin, "A4", "6") + enter_text_to_cell(gridwin, "A5", "2") + enter_text_to_cell(gridwin, "B1", "Misc") + enter_text_to_cell(gridwin, "B2", "s") + enter_text_to_cell(gridwin, "B3", "d") + enter_text_to_cell(gridwin, "B4", "f") + enter_text_to_cell(gridwin, "B5", "g") + #Select cell A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #Open sort dialog by DATA - SORT + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + #Verify that the first sort criteria is set to "Number(ascending)" + xSortKey1 = xDialog.getChild("sortlb") + xAsc = xDialog.getChild("up") + self.assertEqual(get_state_as_dict(xSortKey1)["SelectEntryText"], "Number") + self.assertEqual(get_state_as_dict(xAsc)["Checked"], "true") + #Cancel dialog + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + #Select cell B3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"})) + #Open sort dialog by DATA - SORT + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + #Verify that the first sort criteria is set to "Misc (ascending)" + xSortKey1 = xDialog.getChild("sortlb") + xAsc = xDialog.getChild("up") + self.assertEqual(get_state_as_dict(xSortKey1)["SelectEntryText"], "Misc") + self.assertEqual(get_state_as_dict(xAsc)["Checked"], "true") + #Cancel dialog + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + #Select Range A1:B5 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B5"})) + #Move the active cell inside the range to column A by using the TAB key + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + #Open sort dialog by DATA - SORT + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + #Verify that the first sort criteria is set to "Number(ascending)" + xSortKey1 = xDialog.getChild("sortlb") + xAsc = xDialog.getChild("up") + self.assertEqual(get_state_as_dict(xSortKey1)["SelectEntryText"], "Number") + self.assertEqual(get_state_as_dict(xAsc)["Checked"], "true") + #Cancel dialog + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + #Select Range A1:B5 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B5"})) + #Move the active cell inside the range to column B by using the TAB key + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + #Open sort dialog by DATA - SORT + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + #Verify that the first sort criteria is set to "Misc (ascending)" + xSortKey1 = xDialog.getChild("sortlb") + xAsc = xDialog.getChild("up") + self.assertEqual(get_state_as_dict(xSortKey1)["SelectEntryText"], "Misc") + self.assertEqual(get_state_as_dict(xAsc)["Checked"], "true") + #Cancel dialog + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/subtotals.py b/sc/qa/uitest/sort/subtotals.py index 5066d1d6dea9..1445a1d87dc2 100644 --- a/sc/qa/uitest/sort/subtotals.py +++ b/sc/qa/uitest/sort/subtotals.py @@ -17,34 +17,36 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file class Subtotals(UITestCase): def test_tdf114720(self): - with self.ui_test.create_doc_in_start_center("calc"): - XcalcDoc = self.xUITest.getTopFocusWindow() - document = self.ui_test.get_component() - gridwin = XcalcDoc.getChild("grid_window") - - enter_text_to_cell(gridwin, "A1", "1") - enter_text_to_cell(gridwin, "A2", "1") - enter_text_to_cell(gridwin, "A3", "1") - enter_text_to_cell(gridwin, "A4", "1") - enter_text_to_cell(gridwin, "A5", "1") - enter_text_to_cell(gridwin, "A6", "1") - enter_text_to_cell(gridwin, "A7", "1") - enter_text_to_cell(gridwin, "A8", "1") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A9"})) - - self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") - xDialog = self.xUITest.getTopFocusWindow() - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 1) - self.assertEqual(get_cell_by_position(document, 0, 0, 8).getString(), "") - - # check cancel button - self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + XcalcDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + gridwin = XcalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "1") + enter_text_to_cell(gridwin, "A3", "1") + enter_text_to_cell(gridwin, "A4", "1") + enter_text_to_cell(gridwin, "A5", "1") + enter_text_to_cell(gridwin, "A6", "1") + enter_text_to_cell(gridwin, "A7", "1") + enter_text_to_cell(gridwin, "A8", "1") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A9"})) + + self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") + xDialog = self.xUITest.getTopFocusWindow() + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 0, 8).getString(), "") + + # check cancel button + self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() def test_tdf88792(self): with self.ui_test.load_file(get_url_for_data_file("tdf88792.ods")) as calc_doc: diff --git a/sc/qa/uitest/sort/tdf100517.py b/sc/qa/uitest/sort/tdf100517.py index b4daacccac92..defbb4a47cc6 100644 --- a/sc/qa/uitest/sort/tdf100517.py +++ b/sc/qa/uitest/sort/tdf100517.py @@ -30,49 +30,51 @@ class tdf100517(UITestCase): self.ui_test.close_dialog_through_button(xOk) def test_tdf100517(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "Text 2") - enter_text_to_cell(gridwin, "A2", "Text 3") - enter_text_to_cell(gridwin, "A3", "Text 1") + enter_text_to_cell(gridwin, "A1", "Text 2") + enter_text_to_cell(gridwin, "A2", "Text 3") + enter_text_to_cell(gridwin, "A3", "Text 1") - for i in ['B1', 'B2', 'B3']: - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": i})) - xArgs = mkPropertyValues({"Text": i}) + for i in ['B1', 'B2', 'B3']: + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": i})) + xArgs = mkPropertyValues({"Text": i}) - self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) - self.execute_sort_dialog(gridwin, "true") + self.execute_sort_dialog(gridwin, "true") - self.assertEqual("Text 1", get_cell_by_position(document, 0, 0, 0).getString()) - self.assertEqual("Text 2", get_cell_by_position(document, 0, 0, 1).getString()) - self.assertEqual("Text 3", get_cell_by_position(document, 0, 0, 2).getString()) + self.assertEqual("Text 1", get_cell_by_position(document, 0, 0, 0).getString()) + self.assertEqual("Text 2", get_cell_by_position(document, 0, 0, 1).getString()) + self.assertEqual("Text 3", get_cell_by_position(document, 0, 0, 2).getString()) - self.assertEqual("B3", get_cell_by_position(document, 0, 1, 0).Annotation.String) - self.assertEqual("B1", get_cell_by_position(document, 0, 1, 1).Annotation.String) - self.assertEqual("B2", get_cell_by_position(document, 0, 1, 2).Annotation.String) + self.assertEqual("B3", get_cell_by_position(document, 0, 1, 0).Annotation.String) + self.assertEqual("B1", get_cell_by_position(document, 0, 1, 1).Annotation.String) + self.assertEqual("B2", get_cell_by_position(document, 0, 1, 2).Annotation.String) - self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") - self.assertEqual("Text 2", get_cell_by_position(document, 0, 0, 0).getString()) - self.assertEqual("Text 3", get_cell_by_position(document, 0, 0, 1).getString()) - self.assertEqual("Text 1", get_cell_by_position(document, 0, 0, 2).getString()) + self.assertEqual("Text 2", get_cell_by_position(document, 0, 0, 0).getString()) + self.assertEqual("Text 3", get_cell_by_position(document, 0, 0, 1).getString()) + self.assertEqual("Text 1", get_cell_by_position(document, 0, 0, 2).getString()) - self.assertEqual("B1", get_cell_by_position(document, 0, 1, 0).Annotation.String) - self.assertEqual("B2", get_cell_by_position(document, 0, 1, 1).Annotation.String) - self.assertEqual("B3", get_cell_by_position(document, 0, 1, 2).Annotation.String) + self.assertEqual("B1", get_cell_by_position(document, 0, 1, 0).Annotation.String) + self.assertEqual("B2", get_cell_by_position(document, 0, 1, 1).Annotation.String) + self.assertEqual("B3", get_cell_by_position(document, 0, 1, 2).Annotation.String) - self.execute_sort_dialog(gridwin, "false") + self.execute_sort_dialog(gridwin, "false") - self.assertEqual("Text 1", get_cell_by_position(document, 0, 0, 0).getString()) - self.assertEqual("Text 2", get_cell_by_position(document, 0, 0, 1).getString()) - self.assertEqual("Text 3", get_cell_by_position(document, 0, 0, 2).getString()) + self.assertEqual("Text 1", get_cell_by_position(document, 0, 0, 0).getString()) + self.assertEqual("Text 2", get_cell_by_position(document, 0, 0, 1).getString()) + self.assertEqual("Text 3", get_cell_by_position(document, 0, 0, 2).getString()) - self.assertEqual("B1", get_cell_by_position(document, 0, 1, 0).Annotation.String) - self.assertEqual("B2", get_cell_by_position(document, 0, 1, 1).Annotation.String) - self.assertEqual("B3", get_cell_by_position(document, 0, 1, 2).Annotation.String) + self.assertEqual("B1", get_cell_by_position(document, 0, 1, 0).Annotation.String) + self.assertEqual("B2", get_cell_by_position(document, 0, 1, 1).Annotation.String) + self.assertEqual("B3", get_cell_by_position(document, 0, 1, 2).Annotation.String) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/tdf126678.py b/sc/qa/uitest/sort/tdf126678.py index 4c7e360957eb..0d63c8c35dd0 100644 --- a/sc/qa/uitest/sort/tdf126678.py +++ b/sc/qa/uitest/sort/tdf126678.py @@ -30,44 +30,46 @@ class tdf126678(UITestCase): self.ui_test.close_dialog_through_button(xOk) def test_tdf126678(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "Text 2") - enter_text_to_cell(gridwin, "A2", "Text 3") - enter_text_to_cell(gridwin, "A3", "Text 1") + enter_text_to_cell(gridwin, "A1", "Text 2") + enter_text_to_cell(gridwin, "A2", "Text 3") + enter_text_to_cell(gridwin, "A3", "Text 1") - # Set the background of the corresponding cell - colorProperty = mkPropertyValues({"BackgroundColor": 16776960}) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) - self.xUITest.executeCommandWithParameters(".uno:BackgroundColor", colorProperty) + # Set the background of the corresponding cell + colorProperty = mkPropertyValues({"BackgroundColor": 16776960}) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) + self.xUITest.executeCommandWithParameters(".uno:BackgroundColor", colorProperty) - self.execute_sort_dialog(gridwin, "false") + self.execute_sort_dialog(gridwin, "false") - self.assertEqual("Text 1", get_cell_by_position(document, 0, 0, 0).getString()) - self.assertEqual("Text 2", get_cell_by_position(document, 0, 0, 1).getString()) - self.assertEqual("Text 3", get_cell_by_position(document, 0, 0, 2).getString()) + self.assertEqual("Text 1", get_cell_by_position(document, 0, 0, 0).getString()) + self.assertEqual("Text 2", get_cell_by_position(document, 0, 0, 1).getString()) + self.assertEqual("Text 3", get_cell_by_position(document, 0, 0, 2).getString()) - # Sorting without option "including formats" does not include cells with cell formats - self.assertEqual(get_cell_by_position(document, 0, 1, 0).CellBackColor, -1) - self.assertEqual(get_cell_by_position(document, 0, 1, 1).CellBackColor, 16776960) - self.assertEqual(get_cell_by_position(document, 0, 1, 2).CellBackColor, -1) + # Sorting without option "including formats" does not include cells with cell formats + self.assertEqual(get_cell_by_position(document, 0, 1, 0).CellBackColor, -1) + self.assertEqual(get_cell_by_position(document, 0, 1, 1).CellBackColor, 16776960) + self.assertEqual(get_cell_by_position(document, 0, 1, 2).CellBackColor, -1) - self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") - self.execute_sort_dialog(gridwin, "true") + self.execute_sort_dialog(gridwin, "true") - self.assertEqual("Text 1", get_cell_by_position(document, 0, 0, 0).getString()) - self.assertEqual("Text 2", get_cell_by_position(document, 0, 0, 1).getString()) - self.assertEqual("Text 3", get_cell_by_position(document, 0, 0, 2).getString()) + self.assertEqual("Text 1", get_cell_by_position(document, 0, 0, 0).getString()) + self.assertEqual("Text 2", get_cell_by_position(document, 0, 0, 1).getString()) + self.assertEqual("Text 3", get_cell_by_position(document, 0, 0, 2).getString()) - # Sorting with option "including formats" includes all cells with visible cell formats - # tdf126678 - Without the fix in place, the test would have failed with - # AssertionError: -1 != 16776960 - self.assertEqual(get_cell_by_position(document, 0, 1, 0).CellBackColor, -1) - self.assertEqual(get_cell_by_position(document, 0, 1, 1).CellBackColor, -1) - self.assertEqual(get_cell_by_position(document, 0, 1, 2).CellBackColor, 16776960) + # Sorting with option "including formats" includes all cells with visible cell formats + # tdf126678 - Without the fix in place, the test would have failed with + # AssertionError: -1 != 16776960 + self.assertEqual(get_cell_by_position(document, 0, 1, 0).CellBackColor, -1) + self.assertEqual(get_cell_by_position(document, 0, 1, 1).CellBackColor, -1) + self.assertEqual(get_cell_by_position(document, 0, 1, 2).CellBackColor, 16776960) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/tdf53482.py b/sc/qa/uitest/sort/tdf53482.py index c9d5093e8fba..2058f1888f93 100644 --- a/sc/qa/uitest/sort/tdf53482.py +++ b/sc/qa/uitest/sort/tdf53482.py @@ -48,40 +48,42 @@ class tdf53482(UITestCase): self.assertEqual(get_cell_by_position(document, 0, 6, 123).getString(), "13") def test_tdf53482_Range_contains_column_headings(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #In column A enter: Misc; s; d; f; g - enter_text_to_cell(gridwin, "A1", "Misc") - enter_text_to_cell(gridwin, "A2", "s") - enter_text_to_cell(gridwin, "A3", "d") - enter_text_to_cell(gridwin, "A4", "f") - enter_text_to_cell(gridwin, "A5", "g") - #1. Highlight cells to be sorted - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"})) - #2. Click Data menu, Sort - self.ui_test.execute_dialog_through_command(".uno:DataSort") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - #3. On Options tab, tick 'Range contains column labels' - xHeader = xDialog.getChild("header") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #In column A enter: Misc; s; d; f; g + enter_text_to_cell(gridwin, "A1", "Misc") + enter_text_to_cell(gridwin, "A2", "s") + enter_text_to_cell(gridwin, "A3", "d") + enter_text_to_cell(gridwin, "A4", "f") + enter_text_to_cell(gridwin, "A5", "g") + #1. Highlight cells to be sorted + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"})) + #2. Click Data menu, Sort + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + #3. On Options tab, tick 'Range contains column labels' + xHeader = xDialog.getChild("header") + xHeader.executeAction("CLICK", tuple()) + if (get_state_as_dict(xHeader)["Selected"]) == "false": xHeader.executeAction("CLICK", tuple()) - if (get_state_as_dict(xHeader)["Selected"]) == "false": - xHeader.executeAction("CLICK", tuple()) - #4. On Sort Criteria tab, set appropriate criteria - select_pos(xTabs, "0") - xDown = xDialog.getChild("down") - xDown.executeAction("CLICK", tuple()) - #5. Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - #6. Expected behavior: Ignore column labels when sorting - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Misc") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "s") - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "g") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "f") - self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "d") + #4. On Sort Criteria tab, set appropriate criteria + select_pos(xTabs, "0") + xDown = xDialog.getChild("down") + xDown.executeAction("CLICK", tuple()) + #5. Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #6. Expected behavior: Ignore column labels when sorting + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Misc") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "s") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "g") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "f") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "d") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/tdf91305.py b/sc/qa/uitest/sort/tdf91305.py index ffb79b332fb6..340efdb3a531 100644 --- a/sc/qa/uitest/sort/tdf91305.py +++ b/sc/qa/uitest/sort/tdf91305.py @@ -18,119 +18,123 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf91305(UITestCase): def test_tdf91305_sort_text_cells_rows(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #In column A enter texts - enter_text_to_cell(gridwin, "A1", "cc") - enter_text_to_cell(gridwin, "A2", "ff") - enter_text_to_cell(gridwin, "A3", "aa") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #In column A enter texts + enter_text_to_cell(gridwin, "A1", "cc") + enter_text_to_cell(gridwin, "A2", "ff") + enter_text_to_cell(gridwin, "A3", "aa") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"})) - #Press toolbarbutton for ascending sorting .uno:SortAsc - self.xUITest.executeCommand(".uno:SortAscending") - #verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "aa") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "cc") - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "ff") - #Press toolbarbutton for descending sorting .uno:SortDescending - self.xUITest.executeCommand(".uno:SortDescending") - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "ff") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "cc") - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "aa") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"})) + #Press toolbarbutton for ascending sorting .uno:SortAsc + self.xUITest.executeCommand(".uno:SortAscending") + #verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "aa") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "cc") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "ff") + #Press toolbarbutton for descending sorting .uno:SortDescending + self.xUITest.executeCommand(".uno:SortDescending") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "ff") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "cc") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "aa") def test_tdf91305_sort_text_cells_columns(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #In column A enter texts - enter_text_to_cell(gridwin, "A1", "cc") - enter_text_to_cell(gridwin, "B1", "ff") - enter_text_to_cell(gridwin, "C1", "aa") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #In column A enter texts + enter_text_to_cell(gridwin, "A1", "cc") + enter_text_to_cell(gridwin, "B1", "ff") + enter_text_to_cell(gridwin, "C1", "aa") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C1"})) - #Open sort dialog by DATA - SORT - self.ui_test.execute_dialog_through_command(".uno:DataSort") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - xleftright = xDialog.getChild("leftright") - select_pos(xTabs, "1") - xleftright.executeAction("CLICK", tuple()) - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - #verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "aa") - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "cc") - self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "ff") - #Open sort dialog by DATA - SORT - self.ui_test.execute_dialog_through_command(".uno:DataSort") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - xleftright = xDialog.getChild("leftright") - xdown = xDialog.getChild("down") - select_pos(xTabs, "1") - xleftright.executeAction("CLICK", tuple()) - select_pos(xTabs, "0") - xdown.executeAction("CLICK", tuple()) - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "ff") - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "cc") - self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "aa") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C1"})) + #Open sort dialog by DATA - SORT + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + xleftright = xDialog.getChild("leftright") + select_pos(xTabs, "1") + xleftright.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "aa") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "cc") + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "ff") + #Open sort dialog by DATA - SORT + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + xleftright = xDialog.getChild("leftright") + xdown = xDialog.getChild("down") + select_pos(xTabs, "1") + xleftright.executeAction("CLICK", tuple()) + select_pos(xTabs, "0") + xdown.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "ff") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "cc") + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "aa") + self.ui_test.close_doc() #comment 6 - Additional sub-bugs: def test_tdf91305_sort_text_cells_rows(self): #Selecting some empty cells and pressing SORT causes empty cells to move below. #No matter if you sort from A to Z or from Z to A. - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #In column A enter text - enter_text_to_cell(gridwin, "A5", "ff") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) - #sorting - self.xUITest.executeCommand(".uno:SortAscending") - self.xUITest.executeCommand(".uno:SortDescending") - #verify - self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "ff") - # Assert that the correct range has been selected - gridWinState = get_state_as_dict(gridwin) - self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A1:Sheet1.A4") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #In column A enter text + enter_text_to_cell(gridwin, "A5", "ff") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + #sorting + self.xUITest.executeCommand(".uno:SortAscending") + self.xUITest.executeCommand(".uno:SortDescending") + #verify + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "ff") + # Assert that the correct range has been selected + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A1:Sheet1.A4") + + self.ui_test.close_doc() #2) Placing digit to the header position and running set of sorts will make digit to be on 2nd or last position. def test_tdf91305_sort_text_cells_1st_row_digit(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #In column A enter texts - enter_text_to_cell(gridwin, "A1", "1") - enter_text_to_cell(gridwin, "A2", "ff") - enter_text_to_cell(gridwin, "A3", "aa") - enter_text_to_cell(gridwin, "A4", "cc") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #In column A enter texts + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "ff") + enter_text_to_cell(gridwin, "A3", "aa") + enter_text_to_cell(gridwin, "A4", "cc") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) - #Press toolbarbutton for ascending sorting .uno:SortAsc - self.xUITest.executeCommand(".uno:SortAscending") - #verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "1") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "aa") - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "cc") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "ff") - #Press toolbarbutton for descending sorting .uno:SortDescending - self.xUITest.executeCommand(".uno:SortDescending") - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "ff") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "cc") - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "aa") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "1") - #Undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "1") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "aa") - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "cc") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "ff") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + #Press toolbarbutton for ascending sorting .uno:SortAsc + self.xUITest.executeCommand(".uno:SortAscending") + #verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "1") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "aa") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "cc") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "ff") + #Press toolbarbutton for descending sorting .uno:SortDescending + self.xUITest.executeCommand(".uno:SortDescending") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "ff") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "cc") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "aa") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "1") + #Undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "1") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "aa") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "cc") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "ff") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/tdf99773.py b/sc/qa/uitest/sort/tdf99773.py index 1dbde186930f..099788fa1428 100644 --- a/sc/qa/uitest/sort/tdf99773.py +++ b/sc/qa/uitest/sort/tdf99773.py @@ -17,35 +17,36 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf99773(UITestCase): def test_tdf99773_natural_sorting_space(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #enter data - enter_text_to_cell(gridwin, "A1", "A 11") - enter_text_to_cell(gridwin, "A2", "A 2") - enter_text_to_cell(gridwin, "A3", "B 2") - enter_text_to_cell(gridwin, "A4", "A 5") - enter_text_to_cell(gridwin, "A5", "A 50") - enter_text_to_cell(gridwin, "A6", "B 20") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #enter data + enter_text_to_cell(gridwin, "A1", "A 11") + enter_text_to_cell(gridwin, "A2", "A 2") + enter_text_to_cell(gridwin, "A3", "B 2") + enter_text_to_cell(gridwin, "A4", "A 5") + enter_text_to_cell(gridwin, "A5", "A 50") + enter_text_to_cell(gridwin, "A6", "B 20") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A6"})) - #Open sort dialog by DATA - SORT - self.ui_test.execute_dialog_through_command(".uno:DataSort") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - xNatural = xDialog.getChild("naturalsort") - if (get_state_as_dict(xNatural)["Selected"]) == "false": - xNatural.executeAction("CLICK", tuple()) - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A 2") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "A 5") - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "A 11") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "A 50") - self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "B 2") - self.assertEqual(get_cell_by_position(document, 0, 0, 5).getString(), "B 20") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A6"})) + #Open sort dialog by DATA - SORT + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + xNatural = xDialog.getChild("naturalsort") + if (get_state_as_dict(xNatural)["Selected"]) == "false": + xNatural.executeAction("CLICK", tuple()) + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A 2") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "A 5") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "A 11") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "A 50") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "B 2") + self.assertEqual(get_cell_by_position(document, 0, 0, 5).getString(), "B 20") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/anova.py b/sc/qa/uitest/statistics/anova.py index 0b0fd8579342..579b9d29014d 100644 --- a/sc/qa/uitest/statistics/anova.py +++ b/sc/qa/uitest/statistics/anova.py @@ -16,131 +16,132 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class anova(UITestCase): def test_statistic_anova(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #fill data - enter_text_to_cell(gridwin, "A1", "Maths") - enter_text_to_cell(gridwin, "A2", "47") - enter_text_to_cell(gridwin, "A3", "36") - enter_text_to_cell(gridwin, "A4", "40") - enter_text_to_cell(gridwin, "A5", "39") - enter_text_to_cell(gridwin, "A7", "47") - enter_text_to_cell(gridwin, "A8", "29") - enter_text_to_cell(gridwin, "A9", "27") - enter_text_to_cell(gridwin, "A10", "57") - enter_text_to_cell(gridwin, "A11", "56") - enter_text_to_cell(gridwin, "A12", "57") - enter_text_to_cell(gridwin, "A13", "26") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #fill data + enter_text_to_cell(gridwin, "A1", "Maths") + enter_text_to_cell(gridwin, "A2", "47") + enter_text_to_cell(gridwin, "A3", "36") + enter_text_to_cell(gridwin, "A4", "40") + enter_text_to_cell(gridwin, "A5", "39") + enter_text_to_cell(gridwin, "A7", "47") + enter_text_to_cell(gridwin, "A8", "29") + enter_text_to_cell(gridwin, "A9", "27") + enter_text_to_cell(gridwin, "A10", "57") + enter_text_to_cell(gridwin, "A11", "56") + enter_text_to_cell(gridwin, "A12", "57") + enter_text_to_cell(gridwin, "A13", "26") - enter_text_to_cell(gridwin, "B1", "Physics") - enter_text_to_cell(gridwin, "B2", "67") - enter_text_to_cell(gridwin, "B3", "68") - enter_text_to_cell(gridwin, "B4", "65") - enter_text_to_cell(gridwin, "B5", "64") - enter_text_to_cell(gridwin, "B6", "38") - enter_text_to_cell(gridwin, "B7", "84") - enter_text_to_cell(gridwin, "B8", "80") - enter_text_to_cell(gridwin, "B9", "49") - enter_text_to_cell(gridwin, "B10", "49") - enter_text_to_cell(gridwin, "B11", "33") + enter_text_to_cell(gridwin, "B1", "Physics") + enter_text_to_cell(gridwin, "B2", "67") + enter_text_to_cell(gridwin, "B3", "68") + enter_text_to_cell(gridwin, "B4", "65") + enter_text_to_cell(gridwin, "B5", "64") + enter_text_to_cell(gridwin, "B6", "38") + enter_text_to_cell(gridwin, "B7", "84") + enter_text_to_cell(gridwin, "B8", "80") + enter_text_to_cell(gridwin, "B9", "49") + enter_text_to_cell(gridwin, "B10", "49") + enter_text_to_cell(gridwin, "B11", "33") - enter_text_to_cell(gridwin, "C1", "Biology") - enter_text_to_cell(gridwin, "C2", "33") - enter_text_to_cell(gridwin, "C3", "42") - enter_text_to_cell(gridwin, "C4", "44") - enter_text_to_cell(gridwin, "C5", "60") - enter_text_to_cell(gridwin, "C6", "43") - enter_text_to_cell(gridwin, "C7", "62") - enter_text_to_cell(gridwin, "C8", "51") - enter_text_to_cell(gridwin, "C9", "40") - enter_text_to_cell(gridwin, "C10", "12") - enter_text_to_cell(gridwin, "C11", "60") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:C13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:AnalysisOfVarianceDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xradiotwofactor = xDialog.getChild("radio-two-factor") - xradiosinglefactor = xDialog.getChild("radio-single-factor") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xalphaspin = xDialog.getChild("alpha-spin") + enter_text_to_cell(gridwin, "C1", "Biology") + enter_text_to_cell(gridwin, "C2", "33") + enter_text_to_cell(gridwin, "C3", "42") + enter_text_to_cell(gridwin, "C4", "44") + enter_text_to_cell(gridwin, "C5", "60") + enter_text_to_cell(gridwin, "C6", "43") + enter_text_to_cell(gridwin, "C7", "62") + enter_text_to_cell(gridwin, "C8", "51") + enter_text_to_cell(gridwin, "C9", "40") + enter_text_to_cell(gridwin, "C10", "12") + enter_text_to_cell(gridwin, "C11", "60") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:C13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:AnalysisOfVarianceDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xradiotwofactor = xDialog.getChild("radio-two-factor") + xradiosinglefactor = xDialog.getChild("radio-single-factor") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xalphaspin = xDialog.getChild("alpha-spin") - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$2:$C$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) - xradiosinglefactor.executeAction("CLICK", tuple()) - xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xalphaspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.05"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "ANOVA - Single Factor") - self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") - self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Groups") - self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Column 1") - self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Column 2") - self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "Column 3") - self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "Source of Variation") - self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "Between Groups") - self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "Within Groups") - self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "Total") + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$2:$C$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xradiosinglefactor.executeAction("CLICK", tuple()) + xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xalphaspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.05"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "ANOVA - Single Factor") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Groups") + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Column 1") + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Column 2") + self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "Column 3") + self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "Source of Variation") + self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "Between Groups") + self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "Within Groups") + self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "Total") - self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05) - self.assertEqual(get_cell_by_position(document, 0, 6, 3).getString(), "Count") - self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue(), 11) - self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 10) - self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 10) - self.assertEqual(get_cell_by_position(document, 0, 6, 8).getString(), "SS") - self.assertEqual(round(get_cell_by_position(document, 0, 6, 9).getValue(),11), 1876.56832844575) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 10).getValue(),10), 6025.1090909091) - #bug 80583 - self.assertEqual(round(get_cell_by_position(document, 0, 6, 11).getValue(),11), 7901.67741935484) + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05) + self.assertEqual(get_cell_by_position(document, 0, 6, 3).getString(), "Count") + self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue(), 11) + self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 10) + self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 10) + self.assertEqual(get_cell_by_position(document, 0, 6, 8).getString(), "SS") + self.assertEqual(round(get_cell_by_position(document, 0, 6, 9).getValue(),11), 1876.56832844575) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 10).getValue(),10), 6025.1090909091) + #bug 80583 + self.assertEqual(round(get_cell_by_position(document, 0, 6, 11).getValue(),11), 7901.67741935484) - self.assertEqual(get_cell_by_position(document, 0, 7, 3).getString(), "Sum") - self.assertEqual(get_cell_by_position(document, 0, 7, 4).getValue(), 461) - self.assertEqual(get_cell_by_position(document, 0, 7, 5).getValue(), 597) - self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue(), 447) - self.assertEqual(get_cell_by_position(document, 0, 7, 8).getString(), "df") - self.assertEqual(get_cell_by_position(document, 0, 7, 9).getValue(), 2) - self.assertEqual(get_cell_by_position(document, 0, 7, 10).getValue(), 28) - self.assertEqual(get_cell_by_position(document, 0, 7, 11).getValue(), 30) + self.assertEqual(get_cell_by_position(document, 0, 7, 3).getString(), "Sum") + self.assertEqual(get_cell_by_position(document, 0, 7, 4).getValue(), 461) + self.assertEqual(get_cell_by_position(document, 0, 7, 5).getValue(), 597) + self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue(), 447) + self.assertEqual(get_cell_by_position(document, 0, 7, 8).getString(), "df") + self.assertEqual(get_cell_by_position(document, 0, 7, 9).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 7, 10).getValue(), 28) + self.assertEqual(get_cell_by_position(document, 0, 7, 11).getValue(), 30) - self.assertEqual(get_cell_by_position(document, 0, 8, 3).getString(), "Mean") - self.assertEqual(round(get_cell_by_position(document, 0, 8, 4).getValue(), 12), 41.909090909091) - self.assertEqual(get_cell_by_position(document, 0, 8, 5).getValue(), 59.7) - self.assertEqual(get_cell_by_position(document, 0, 8, 6).getValue(), 44.7) - self.assertEqual(get_cell_by_position(document, 0, 8, 8).getString(), "MS") - self.assertEqual(round(get_cell_by_position(document, 0, 8, 9).getValue(),11), 938.28416422287) - self.assertEqual(round(get_cell_by_position(document, 0, 8, 10).getValue(),11), 215.18246753247) + self.assertEqual(get_cell_by_position(document, 0, 8, 3).getString(), "Mean") + self.assertEqual(round(get_cell_by_position(document, 0, 8, 4).getValue(), 12), 41.909090909091) + self.assertEqual(get_cell_by_position(document, 0, 8, 5).getValue(), 59.7) + self.assertEqual(get_cell_by_position(document, 0, 8, 6).getValue(), 44.7) + self.assertEqual(get_cell_by_position(document, 0, 8, 8).getString(), "MS") + self.assertEqual(round(get_cell_by_position(document, 0, 8, 9).getValue(),11), 938.28416422287) + self.assertEqual(round(get_cell_by_position(document, 0, 8, 10).getValue(),11), 215.18246753247) - self.assertEqual(get_cell_by_position(document, 0, 9, 3).getString(), "Variance") - self.assertEqual(round(get_cell_by_position(document, 0, 9, 4).getValue(),11), 139.49090909091) - self.assertEqual(round(get_cell_by_position(document, 0, 9, 5).getValue(),12), 287.122222222222) - self.assertEqual(round(get_cell_by_position(document, 0, 9, 6).getValue(),12), 227.344444444444) - self.assertEqual(get_cell_by_position(document, 0, 9, 8).getString(), "F") - self.assertEqual(round(get_cell_by_position(document, 0, 9, 9).getValue(),13), 4.3604117704492) + self.assertEqual(get_cell_by_position(document, 0, 9, 3).getString(), "Variance") + self.assertEqual(round(get_cell_by_position(document, 0, 9, 4).getValue(),11), 139.49090909091) + self.assertEqual(round(get_cell_by_position(document, 0, 9, 5).getValue(),12), 287.122222222222) + self.assertEqual(round(get_cell_by_position(document, 0, 9, 6).getValue(),12), 227.344444444444) + self.assertEqual(get_cell_by_position(document, 0, 9, 8).getString(), "F") + self.assertEqual(round(get_cell_by_position(document, 0, 9, 9).getValue(),13), 4.3604117704492) - self.assertEqual(get_cell_by_position(document, 0, 10, 8).getString(), "P-value") - self.assertEqual(round(get_cell_by_position(document, 0, 10, 9).getValue(),14), 0.02246149518798) + self.assertEqual(get_cell_by_position(document, 0, 10, 8).getString(), "P-value") + self.assertEqual(round(get_cell_by_position(document, 0, 10, 9).getValue(),14), 0.02246149518798) - self.assertEqual(get_cell_by_position(document, 0, 11, 8).getString(), "F critical") - self.assertEqual(round(get_cell_by_position(document, 0, 11, 9).getValue(),13), 3.3403855582378) + self.assertEqual(get_cell_by_position(document, 0, 11, 8).getString(), "F critical") + self.assertEqual(round(get_cell_by_position(document, 0, 11, 9).getValue(),13), 3.3403855582378) - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") - # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:AnalysisOfVarianceDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:AnalysisOfVarianceDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/chiSquare.py b/sc/qa/uitest/statistics/chiSquare.py index 03ead882bc8f..5016e71f861c 100644 --- a/sc/qa/uitest/statistics/chiSquare.py +++ b/sc/qa/uitest/statistics/chiSquare.py @@ -16,78 +16,80 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class chiSquare(UITestCase): def test_chiSquare(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #fill data - enter_text_to_cell(gridwin, "A1", "28") - enter_text_to_cell(gridwin, "A2", "26") - enter_text_to_cell(gridwin, "A3", "31") - enter_text_to_cell(gridwin, "A4", "23") - enter_text_to_cell(gridwin, "A5", "20") - enter_text_to_cell(gridwin, "A6", "27") - enter_text_to_cell(gridwin, "A7", "28") - enter_text_to_cell(gridwin, "A8", "14") - enter_text_to_cell(gridwin, "A9", "4") - enter_text_to_cell(gridwin, "A10", "0") - enter_text_to_cell(gridwin, "A11", "2") - enter_text_to_cell(gridwin, "A12", "8") - enter_text_to_cell(gridwin, "A13", "9") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #fill data + enter_text_to_cell(gridwin, "A1", "28") + enter_text_to_cell(gridwin, "A2", "26") + enter_text_to_cell(gridwin, "A3", "31") + enter_text_to_cell(gridwin, "A4", "23") + enter_text_to_cell(gridwin, "A5", "20") + enter_text_to_cell(gridwin, "A6", "27") + enter_text_to_cell(gridwin, "A7", "28") + enter_text_to_cell(gridwin, "A8", "14") + enter_text_to_cell(gridwin, "A9", "4") + enter_text_to_cell(gridwin, "A10", "0") + enter_text_to_cell(gridwin, "A11", "2") + enter_text_to_cell(gridwin, "A12", "8") + enter_text_to_cell(gridwin, "A13", "9") - enter_text_to_cell(gridwin, "B1", "19") - enter_text_to_cell(gridwin, "B2", "13") - enter_text_to_cell(gridwin, "B3", "12") - enter_text_to_cell(gridwin, "B4", "5") - enter_text_to_cell(gridwin, "B5", "34") - enter_text_to_cell(gridwin, "B6", "31") - enter_text_to_cell(gridwin, "B7", "31") - enter_text_to_cell(gridwin, "B8", "12") - enter_text_to_cell(gridwin, "B9", "24") - enter_text_to_cell(gridwin, "B10", "23") - enter_text_to_cell(gridwin, "B11", "19") - enter_text_to_cell(gridwin, "B12", "10") - enter_text_to_cell(gridwin, "B13", "33") + enter_text_to_cell(gridwin, "B1", "19") + enter_text_to_cell(gridwin, "B2", "13") + enter_text_to_cell(gridwin, "B3", "12") + enter_text_to_cell(gridwin, "B4", "5") + enter_text_to_cell(gridwin, "B5", "34") + enter_text_to_cell(gridwin, "B6", "31") + enter_text_to_cell(gridwin, "B7", "31") + enter_text_to_cell(gridwin, "B8", "12") + enter_text_to_cell(gridwin, "B9", "24") + enter_text_to_cell(gridwin, "B10", "23") + enter_text_to_cell(gridwin, "B11", "19") + enter_text_to_cell(gridwin, "B12", "10") + enter_text_to_cell(gridwin, "B13", "33") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:ChiSquareTestDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:ChiSquareTestDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) - xgroupedbycolumnsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Test of Independence (Chi-Square)") - self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Test of Independence (Chi-Square)") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") - self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "df") - self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "P-value") - self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Test Statistic") - self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Critical Value") + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "df") + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "P-value") + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Test Statistic") + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Critical Value") - self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05) - self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 12) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 4).getValue(),12), 91.687005584173) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 5).getValue(),12), 21.026069817483) + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05) + self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 12) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 4).getValue(),12), 91.687005584173) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 5).getValue(),12), 21.026069817483) - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") - # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:ChiSquareTestDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:ChiSquareTestDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/correlation.py b/sc/qa/uitest/statistics/correlation.py index 5a4b2a2e59a3..a005e7830c40 100644 --- a/sc/qa/uitest/statistics/correlation.py +++ b/sc/qa/uitest/statistics/correlation.py @@ -16,184 +16,187 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class correlation(UITestCase): def test_statistic_correlation_column(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #fill data - enter_text_to_cell(gridwin, "A1", "Maths") - enter_text_to_cell(gridwin, "A2", "47") - enter_text_to_cell(gridwin, "A3", "36") - enter_text_to_cell(gridwin, "A4", "40") - enter_text_to_cell(gridwin, "A5", "39") - enter_text_to_cell(gridwin, "A7", "47") - enter_text_to_cell(gridwin, "A8", "29") - enter_text_to_cell(gridwin, "A9", "27") - enter_text_to_cell(gridwin, "A10", "57") - enter_text_to_cell(gridwin, "A11", "56") - enter_text_to_cell(gridwin, "A12", "57") - enter_text_to_cell(gridwin, "A13", "26") - - enter_text_to_cell(gridwin, "B1", "Physics") - enter_text_to_cell(gridwin, "B2", "67") - enter_text_to_cell(gridwin, "B3", "68") - enter_text_to_cell(gridwin, "B4", "65") - enter_text_to_cell(gridwin, "B5", "64") - enter_text_to_cell(gridwin, "B6", "38") - enter_text_to_cell(gridwin, "B7", "84") - enter_text_to_cell(gridwin, "B8", "80") - enter_text_to_cell(gridwin, "B9", "49") - enter_text_to_cell(gridwin, "B10", "49") - enter_text_to_cell(gridwin, "B11", "33") - - enter_text_to_cell(gridwin, "C1", "Biology") - enter_text_to_cell(gridwin, "C2", "33") - enter_text_to_cell(gridwin, "C3", "42") - enter_text_to_cell(gridwin, "C4", "44") - enter_text_to_cell(gridwin, "C5", "60") - enter_text_to_cell(gridwin, "C6", "43") - enter_text_to_cell(gridwin, "C7", "62") - enter_text_to_cell(gridwin, "C8", "51") - enter_text_to_cell(gridwin, "C9", "40") - enter_text_to_cell(gridwin, "C10", "12") - enter_text_to_cell(gridwin, "C11", "60") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) - xgroupedbyrowsradio.executeAction("CLICK", tuple()) - xgroupedbycolumnsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - #Verify - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Correlations") - self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Column 1") - self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Column 2") - self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Column 3") - - self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "Column 1") - self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 1) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 2).getValue(),14), -0.40292549168204) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 3).getValue(),14), -0.21076428363645) - - self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString(), "Column 2") - self.assertEqual(get_cell_by_position(document, 0, 7, 2).getValue(), 1) - self.assertEqual(round(get_cell_by_position(document, 0, 7, 3).getValue(),14), 0.23097140475091) - - self.assertEqual(get_cell_by_position(document, 0, 8, 0).getString(), "Column 3") - self.assertEqual(get_cell_by_position(document, 0, 8, 3).getValue(), 1) - - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") - - # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #fill data + enter_text_to_cell(gridwin, "A1", "Maths") + enter_text_to_cell(gridwin, "A2", "47") + enter_text_to_cell(gridwin, "A3", "36") + enter_text_to_cell(gridwin, "A4", "40") + enter_text_to_cell(gridwin, "A5", "39") + enter_text_to_cell(gridwin, "A7", "47") + enter_text_to_cell(gridwin, "A8", "29") + enter_text_to_cell(gridwin, "A9", "27") + enter_text_to_cell(gridwin, "A10", "57") + enter_text_to_cell(gridwin, "A11", "56") + enter_text_to_cell(gridwin, "A12", "57") + enter_text_to_cell(gridwin, "A13", "26") + + enter_text_to_cell(gridwin, "B1", "Physics") + enter_text_to_cell(gridwin, "B2", "67") + enter_text_to_cell(gridwin, "B3", "68") + enter_text_to_cell(gridwin, "B4", "65") + enter_text_to_cell(gridwin, "B5", "64") + enter_text_to_cell(gridwin, "B6", "38") + enter_text_to_cell(gridwin, "B7", "84") + enter_text_to_cell(gridwin, "B8", "80") + enter_text_to_cell(gridwin, "B9", "49") + enter_text_to_cell(gridwin, "B10", "49") + enter_text_to_cell(gridwin, "B11", "33") + + enter_text_to_cell(gridwin, "C1", "Biology") + enter_text_to_cell(gridwin, "C2", "33") + enter_text_to_cell(gridwin, "C3", "42") + enter_text_to_cell(gridwin, "C4", "44") + enter_text_to_cell(gridwin, "C5", "60") + enter_text_to_cell(gridwin, "C6", "43") + enter_text_to_cell(gridwin, "C7", "62") + enter_text_to_cell(gridwin, "C8", "51") + enter_text_to_cell(gridwin, "C9", "40") + enter_text_to_cell(gridwin, "C10", "12") + enter_text_to_cell(gridwin, "C11", "60") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xgroupedbyrowsradio.executeAction("CLICK", tuple()) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Correlations") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Column 1") + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Column 2") + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Column 3") + + self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "Column 1") + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 1) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 2).getValue(),14), -0.40292549168204) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 3).getValue(),14), -0.21076428363645) + + self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString(), "Column 2") + self.assertEqual(get_cell_by_position(document, 0, 7, 2).getValue(), 1) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 3).getValue(),14), 0.23097140475091) + + self.assertEqual(get_cell_by_position(document, 0, 8, 0).getString(), "Column 3") + self.assertEqual(get_cell_by_position(document, 0, 8, 3).getValue(), 1) + + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() def test_statistic_correlation_row(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #fill data - enter_text_to_cell(gridwin, "A1", "Maths") - enter_text_to_cell(gridwin, "A2", "Physics") - enter_text_to_cell(gridwin, "A3", "Biology") - - enter_text_to_cell(gridwin, "B1", "47") - enter_text_to_cell(gridwin, "B2", "67") - enter_text_to_cell(gridwin, "B3", "33") - - enter_text_to_cell(gridwin, "C1", "36") - enter_text_to_cell(gridwin, "C2", "68") - enter_text_to_cell(gridwin, "C3", "42") - - enter_text_to_cell(gridwin, "D1", "40") - enter_text_to_cell(gridwin, "D2", "65") - enter_text_to_cell(gridwin, "D3", "44") - - enter_text_to_cell(gridwin, "E1", "39") - enter_text_to_cell(gridwin, "E2", "64") - enter_text_to_cell(gridwin, "E3", "60") - - enter_text_to_cell(gridwin, "F2", "38") - enter_text_to_cell(gridwin, "F3", "43") - - enter_text_to_cell(gridwin, "G1", "47") - enter_text_to_cell(gridwin, "G2", "84") - enter_text_to_cell(gridwin, "G3", "62") - - enter_text_to_cell(gridwin, "H1", "29") - enter_text_to_cell(gridwin, "H2", "80") - enter_text_to_cell(gridwin, "H3", "51") - - enter_text_to_cell(gridwin, "I1", "27") - enter_text_to_cell(gridwin, "I2", "49") - enter_text_to_cell(gridwin, "I3", "40") - - enter_text_to_cell(gridwin, "J1", "57") - enter_text_to_cell(gridwin, "J2", "49") - enter_text_to_cell(gridwin, "J3", "12") - - enter_text_to_cell(gridwin, "K1", "56") - enter_text_to_cell(gridwin, "K2", "33") - enter_text_to_cell(gridwin, "K3", "60") - - enter_text_to_cell(gridwin, "L1", "57") - - enter_text_to_cell(gridwin, "M1", "26") - - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:M3"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$M$3"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$A$7"})) - xgroupedbyrowsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "Correlations") - self.assertEqual(get_cell_by_position(document, 0, 0, 7).getString(), "Row 1") - self.assertEqual(get_cell_by_position(document, 0, 0, 8).getString(), "Row 2") - self.assertEqual(get_cell_by_position(document, 0, 0, 9).getString(), "Row 3") - - self.assertEqual(get_cell_by_position(document, 0, 1, 6).getString(), "Row 1") - self.assertEqual(get_cell_by_position(document, 0, 1, 7).getValue(), 1) - self.assertEqual(round(get_cell_by_position(document, 0, 1, 8).getValue(),15), -0.402925491682042) - self.assertEqual(round(get_cell_by_position(document, 0, 1, 9).getValue(),15), -0.210764283636454) - - self.assertEqual(get_cell_by_position(document, 0, 2, 6).getString(), "Row 2") - self.assertEqual(get_cell_by_position(document, 0, 2, 8).getValue(), 1) - self.assertEqual(round(get_cell_by_position(document, 0, 2, 9).getValue(),14), 0.23097140475091) - - self.assertEqual(get_cell_by_position(document, 0, 3, 6).getString(), "Row 3") - self.assertEqual(get_cell_by_position(document, 0, 3, 9).getValue(), 1) - - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") - + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #fill data + enter_text_to_cell(gridwin, "A1", "Maths") + enter_text_to_cell(gridwin, "A2", "Physics") + enter_text_to_cell(gridwin, "A3", "Biology") + + enter_text_to_cell(gridwin, "B1", "47") + enter_text_to_cell(gridwin, "B2", "67") + enter_text_to_cell(gridwin, "B3", "33") + + enter_text_to_cell(gridwin, "C1", "36") + enter_text_to_cell(gridwin, "C2", "68") + enter_text_to_cell(gridwin, "C3", "42") + + enter_text_to_cell(gridwin, "D1", "40") + enter_text_to_cell(gridwin, "D2", "65") + enter_text_to_cell(gridwin, "D3", "44") + + enter_text_to_cell(gridwin, "E1", "39") + enter_text_to_cell(gridwin, "E2", "64") + enter_text_to_cell(gridwin, "E3", "60") + + enter_text_to_cell(gridwin, "F2", "38") + enter_text_to_cell(gridwin, "F3", "43") + + enter_text_to_cell(gridwin, "G1", "47") + enter_text_to_cell(gridwin, "G2", "84") + enter_text_to_cell(gridwin, "G3", "62") + + enter_text_to_cell(gridwin, "H1", "29") + enter_text_to_cell(gridwin, "H2", "80") + enter_text_to_cell(gridwin, "H3", "51") + + enter_text_to_cell(gridwin, "I1", "27") + enter_text_to_cell(gridwin, "I2", "49") + enter_text_to_cell(gridwin, "I3", "40") + + enter_text_to_cell(gridwin, "J1", "57") + enter_text_to_cell(gridwin, "J2", "49") + enter_text_to_cell(gridwin, "J3", "12") + + enter_text_to_cell(gridwin, "K1", "56") + enter_text_to_cell(gridwin, "K2", "33") + enter_text_to_cell(gridwin, "K3", "60") + + enter_text_to_cell(gridwin, "L1", "57") + + enter_text_to_cell(gridwin, "M1", "26") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:M3"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$M$3"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$A$7"})) + xgroupedbyrowsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "Correlations") + self.assertEqual(get_cell_by_position(document, 0, 0, 7).getString(), "Row 1") + self.assertEqual(get_cell_by_position(document, 0, 0, 8).getString(), "Row 2") + self.assertEqual(get_cell_by_position(document, 0, 0, 9).getString(), "Row 3") + + self.assertEqual(get_cell_by_position(document, 0, 1, 6).getString(), "Row 1") + self.assertEqual(get_cell_by_position(document, 0, 1, 7).getValue(), 1) + self.assertEqual(round(get_cell_by_position(document, 0, 1, 8).getValue(),15), -0.402925491682042) + self.assertEqual(round(get_cell_by_position(document, 0, 1, 9).getValue(),15), -0.210764283636454) + + self.assertEqual(get_cell_by_position(document, 0, 2, 6).getString(), "Row 2") + self.assertEqual(get_cell_by_position(document, 0, 2, 8).getValue(), 1) + self.assertEqual(round(get_cell_by_position(document, 0, 2, 9).getValue(),14), 0.23097140475091) + + self.assertEqual(get_cell_by_position(document, 0, 3, 6).getString(), "Row 3") + self.assertEqual(get_cell_by_position(document, 0, 3, 9).getValue(), 1) + + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/covariance.py b/sc/qa/uitest/statistics/covariance.py index 2f101c5a6a52..3787a458648e 100644 --- a/sc/qa/uitest/statistics/covariance.py +++ b/sc/qa/uitest/statistics/covariance.py @@ -16,182 +16,185 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class covariance(UITestCase): def test_statistic_covariance_column(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #fill data - enter_text_to_cell(gridwin, "A1", "Maths") - enter_text_to_cell(gridwin, "A2", "47") - enter_text_to_cell(gridwin, "A3", "36") - enter_text_to_cell(gridwin, "A4", "40") - enter_text_to_cell(gridwin, "A5", "39") - enter_text_to_cell(gridwin, "A7", "47") - enter_text_to_cell(gridwin, "A8", "29") - enter_text_to_cell(gridwin, "A9", "27") - enter_text_to_cell(gridwin, "A10", "57") - enter_text_to_cell(gridwin, "A11", "56") - enter_text_to_cell(gridwin, "A12", "57") - enter_text_to_cell(gridwin, "A13", "26") - - enter_text_to_cell(gridwin, "B1", "Physics") - enter_text_to_cell(gridwin, "B2", "67") - enter_text_to_cell(gridwin, "B3", "68") - enter_text_to_cell(gridwin, "B4", "65") - enter_text_to_cell(gridwin, "B5", "64") - enter_text_to_cell(gridwin, "B6", "38") - enter_text_to_cell(gridwin, "B7", "84") - enter_text_to_cell(gridwin, "B8", "80") - enter_text_to_cell(gridwin, "B9", "49") - enter_text_to_cell(gridwin, "B10", "49") - enter_text_to_cell(gridwin, "B11", "33") - - enter_text_to_cell(gridwin, "C1", "Biology") - enter_text_to_cell(gridwin, "C2", "33") - enter_text_to_cell(gridwin, "C3", "42") - enter_text_to_cell(gridwin, "C4", "44") - enter_text_to_cell(gridwin, "C5", "60") - enter_text_to_cell(gridwin, "C6", "43") - enter_text_to_cell(gridwin, "C7", "62") - enter_text_to_cell(gridwin, "C8", "51") - enter_text_to_cell(gridwin, "C9", "40") - enter_text_to_cell(gridwin, "C10", "12") - enter_text_to_cell(gridwin, "C11", "60") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) - xgroupedbycolumnsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Covariances") - self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Column 1") - self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Column 2") - self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Column 3") - - self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "Column 1") - self.assertEqual(round(get_cell_by_position(document, 0, 6, 1).getValue(),11), 126.80991735537) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 2).getValue(),12), -61.444444444444) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 3).getValue()), -32) - - self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString(), "Column 2") - self.assertEqual(round(get_cell_by_position(document, 0, 7, 2).getValue(),2), 258.41) - self.assertEqual(round(get_cell_by_position(document, 0, 7, 3).getValue(),2), 53.11) - - self.assertEqual(get_cell_by_position(document, 0, 8, 0).getString(), "Column 3") - self.assertEqual(round(get_cell_by_position(document, 0, 8, 3).getValue(),2), 204.61) - - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") - - # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #fill data + enter_text_to_cell(gridwin, "A1", "Maths") + enter_text_to_cell(gridwin, "A2", "47") + enter_text_to_cell(gridwin, "A3", "36") + enter_text_to_cell(gridwin, "A4", "40") + enter_text_to_cell(gridwin, "A5", "39") + enter_text_to_cell(gridwin, "A7", "47") + enter_text_to_cell(gridwin, "A8", "29") + enter_text_to_cell(gridwin, "A9", "27") + enter_text_to_cell(gridwin, "A10", "57") + enter_text_to_cell(gridwin, "A11", "56") + enter_text_to_cell(gridwin, "A12", "57") + enter_text_to_cell(gridwin, "A13", "26") + + enter_text_to_cell(gridwin, "B1", "Physics") + enter_text_to_cell(gridwin, "B2", "67") + enter_text_to_cell(gridwin, "B3", "68") + enter_text_to_cell(gridwin, "B4", "65") + enter_text_to_cell(gridwin, "B5", "64") + enter_text_to_cell(gridwin, "B6", "38") + enter_text_to_cell(gridwin, "B7", "84") + enter_text_to_cell(gridwin, "B8", "80") + enter_text_to_cell(gridwin, "B9", "49") + enter_text_to_cell(gridwin, "B10", "49") + enter_text_to_cell(gridwin, "B11", "33") + + enter_text_to_cell(gridwin, "C1", "Biology") + enter_text_to_cell(gridwin, "C2", "33") + enter_text_to_cell(gridwin, "C3", "42") + enter_text_to_cell(gridwin, "C4", "44") + enter_text_to_cell(gridwin, "C5", "60") + enter_text_to_cell(gridwin, "C6", "43") + enter_text_to_cell(gridwin, "C7", "62") + enter_text_to_cell(gridwin, "C8", "51") + enter_text_to_cell(gridwin, "C9", "40") + enter_text_to_cell(gridwin, "C10", "12") + enter_text_to_cell(gridwin, "C11", "60") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Covariances") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Column 1") + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Column 2") + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Column 3") + + self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "Column 1") + self.assertEqual(round(get_cell_by_position(document, 0, 6, 1).getValue(),11), 126.80991735537) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 2).getValue(),12), -61.444444444444) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 3).getValue()), -32) + + self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString(), "Column 2") + self.assertEqual(round(get_cell_by_position(document, 0, 7, 2).getValue(),2), 258.41) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 3).getValue(),2), 53.11) + + self.assertEqual(get_cell_by_position(document, 0, 8, 0).getString(), "Column 3") + self.assertEqual(round(get_cell_by_position(document, 0, 8, 3).getValue(),2), 204.61) + + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() def test_statistic_covariance_row(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #fill data - enter_text_to_cell(gridwin, "A1", "Maths") - enter_text_to_cell(gridwin, "A2", "Physics") - enter_text_to_cell(gridwin, "A3", "Biology") - - enter_text_to_cell(gridwin, "B1", "47") - enter_text_to_cell(gridwin, "B2", "67") - enter_text_to_cell(gridwin, "B3", "33") - - enter_text_to_cell(gridwin, "C1", "36") - enter_text_to_cell(gridwin, "C2", "68") - enter_text_to_cell(gridwin, "C3", "42") - - enter_text_to_cell(gridwin, "D1", "40") - enter_text_to_cell(gridwin, "D2", "65") - enter_text_to_cell(gridwin, "D3", "44") - - enter_text_to_cell(gridwin, "E1", "39") - enter_text_to_cell(gridwin, "E2", "64") - enter_text_to_cell(gridwin, "E3", "60") - - enter_text_to_cell(gridwin, "F2", "38") - enter_text_to_cell(gridwin, "F3", "43") - - enter_text_to_cell(gridwin, "G1", "47") - enter_text_to_cell(gridwin, "G2", "84") - enter_text_to_cell(gridwin, "G3", "62") - - enter_text_to_cell(gridwin, "H1", "29") - enter_text_to_cell(gridwin, "H2", "80") - enter_text_to_cell(gridwin, "H3", "51") - - enter_text_to_cell(gridwin, "I1", "27") - enter_text_to_cell(gridwin, "I2", "49") - enter_text_to_cell(gridwin, "I3", "40") - - enter_text_to_cell(gridwin, "J1", "57") - enter_text_to_cell(gridwin, "J2", "49") - enter_text_to_cell(gridwin, "J3", "12") - - enter_text_to_cell(gridwin, "K1", "56") - enter_text_to_cell(gridwin, "K2", "33") - enter_text_to_cell(gridwin, "K3", "60") - - enter_text_to_cell(gridwin, "L1", "57") - - enter_text_to_cell(gridwin, "M1", "26") - - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:M3"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$M$3"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$A$7"})) - xgroupedbyrowsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "Covariances") - self.assertEqual(get_cell_by_position(document, 0, 0, 7).getString(), "Row 1") - self.assertEqual(get_cell_by_position(document, 0, 0, 8).getString(), "Row 2") - self.assertEqual(get_cell_by_position(document, 0, 0, 9).getString(), "Row 3") - - self.assertEqual(get_cell_by_position(document, 0, 1, 6).getString(), "Row 1") - self.assertEqual(round(get_cell_by_position(document, 0, 1, 7).getValue(),10), 126.8099173554) - self.assertEqual(round(get_cell_by_position(document, 0, 1, 8).getValue(),12), -61.444444444444) - self.assertEqual(round(get_cell_by_position(document, 0, 1, 9).getValue()), -32) - - self.assertEqual(get_cell_by_position(document, 0, 2, 6).getString(), "Row 2") - self.assertEqual(round(get_cell_by_position(document, 0, 2, 8).getValue(),2), 258.41) - self.assertEqual(round(get_cell_by_position(document, 0, 2, 9).getValue(),2), 53.11) - - self.assertEqual(get_cell_by_position(document, 0, 3, 6).getString(), "Row 3") - self.assertEqual(round(get_cell_by_position(document, 0, 3, 9).getValue(),2), 204.61) - - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") - + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #fill data + enter_text_to_cell(gridwin, "A1", "Maths") + enter_text_to_cell(gridwin, "A2", "Physics") + enter_text_to_cell(gridwin, "A3", "Biology") + + enter_text_to_cell(gridwin, "B1", "47") + enter_text_to_cell(gridwin, "B2", "67") + enter_text_to_cell(gridwin, "B3", "33") + + enter_text_to_cell(gridwin, "C1", "36") + enter_text_to_cell(gridwin, "C2", "68") + enter_text_to_cell(gridwin, "C3", "42") + + enter_text_to_cell(gridwin, "D1", "40") + enter_text_to_cell(gridwin, "D2", "65") + enter_text_to_cell(gridwin, "D3", "44") + + enter_text_to_cell(gridwin, "E1", "39") + enter_text_to_cell(gridwin, "E2", "64") + enter_text_to_cell(gridwin, "E3", "60") + + enter_text_to_cell(gridwin, "F2", "38") + enter_text_to_cell(gridwin, "F3", "43") + + enter_text_to_cell(gridwin, "G1", "47") + enter_text_to_cell(gridwin, "G2", "84") + enter_text_to_cell(gridwin, "G3", "62") + + enter_text_to_cell(gridwin, "H1", "29") + enter_text_to_cell(gridwin, "H2", "80") + enter_text_to_cell(gridwin, "H3", "51") + + enter_text_to_cell(gridwin, "I1", "27") + enter_text_to_cell(gridwin, "I2", "49") + enter_text_to_cell(gridwin, "I3", "40") + + enter_text_to_cell(gridwin, "J1", "57") + enter_text_to_cell(gridwin, "J2", "49") + enter_text_to_cell(gridwin, "J3", "12") + + enter_text_to_cell(gridwin, "K1", "56") + enter_text_to_cell(gridwin, "K2", "33") + enter_text_to_cell(gridwin, "K3", "60") + + enter_text_to_cell(gridwin, "L1", "57") + + enter_text_to_cell(gridwin, "M1", "26") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:M3"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$M$3"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$A$7"})) + xgroupedbyrowsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "Covariances") + self.assertEqual(get_cell_by_position(document, 0, 0, 7).getString(), "Row 1") + self.assertEqual(get_cell_by_position(document, 0, 0, 8).getString(), "Row 2") + self.assertEqual(get_cell_by_position(document, 0, 0, 9).getString(), "Row 3") + + self.assertEqual(get_cell_by_position(document, 0, 1, 6).getString(), "Row 1") + self.assertEqual(round(get_cell_by_position(document, 0, 1, 7).getValue(),10), 126.8099173554) + self.assertEqual(round(get_cell_by_position(document, 0, 1, 8).getValue(),12), -61.444444444444) + self.assertEqual(round(get_cell_by_position(document, 0, 1, 9).getValue()), -32) + + self.assertEqual(get_cell_by_position(document, 0, 2, 6).getString(), "Row 2") + self.assertEqual(round(get_cell_by_position(document, 0, 2, 8).getValue(),2), 258.41) + self.assertEqual(round(get_cell_by_position(document, 0, 2, 9).getValue(),2), 53.11) + + self.assertEqual(get_cell_by_position(document, 0, 3, 6).getString(), "Row 3") + self.assertEqual(round(get_cell_by_position(document, 0, 3, 9).getValue(),2), 204.61) + + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/descriptiveStatistics.py b/sc/qa/uitest/statistics/descriptiveStatistics.py index 1de1b6253d06..b0fe011fee66 100644 --- a/sc/qa/uitest/statistics/descriptiveStatistics.py +++ b/sc/qa/uitest/statistics/descriptiveStatistics.py @@ -16,147 +16,148 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class descriptiveStatistics(UITestCase): def test_descriptive_statistics(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #fill data - enter_text_to_cell(gridwin, "A1", "Math") - enter_text_to_cell(gridwin, "A2", "47") - enter_text_to_cell(gridwin, "A3", "36") - enter_text_to_cell(gridwin, "A4", "40") - enter_text_to_cell(gridwin, "A5", "39") - enter_text_to_cell(gridwin, "A7", "47") - enter_text_to_cell(gridwin, "A8", "29") - enter_text_to_cell(gridwin, "A9", "27") - enter_text_to_cell(gridwin, "A10", "57") - enter_text_to_cell(gridwin, "A11", "56") - enter_text_to_cell(gridwin, "A12", "57") - enter_text_to_cell(gridwin, "A13", "26") - - - enter_text_to_cell(gridwin, "B1", "Physics") - enter_text_to_cell(gridwin, "B2", "67") - enter_text_to_cell(gridwin, "B3", "68") - enter_text_to_cell(gridwin, "B4", "65") - enter_text_to_cell(gridwin, "B5", "64") - enter_text_to_cell(gridwin, "B6", "38") - enter_text_to_cell(gridwin, "B7", "84") - enter_text_to_cell(gridwin, "B8", "80") - enter_text_to_cell(gridwin, "B9", "49") - enter_text_to_cell(gridwin, "B10", "49") - enter_text_to_cell(gridwin, "B11", "33") - - enter_text_to_cell(gridwin, "C1", "Biology") - enter_text_to_cell(gridwin, "C2", "33") - enter_text_to_cell(gridwin, "C3", "42") - enter_text_to_cell(gridwin, "C4", "44") - enter_text_to_cell(gridwin, "C5", "60") - enter_text_to_cell(gridwin, "C6", "43") - enter_text_to_cell(gridwin, "C7", "62") - enter_text_to_cell(gridwin, "C8", "51") - enter_text_to_cell(gridwin, "C9", "40") - enter_text_to_cell(gridwin, "C10", "12") - enter_text_to_cell(gridwin, "C11", "60") - - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DescriptiveStatisticsDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$13"})) - - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$F$1"})) - - xgroupedbyrowsradio.executeAction("CLICK", tuple()) - xgroupedbycolumnsradio.executeAction("CLICK", tuple()) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - #Verify - self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString() , "Mean") - self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString() , "Standard Error") - self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString() , "Mode") - self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString() , "Median") - self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString() , "First Quartile") - self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString() , "Third Quartile") - self.assertEqual(get_cell_by_position(document, 0, 5, 7).getString() , "Variance") - self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString() , "Standard Deviation") - self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString() , "Kurtosis") - self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString() , "Skewness") - self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString() , "Range") - self.assertEqual(get_cell_by_position(document, 0, 5, 12).getString() , "Minimum") - self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString() , "Maximum") - self.assertEqual(get_cell_by_position(document, 0, 5, 14).getString() , "Sum") - self.assertEqual(get_cell_by_position(document, 0, 5, 15).getString() , "Count") - - self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString() , "Math") - self.assertEqual(round(get_cell_by_position(document, 0, 6, 1).getValue(),12) , 41.909090909091) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 2).getValue(),13) , 3.5610380137731) - self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue() , 47) - self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue() , 40) - self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue() , 32.5) - self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue() , 51.5) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 7).getValue(),11) , 139.49090909091) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 8).getValue(),12) , 11.810626955878) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 9).getValue(),13) , -1.4621677980825) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 10).getValue(),14) , 0.01524095329036) - self.assertEqual(get_cell_by_position(document, 0, 6, 11).getValue() , 31) - self.assertEqual(get_cell_by_position(document, 0, 6, 12).getValue() , 26) - self.assertEqual(get_cell_by_position(document, 0, 6, 13).getValue() , 57) - self.assertEqual(get_cell_by_position(document, 0, 6, 14).getValue() , 461) - self.assertEqual(get_cell_by_position(document, 0, 6, 15).getValue() , 11) - - self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString() , "Physics") - self.assertEqual(round(get_cell_by_position(document, 0, 7, 1).getValue(),1) , 59.7) - self.assertEqual(round(get_cell_by_position(document, 0, 7, 2).getValue(),14) , 5.35837869343164) - self.assertEqual(get_cell_by_position(document, 0, 7, 3).getValue() , 49) - self.assertEqual(get_cell_by_position(document, 0, 7, 4).getValue() , 64.5) - self.assertEqual(get_cell_by_position(document, 0, 7, 5).getValue() , 49) - self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue() , 67.75) - self.assertEqual(round(get_cell_by_position(document, 0, 7, 7).getValue(),11) , 287.12222222222) - self.assertEqual(round(get_cell_by_position(document, 0, 7, 8).getValue(),12) , 16.944681236961) - self.assertEqual(round(get_cell_by_position(document, 0, 7, 9).getValue(),14) , -0.94159887458526) - self.assertEqual(round(get_cell_by_position(document, 0, 7, 10).getValue(),13) , -0.2226426904338) - self.assertEqual(get_cell_by_position(document, 0, 7, 11).getValue() , 51) - self.assertEqual(get_cell_by_position(document, 0, 7, 12).getValue() , 33) - self.assertEqual(get_cell_by_position(document, 0, 7, 13).getValue() , 84) - self.assertEqual(get_cell_by_position(document, 0, 7, 14).getValue() , 597) - self.assertEqual(get_cell_by_position(document, 0, 7, 15).getValue() , 10) - - self.assertEqual(get_cell_by_position(document, 0, 8, 0).getString() , "Biology") - self.assertEqual(get_cell_by_position(document, 0, 8, 1).getValue() , 44.7) - self.assertEqual(round(get_cell_by_position(document, 0, 8, 2).getValue(),13) , 4.7680650629416) - self.assertEqual(get_cell_by_position(document, 0, 8, 3).getValue() , 60) - self.assertEqual(get_cell_by_position(document, 0, 8, 4).getValue() , 43.5) - self.assertEqual(get_cell_by_position(document, 0, 8, 5).getValue() , 40.5) - self.assertEqual(get_cell_by_position(document, 0, 8, 6).getValue() , 57.75) - self.assertEqual(round(get_cell_by_position(document, 0, 8, 7).getValue(),11) , 227.34444444444) - self.assertEqual(round(get_cell_by_position(document, 0, 8, 8).getValue(),11) , 15.07794563077) - self.assertEqual(round(get_cell_by_position(document, 0, 8, 9).getValue(),12) , 1.418052718986) - self.assertEqual(round(get_cell_by_position(document, 0, 8, 10).getValue(),14) , -0.97668033725691) - self.assertEqual(get_cell_by_position(document, 0, 8, 11).getValue() , 50) - self.assertEqual(get_cell_by_position(document, 0, 8, 12).getValue() , 12) - self.assertEqual(get_cell_by_position(document, 0, 8, 13).getValue() , 62) - self.assertEqual(get_cell_by_position(document, 0, 8, 14).getValue() , 447) - self.assertEqual(get_cell_by_position(document, 0, 8, 15).getValue() , 10) - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") - - # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:DescriptiveStatisticsDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #fill data + enter_text_to_cell(gridwin, "A1", "Math") + enter_text_to_cell(gridwin, "A2", "47") + enter_text_to_cell(gridwin, "A3", "36") + enter_text_to_cell(gridwin, "A4", "40") + enter_text_to_cell(gridwin, "A5", "39") + enter_text_to_cell(gridwin, "A7", "47") + enter_text_to_cell(gridwin, "A8", "29") + enter_text_to_cell(gridwin, "A9", "27") + enter_text_to_cell(gridwin, "A10", "57") + enter_text_to_cell(gridwin, "A11", "56") + enter_text_to_cell(gridwin, "A12", "57") + enter_text_to_cell(gridwin, "A13", "26") + + + enter_text_to_cell(gridwin, "B1", "Physics") + enter_text_to_cell(gridwin, "B2", "67") + enter_text_to_cell(gridwin, "B3", "68") + enter_text_to_cell(gridwin, "B4", "65") + enter_text_to_cell(gridwin, "B5", "64") + enter_text_to_cell(gridwin, "B6", "38") + enter_text_to_cell(gridwin, "B7", "84") + enter_text_to_cell(gridwin, "B8", "80") + enter_text_to_cell(gridwin, "B9", "49") + enter_text_to_cell(gridwin, "B10", "49") + enter_text_to_cell(gridwin, "B11", "33") + + enter_text_to_cell(gridwin, "C1", "Biology") + enter_text_to_cell(gridwin, "C2", "33") + enter_text_to_cell(gridwin, "C3", "42") + enter_text_to_cell(gridwin, "C4", "44") + enter_text_to_cell(gridwin, "C5", "60") + enter_text_to_cell(gridwin, "C6", "43") + enter_text_to_cell(gridwin, "C7", "62") + enter_text_to_cell(gridwin, "C8", "51") + enter_text_to_cell(gridwin, "C9", "40") + enter_text_to_cell(gridwin, "C10", "12") + enter_text_to_cell(gridwin, "C11", "60") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DescriptiveStatisticsDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$13"})) + + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$F$1"})) + + xgroupedbyrowsradio.executeAction("CLICK", tuple()) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString() , "Mean") + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString() , "Standard Error") + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString() , "Mode") + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString() , "Median") + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString() , "First Quartile") + self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString() , "Third Quartile") + self.assertEqual(get_cell_by_position(document, 0, 5, 7).getString() , "Variance") + self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString() , "Standard Deviation") + self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString() , "Kurtosis") + self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString() , "Skewness") + self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString() , "Range") + self.assertEqual(get_cell_by_position(document, 0, 5, 12).getString() , "Minimum") + self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString() , "Maximum") + self.assertEqual(get_cell_by_position(document, 0, 5, 14).getString() , "Sum") + self.assertEqual(get_cell_by_position(document, 0, 5, 15).getString() , "Count") + + self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString() , "Math") + self.assertEqual(round(get_cell_by_position(document, 0, 6, 1).getValue(),12) , 41.909090909091) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 2).getValue(),13) , 3.5610380137731) + self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue() , 47) + self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue() , 40) + self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue() , 32.5) + self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue() , 51.5) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 7).getValue(),11) , 139.49090909091) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 8).getValue(),12) , 11.810626955878) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 9).getValue(),13) , -1.4621677980825) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 10).getValue(),14) , 0.01524095329036) + self.assertEqual(get_cell_by_position(document, 0, 6, 11).getValue() , 31) + self.assertEqual(get_cell_by_position(document, 0, 6, 12).getValue() , 26) + self.assertEqual(get_cell_by_position(document, 0, 6, 13).getValue() , 57) + self.assertEqual(get_cell_by_position(document, 0, 6, 14).getValue() , 461) + self.assertEqual(get_cell_by_position(document, 0, 6, 15).getValue() , 11) + + self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString() , "Physics") + self.assertEqual(round(get_cell_by_position(document, 0, 7, 1).getValue(),1) , 59.7) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 2).getValue(),14) , 5.35837869343164) + self.assertEqual(get_cell_by_position(document, 0, 7, 3).getValue() , 49) + self.assertEqual(get_cell_by_position(document, 0, 7, 4).getValue() , 64.5) + self.assertEqual(get_cell_by_position(document, 0, 7, 5).getValue() , 49) + self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue() , 67.75) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 7).getValue(),11) , 287.12222222222) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 8).getValue(),12) , 16.944681236961) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 9).getValue(),14) , -0.94159887458526) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 10).getValue(),13) , -0.2226426904338) + self.assertEqual(get_cell_by_position(document, 0, 7, 11).getValue() , 51) + self.assertEqual(get_cell_by_position(document, 0, 7, 12).getValue() , 33) + self.assertEqual(get_cell_by_position(document, 0, 7, 13).getValue() , 84) + self.assertEqual(get_cell_by_position(document, 0, 7, 14).getValue() , 597) + self.assertEqual(get_cell_by_position(document, 0, 7, 15).getValue() , 10) + + self.assertEqual(get_cell_by_position(document, 0, 8, 0).getString() , "Biology") + self.assertEqual(get_cell_by_position(document, 0, 8, 1).getValue() , 44.7) + self.assertEqual(round(get_cell_by_position(document, 0, 8, 2).getValue(),13) , 4.7680650629416) + self.assertEqual(get_cell_by_position(document, 0, 8, 3).getValue() , 60) + self.assertEqual(get_cell_by_position(document, 0, 8, 4).getValue() , 43.5) + self.assertEqual(get_cell_by_position(document, 0, 8, 5).getValue() , 40.5) + self.assertEqual(get_cell_by_position(document, 0, 8, 6).getValue() , 57.75) + self.assertEqual(round(get_cell_by_position(document, 0, 8, 7).getValue(),11) , 227.34444444444) + self.assertEqual(round(get_cell_by_position(document, 0, 8, 8).getValue(),11) , 15.07794563077) + self.assertEqual(round(get_cell_by_position(document, 0, 8, 9).getValue(),12) , 1.418052718986) + self.assertEqual(round(get_cell_by_position(document, 0, 8, 10).getValue(),14) , -0.97668033725691) + self.assertEqual(get_cell_by_position(document, 0, 8, 11).getValue() , 50) + self.assertEqual(get_cell_by_position(document, 0, 8, 12).getValue() , 12) + self.assertEqual(get_cell_by_position(document, 0, 8, 13).getValue() , 62) + self.assertEqual(get_cell_by_position(document, 0, 8, 14).getValue() , 447) + self.assertEqual(get_cell_by_position(document, 0, 8, 15).getValue() , 10) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:DescriptiveStatisticsDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/exponentialSmoothing.py b/sc/qa/uitest/statistics/exponentialSmoothing.py index 9f539989b16e..7ea2c23ec62f 100644 --- a/sc/qa/uitest/statistics/exponentialSmoothing.py +++ b/sc/qa/uitest/statistics/exponentialSmoothing.py @@ -16,171 +16,174 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class exponentialSmoothing(UITestCase): def test_exponential_smoothing_column(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #fill data - enter_text_to_cell(gridwin, "A1", "1") - enter_text_to_cell(gridwin, "A2", "0") - enter_text_to_cell(gridwin, "A3", "0") - enter_text_to_cell(gridwin, "A4", "0") - enter_text_to_cell(gridwin, "A5", "0") - enter_text_to_cell(gridwin, "A7", "0") - enter_text_to_cell(gridwin, "A8", "0") - enter_text_to_cell(gridwin, "A9", "0") - enter_text_to_cell(gridwin, "A10", "0") - enter_text_to_cell(gridwin, "A11", "0") - enter_text_to_cell(gridwin, "A12", "0") - enter_text_to_cell(gridwin, "A13", "0") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #fill data + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "0") + enter_text_to_cell(gridwin, "A3", "0") + enter_text_to_cell(gridwin, "A4", "0") + enter_text_to_cell(gridwin, "A5", "0") + enter_text_to_cell(gridwin, "A7", "0") + enter_text_to_cell(gridwin, "A8", "0") + enter_text_to_cell(gridwin, "A9", "0") + enter_text_to_cell(gridwin, "A10", "0") + enter_text_to_cell(gridwin, "A11", "0") + enter_text_to_cell(gridwin, "A12", "0") + enter_text_to_cell(gridwin, "A13", "0") - enter_text_to_cell(gridwin, "B1", "0") - enter_text_to_cell(gridwin, "B2", "0") - enter_text_to_cell(gridwin, "B3", "1") - enter_text_to_cell(gridwin, "B4", "0") - enter_text_to_cell(gridwin, "B5", "0") - enter_text_to_cell(gridwin, "B6", "0") - enter_text_to_cell(gridwin, "B7", "0") - enter_text_to_cell(gridwin, "B8", "0") - enter_text_to_cell(gridwin, "B9", "0") - enter_text_to_cell(gridwin, "B10", "0") - enter_text_to_cell(gridwin, "B11", "0") - enter_text_to_cell(gridwin, "B12", "0") - enter_text_to_cell(gridwin, "B13", "0") + enter_text_to_cell(gridwin, "B1", "0") + enter_text_to_cell(gridwin, "B2", "0") + enter_text_to_cell(gridwin, "B3", "1") + enter_text_to_cell(gridwin, "B4", "0") + enter_text_to_cell(gridwin, "B5", "0") + enter_text_to_cell(gridwin, "B6", "0") + enter_text_to_cell(gridwin, "B7", "0") + enter_text_to_cell(gridwin, "B8", "0") + enter_text_to_cell(gridwin, "B9", "0") + enter_text_to_cell(gridwin, "B10", "0") + enter_text_to_cell(gridwin, "B11", "0") + enter_text_to_cell(gridwin, "B12", "0") + enter_text_to_cell(gridwin, "B13", "0") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xmoothingfactorspin = xDialog.getChild("smoothing-factor-spin") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xmoothingfactorspin = xDialog.getChild("smoothing-factor-spin") - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) - xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.5"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Alpha") - self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 0.5) - self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Column 1") - self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 1) - self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 1) - self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 0.5) - self.assertEqual(get_cell_by_position(document, 0, 5, 6).getValue(), 0.25) - self.assertEqual(get_cell_by_position(document, 0, 5, 7).getValue(), 0.125) - self.assertEqual(get_cell_by_position(document, 0, 5, 8).getValue(), 0.0625) - self.assertEqual(get_cell_by_position(document, 0, 5, 9).getValue(), 0.03125) - self.assertEqual(get_cell_by_position(document, 0, 5, 10).getValue(), 0.015625) - self.assertEqual(get_cell_by_position(document, 0, 5, 11).getValue(), 0.0078125) - self.assertEqual(get_cell_by_position(document, 0, 5, 12).getValue(), 0.00390625) - self.assertEqual(get_cell_by_position(document, 0, 5, 13).getValue(), 0.001953125) - self.assertEqual(get_cell_by_position(document, 0, 5, 14).getValue(), 0.0009765625) - self.assertEqual(get_cell_by_position(document, 0, 5, 15).getValue(), 0.00048828125) - self.assertEqual(get_cell_by_position(document, 0, 5, 16).getValue(), 0.000244140625) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.5"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Alpha") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 0.5) + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Column 1") + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 0.5) + self.assertEqual(get_cell_by_position(document, 0, 5, 6).getValue(), 0.25) + self.assertEqual(get_cell_by_position(document, 0, 5, 7).getValue(), 0.125) + self.assertEqual(get_cell_by_position(document, 0, 5, 8).getValue(), 0.0625) + self.assertEqual(get_cell_by_position(document, 0, 5, 9).getValue(), 0.03125) + self.assertEqual(get_cell_by_position(document, 0, 5, 10).getValue(), 0.015625) + self.assertEqual(get_cell_by_position(document, 0, 5, 11).getValue(), 0.0078125) + self.assertEqual(get_cell_by_position(document, 0, 5, 12).getValue(), 0.00390625) + self.assertEqual(get_cell_by_position(document, 0, 5, 13).getValue(), 0.001953125) + self.assertEqual(get_cell_by_position(document, 0, 5, 14).getValue(), 0.0009765625) + self.assertEqual(get_cell_by_position(document, 0, 5, 15).getValue(), 0.00048828125) + self.assertEqual(get_cell_by_position(document, 0, 5, 16).getValue(), 0.000244140625) - self.assertEqual(get_cell_by_position(document, 0, 6, 2).getString(), "Column 2") - self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 0.5) - self.assertEqual(get_cell_by_position(document, 0, 6, 7).getValue(), 0.25) - self.assertEqual(get_cell_by_position(document, 0, 6, 8).getValue(), 0.125) - self.assertEqual(get_cell_by_position(document, 0, 6, 9).getValue(), 0.0625) - self.assertEqual(get_cell_by_position(document, 0, 6, 10).getValue(), 0.03125) - self.assertEqual(get_cell_by_position(document, 0, 6, 11).getValue(), 0.015625) - self.assertEqual(get_cell_by_position(document, 0, 6, 12).getValue(), 0.0078125) - self.assertEqual(get_cell_by_position(document, 0, 6, 13).getValue(), 0.00390625) - self.assertEqual(get_cell_by_position(document, 0, 6, 14).getValue(), 0.001953125) - self.assertEqual(get_cell_by_position(document, 0, 6, 15).getValue(), 0.0009765625) - self.assertEqual(get_cell_by_position(document, 0, 6, 16).getValue(), 0.00048828125) + self.assertEqual(get_cell_by_position(document, 0, 6, 2).getString(), "Column 2") + self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 0.5) + self.assertEqual(get_cell_by_position(document, 0, 6, 7).getValue(), 0.25) + self.assertEqual(get_cell_by_position(document, 0, 6, 8).getValue(), 0.125) + self.assertEqual(get_cell_by_position(document, 0, 6, 9).getValue(), 0.0625) + self.assertEqual(get_cell_by_position(document, 0, 6, 10).getValue(), 0.03125) + self.assertEqual(get_cell_by_position(document, 0, 6, 11).getValue(), 0.015625) + self.assertEqual(get_cell_by_position(document, 0, 6, 12).getValue(), 0.0078125) + self.assertEqual(get_cell_by_position(document, 0, 6, 13).getValue(), 0.00390625) + self.assertEqual(get_cell_by_position(document, 0, 6, 14).getValue(), 0.001953125) + self.assertEqual(get_cell_by_position(document, 0, 6, 15).getValue(), 0.0009765625) + self.assertEqual(get_cell_by_position(document, 0, 6, 16).getValue(), 0.00048828125) - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") - # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() def test_exponential_smoothing_row(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #fill data - enter_text_to_cell(gridwin, "A1", "1") - enter_text_to_cell(gridwin, "A2", "0") - enter_text_to_cell(gridwin, "A3", "0") - enter_text_to_cell(gridwin, "A4", "0") - enter_text_to_cell(gridwin, "A5", "0") - enter_text_to_cell(gridwin, "A7", "0") - enter_text_to_cell(gridwin, "A8", "0") - enter_text_to_cell(gridwin, "A9", "0") - enter_text_to_cell(gridwin, "A10", "0") - enter_text_to_cell(gridwin, "A11", "0") - enter_text_to_cell(gridwin, "A12", "0") - enter_text_to_cell(gridwin, "A13", "0") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #fill data + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "0") + enter_text_to_cell(gridwin, "A3", "0") + enter_text_to_cell(gridwin, "A4", "0") + enter_text_to_cell(gridwin, "A5", "0") + enter_text_to_cell(gridwin, "A7", "0") + enter_text_to_cell(gridwin, "A8", "0") + enter_text_to_cell(gridwin, "A9", "0") + enter_text_to_cell(gridwin, "A10", "0") + enter_text_to_cell(gridwin, "A11", "0") + enter_text_to_cell(gridwin, "A12", "0") + enter_text_to_cell(gridwin, "A13", "0") - enter_text_to_cell(gridwin, "B1", "0") - enter_text_to_cell(gridwin, "B2", "0") - enter_text_to_cell(gridwin, "B3", "1") - enter_text_to_cell(gridwin, "B4", "0") - enter_text_to_cell(gridwin, "B5", "0") - enter_text_to_cell(gridwin, "B6", "0") - enter_text_to_cell(gridwin, "B7", "0") - enter_text_to_cell(gridwin, "B8", "0") - enter_text_to_cell(gridwin, "B9", "0") - enter_text_to_cell(gridwin, "B10", "0") - enter_text_to_cell(gridwin, "B11", "0") - enter_text_to_cell(gridwin, "B12", "0") - enter_text_to_cell(gridwin, "B13", "0") + enter_text_to_cell(gridwin, "B1", "0") + enter_text_to_cell(gridwin, "B2", "0") + enter_text_to_cell(gridwin, "B3", "1") + enter_text_to_cell(gridwin, "B4", "0") + enter_text_to_cell(gridwin, "B5", "0") + enter_text_to_cell(gridwin, "B6", "0") + enter_text_to_cell(gridwin, "B7", "0") + enter_text_to_cell(gridwin, "B8", "0") + enter_text_to_cell(gridwin, "B9", "0") + enter_text_to_cell(gridwin, "B10", "0") + enter_text_to_cell(gridwin, "B11", "0") + enter_text_to_cell(gridwin, "B12", "0") + enter_text_to_cell(gridwin, "B13", "0") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xmoothingfactorspin = xDialog.getChild("smoothing-factor-spin") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xmoothingfactorspin = xDialog.getChild("smoothing-factor-spin") - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) - xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.5"})) - xgroupedbyrowsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Alpha") - self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 0.5) - self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Row 1") - self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 1) - self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 1) - self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 0.5) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.5"})) + xgroupedbyrowsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Alpha") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 0.5) + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Row 1") + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 0.5) - self.assertEqual(get_cell_by_position(document, 0, 6, 2).getString(), "Row 2") - self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 0) - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 6, 2).getString(), "Row 2") + self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 0) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/fTest.py b/sc/qa/uitest/statistics/fTest.py index b3beb09d83ed..1f2762c4f796 100644 --- a/sc/qa/uitest/statistics/fTest.py +++ b/sc/qa/uitest/statistics/fTest.py @@ -16,104 +16,106 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tTest(UITestCase): def test_fTest_column(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #fill data - enter_text_to_cell(gridwin, "A1", "28") - enter_text_to_cell(gridwin, "A2", "26") - enter_text_to_cell(gridwin, "A3", "31") - enter_text_to_cell(gridwin, "A4", "23") - enter_text_to_cell(gridwin, "A5", "20") - enter_text_to_cell(gridwin, "A6", "27") - enter_text_to_cell(gridwin, "A7", "28") - enter_text_to_cell(gridwin, "A8", "14") - enter_text_to_cell(gridwin, "A9", "4") - enter_text_to_cell(gridwin, "A10", "0") - enter_text_to_cell(gridwin, "A11", "2") - enter_text_to_cell(gridwin, "A12", "8") - enter_text_to_cell(gridwin, "A13", "9") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #fill data + enter_text_to_cell(gridwin, "A1", "28") + enter_text_to_cell(gridwin, "A2", "26") + enter_text_to_cell(gridwin, "A3", "31") + enter_text_to_cell(gridwin, "A4", "23") + enter_text_to_cell(gridwin, "A5", "20") + enter_text_to_cell(gridwin, "A6", "27") + enter_text_to_cell(gridwin, "A7", "28") + enter_text_to_cell(gridwin, "A8", "14") + enter_text_to_cell(gridwin, "A9", "4") + enter_text_to_cell(gridwin, "A10", "0") + enter_text_to_cell(gridwin, "A11", "2") + enter_text_to_cell(gridwin, "A12", "8") + enter_text_to_cell(gridwin, "A13", "9") - enter_text_to_cell(gridwin, "B1", "19") - enter_text_to_cell(gridwin, "B2", "13") - enter_text_to_cell(gridwin, "B3", "12") - enter_text_to_cell(gridwin, "B4", "5") - enter_text_to_cell(gridwin, "B5", "34") - enter_text_to_cell(gridwin, "B6", "31") - enter_text_to_cell(gridwin, "B7", "31") - enter_text_to_cell(gridwin, "B8", "12") - enter_text_to_cell(gridwin, "B9", "24") - enter_text_to_cell(gridwin, "B10", "23") - enter_text_to_cell(gridwin, "B11", "19") - enter_text_to_cell(gridwin, "B12", "10") - enter_text_to_cell(gridwin, "B13", "33") + enter_text_to_cell(gridwin, "B1", "19") + enter_text_to_cell(gridwin, "B2", "13") + enter_text_to_cell(gridwin, "B3", "12") + enter_text_to_cell(gridwin, "B4", "5") + enter_text_to_cell(gridwin, "B5", "34") + enter_text_to_cell(gridwin, "B6", "31") + enter_text_to_cell(gridwin, "B7", "31") + enter_text_to_cell(gridwin, "B8", "12") + enter_text_to_cell(gridwin, "B9", "24") + enter_text_to_cell(gridwin, "B10", "23") + enter_text_to_cell(gridwin, "B11", "19") + enter_text_to_cell(gridwin, "B12", "10") + enter_text_to_cell(gridwin, "B13", "33") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:FTestDialog") - xDialog = self.xUITest.getTopFocusWindow() - xvariable1rangeedit = xDialog.getChild("variable1-range-edit") - xvariable2rangeedit = xDialog.getChild("variable2-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:FTestDialog") + xDialog = self.xUITest.getTopFocusWindow() + xvariable1rangeedit = xDialog.getChild("variable1-range-edit") + xvariable2rangeedit = xDialog.getChild("variable2-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) - xgroupedbycolumnsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "F-test") - self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "F-test") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") - self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Mean") - self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Variance") - self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Observations") - self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "df") - self.assertEqual(get_cell_by_position(document, 0, 5, 7).getString(), "F") - self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "P (F<=f) right-tail") - self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "F Critical right-tail") - self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "P (F<=f) left-tail") - self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "F Critical left-tail") - self.assertEqual(get_cell_by_position(document, 0, 5, 12).getString(), "P two-tail") - self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString(), "F Critical two-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Mean") + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Variance") + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Observations") + self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "df") + self.assertEqual(get_cell_by_position(document, 0, 5, 7).getString(), "F") + self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "P (F<=f) right-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "F Critical right-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "P (F<=f) left-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "F Critical left-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 12).getString(), "P two-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString(), "F Critical two-tail") - self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05) - self.assertEqual(get_cell_by_position(document, 0, 6, 2).getString(), "Variable 1") - self.assertEqual(round(get_cell_by_position(document, 0, 6, 3).getValue(),12), 16.923076923077) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 4).getValue(),12), 125.076923076923) - self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 13) - self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 12) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 7).getValue(),12), 1.324463752376) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 8).getValue(),12), 0.317061414639) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 9).getValue(),12), 2.686637112496) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 10).getValue(),12), 0.682938585361) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 12).getValue(),12), 0.634122829279) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 13).getValue(),12), 0.305131354874) + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05) + self.assertEqual(get_cell_by_position(document, 0, 6, 2).getString(), "Variable 1") + self.assertEqual(round(get_cell_by_position(document, 0, 6, 3).getValue(),12), 16.923076923077) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 4).getValue(),12), 125.076923076923) + self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 13) + self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 12) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 7).getValue(),12), 1.324463752376) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 8).getValue(),12), 0.317061414639) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 9).getValue(),12), 2.686637112496) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 10).getValue(),12), 0.682938585361) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 12).getValue(),12), 0.634122829279) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 13).getValue(),12), 0.305131354874) - self.assertEqual(get_cell_by_position(document, 0, 7, 2).getString(), "Variable 2") - self.assertEqual(round(get_cell_by_position(document, 0, 7, 3).getValue(),12), 20.461538461538) - self.assertEqual(round(get_cell_by_position(document, 0, 7, 4).getValue(),12), 94.435897435897) - self.assertEqual(get_cell_by_position(document, 0, 7, 5).getValue(), 13) - self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue(), 12) - self.assertEqual(round(get_cell_by_position(document, 0, 7, 13).getValue(),12), 3.277277094033) - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 7, 2).getString(), "Variable 2") + self.assertEqual(round(get_cell_by_position(document, 0, 7, 3).getValue(),12), 20.461538461538) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 4).getValue(),12), 94.435897435897) + self.assertEqual(get_cell_by_position(document, 0, 7, 5).getValue(), 13) + self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue(), 12) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 13).getValue(),12), 3.277277094033) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") - # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:FTestDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:FTestDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/movingAverage.py b/sc/qa/uitest/statistics/movingAverage.py index 6cb4934f7764..9f94aaf29856 100644 --- a/sc/qa/uitest/statistics/movingAverage.py +++ b/sc/qa/uitest/statistics/movingAverage.py @@ -16,163 +16,167 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class movingAverage(UITestCase): def test_moving_average_column(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #fill data - enter_text_to_cell(gridwin, "A1", "1") - enter_text_to_cell(gridwin, "A2", "0") - enter_text_to_cell(gridwin, "A3", "0") - enter_text_to_cell(gridwin, "A4", "0") - enter_text_to_cell(gridwin, "A5", "0") - enter_text_to_cell(gridwin, "A7", "0") - enter_text_to_cell(gridwin, "A8", "0") - enter_text_to_cell(gridwin, "A9", "0") - enter_text_to_cell(gridwin, "A10", "0") - enter_text_to_cell(gridwin, "A11", "0") - enter_text_to_cell(gridwin, "A12", "0") - enter_text_to_cell(gridwin, "A13", "0") - - enter_text_to_cell(gridwin, "B1", "0") - enter_text_to_cell(gridwin, "B2", "0") - enter_text_to_cell(gridwin, "B3", "1") - enter_text_to_cell(gridwin, "B4", "0") - enter_text_to_cell(gridwin, "B5", "0") - enter_text_to_cell(gridwin, "B6", "0") - enter_text_to_cell(gridwin, "B7", "0") - enter_text_to_cell(gridwin, "B8", "0") - enter_text_to_cell(gridwin, "B9", "0") - enter_text_to_cell(gridwin, "B10", "0") - enter_text_to_cell(gridwin, "B11", "0") - enter_text_to_cell(gridwin, "B12", "0") - enter_text_to_cell(gridwin, "B13", "0") - - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xintervalspin = xDialog.getChild("interval-spin") - - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) - xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xintervalspin.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Column 1") - self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "#N/A") - self.assertEqual(round(get_cell_by_position(document, 0, 5, 2).getValue(),8), 0.33333333) - self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 5, 6).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 5, 7).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 5, 8).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 5, 9).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 5, 10).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 5, 11).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 5, 12).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString(), "#N/A") - - - self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "Column 2") - self.assertEqual(get_cell_by_position(document, 0, 6, 1).getString(), "#N/A") - self.assertEqual(round(get_cell_by_position(document, 0, 6, 2).getValue(),8), 0.33333333) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 3).getValue(),8), 0.33333333) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 4).getValue(),8), 0.33333333) - self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 6, 7).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 6, 9).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 6, 10).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 6, 11).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 6, 12).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 6, 13).getString(), "#N/A") - - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") - - # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #fill data + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "0") + enter_text_to_cell(gridwin, "A3", "0") + enter_text_to_cell(gridwin, "A4", "0") + enter_text_to_cell(gridwin, "A5", "0") + enter_text_to_cell(gridwin, "A7", "0") + enter_text_to_cell(gridwin, "A8", "0") + enter_text_to_cell(gridwin, "A9", "0") + enter_text_to_cell(gridwin, "A10", "0") + enter_text_to_cell(gridwin, "A11", "0") + enter_text_to_cell(gridwin, "A12", "0") + enter_text_to_cell(gridwin, "A13", "0") + + enter_text_to_cell(gridwin, "B1", "0") + enter_text_to_cell(gridwin, "B2", "0") + enter_text_to_cell(gridwin, "B3", "1") + enter_text_to_cell(gridwin, "B4", "0") + enter_text_to_cell(gridwin, "B5", "0") + enter_text_to_cell(gridwin, "B6", "0") + enter_text_to_cell(gridwin, "B7", "0") + enter_text_to_cell(gridwin, "B8", "0") + enter_text_to_cell(gridwin, "B9", "0") + enter_text_to_cell(gridwin, "B10", "0") + enter_text_to_cell(gridwin, "B11", "0") + enter_text_to_cell(gridwin, "B12", "0") + enter_text_to_cell(gridwin, "B13", "0") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xintervalspin = xDialog.getChild("interval-spin") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xintervalspin.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Column 1") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "#N/A") + self.assertEqual(round(get_cell_by_position(document, 0, 5, 2).getValue(),8), 0.33333333) + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 6).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 7).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 8).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 9).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 10).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 11).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 12).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString(), "#N/A") + + + self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "Column 2") + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getString(), "#N/A") + self.assertEqual(round(get_cell_by_position(document, 0, 6, 2).getValue(),8), 0.33333333) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 3).getValue(),8), 0.33333333) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 4).getValue(),8), 0.33333333) + self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 7).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 9).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 10).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 11).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 12).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 13).getString(), "#N/A") + + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() def test_moving_average_row(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #fill data - enter_text_to_cell(gridwin, "A1", "1") - enter_text_to_cell(gridwin, "A2", "0") - enter_text_to_cell(gridwin, "A3", "0") - enter_text_to_cell(gridwin, "A4", "0") - enter_text_to_cell(gridwin, "A5", "0") - enter_text_to_cell(gridwin, "A7", "0") - enter_text_to_cell(gridwin, "A8", "0") - enter_text_to_cell(gridwin, "A9", "0") - enter_text_to_cell(gridwin, "A10", "0") - enter_text_to_cell(gridwin, "A11", "0") - enter_text_to_cell(gridwin, "A12", "0") - enter_text_to_cell(gridwin, "A13", "0") - - enter_text_to_cell(gridwin, "B1", "0") - enter_text_to_cell(gridwin, "B2", "0") - enter_text_to_cell(gridwin, "B3", "1") - enter_text_to_cell(gridwin, "B4", "0") - enter_text_to_cell(gridwin, "B5", "0") - enter_text_to_cell(gridwin, "B6", "0") - enter_text_to_cell(gridwin, "B7", "0") - enter_text_to_cell(gridwin, "B8", "0") - enter_text_to_cell(gridwin, "B9", "0") - enter_text_to_cell(gridwin, "B10", "0") - enter_text_to_cell(gridwin, "B11", "0") - enter_text_to_cell(gridwin, "B12", "0") - enter_text_to_cell(gridwin, "B13", "0") - - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xintervalspin = xDialog.getChild("interval-spin") - - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) - xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xintervalspin.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) - xgroupedbyrowsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Row 1") - self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "#N/A") - self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "#N/A") - - self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "Row 2") - self.assertEqual(get_cell_by_position(document, 0, 6, 1).getString(), "#N/A") - self.assertEqual(get_cell_by_position(document, 0, 6, 2).getString(), "#N/A") - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #fill data + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "0") + enter_text_to_cell(gridwin, "A3", "0") + enter_text_to_cell(gridwin, "A4", "0") + enter_text_to_cell(gridwin, "A5", "0") + enter_text_to_cell(gridwin, "A7", "0") + enter_text_to_cell(gridwin, "A8", "0") + enter_text_to_cell(gridwin, "A9", "0") + enter_text_to_cell(gridwin, "A10", "0") + enter_text_to_cell(gridwin, "A11", "0") + enter_text_to_cell(gridwin, "A12", "0") + enter_text_to_cell(gridwin, "A13", "0") + + enter_text_to_cell(gridwin, "B1", "0") + enter_text_to_cell(gridwin, "B2", "0") + enter_text_to_cell(gridwin, "B3", "1") + enter_text_to_cell(gridwin, "B4", "0") + enter_text_to_cell(gridwin, "B5", "0") + enter_text_to_cell(gridwin, "B6", "0") + enter_text_to_cell(gridwin, "B7", "0") + enter_text_to_cell(gridwin, "B8", "0") + enter_text_to_cell(gridwin, "B9", "0") + enter_text_to_cell(gridwin, "B10", "0") + enter_text_to_cell(gridwin, "B11", "0") + enter_text_to_cell(gridwin, "B12", "0") + enter_text_to_cell(gridwin, "B13", "0") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xintervalspin = xDialog.getChild("interval-spin") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xintervalspin.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + xgroupedbyrowsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Row 1") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "#N/A") + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "#N/A") + + self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "Row 2") + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getString(), "#N/A") + self.assertEqual(get_cell_by_position(document, 0, 6, 2).getString(), "#N/A") + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/regression.py b/sc/qa/uitest/statistics/regression.py index 769014d5babf..0102df1f8f92 100644 --- a/sc/qa/uitest/statistics/regression.py +++ b/sc/qa/uitest/statistics/regression.py @@ -103,10 +103,12 @@ class regression(UITestCase): self.ui_test.close_dialog_through_button(xOKBtn) def test_regression_cancel(self): - with self.ui_test.create_doc_in_start_center("calc"): - self.ui_test.execute_modeless_dialog_through_command(".uno:RegressionDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + self.ui_test.execute_modeless_dialog_through_command(".uno:RegressionDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/sampling.py b/sc/qa/uitest/statistics/sampling.py index 3ea6c1e1ecd4..dd3fd2698c5b 100644 --- a/sc/qa/uitest/statistics/sampling.py +++ b/sc/qa/uitest/statistics/sampling.py @@ -16,99 +16,100 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class sampling(UITestCase): def test_statistic_sampling(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #fill data - enter_text_to_cell(gridwin, "A1", "11") - enter_text_to_cell(gridwin, "A2", "12") - enter_text_to_cell(gridwin, "A3", "13") - enter_text_to_cell(gridwin, "A4", "14") - enter_text_to_cell(gridwin, "A5", "15") - enter_text_to_cell(gridwin, "A6", "16") - enter_text_to_cell(gridwin, "A7", "17") - enter_text_to_cell(gridwin, "A8", "18") - enter_text_to_cell(gridwin, "A9", "19") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #fill data + enter_text_to_cell(gridwin, "A1", "11") + enter_text_to_cell(gridwin, "A2", "12") + enter_text_to_cell(gridwin, "A3", "13") + enter_text_to_cell(gridwin, "A4", "14") + enter_text_to_cell(gridwin, "A5", "15") + enter_text_to_cell(gridwin, "A6", "16") + enter_text_to_cell(gridwin, "A7", "17") + enter_text_to_cell(gridwin, "A8", "18") + enter_text_to_cell(gridwin, "A9", "19") - enter_text_to_cell(gridwin, "B1", "21") - enter_text_to_cell(gridwin, "B2", "22") - enter_text_to_cell(gridwin, "B3", "23") - enter_text_to_cell(gridwin, "B4", "24") - enter_text_to_cell(gridwin, "B5", "25") - enter_text_to_cell(gridwin, "B6", "26") - enter_text_to_cell(gridwin, "B7", "27") - enter_text_to_cell(gridwin, "B8", "28") - enter_text_to_cell(gridwin, "B9", "29") + enter_text_to_cell(gridwin, "B1", "21") + enter_text_to_cell(gridwin, "B2", "22") + enter_text_to_cell(gridwin, "B3", "23") + enter_text_to_cell(gridwin, "B4", "24") + enter_text_to_cell(gridwin, "B5", "25") + enter_text_to_cell(gridwin, "B6", "26") + enter_text_to_cell(gridwin, "B7", "27") + enter_text_to_cell(gridwin, "B8", "28") + enter_text_to_cell(gridwin, "B9", "29") - enter_text_to_cell(gridwin, "C1", "31") - enter_text_to_cell(gridwin, "C2", "32") - enter_text_to_cell(gridwin, "C3", "33") - enter_text_to_cell(gridwin, "C4", "34") - enter_text_to_cell(gridwin, "C5", "35") - enter_text_to_cell(gridwin, "C6", "36") - enter_text_to_cell(gridwin, "C7", "37") - enter_text_to_cell(gridwin, "C8", "38") - enter_text_to_cell(gridwin, "C9", "39") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C9"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:SamplingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xrandommethodradio = xDialog.getChild("random-method-radio") - xsamplesizespin = xDialog.getChild("sample-size-spin") - xperiodicmethodradio = xDialog.getChild("periodic-method-radio") - xperiodspin = xDialog.getChild("period-spin") + enter_text_to_cell(gridwin, "C1", "31") + enter_text_to_cell(gridwin, "C2", "32") + enter_text_to_cell(gridwin, "C3", "33") + enter_text_to_cell(gridwin, "C4", "34") + enter_text_to_cell(gridwin, "C5", "35") + enter_text_to_cell(gridwin, "C6", "36") + enter_text_to_cell(gridwin, "C7", "37") + enter_text_to_cell(gridwin, "C8", "38") + enter_text_to_cell(gridwin, "C9", "39") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C9"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:SamplingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xrandommethodradio = xDialog.getChild("random-method-radio") + xsamplesizespin = xDialog.getChild("sample-size-spin") + xperiodicmethodradio = xDialog.getChild("periodic-method-radio") + xperiodspin = xDialog.getChild("period-spin") - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$9"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$9"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$F$1"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$F$1"})) - xperiodicmethodradio.executeAction("CLICK", tuple()) + xperiodicmethodradio.executeAction("CLICK", tuple()) - xperiodspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xperiodspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xperiodspin.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 12) - self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue() , 14) - self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue() , 16) - self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue() , 18) + xperiodspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xperiodspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xperiodspin.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 12) + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue() , 14) + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue() , 16) + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue() , 18) - self.assertEqual(get_cell_by_position(document, 0, 6, 0).getValue(), 22) - self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue() , 24) - self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue() , 26) - self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue() , 28) + self.assertEqual(get_cell_by_position(document, 0, 6, 0).getValue(), 22) + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue() , 24) + self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue() , 26) + self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue() , 28) - self.assertEqual(get_cell_by_position(document, 0, 7, 0).getValue(), 32) - self.assertEqual(get_cell_by_position(document, 0, 7, 1).getValue() , 34) - self.assertEqual(get_cell_by_position(document, 0, 7, 2).getValue() , 36) - self.assertEqual(get_cell_by_position(document, 0, 7, 3).getValue() , 38) - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue() , 0) - self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue() , 0) - self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue() , 0) + self.assertEqual(get_cell_by_position(document, 0, 7, 0).getValue(), 32) + self.assertEqual(get_cell_by_position(document, 0, 7, 1).getValue() , 34) + self.assertEqual(get_cell_by_position(document, 0, 7, 2).getValue() , 36) + self.assertEqual(get_cell_by_position(document, 0, 7, 3).getValue() , 38) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue() , 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue() , 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue() , 0) - self.assertEqual(get_cell_by_position(document, 0, 6, 0).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue() , 0) - self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue() , 0) - self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue() , 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 0).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue() , 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue() , 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue() , 0) - self.assertEqual(get_cell_by_position(document, 0, 7, 0).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 7, 1).getValue() , 0) - self.assertEqual(get_cell_by_position(document, 0, 7, 2).getValue() , 0) - self.assertEqual(get_cell_by_position(document, 0, 7, 3).getValue() , 0) + self.assertEqual(get_cell_by_position(document, 0, 7, 0).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 7, 1).getValue() , 0) + self.assertEqual(get_cell_by_position(document, 0, 7, 2).getValue() , 0) + self.assertEqual(get_cell_by_position(document, 0, 7, 3).getValue() , 0) - # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:SamplingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:SamplingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/tTest.py b/sc/qa/uitest/statistics/tTest.py index 34eaab786c2c..035bb4ef6d89 100644 --- a/sc/qa/uitest/statistics/tTest.py +++ b/sc/qa/uitest/statistics/tTest.py @@ -16,105 +16,107 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tTest(UITestCase): def test_tTest_column(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #fill data - enter_text_to_cell(gridwin, "A1", "28") - enter_text_to_cell(gridwin, "A2", "26") - enter_text_to_cell(gridwin, "A3", "31") - enter_text_to_cell(gridwin, "A4", "23") - enter_text_to_cell(gridwin, "A5", "20") - enter_text_to_cell(gridwin, "A6", "27") - enter_text_to_cell(gridwin, "A7", "28") - enter_text_to_cell(gridwin, "A8", "14") - enter_text_to_cell(gridwin, "A9", "4") - enter_text_to_cell(gridwin, "A10", "0") - enter_text_to_cell(gridwin, "A11", "2") - enter_text_to_cell(gridwin, "A12", "8") - enter_text_to_cell(gridwin, "A13", "9") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #fill data + enter_text_to_cell(gridwin, "A1", "28") + enter_text_to_cell(gridwin, "A2", "26") + enter_text_to_cell(gridwin, "A3", "31") + enter_text_to_cell(gridwin, "A4", "23") + enter_text_to_cell(gridwin, "A5", "20") + enter_text_to_cell(gridwin, "A6", "27") + enter_text_to_cell(gridwin, "A7", "28") + enter_text_to_cell(gridwin, "A8", "14") + enter_text_to_cell(gridwin, "A9", "4") + enter_text_to_cell(gridwin, "A10", "0") + enter_text_to_cell(gridwin, "A11", "2") + enter_text_to_cell(gridwin, "A12", "8") + enter_text_to_cell(gridwin, "A13", "9") - enter_text_to_cell(gridwin, "B1", "19") - enter_text_to_cell(gridwin, "B2", "13") - enter_text_to_cell(gridwin, "B3", "12") - enter_text_to_cell(gridwin, "B4", "5") - enter_text_to_cell(gridwin, "B5", "34") - enter_text_to_cell(gridwin, "B6", "31") - enter_text_to_cell(gridwin, "B7", "31") - enter_text_to_cell(gridwin, "B8", "12") - enter_text_to_cell(gridwin, "B9", "24") - enter_text_to_cell(gridwin, "B10", "23") - enter_text_to_cell(gridwin, "B11", "19") - enter_text_to_cell(gridwin, "B12", "10") - enter_text_to_cell(gridwin, "B13", "33") + enter_text_to_cell(gridwin, "B1", "19") + enter_text_to_cell(gridwin, "B2", "13") + enter_text_to_cell(gridwin, "B3", "12") + enter_text_to_cell(gridwin, "B4", "5") + enter_text_to_cell(gridwin, "B5", "34") + enter_text_to_cell(gridwin, "B6", "31") + enter_text_to_cell(gridwin, "B7", "31") + enter_text_to_cell(gridwin, "B8", "12") + enter_text_to_cell(gridwin, "B9", "24") + enter_text_to_cell(gridwin, "B10", "23") + enter_text_to_cell(gridwin, "B11", "19") + enter_text_to_cell(gridwin, "B12", "10") + enter_text_to_cell(gridwin, "B13", "33") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:TTestDialog") - xDialog = self.xUITest.getTopFocusWindow() - xvariable1rangeedit = xDialog.getChild("variable1-range-edit") - xvariable2rangeedit = xDialog.getChild("variable2-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:TTestDialog") + xDialog = self.xUITest.getTopFocusWindow() + xvariable1rangeedit = xDialog.getChild("variable1-range-edit") + xvariable2rangeedit = xDialog.getChild("variable2-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) - xgroupedbycolumnsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Paired t-test") - self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") - self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Hypothesized Mean Difference") - self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Mean") - self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Variance") - self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "Observations") - self.assertEqual(get_cell_by_position(document, 0, 5, 7).getString(), "Pearson Correlation") - self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "Observed Mean Difference") - self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "Variance of the Differences") - self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "df") - self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "t Stat") - self.assertEqual(get_cell_by_position(document, 0, 5, 12).getString(), "P (T<=t) one-tail") - self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString(), "t Critical one-tail") - self.assertEqual(get_cell_by_position(document, 0, 5, 14).getString(), "P (T<=t) two-tail") - self.assertEqual(get_cell_by_position(document, 0, 5, 15).getString(), "t Critical two-tail") + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Paired t-test") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Hypothesized Mean Difference") + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Mean") + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Variance") + self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "Observations") + self.assertEqual(get_cell_by_position(document, 0, 5, 7).getString(), "Pearson Correlation") + self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "Observed Mean Difference") + self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "Variance of the Differences") + self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "df") + self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "t Stat") + self.assertEqual(get_cell_by_position(document, 0, 5, 12).getString(), "P (T<=t) one-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString(), "t Critical one-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 14).getString(), "P (T<=t) two-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 15).getString(), "t Critical two-tail") - self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05) - self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 6, 3).getString(), "Variable 1") - self.assertEqual(round(get_cell_by_position(document, 0, 6, 4).getValue(),12), 16.923076923077) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 5).getValue(),12), 125.076923076923) - self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 13) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 7).getValue(),12), -0.061753977175) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 8).getValue(),12), -3.538461538462) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 9).getValue(),12), 232.935897435897) - self.assertEqual(get_cell_by_position(document, 0, 6, 10).getValue(), 12) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 11).getValue(),12), -0.835926213674) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 12).getValue(),12), 0.209765144211) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 13).getValue(),12), 1.782287555649) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 14).getValue(),12), 0.419530288422) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 15).getValue(),12), 2.178812829667) + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05) + self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 3).getString(), "Variable 1") + self.assertEqual(round(get_cell_by_position(document, 0, 6, 4).getValue(),12), 16.923076923077) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 5).getValue(),12), 125.076923076923) + self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 13) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 7).getValue(),12), -0.061753977175) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 8).getValue(),12), -3.538461538462) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 9).getValue(),12), 232.935897435897) + self.assertEqual(get_cell_by_position(document, 0, 6, 10).getValue(), 12) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 11).getValue(),12), -0.835926213674) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 12).getValue(),12), 0.209765144211) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 13).getValue(),12), 1.782287555649) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 14).getValue(),12), 0.419530288422) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 15).getValue(),12), 2.178812829667) - self.assertEqual(get_cell_by_position(document, 0, 7, 3).getString(), "Variable 2") - self.assertEqual(round(get_cell_by_position(document, 0, 7, 4).getValue(),12), 20.461538461538) - self.assertEqual(round(get_cell_by_position(document, 0, 7, 5).getValue(),12), 94.435897435897) - self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue(), 13) - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 7, 3).getString(), "Variable 2") + self.assertEqual(round(get_cell_by_position(document, 0, 7, 4).getValue(),12), 20.461538461538) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 5).getValue(),12), 94.435897435897) + self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue(), 13) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") - # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:TTestDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:TTestDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/zTest.py b/sc/qa/uitest/statistics/zTest.py index ea44d9f0cee9..a7f791e1a898 100644 --- a/sc/qa/uitest/statistics/zTest.py +++ b/sc/qa/uitest/statistics/zTest.py @@ -16,95 +16,97 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class zTest(UITestCase): def test_zTest_column(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - #fill data - enter_text_to_cell(gridwin, "A1", "28") - enter_text_to_cell(gridwin, "A2", "26") - enter_text_to_cell(gridwin, "A3", "31") - enter_text_to_cell(gridwin, "A4", "23") - enter_text_to_cell(gridwin, "A5", "20") - enter_text_to_cell(gridwin, "A6", "27") - enter_text_to_cell(gridwin, "A7", "28") - enter_text_to_cell(gridwin, "A8", "14") - enter_text_to_cell(gridwin, "A9", "4") - enter_text_to_cell(gridwin, "A10", "0") - enter_text_to_cell(gridwin, "A11", "2") - enter_text_to_cell(gridwin, "A12", "8") - enter_text_to_cell(gridwin, "A13", "9") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #fill data + enter_text_to_cell(gridwin, "A1", "28") + enter_text_to_cell(gridwin, "A2", "26") + enter_text_to_cell(gridwin, "A3", "31") + enter_text_to_cell(gridwin, "A4", "23") + enter_text_to_cell(gridwin, "A5", "20") + enter_text_to_cell(gridwin, "A6", "27") + enter_text_to_cell(gridwin, "A7", "28") + enter_text_to_cell(gridwin, "A8", "14") + enter_text_to_cell(gridwin, "A9", "4") + enter_text_to_cell(gridwin, "A10", "0") + enter_text_to_cell(gridwin, "A11", "2") + enter_text_to_cell(gridwin, "A12", "8") + enter_text_to_cell(gridwin, "A13", "9") - enter_text_to_cell(gridwin, "B1", "19") - enter_text_to_cell(gridwin, "B2", "13") - enter_text_to_cell(gridwin, "B3", "12") - enter_text_to_cell(gridwin, "B4", "5") - enter_text_to_cell(gridwin, "B5", "34") - enter_text_to_cell(gridwin, "B6", "31") - enter_text_to_cell(gridwin, "B7", "31") - enter_text_to_cell(gridwin, "B8", "12") - enter_text_to_cell(gridwin, "B9", "24") - enter_text_to_cell(gridwin, "B10", "23") - enter_text_to_cell(gridwin, "B11", "19") - enter_text_to_cell(gridwin, "B12", "10") - enter_text_to_cell(gridwin, "B13", "33") + enter_text_to_cell(gridwin, "B1", "19") + enter_text_to_cell(gridwin, "B2", "13") + enter_text_to_cell(gridwin, "B3", "12") + enter_text_to_cell(gridwin, "B4", "5") + enter_text_to_cell(gridwin, "B5", "34") + enter_text_to_cell(gridwin, "B6", "31") + enter_text_to_cell(gridwin, "B7", "31") + enter_text_to_cell(gridwin, "B8", "12") + enter_text_to_cell(gridwin, "B9", "24") + enter_text_to_cell(gridwin, "B10", "23") + enter_text_to_cell(gridwin, "B11", "19") + enter_text_to_cell(gridwin, "B12", "10") + enter_text_to_cell(gridwin, "B13", "33") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:ZTestDialog") - xDialog = self.xUITest.getTopFocusWindow() - xvariable1rangeedit = xDialog.getChild("variable1-range-edit") - xvariable2rangeedit = xDialog.getChild("variable2-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:ZTestDialog") + xDialog = self.xUITest.getTopFocusWindow() + xvariable1rangeedit = xDialog.getChild("variable1-range-edit") + xvariable2rangeedit = xDialog.getChild("variable2-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) - xgroupedbycolumnsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #Verify - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "z-test") - self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "z-test") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") - self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Hypothesized Mean Difference") - self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Known Variance") - self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Mean") - self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "Observations") - self.assertEqual(get_cell_by_position(document, 0, 5, 7).getString(), "Observed Mean Difference") - self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "z") - self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "P (Z<=z) one-tail") - self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "z Critical one-tail") - self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "P (Z<=z) two-tail") - self.assertEqual(get_cell_by_position(document, 0, 5, 12).getString(), "z Critical two-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Hypothesized Mean Difference") + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Known Variance") + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Mean") + self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "Observations") + self.assertEqual(get_cell_by_position(document, 0, 5, 7).getString(), "Observed Mean Difference") + self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "z") + self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "P (Z<=z) one-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "z Critical one-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "P (Z<=z) two-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 12).getString(), "z Critical two-tail") - self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05) - self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0) - self.assertEqual(get_cell_by_position(document, 0, 6, 3).getString(), "Variable 1") - self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue(), 0) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 5).getValue(),12), 16.923076923077) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 10).getValue(),12), 1.644853626951) - self.assertEqual(round(get_cell_by_position(document, 0, 6, 12).getValue(),12), 1.959963984540) + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05) + self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 3).getString(), "Variable 1") + self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue(), 0) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 5).getValue(),12), 16.923076923077) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 10).getValue(),12), 1.644853626951) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 12).getValue(),12), 1.959963984540) - self.assertEqual(get_cell_by_position(document, 0, 7, 3).getString(), "Variable 2") - self.assertEqual(get_cell_by_position(document, 0, 7, 4).getValue(), 0) - self.assertEqual(round(get_cell_by_position(document, 0, 7, 5).getValue(),12), 20.461538461538) - self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue(), 13) - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 7, 3).getString(), "Variable 2") + self.assertEqual(get_cell_by_position(document, 0, 7, 4).getValue(), 0) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 5).getValue(),12), 20.461538461538) + self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue(), 13) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") - # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:ZTestDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:ZTestDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/textCase/textCase.py b/sc/qa/uitest/textCase/textCase.py index 61085e831218..d3823f1dacc6 100644 --- a/sc/qa/uitest/textCase/textCase.py +++ b/sc/qa/uitest/textCase/textCase.py @@ -13,116 +13,117 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class textCase(UITestCase): def test_text_case_switch(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - #enter data - enter_text_to_cell(gridwin, "A1", "hello world") - enter_text_to_cell(gridwin, "A2", "libre office") - enter_text_to_cell(gridwin, "A4", "free suite") - #select - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) - #Capitalize every word - CommandSent Name:.uno:ChangeCaseToTitleCase - self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase") - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Hello World") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Libre Office") - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Free Suite") - - #Sentence case - CommandSent Name:.uno:ChangeCaseToSentenceCase - self.xUITest.executeCommand(".uno:ChangeCaseToSentenceCase") - - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Hello world") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Libre office") - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Free suite") - - #toggle case - CommandSent Name:.uno:ChangeCaseToToggleCase - self.xUITest.executeCommand(".uno:ChangeCaseToToggleCase") - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "hELLO WORLD") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "lIBRE OFFICE") - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "fREE SUITE") - - #uppercase = CommandSent Name:.uno:ChangeCaseToUpper - self.xUITest.executeCommand(".uno:ChangeCaseToUpper") - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "HELLO WORLD") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "LIBRE OFFICE") - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "FREE SUITE") - - #lowercase - CommandSent Name:.uno:ChangeCaseToLower - self.xUITest.executeCommand(".uno:ChangeCaseToLower") - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "hello world") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "libre office") - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "free suite") - - #cycle case = CommandSent Name:.uno:ChangeCaseRotateCase - self.xUITest.executeCommand(".uno:ChangeCaseRotateCase") - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Hello World") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Libre Office") - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Free Suite") - - #select non continuous range - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B2"})) - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A4:A5", "EXTEND":"1"})) - - #lowercase - CommandSent Name:.uno:ChangeCaseToLower - self.xUITest.executeCommand(".uno:ChangeCaseToLower") - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "hello world") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "libre office") - self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "free suite") - - #Capitalize every word - CommandSent Name:.uno:ChangeCaseToTitleCase - self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase") - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Hello World") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Libre Office") - self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Free Suite") - - #Sentence case - CommandSent Name:.uno:ChangeCaseToSentenceCase - self.xUITest.executeCommand(".uno:ChangeCaseToSentenceCase") - - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Hello world") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Libre office") - self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Free suite") - - #toggle case - CommandSent Name:.uno:ChangeCaseToToggleCase - self.xUITest.executeCommand(".uno:ChangeCaseToToggleCase") - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "hELLO WORLD") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "lIBRE OFFICE") - self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "fREE SUITE") - - #uppercase = CommandSent Name:.uno:ChangeCaseToUpper - self.xUITest.executeCommand(".uno:ChangeCaseToUpper") - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "HELLO WORLD") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "LIBRE OFFICE") - self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "FREE SUITE") - - #lowercase - CommandSent Name:.uno:ChangeCaseToLower - self.xUITest.executeCommand(".uno:ChangeCaseToLower") - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "hello world") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "libre office") - self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "free suite") - - #cycle case = CommandSent Name:.uno:ChangeCaseRotateCase - self.xUITest.executeCommand(".uno:ChangeCaseRotateCase") - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Hello world") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Libre office") - self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Free suite") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #enter data + enter_text_to_cell(gridwin, "A1", "hello world") + enter_text_to_cell(gridwin, "A2", "libre office") + enter_text_to_cell(gridwin, "A4", "free suite") + #select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + #Capitalize every word - CommandSent Name:.uno:ChangeCaseToTitleCase + self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase") + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Hello World") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Libre Office") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Free Suite") + + #Sentence case - CommandSent Name:.uno:ChangeCaseToSentenceCase + self.xUITest.executeCommand(".uno:ChangeCaseToSentenceCase") + + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Hello world") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Libre office") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Free suite") + + #toggle case - CommandSent Name:.uno:ChangeCaseToToggleCase + self.xUITest.executeCommand(".uno:ChangeCaseToToggleCase") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "hELLO WORLD") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "lIBRE OFFICE") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "fREE SUITE") + + #uppercase = CommandSent Name:.uno:ChangeCaseToUpper + self.xUITest.executeCommand(".uno:ChangeCaseToUpper") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "HELLO WORLD") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "LIBRE OFFICE") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "FREE SUITE") + + #lowercase - CommandSent Name:.uno:ChangeCaseToLower + self.xUITest.executeCommand(".uno:ChangeCaseToLower") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "hello world") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "libre office") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "free suite") + + #cycle case = CommandSent Name:.uno:ChangeCaseRotateCase + self.xUITest.executeCommand(".uno:ChangeCaseRotateCase") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Hello World") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Libre Office") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Free Suite") + + #select non continuous range + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B2"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A4:A5", "EXTEND":"1"})) + + #lowercase - CommandSent Name:.uno:ChangeCaseToLower + self.xUITest.executeCommand(".uno:ChangeCaseToLower") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "hello world") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "libre office") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "free suite") + + #Capitalize every word - CommandSent Name:.uno:ChangeCaseToTitleCase + self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase") + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Hello World") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Libre Office") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Free Suite") + + #Sentence case - CommandSent Name:.uno:ChangeCaseToSentenceCase + self.xUITest.executeCommand(".uno:ChangeCaseToSentenceCase") + + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Hello world") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Libre office") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Free suite") + + #toggle case - CommandSent Name:.uno:ChangeCaseToToggleCase + self.xUITest.executeCommand(".uno:ChangeCaseToToggleCase") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "hELLO WORLD") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "lIBRE OFFICE") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "fREE SUITE") + + #uppercase = CommandSent Name:.uno:ChangeCaseToUpper + self.xUITest.executeCommand(".uno:ChangeCaseToUpper") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "HELLO WORLD") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "LIBRE OFFICE") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "FREE SUITE") + + #lowercase - CommandSent Name:.uno:ChangeCaseToLower + self.xUITest.executeCommand(".uno:ChangeCaseToLower") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "hello world") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "libre office") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "free suite") + + #cycle case = CommandSent Name:.uno:ChangeCaseRotateCase + self.xUITest.executeCommand(".uno:ChangeCaseRotateCase") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Hello world") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Libre office") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Free suite") + self.ui_test.close_doc() def test_tdf119155_Capitalize_Every_Word(self): #Bug 119155 - Freeze after command format->text->Capitalize Every Word diff --git a/sc/qa/uitest/validity/tdf138134.py b/sc/qa/uitest/validity/tdf138134.py index 9147a263c862..1bbdc443d60e 100644 --- a/sc/qa/uitest/validity/tdf138134.py +++ b/sc/qa/uitest/validity/tdf138134.py @@ -15,44 +15,46 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class DetectiveCircle(UITestCase): def test_delete_circle_at_formula(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "1") - enter_text_to_cell(gridwin, "A2", "3") - enter_text_to_cell(gridwin, "A3", "=SUM(A1:A2)") - - #Select the cells to be validated - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - #Apply Data > Validity ... > Whole Numbers - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xallow = xDialog.getChild("allow") - xallowempty = xDialog.getChild("allowempty") - xdata = xDialog.getChild("data") - xmin = xDialog.getChild("min") - xmax = xDialog.getChild("max") - - select_by_text(xallow, "Whole Numbers") - xallowempty.executeAction("CLICK", tuple()) - select_by_text(xdata, "equal") - xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"5"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - self.xUITest.executeCommand(".uno:ShowInvalid") - - detectiveCircle1 = document.Sheets.getByName("Sheet1").DrawPage.getCount() - #There should be 1 detective circle object! - self.assertEqual(detectiveCircle1, 1) - - enter_text_to_cell(gridwin, "A1", "2") - - detectiveCircle2 = document.Sheets.getByName("Sheet1").DrawPage.getCount() - #There should not be a detective circle object! - self.assertEqual(detectiveCircle2, 0) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "3") + enter_text_to_cell(gridwin, "A3", "=SUM(A1:A2)") + + #Select the cells to be validated + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #Apply Data > Validity ... > Whole Numbers + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xdata = xDialog.getChild("data") + xmin = xDialog.getChild("min") + xmax = xDialog.getChild("max") + + select_by_text(xallow, "Whole Numbers") + xallowempty.executeAction("CLICK", tuple()) + select_by_text(xdata, "equal") + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"5"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.xUITest.executeCommand(".uno:ShowInvalid") + + detectiveCircle1 = document.Sheets.getByName("Sheet1").DrawPage.getCount() + #There should be 1 detective circle object! + self.assertEqual(detectiveCircle1, 1) + + enter_text_to_cell(gridwin, "A1", "2") + + detectiveCircle2 = document.Sheets.getByName("Sheet1").DrawPage.getCount() + #There should not be a detective circle object! + self.assertEqual(detectiveCircle2, 0) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/validity/tdf53920.py b/sc/qa/uitest/validity/tdf53920.py index b709d31d8545..e1a4fc87efaa 100644 --- a/sc/qa/uitest/validity/tdf53920.py +++ b/sc/qa/uitest/validity/tdf53920.py @@ -15,61 +15,63 @@ from uitest.debug import sleep #Bug 53920 - EDITING: Data Validity Cell Range not being applied to multiple selected cells class tdf53920(UITestCase): def test_tdf53920_validity_multiple_cells(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #. Provide the desired values in a range of cells - enter_text_to_cell(gridwin, "C1", "A") - enter_text_to_cell(gridwin, "C2", "B") - enter_text_to_cell(gridwin, "C3", "C") - #Select the cells to be validated - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3", "EXTEND":"1"})) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A5", "EXTEND":"1"})) - #Apply Data > Validity ... > Cell Range - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xallow = xDialog.getChild("allow") - xmin = xDialog.getChild("min") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #. Provide the desired values in a range of cells + enter_text_to_cell(gridwin, "C1", "A") + enter_text_to_cell(gridwin, "C2", "B") + enter_text_to_cell(gridwin, "C3", "C") + #Select the cells to be validated + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3", "EXTEND":"1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A5", "EXTEND":"1"})) + #Apply Data > Validity ... > Cell Range + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xmin = xDialog.getChild("min") - select_by_text(xallow, "Cell range") - xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$C$1:$C$3"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + select_by_text(xallow, "Cell range") + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$C$1:$C$3"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - #Expected behavior: All selected cells validate data. - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xallow = xDialog.getChild("allow") - xmin = xDialog.getChild("min") - self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Cell range") - self.assertEqual(get_state_as_dict(xmin)["Text"], "$Sheet1.$C$1:$C$3") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + #Expected behavior: All selected cells validate data. + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xallow = xDialog.getChild("allow") + xmin = xDialog.getChild("min") + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Cell range") + self.assertEqual(get_state_as_dict(xmin)["Text"], "$Sheet1.$C$1:$C$3") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xallow = xDialog.getChild("allow") - xmin = xDialog.getChild("min") - self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Cell range") - self.assertEqual(get_state_as_dict(xmin)["Text"], "$Sheet1.$C$1:$C$3") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xallow = xDialog.getChild("allow") + xmin = xDialog.getChild("min") + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Cell range") + self.assertEqual(get_state_as_dict(xmin)["Text"], "$Sheet1.$C$1:$C$3") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A5"})) - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xallow = xDialog.getChild("allow") - xmin = xDialog.getChild("min") - self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Cell range") - self.assertEqual(get_state_as_dict(xmin)["Text"], "$Sheet1.$C$1:$C$3") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A5"})) + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xallow = xDialog.getChild("allow") + xmin = xDialog.getChild("min") + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Cell range") + self.assertEqual(get_state_as_dict(xmin)["Text"], "$Sheet1.$C$1:$C$3") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/validity/tdf65686.py b/sc/qa/uitest/validity/tdf65686.py index 0fd26b1af72d..557701b1dd7f 100644 --- a/sc/qa/uitest/validity/tdf65686.py +++ b/sc/qa/uitest/validity/tdf65686.py @@ -14,43 +14,45 @@ from libreoffice.uno.propertyvalue import mkPropertyValues #Bug 65686 - EDITING Data > Validity broken (for list entries at least) class tdf65686(UITestCase): def test_tdf65686_validity_list(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #- Data > Validity - #- Select Allow List - #- Enter Entries Aap Noot Mies - #- OK - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xallow = xDialog.getChild("allow") - xallowempty = xDialog.getChild("allowempty") - minlist = xDialog.getChild("minlist") + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #- Data > Validity + #- Select Allow List + #- Enter Entries Aap Noot Mies + #- OK + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + minlist = xDialog.getChild("minlist") - select_by_text(xallow, "List") - minlist.executeAction("TYPE", mkPropertyValues({"TEXT":"Aap"})) - minlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - minlist.executeAction("TYPE", mkPropertyValues({"TEXT":"Noot"})) - minlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - minlist.executeAction("TYPE", mkPropertyValues({"TEXT":"Mies"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #- again open Data > Validity - #> there are empty lines in the list Entries - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xallow = xDialog.getChild("allow") - xallowempty = xDialog.getChild("allowempty") - minlist = xDialog.getChild("minlist") + select_by_text(xallow, "List") + minlist.executeAction("TYPE", mkPropertyValues({"TEXT":"Aap"})) + minlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + minlist.executeAction("TYPE", mkPropertyValues({"TEXT":"Noot"})) + minlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + minlist.executeAction("TYPE", mkPropertyValues({"TEXT":"Mies"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #- again open Data > Validity + #> there are empty lines in the list Entries + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + minlist = xDialog.getChild("minlist") - self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "List") - self.assertEqual(get_state_as_dict(minlist)["Text"], "Aap\nNoot\nMies") + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "List") + self.assertEqual(get_state_as_dict(minlist)["Text"], "Aap\nNoot\nMies") - 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.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/validity/tdf96698.py b/sc/qa/uitest/validity/tdf96698.py index 4bc5e04579d1..a3bd19c2f3ef 100644 --- a/sc/qa/uitest/validity/tdf96698.py +++ b/sc/qa/uitest/validity/tdf96698.py @@ -14,115 +14,117 @@ from libreoffice.uno.propertyvalue import mkPropertyValues #Bug 96698 - Data => Validity => Custom (like Excel) is missing class tdf96698(UITestCase): def test_tdf96698_validity_custom_formula(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - - #A general validity check for the entered new content of the active cell - especially for text - #with a custom formula like in Excel is not possible. - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xallow = xDialog.getChild("allow") - xallowempty = xDialog.getChild("allowempty") - xmin = xDialog.getChild("min") - - select_by_text(xallow, "Custom") - xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"ISERROR(FIND(\",\",B2))"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #verify - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xallow = xDialog.getChild("allow") - xallowempty = xDialog.getChild("allowempty") - xmin = xDialog.getChild("min") - - self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom") - self.assertEqual(get_state_as_dict(xmin)["Text"], "ISERROR(FIND(\",\",B2))") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xallow = xDialog.getChild("allow") - xallowempty = xDialog.getChild("allowempty") - xmin = xDialog.getChild("min") - - select_by_text(xallow, "Custom") - xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"NOT(ISERROR(B3))"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #verify - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xallow = xDialog.getChild("allow") - xallowempty = xDialog.getChild("allowempty") - xmin = xDialog.getChild("min") - - self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom") - self.assertEqual(get_state_as_dict(xmin)["Text"], "NOT(ISERROR(B3))") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A7"})) - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xallow = xDialog.getChild("allow") - xallowempty = xDialog.getChild("allowempty") - xmin = xDialog.getChild("min") - - select_by_text(xallow, "Custom") - xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"ISERROR(FIND(\",\",A7))"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #verify - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xallow = xDialog.getChild("allow") - xallowempty = xDialog.getChild("allowempty") - xmin = xDialog.getChild("min") - - self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom") - self.assertEqual(get_state_as_dict(xmin)["Text"], "ISERROR(FIND(\",\",A7))") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A8"})) - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xallow = xDialog.getChild("allow") - xallowempty = xDialog.getChild("allowempty") - xmin = xDialog.getChild("min") - - select_by_text(xallow, "Custom") - xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"NOT(ISERROR(A8))"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #verify - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xallow = xDialog.getChild("allow") - xallowempty = xDialog.getChild("allowempty") - xmin = xDialog.getChild("min") - - self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom") - self.assertEqual(get_state_as_dict(xmin)["Text"], "NOT(ISERROR(A8))") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #A general validity check for the entered new content of the active cell - especially for text + #with a custom formula like in Excel is not possible. + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xmin = xDialog.getChild("min") + + select_by_text(xallow, "Custom") + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"ISERROR(FIND(\",\",B2))"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xmin = xDialog.getChild("min") + + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom") + self.assertEqual(get_state_as_dict(xmin)["Text"], "ISERROR(FIND(\",\",B2))") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xmin = xDialog.getChild("min") + + select_by_text(xallow, "Custom") + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"NOT(ISERROR(B3))"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xmin = xDialog.getChild("min") + + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom") + self.assertEqual(get_state_as_dict(xmin)["Text"], "NOT(ISERROR(B3))") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A7"})) + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xmin = xDialog.getChild("min") + + select_by_text(xallow, "Custom") + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"ISERROR(FIND(\",\",A7))"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xmin = xDialog.getChild("min") + + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom") + self.assertEqual(get_state_as_dict(xmin)["Text"], "ISERROR(FIND(\",\",A7))") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A8"})) + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xmin = xDialog.getChild("min") + + select_by_text(xallow, "Custom") + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"NOT(ISERROR(A8))"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xmin = xDialog.getChild("min") + + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom") + self.assertEqual(get_state_as_dict(xmin)["Text"], "NOT(ISERROR(A8))") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/validity/validity.py b/sc/qa/uitest/validity/validity.py index 6215a47c16ed..dc36e96f87df 100644 --- a/sc/qa/uitest/validity/validity.py +++ b/sc/qa/uitest/validity/validity.py @@ -14,119 +14,125 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class validity(UITestCase): def test_validity_tab_criteria(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xallow = xDialog.getChild("allow") - xallowempty = xDialog.getChild("allowempty") - xdata = xDialog.getChild("data") - xmin = xDialog.getChild("min") - xmax = xDialog.getChild("max") - - select_by_text(xallow, "Whole Numbers") - xallowempty.executeAction("CLICK", tuple()) - select_by_text(xdata, "valid range") - xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - xmax.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #reopen and verify - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xallow = xDialog.getChild("allow") - xallowempty = xDialog.getChild("allowempty") - xdata = xDialog.getChild("data") - xmin = xDialog.getChild("min") - xmax = xDialog.getChild("max") - - self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Whole Numbers") - self.assertEqual(get_state_as_dict(xallowempty)["Selected"], "false") - self.assertEqual(get_state_as_dict(xdata)["SelectEntryText"], "valid range") - self.assertEqual(get_state_as_dict(xmin)["Text"], "1") - self.assertEqual(get_state_as_dict(xmax)["Text"], "2") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xdata = xDialog.getChild("data") + xmin = xDialog.getChild("min") + xmax = xDialog.getChild("max") + + select_by_text(xallow, "Whole Numbers") + xallowempty.executeAction("CLICK", tuple()) + select_by_text(xdata, "valid range") + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + xmax.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #reopen and verify + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xdata = xDialog.getChild("data") + xmin = xDialog.getChild("min") + xmax = xDialog.getChild("max") + + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Whole Numbers") + self.assertEqual(get_state_as_dict(xallowempty)["Selected"], "false") + self.assertEqual(get_state_as_dict(xdata)["SelectEntryText"], "valid range") + self.assertEqual(get_state_as_dict(xmin)["Text"], "1") + self.assertEqual(get_state_as_dict(xmax)["Text"], "2") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() def test_validity_tab_inputHelp(self): #validationhelptabpage.ui - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - xtsbhelp = xDialog.getChild("tsbhelp") - xtitle = xDialog.getChild("title") - xinputhelp = xDialog.getChild("inputhelp") - - xtsbhelp.executeAction("CLICK", tuple()) - xtitle.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) - xinputhelp.executeAction("TYPE", mkPropertyValues({"TEXT":"B"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #reopen and verify - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - xtsbhelp = xDialog.getChild("tsbhelp") - xtitle = xDialog.getChild("title") - xinputhelp = xDialog.getChild("inputhelp") - # print(get_state_as_dict(xtsbhelp)) - select_pos(xTabs, "1") - self.assertEqual(get_state_as_dict(xtsbhelp)["Selected"], "true") - self.assertEqual(get_state_as_dict(xtitle)["Text"], "A") - self.assertEqual(get_state_as_dict(xinputhelp)["Text"], "B") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + xtsbhelp = xDialog.getChild("tsbhelp") + xtitle = xDialog.getChild("title") + xinputhelp = xDialog.getChild("inputhelp") + + xtsbhelp.executeAction("CLICK", tuple()) + xtitle.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) + xinputhelp.executeAction("TYPE", mkPropertyValues({"TEXT":"B"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #reopen and verify + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + xtsbhelp = xDialog.getChild("tsbhelp") + xtitle = xDialog.getChild("title") + xinputhelp = xDialog.getChild("inputhelp") + # print(get_state_as_dict(xtsbhelp)) + select_pos(xTabs, "1") + self.assertEqual(get_state_as_dict(xtsbhelp)["Selected"], "true") + self.assertEqual(get_state_as_dict(xtitle)["Text"], "A") + self.assertEqual(get_state_as_dict(xinputhelp)["Text"], "B") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() def test_validity_tab_errorAlert(self): # erroralerttabpage.ui - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "2") - - xactionCB = xDialog.getChild("actionCB") - xerroralerttitle = xDialog.getChild("erroralert_title") - xerrorMsg = xDialog.getChild("errorMsg") - - select_by_text(xactionCB, "Warning") - xerroralerttitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Warn"})) - xerrorMsg.executeAction("TYPE", mkPropertyValues({"TEXT":"Warn2"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #reopen and verify - self.ui_test.execute_dialog_through_command(".uno:Validation") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "2") - - xactionCB = xDialog.getChild("actionCB") - xerroralerttitle = xDialog.getChild("erroralert_title") - xerrorMsg = xDialog.getChild("errorMsg") - - self.assertEqual(get_state_as_dict(xactionCB)["SelectEntryText"], "Warning") - self.assertEqual(get_state_as_dict(xerroralerttitle)["Text"], "Warn") - self.assertEqual(get_state_as_dict(xerrorMsg)["Text"], "Warn2") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + + xactionCB = xDialog.getChild("actionCB") + xerroralerttitle = xDialog.getChild("erroralert_title") + xerrorMsg = xDialog.getChild("errorMsg") + + select_by_text(xactionCB, "Warning") + xerroralerttitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Warn"})) + xerrorMsg.executeAction("TYPE", mkPropertyValues({"TEXT":"Warn2"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #reopen and verify + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + + xactionCB = xDialog.getChild("actionCB") + xerroralerttitle = xDialog.getChild("erroralert_title") + xerrorMsg = xDialog.getChild("errorMsg") + + self.assertEqual(get_state_as_dict(xactionCB)["SelectEntryText"], "Warning") + self.assertEqual(get_state_as_dict(xerroralerttitle)["Text"], "Warn") + self.assertEqual(get_state_as_dict(xerrorMsg)["Text"], "Warn2") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/autocorrectOptions.py b/sd/qa/uitest/impress_tests/autocorrectOptions.py index a84e4b6e6a7f..d386aa8b189c 100644 --- a/sd/qa/uitest/impress_tests/autocorrectOptions.py +++ b/sd/qa/uitest/impress_tests/autocorrectOptions.py @@ -14,89 +14,91 @@ from uitest.uihelper.common import select_pos class autocorrectOptions(UITestCase): def test_autocorrect_options_impress(self): - with self.ui_test.create_doc_in_start_center("impress"): - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) - document = self.ui_test.get_component() - - self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") #tab replace - origtext = xDialog.getChild("origtext") - newtext = xDialog.getChild("newtext") - xnew = xDialog.getChild("new") - xdelete = xDialog.getChild("delete") - xtabview = xDialog.getChild("tabview") - xreset = xDialog.getChild("reset") - nrRows = get_state_as_dict(xtabview)["VisibleCount"] - - self.assertTrue(int(nrRows) > 0) - - #add new rule - origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) - newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) - xnew.executeAction("CLICK", tuple()) - nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"] - nrRowsDiff = int(nrRowsNew) - int(nrRows) - self.assertEqual(nrRowsDiff, 1) #we have +1 rule - #delete rule - origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) - newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) - xdelete.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules - - select_pos(xTabs, "1") #tab Exceptions - #abbreviations - abbrev = xDialog.getChild("abbrev") - newabbrev = xDialog.getChild("newabbrev") - delabbrev = xDialog.getChild("delabbrev") - abbrevlist = xDialog.getChild("abbrevlist") - - nrRowsAbb = get_state_as_dict(abbrevlist)["VisibleCount"] - - self.assertTrue(int(nrRowsAbb) > 0) - - abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"})) - newabbrev.executeAction("CLICK", tuple()) - nrRowsAbbNew = get_state_as_dict(abbrevlist)["VisibleCount"] - nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb) - self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule - delabbrev.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(abbrevlist)["VisibleCount"], nrRowsAbb) #we have default nr of rules - - #words with two initial capitals - double = xDialog.getChild("double") - newdouble = xDialog.getChild("newdouble") - deldouble = xDialog.getChild("deldouble") - doublelist = xDialog.getChild("doublelist") - - nrRowsDouble = get_state_as_dict(doublelist)["VisibleCount"] - - self.assertTrue(int(nrRowsDouble) > 0) - - double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"})) - newdouble.executeAction("CLICK", tuple()) - nrRowsDoubleNew = get_state_as_dict(doublelist)["VisibleCount"] - nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and - self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule - deldouble.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(doublelist)["VisibleCount"], nrRowsDouble) #we have default nr of rules - - xCancelButton = xDialog.getChild("cancel") - xCancelButton.executeAction("CLICK", tuple()) + self.ui_test.create_doc_in_start_center("impress") + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab replace + origtext = xDialog.getChild("origtext") + newtext = xDialog.getChild("newtext") + xnew = xDialog.getChild("new") + xdelete = xDialog.getChild("delete") + xtabview = xDialog.getChild("tabview") + xreset = xDialog.getChild("reset") + nrRows = get_state_as_dict(xtabview)["VisibleCount"] + + self.assertTrue(int(nrRows) > 0) + + #add new rule + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) + xnew.executeAction("CLICK", tuple()) + nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"] + nrRowsDiff = int(nrRowsNew) - int(nrRows) + self.assertEqual(nrRowsDiff, 1) #we have +1 rule + #delete rule + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) + xdelete.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules + + select_pos(xTabs, "1") #tab Exceptions + #abbreviations + abbrev = xDialog.getChild("abbrev") + newabbrev = xDialog.getChild("newabbrev") + delabbrev = xDialog.getChild("delabbrev") + abbrevlist = xDialog.getChild("abbrevlist") + + nrRowsAbb = get_state_as_dict(abbrevlist)["VisibleCount"] + + self.assertTrue(int(nrRowsAbb) > 0) + + abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"})) + newabbrev.executeAction("CLICK", tuple()) + nrRowsAbbNew = get_state_as_dict(abbrevlist)["VisibleCount"] + nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb) + self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule + delabbrev.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(abbrevlist)["VisibleCount"], nrRowsAbb) #we have default nr of rules + + #words with two initial capitals + double = xDialog.getChild("double") + newdouble = xDialog.getChild("newdouble") + deldouble = xDialog.getChild("deldouble") + doublelist = xDialog.getChild("doublelist") + + nrRowsDouble = get_state_as_dict(doublelist)["VisibleCount"] + + self.assertTrue(int(nrRowsDouble) > 0) + + double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"})) + newdouble.executeAction("CLICK", tuple()) + nrRowsDoubleNew = get_state_as_dict(doublelist)["VisibleCount"] + nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and + self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule + deldouble.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(doublelist)["VisibleCount"], nrRowsDouble) #we have default nr of rules + + xCancelButton = xDialog.getChild("cancel") + xCancelButton.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/customSlideShow.py b/sd/qa/uitest/impress_tests/customSlideShow.py index 916eb600da64..a7aa67b25816 100644 --- a/sd/qa/uitest/impress_tests/customSlideShow.py +++ b/sd/qa/uitest/impress_tests/customSlideShow.py @@ -9,61 +9,63 @@ from uitest.uihelper.common import get_state_as_dict, type_text class customSlideShow(UITestCase): def test_customSlideShow(self): - with self.ui_test.create_doc_in_start_center("impress"): - MainWindow = self.xUITest.getTopFocusWindow() - TemplateDialog = self.xUITest.getTopFocusWindow() - cancel = TemplateDialog.getChild("close") - self.ui_test.close_dialog_through_button(cancel) - self.ui_test.execute_dialog_through_command(".uno:CustomShowDialog") - CustomSlideShows = self.xUITest.getTopFocusWindow() - new = CustomSlideShows.getChild("new") - ok = CustomSlideShows.getChild("ok") + MainDoc = self.ui_test.create_doc_in_start_center("impress") + MainWindow = self.xUITest.getTopFocusWindow() + TemplateDialog = self.xUITest.getTopFocusWindow() + cancel = TemplateDialog.getChild("close") + self.ui_test.close_dialog_through_button(cancel) + self.ui_test.execute_dialog_through_command(".uno:CustomShowDialog") + CustomSlideShows = self.xUITest.getTopFocusWindow() + new = CustomSlideShows.getChild("new") + ok = CustomSlideShows.getChild("ok") - with self.ui_test.execute_blocking_action(new.executeAction, args=('CLICK', ())) as DefineCustomSlideShow: - customname = DefineCustomSlideShow.getChild("customname") - customname.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) - customname.executeAction("TYPE", mkPropertyValues({"TEXT": "a"})) - customname.executeAction("TYPE", mkPropertyValues({"TEXT": "a"})) - pages = DefineCustomSlideShow.getChild("pages") - xEntry = pages.getChild("0") - xEntry.executeAction("SELECT", tuple()) - add = DefineCustomSlideShow.getChild("add") - add.executeAction("CLICK",tuple()) + with self.ui_test.execute_blocking_action(new.executeAction, args=('CLICK', ())) as DefineCustomSlideShow: + customname = DefineCustomSlideShow.getChild("customname") + customname.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + customname.executeAction("TYPE", mkPropertyValues({"TEXT": "a"})) + customname.executeAction("TYPE", mkPropertyValues({"TEXT": "a"})) + pages = DefineCustomSlideShow.getChild("pages") + xEntry = pages.getChild("0") + xEntry.executeAction("SELECT", tuple()) + add = DefineCustomSlideShow.getChild("add") + add.executeAction("CLICK",tuple()) - self.ui_test.close_dialog_through_button(ok) - #verify - self.ui_test.execute_dialog_through_command(".uno:CustomShowDialog") - CustomSlideShows = self.xUITest.getTopFocusWindow() - edit = CustomSlideShows.getChild("edit") - customshowlist = CustomSlideShows.getChild("customshowlist") - self.assertEqual(get_state_as_dict(customshowlist)["SelectionCount"], "1") - ok = CustomSlideShows.getChild("ok") + self.ui_test.close_dialog_through_button(ok) + #verify + self.ui_test.execute_dialog_through_command(".uno:CustomShowDialog") + CustomSlideShows = self.xUITest.getTopFocusWindow() + edit = CustomSlideShows.getChild("edit") + customshowlist = CustomSlideShows.getChild("customshowlist") + self.assertEqual(get_state_as_dict(customshowlist)["SelectionCount"], "1") + ok = CustomSlideShows.getChild("ok") - with self.ui_test.execute_blocking_action(edit.executeAction, args=('CLICK', ()), close_button="cancel") as DefineCustomSlideShow: - customname = DefineCustomSlideShow.getChild("customname") - self.assertEqual(get_state_as_dict(customname)["Text"], "aa") - # print(DefineCustomSlideShow.getChildren()) - custompages = DefineCustomSlideShow.getChild("custompages") - pages = DefineCustomSlideShow.getChild("pages") - remove = DefineCustomSlideShow.getChild("remove") - # print(get_state_as_dict(custompages)) - self.assertEqual(get_state_as_dict(custompages)["Children"], "1") - self.assertEqual(get_state_as_dict(pages)["Children"], "1") - xEntry = custompages.getChild("0") - xEntry.executeAction("SELECT", tuple()) - # remove.executeAction("CLICK",tuple()) #tdf126951 - self.assertEqual(get_state_as_dict(custompages)["Children"], "1") - self.assertEqual(get_state_as_dict(pages)["Children"], "1") + with self.ui_test.execute_blocking_action(edit.executeAction, args=('CLICK', ()), close_button="cancel") as DefineCustomSlideShow: + customname = DefineCustomSlideShow.getChild("customname") + self.assertEqual(get_state_as_dict(customname)["Text"], "aa") +# print(DefineCustomSlideShow.getChildren()) + custompages = DefineCustomSlideShow.getChild("custompages") + pages = DefineCustomSlideShow.getChild("pages") + remove = DefineCustomSlideShow.getChild("remove") +# print(get_state_as_dict(custompages)) + self.assertEqual(get_state_as_dict(custompages)["Children"], "1") + self.assertEqual(get_state_as_dict(pages)["Children"], "1") + xEntry = custompages.getChild("0") + xEntry.executeAction("SELECT", tuple()) +# remove.executeAction("CLICK",tuple()) #tdf126951 + self.assertEqual(get_state_as_dict(custompages)["Children"], "1") + self.assertEqual(get_state_as_dict(pages)["Children"], "1") - CustomSlideShows = self.xUITest.getTopFocusWindow() - delete = CustomSlideShows.getChild("delete") - customshowlist = CustomSlideShows.getChild("customshowlist") - self.assertEqual(get_state_as_dict(customshowlist)["Children"], "1") + CustomSlideShows = self.xUITest.getTopFocusWindow() + delete = CustomSlideShows.getChild("delete") + customshowlist = CustomSlideShows.getChild("customshowlist") + self.assertEqual(get_state_as_dict(customshowlist)["Children"], "1") - # delete.executeAction("CLICK",tuple()) - # self.assertEqual(get_state_as_dict(customshowlist)["Children"], "0") +# delete.executeAction("CLICK",tuple()) +# self.assertEqual(get_state_as_dict(customshowlist)["Children"], "0") - ok = CustomSlideShows.getChild("ok") - self.ui_test.close_dialog_through_button(ok) + ok = CustomSlideShows.getChild("ok") + self.ui_test.close_dialog_through_button(ok) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/insertSlide.py b/sd/qa/uitest/impress_tests/insertSlide.py index 6918516d9167..d33f3212cb5a 100644 --- a/sd/qa/uitest/impress_tests/insertSlide.py +++ b/sd/qa/uitest/impress_tests/insertSlide.py @@ -15,39 +15,41 @@ from uitest.uihelper.common import select_pos class insertSlide(UITestCase): def test_insert_slide(self): - with self.ui_test.create_doc_in_start_center("impress"): - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) - document = self.ui_test.get_component() - self.assertEqual(document.DrawPages.getCount(), 1) #nr. of pages + self.ui_test.create_doc_in_start_center("impress") + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + document = self.ui_test.get_component() + self.assertEqual(document.DrawPages.getCount(), 1) #nr. of pages - self.xUITest.executeCommand(".uno:InsertPage") + self.xUITest.executeCommand(".uno:InsertPage") - #verify - self.assertEqual(document.DrawPages.getCount(), 2) #nr. of pages - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.DrawPages.getCount(), 1) #nr. of pages + #verify + self.assertEqual(document.DrawPages.getCount(), 2) #nr. of pages + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.DrawPages.getCount(), 1) #nr. of pages + self.ui_test.close_doc() def test_tdf85360_insert_4th_slide(self): - with self.ui_test.create_doc_in_start_center("impress"): - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) - document = self.ui_test.get_component() - self.assertEqual(document.DrawPages.getCount(), 1) #nr. of pages + self.ui_test.create_doc_in_start_center("impress") + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + document = self.ui_test.get_component() + self.assertEqual(document.DrawPages.getCount(), 1) #nr. of pages - self.xUITest.executeCommand(".uno:InsertPage") - self.xUITest.executeCommand(".uno:InsertPage") - self.xUITest.executeCommand(".uno:InsertPage") - self.xUITest.executeCommand(".uno:InsertPage") - #verify - self.assertEqual(document.DrawPages.getCount(), 5) #nr. of pages - #undo - self.xUITest.executeCommand(".uno:Undo") - self.xUITest.executeCommand(".uno:Undo") - self.xUITest.executeCommand(".uno:Undo") - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.DrawPages.getCount(), 1) #nr. of pages + self.xUITest.executeCommand(".uno:InsertPage") + self.xUITest.executeCommand(".uno:InsertPage") + self.xUITest.executeCommand(".uno:InsertPage") + self.xUITest.executeCommand(".uno:InsertPage") + #verify + self.assertEqual(document.DrawPages.getCount(), 5) #nr. of pages + #undo + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.DrawPages.getCount(), 1) #nr. of pages + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/masterElements.py b/sd/qa/uitest/impress_tests/masterElements.py index 318c4c9b8179..00e865d269d5 100644 --- a/sd/qa/uitest/impress_tests/masterElements.py +++ b/sd/qa/uitest/impress_tests/masterElements.py @@ -14,37 +14,39 @@ from uitest.uihelper.common import select_pos class masterElements(UITestCase): def test_master_elements(self): - with self.ui_test.create_doc_in_start_center("impress"): - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) - document = self.ui_test.get_component() - - self.ui_test.execute_dialog_through_command(".uno:MasterLayouts") - xDialog = self.xUITest.getTopFocusWindow() - - xpagenumber = xDialog.getChild("pagenumber") - xfooter = xDialog.getChild("footer") - datetime = xDialog.getChild("datetime") - xpagenumber.executeAction("CLICK", tuple()) - xfooter.executeAction("CLICK", tuple()) - datetime.executeAction("CLICK", tuple()) - - xOKButton = xDialog.getChild("ok") - xOKButton.executeAction("CLICK", tuple()) - - #verify - self.ui_test.execute_dialog_through_command(".uno:MasterLayouts") - xDialog = self.xUITest.getTopFocusWindow() - xfooter = xDialog.getChild("footer") - datetime = xDialog.getChild("datetime") - xpagenumber = xDialog.getChild("pagenumber") - - self.assertEqual(get_state_as_dict(xfooter)["Selected"], "false") - self.assertEqual(get_state_as_dict(datetime)["Selected"], "false") - self.assertEqual(get_state_as_dict(xpagenumber)["Selected"], "false") - - xOKButton = xDialog.getChild("ok") - xOKButton.executeAction("CLICK", tuple()) + self.ui_test.create_doc_in_start_center("impress") + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:MasterLayouts") + xDialog = self.xUITest.getTopFocusWindow() + + xpagenumber = xDialog.getChild("pagenumber") + xfooter = xDialog.getChild("footer") + datetime = xDialog.getChild("datetime") + xpagenumber.executeAction("CLICK", tuple()) + xfooter.executeAction("CLICK", tuple()) + datetime.executeAction("CLICK", tuple()) + + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) + + #verify + self.ui_test.execute_dialog_through_command(".uno:MasterLayouts") + xDialog = self.xUITest.getTopFocusWindow() + xfooter = xDialog.getChild("footer") + datetime = xDialog.getChild("datetime") + xpagenumber = xDialog.getChild("pagenumber") + + self.assertEqual(get_state_as_dict(xfooter)["Selected"], "false") + self.assertEqual(get_state_as_dict(datetime)["Selected"], "false") + self.assertEqual(get_state_as_dict(xpagenumber)["Selected"], "false") + + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/masterSlides.py b/sd/qa/uitest/impress_tests/masterSlides.py index ce0e274b4e9f..8a3415576d0a 100644 --- a/sd/qa/uitest/impress_tests/masterSlides.py +++ b/sd/qa/uitest/impress_tests/masterSlides.py @@ -13,35 +13,37 @@ class masterSlides(UITestCase): def test_change_master_slide_from_dialog(self): - with self.ui_test.create_doc_in_start_center("impress"): + self.ui_test.create_doc_in_start_center("impress") - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) - xImpress = self.xUITest.getTopFocusWindow() - xMasterSlide = xImpress.getChild("masterslide") - self.assertEqual("Default", get_state_as_dict(xMasterSlide)['SelectEntryText']) + xImpress = self.xUITest.getTopFocusWindow() + xMasterSlide = xImpress.getChild("masterslide") + self.assertEqual("Default", get_state_as_dict(xMasterSlide)['SelectEntryText']) - xMasterButton = xImpress.getChild("masterslidebutton") - xMasterButton.executeAction("CLICK", tuple()) + xMasterButton = xImpress.getChild("masterslidebutton") + xMasterButton.executeAction("CLICK", tuple()) - self.xUITest.executeCommand(".uno:InsertMasterPage") + self.xUITest.executeCommand(".uno:InsertMasterPage") - xCloseMasterButton = xImpress.getChild("closemasterslide") - xCloseMasterButton.executeAction("CLICK", tuple()) + xCloseMasterButton = xImpress.getChild("closemasterslide") + xCloseMasterButton.executeAction("CLICK", tuple()) - self.ui_test.execute_dialog_through_command(".uno:PresentationLayout") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:PresentationLayout") + xDialog = self.xUITest.getTopFocusWindow() - xSelect = xDialog.getChild('select') - xSelect.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xSelect = xDialog.getChild('select') + xSelect.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) - xMasterSlide = xImpress.getChild("masterslide") - self.assertEqual("Default 1", get_state_as_dict(xMasterSlide)['SelectEntryText']) + xMasterSlide = xImpress.getChild("masterslide") + self.assertEqual("Default 1", get_state_as_dict(xMasterSlide)['SelectEntryText']) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/renameSlide.py b/sd/qa/uitest/impress_tests/renameSlide.py index 29b57dda1ed2..7393a4145a44 100644 --- a/sd/qa/uitest/impress_tests/renameSlide.py +++ b/sd/qa/uitest/impress_tests/renameSlide.py @@ -11,43 +11,44 @@ from uitest.uihelper.common import get_state_as_dict class renameSlide(UITestCase): def test_rename_slide(self): - with self.ui_test.create_doc_in_start_center("impress"): - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.create_doc_in_start_center("impress") + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) - self.ui_test.execute_dialog_through_command(".uno:RenamePage") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:RenamePage") + xDialog = self.xUITest.getTopFocusWindow() - name_entry = xDialog.getChild("name_entry") - name_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"})) + name_entry = xDialog.getChild("name_entry") + name_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - #verify - self.ui_test.execute_dialog_through_command(".uno:RenamePage") - xDialog = self.xUITest.getTopFocusWindow() + #verify + self.ui_test.execute_dialog_through_command(".uno:RenamePage") + xDialog = self.xUITest.getTopFocusWindow() - name_entry = xDialog.getChild("name_entry") - self.assertEqual(get_state_as_dict(name_entry)["Text"], "NewName") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + name_entry = xDialog.getChild("name_entry") + self.assertEqual(get_state_as_dict(name_entry)["Text"], "NewName") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - self.xUITest.executeCommand(".uno:InsertPage") + self.xUITest.executeCommand(".uno:InsertPage") - self.ui_test.execute_dialog_through_command(".uno:RenamePage") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:RenamePage") + xDialog = self.xUITest.getTopFocusWindow() - xOKBtn = xDialog.getChild("ok") - self.assertEqual("true", get_state_as_dict(xOKBtn)['Enabled']) + xOKBtn = xDialog.getChild("ok") + self.assertEqual("true", get_state_as_dict(xOKBtn)['Enabled']) - name_entry = xDialog.getChild("name_entry") - name_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"})) + name_entry = xDialog.getChild("name_entry") + name_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"})) - self.assertEqual("false", get_state_as_dict(xOKBtn)['Enabled']) + self.assertEqual("false", get_state_as_dict(xOKBtn)['Enabled']) - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/slideShowSettings.py b/sd/qa/uitest/impress_tests/slideShowSettings.py index e4cd3d407258..5b9e44ffa1cc 100644 --- a/sd/qa/uitest/impress_tests/slideShowSettings.py +++ b/sd/qa/uitest/impress_tests/slideShowSettings.py @@ -8,53 +8,55 @@ from uitest.uihelper.common import get_state_as_dict, type_text class slideShowSettings(UITestCase): def test_slideShowSettings(self): - with self.ui_test.create_doc_in_start_center("impress"): - MainWindow = self.xUITest.getTopFocusWindow() - TemplateDialog = self.xUITest.getTopFocusWindow() - cancel = TemplateDialog.getChild("close") - self.ui_test.close_dialog_through_button(cancel) - self.xUITest.executeCommand(".uno:InsertPage") - self.ui_test.execute_dialog_through_command(".uno:PresentationDialog") - PresentationDialog = self.xUITest.getTopFocusWindow() + MainDoc = self.ui_test.create_doc_in_start_center("impress") + MainWindow = self.xUITest.getTopFocusWindow() + TemplateDialog = self.xUITest.getTopFocusWindow() + cancel = TemplateDialog.getChild("close") + self.ui_test.close_dialog_through_button(cancel) + self.xUITest.executeCommand(".uno:InsertPage") + self.ui_test.execute_dialog_through_command(".uno:PresentationDialog") + PresentationDialog = self.xUITest.getTopFocusWindow() - xfrom = PresentationDialog.getChild("from") - xfrom.executeAction("CLICK",tuple()) - from_cb = PresentationDialog.getChild("from_cb") - from_cb.executeAction("SELECT", mkPropertyValues({"POS": "0"})) - window = PresentationDialog.getChild("window") - window.executeAction("CLICK",tuple()) - manualslides = PresentationDialog.getChild("manualslides") - manualslides.executeAction("CLICK",tuple()) - pointervisible = PresentationDialog.getChild("pointervisible") - pointervisible.executeAction("CLICK",tuple()) - pointeraspen = PresentationDialog.getChild("pointeraspen") - pointeraspen.executeAction("CLICK",tuple()) - animationsallowed = PresentationDialog.getChild("animationsallowed") - animationsallowed.executeAction("CLICK",tuple()) - changeslidesbyclick = PresentationDialog.getChild("changeslidesbyclick") - changeslidesbyclick.executeAction("CLICK",tuple()) + xfrom = PresentationDialog.getChild("from") + xfrom.executeAction("CLICK",tuple()) + from_cb = PresentationDialog.getChild("from_cb") + from_cb.executeAction("SELECT", mkPropertyValues({"POS": "0"})) + window = PresentationDialog.getChild("window") + window.executeAction("CLICK",tuple()) + manualslides = PresentationDialog.getChild("manualslides") + manualslides.executeAction("CLICK",tuple()) + pointervisible = PresentationDialog.getChild("pointervisible") + pointervisible.executeAction("CLICK",tuple()) + pointeraspen = PresentationDialog.getChild("pointeraspen") + pointeraspen.executeAction("CLICK",tuple()) + animationsallowed = PresentationDialog.getChild("animationsallowed") + animationsallowed.executeAction("CLICK",tuple()) + changeslidesbyclick = PresentationDialog.getChild("changeslidesbyclick") + changeslidesbyclick.executeAction("CLICK",tuple()) - ok = PresentationDialog.getChild("ok") - self.ui_test.close_dialog_through_button(ok) - #verify - self.ui_test.execute_dialog_through_command(".uno:PresentationDialog") - PresentationDialog = self.xUITest.getTopFocusWindow() - xfrom = PresentationDialog.getChild("from") - self.assertEqual(get_state_as_dict(xfrom)["Checked"], "true") - from_cb = PresentationDialog.getChild("from_cb") - self.assertEqual(get_state_as_dict(from_cb)["SelectEntryText"], "Slide 1") - manualslides = PresentationDialog.getChild("manualslides") - self.assertEqual(get_state_as_dict(manualslides)["Selected"], "true") - pointervisible = PresentationDialog.getChild("pointervisible") - self.assertEqual(get_state_as_dict(pointervisible)["Selected"], "true") - pointeraspen = PresentationDialog.getChild("pointeraspen") - self.assertEqual(get_state_as_dict(pointeraspen)["Selected"], "true") - animationsallowed = PresentationDialog.getChild("animationsallowed") - self.assertEqual(get_state_as_dict(animationsallowed)["Selected"], "false") - changeslidesbyclick = PresentationDialog.getChild("changeslidesbyclick") - self.assertEqual(get_state_as_dict(changeslidesbyclick)["Selected"], "false") + ok = PresentationDialog.getChild("ok") + self.ui_test.close_dialog_through_button(ok) + #verify + self.ui_test.execute_dialog_through_command(".uno:PresentationDialog") + PresentationDialog = self.xUITest.getTopFocusWindow() + xfrom = PresentationDialog.getChild("from") + self.assertEqual(get_state_as_dict(xfrom)["Checked"], "true") + from_cb = PresentationDialog.getChild("from_cb") + self.assertEqual(get_state_as_dict(from_cb)["SelectEntryText"], "Slide 1") + manualslides = PresentationDialog.getChild("manualslides") + self.assertEqual(get_state_as_dict(manualslides)["Selected"], "true") + pointervisible = PresentationDialog.getChild("pointervisible") + self.assertEqual(get_state_as_dict(pointervisible)["Selected"], "true") + pointeraspen = PresentationDialog.getChild("pointeraspen") + self.assertEqual(get_state_as_dict(pointeraspen)["Selected"], "true") + animationsallowed = PresentationDialog.getChild("animationsallowed") + self.assertEqual(get_state_as_dict(animationsallowed)["Selected"], "false") + changeslidesbyclick = PresentationDialog.getChild("changeslidesbyclick") + self.assertEqual(get_state_as_dict(changeslidesbyclick)["Selected"], "false") - cancel = PresentationDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(cancel) + cancel = PresentationDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(cancel) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf106612.py b/sd/qa/uitest/impress_tests/tdf106612.py index a7bd3bee1f30..ac3b717820d7 100644 --- a/sd/qa/uitest/impress_tests/tdf106612.py +++ b/sd/qa/uitest/impress_tests/tdf106612.py @@ -11,34 +11,35 @@ from uitest.uihelper.common import get_state_as_dict class Tdf106612(UITestCase): def test_tdf106612(self): - with self.ui_test.create_doc_in_start_center("impress"): - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.create_doc_in_start_center("impress") + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) - xImpressDoc = self.xUITest.getTopFocusWindow() + xImpressDoc = self.xUITest.getTopFocusWindow() - xEditWin = xImpressDoc.getChild("impress_win") + xEditWin = xImpressDoc.getChild("impress_win") - self.xUITest.executeCommand(".uno:DuplicatePage") + self.xUITest.executeCommand(".uno:DuplicatePage") - self.assertEqual("2", get_state_as_dict(xEditWin)["CurrentSlide"]) + self.assertEqual("2", get_state_as_dict(xEditWin)["CurrentSlide"]) - xEditWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SdNavigatorPanel"})) + xEditWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SdNavigatorPanel"})) - xTree = xImpressDoc.getChild("tree") - self.assertEqual(2, len(xTree.getChildren())) + xTree = xImpressDoc.getChild("tree") + self.assertEqual(2, len(xTree.getChildren())) - self.assertEqual("Slide 1", get_state_as_dict(xTree.getChild('0'))['Text']) - self.assertEqual(2, len(xTree.getChild('0').getChildren())) + self.assertEqual("Slide 1", get_state_as_dict(xTree.getChild('0'))['Text']) + self.assertEqual(2, len(xTree.getChild('0').getChildren())) - self.assertEqual("Slide 2", get_state_as_dict(xTree.getChild('1'))['Text']) - self.assertEqual(2, len(xTree.getChild('1').getChildren())) + self.assertEqual("Slide 2", get_state_as_dict(xTree.getChild('1'))['Text']) + self.assertEqual(2, len(xTree.getChild('1').getChildren())) - xTree.getChild('0').executeAction("DOUBLECLICK", tuple()) + xTree.getChild('0').executeAction("DOUBLECLICK", tuple()) - # Without the fix in place, this test would have failed with - # AssertionError: '1' != '2' - self.assertEqual("1", get_state_as_dict(xEditWin)["CurrentSlide"]) + # Without the fix in place, this test would have failed with + # AssertionError: '1' != '2' + self.assertEqual("1", get_state_as_dict(xEditWin)["CurrentSlide"]) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf125449.py b/sd/qa/uitest/impress_tests/tdf125449.py index f7d50cc45fca..43db59b3be14 100644 --- a/sd/qa/uitest/impress_tests/tdf125449.py +++ b/sd/qa/uitest/impress_tests/tdf125449.py @@ -12,48 +12,50 @@ class tdf125449(UITestCase): def test_tdf125449(self): - with self.ui_test.create_doc_in_start_center("impress"): - - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) - - self.ui_test.execute_dialog_through_command(".uno:PageSetup") - - xPageSetupDlg = self.xUITest.getTopFocusWindow() - tabcontrol = xPageSetupDlg.getChild("tabcontrol") - select_pos(tabcontrol, "1") - - xBtn = xPageSetupDlg.getChild('btngradient') - xBtn.executeAction("CLICK", tuple()) - - xAngle = xPageSetupDlg.getChild('anglemtr') - xAngle.executeAction("UP", tuple()) - - xOkBtn = xPageSetupDlg.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - - document = self.ui_test.get_component() - self.assertEqual( - document.DrawPages.getByIndex(0).Background.FillGradient.Style, LINEAR) - self.assertEqual( - hex(document.DrawPages.getByIndex(0).Background.FillGradient.StartColor), '0xdde8cb') - self.assertEqual( - document.DrawPages.getByIndex(0).Background.FillGradient.Angle, 450) - self.assertEqual( - document.DrawPages.getByIndex(0).Background.FillGradient.Border, 0) - self.assertEqual( - document.DrawPages.getByIndex(0).Background.FillGradient.XOffset, 0) - self.assertEqual( - document.DrawPages.getByIndex(0).Background.FillGradient.YOffset, 0) - self.assertEqual( - document.DrawPages.getByIndex(0).Background.FillGradient.StartIntensity, 100) - self.assertEqual( - document.DrawPages.getByIndex(0).Background.FillGradient.EndIntensity, 100) - - # Without the patch in place, this test would have failed with - # AssertionError: '' != 'gradient' - self.assertEqual( - document.DrawPages.getByIndex(0).Background.FillGradientName, 'gradient') + self.ui_test.create_doc_in_start_center("impress") + + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.execute_dialog_through_command(".uno:PageSetup") + + xPageSetupDlg = self.xUITest.getTopFocusWindow() + tabcontrol = xPageSetupDlg.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + xBtn = xPageSetupDlg.getChild('btngradient') + xBtn.executeAction("CLICK", tuple()) + + xAngle = xPageSetupDlg.getChild('anglemtr') + xAngle.executeAction("UP", tuple()) + + xOkBtn = xPageSetupDlg.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + document = self.ui_test.get_component() + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.Style, LINEAR) + self.assertEqual( + hex(document.DrawPages.getByIndex(0).Background.FillGradient.StartColor), '0xdde8cb') + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.Angle, 450) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.Border, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.XOffset, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.YOffset, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.StartIntensity, 100) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.EndIntensity, 100) + + # Without the patch in place, this test would have failed with + # AssertionError: '' != 'gradient' + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradientName, 'gradient') + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf126605.py b/sd/qa/uitest/impress_tests/tdf126605.py index 899c98042e8e..b4a2668a1952 100644 --- a/sd/qa/uitest/impress_tests/tdf126605.py +++ b/sd/qa/uitest/impress_tests/tdf126605.py @@ -10,17 +10,19 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf126605(UITestCase): def test_run(self): - with self.ui_test.create_doc_in_start_center("impress"): - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.create_doc_in_start_center("impress") + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) - xDoc = self.xUITest.getTopFocusWindow() - xEdit = xDoc.getChild("impress_win") - xEdit.executeAction("TYPE", mkPropertyValues({"TEXT":"test"})) + xDoc = self.xUITest.getTopFocusWindow() + xEdit = xDoc.getChild("impress_win") + xEdit.executeAction("TYPE", mkPropertyValues({"TEXT":"test"})) - # Without the accompanying fix in place, it would crash at this point - self.xUITest.executeCommand(".uno:ParaRightToLeft") - self.xUITest.executeCommand(".uno:ParaLeftToRight") + # Without the accompanying fix in place, it would crash at this point + self.xUITest.executeCommand(".uno:ParaRightToLeft") + self.xUITest.executeCommand(".uno:ParaLeftToRight") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf130440.py b/sd/qa/uitest/impress_tests/tdf130440.py index d51b7ffb858f..60ea610206e1 100644 --- a/sd/qa/uitest/impress_tests/tdf130440.py +++ b/sd/qa/uitest/impress_tests/tdf130440.py @@ -10,47 +10,48 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf129346(UITestCase): def test_run(self): - with self.ui_test.create_doc_in_start_center("impress"): - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.create_doc_in_start_center("impress") + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) - xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') - document = self.ui_test.get_component() - self.assertEqual(document.CurrentController.getCurrentPage().Number, 1) - self.xUITest.executeCommand(".uno:DuplicatePage") - xToolkit.processEventsToIdle() - self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) + document = self.ui_test.get_component() + self.assertEqual(document.CurrentController.getCurrentPage().Number, 1) + self.xUITest.executeCommand(".uno:DuplicatePage") + xToolkit.processEventsToIdle() + self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) - xDoc = self.xUITest.getTopFocusWindow() - xEdit = xDoc.getChild("impress_win") - xEdit.executeAction("TYPE", mkPropertyValues({"TEXT":"test"})) + xDoc = self.xUITest.getTopFocusWindow() + xEdit = xDoc.getChild("impress_win") + xEdit.executeAction("TYPE", mkPropertyValues({"TEXT":"test"})) - self.xUITest.executeCommand(".uno:Undo") - xToolkit.processEventsToIdle() - self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) + self.xUITest.executeCommand(".uno:Undo") + xToolkit.processEventsToIdle() + self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) - self.xUITest.executeCommand(".uno:Undo") - xToolkit.processEventsToIdle() - self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) + self.xUITest.executeCommand(".uno:Undo") + xToolkit.processEventsToIdle() + self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) - self.xUITest.executeCommand(".uno:Undo") - xToolkit.processEventsToIdle() - self.assertEqual(document.CurrentController.getCurrentPage().Number, 1) + self.xUITest.executeCommand(".uno:Undo") + xToolkit.processEventsToIdle() + self.assertEqual(document.CurrentController.getCurrentPage().Number, 1) - self.xUITest.executeCommand(".uno:Redo") - xToolkit.processEventsToIdle() - self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) + self.xUITest.executeCommand(".uno:Redo") + xToolkit.processEventsToIdle() + self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) - self.xUITest.executeCommand(".uno:Redo") + self.xUITest.executeCommand(".uno:Redo") - xDoc = self.xUITest.getTopFocusWindow() - xEdit = xDoc.getChild("impress_win") - xEdit.executeAction("TYPE", mkPropertyValues({"TEXT":"test"})) + xDoc = self.xUITest.getTopFocusWindow() + xEdit = xDoc.getChild("impress_win") + xEdit.executeAction("TYPE", mkPropertyValues({"TEXT":"test"})) - xToolkit.processEventsToIdle() - #Without the accompanying fix in place, it would fail with AssertionError: 2 != 1 - self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) + xToolkit.processEventsToIdle() + #Without the accompanying fix in place, it would fail with AssertionError: 2 != 1 + self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf134734.py b/sd/qa/uitest/impress_tests/tdf134734.py index 069f565577c0..29641e06403a 100644 --- a/sd/qa/uitest/impress_tests/tdf134734.py +++ b/sd/qa/uitest/impress_tests/tdf134734.py @@ -13,97 +13,99 @@ import importlib class TestClass(UITestCase): def test_master_page_background(self): - with self.ui_test.create_doc_in_start_center("impress"): - document = self.ui_test.get_component() - TemplateDialog = self.xUITest.getTopFocusWindow() - close = TemplateDialog.getChild("close") - self.ui_test.close_dialog_through_button(close) + self.ui_test.create_doc_in_start_center("impress") + document = self.ui_test.get_component() + TemplateDialog = self.xUITest.getTopFocusWindow() + close = TemplateDialog.getChild("close") + self.ui_test.close_dialog_through_button(close) - # set margins and fill color - self.ui_test.execute_dialog_through_command(".uno:PageSetup") - DrawPageDialog = self.xUITest.getTopFocusWindow() - xTabs = DrawPageDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize") - self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "false") - 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, "1") - 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:PageSetup") + DrawPageDialog = self.xUITest.getTopFocusWindow() + xTabs = DrawPageDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize") + self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "false") + 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, "1") + btncolor = DrawPageDialog.getChild("btncolor") + btncolor.executeAction("CLICK",tuple()) + ok = DrawPageDialog.getChild("ok") + self.ui_test.close_dialog_through_button(ok) - self.assertEqual( - document.DrawPages.getByIndex(0).Background.FillStyle, SOLID) - self.assertEqual( - document.DrawPages.getByIndex(0).BorderLeft, 1016) - self.assertEqual( - document.DrawPages.getByIndex(0).BorderRight, 762) - self.assertEqual( - document.DrawPages.getByIndex(0).BorderTop, 508) - self.assertEqual( - document.DrawPages.getByIndex(0).BorderBottom, 254) - self.assertEqual( - document.MasterPages.getByIndex(0).BackgroundFullSize, False) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillStyle, SOLID) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderLeft, 1016) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderRight, 762) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderTop, 508) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderBottom, 254) + self.assertEqual( + document.MasterPages.getByIndex(0).BackgroundFullSize, False) - # check it - self.ui_test.execute_dialog_through_command(".uno:PageSetup") - DrawPageDialog = self.xUITest.getTopFocusWindow() - xTabs = DrawPageDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - 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 + self.ui_test.execute_dialog_through_command(".uno:PageSetup") + DrawPageDialog = self.xUITest.getTopFocusWindow() + xTabs = DrawPageDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + 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( - document.DrawPages.getByIndex(0).Background.FillStyle, SOLID) - self.assertEqual( - document.DrawPages.getByIndex(0).BorderLeft, 1016) - self.assertEqual( - document.DrawPages.getByIndex(0).BorderRight, 762) - self.assertEqual( - document.DrawPages.getByIndex(0).BorderTop, 508) - self.assertEqual( - document.DrawPages.getByIndex(0).BorderBottom, 254) - self.assertEqual( - document.MasterPages.getByIndex(0).BackgroundFullSize, True) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillStyle, SOLID) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderLeft, 1016) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderRight, 762) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderTop, 508) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderBottom, 254) + self.assertEqual( + document.MasterPages.getByIndex(0).BackgroundFullSize, True) - # uncheck it again - self.ui_test.execute_dialog_through_command(".uno:PageSetup") - DrawPageDialog = self.xUITest.getTopFocusWindow() - xTabs = DrawPageDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - 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 again + self.ui_test.execute_dialog_through_command(".uno:PageSetup") + DrawPageDialog = self.xUITest.getTopFocusWindow() + xTabs = DrawPageDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + 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( - document.DrawPages.getByIndex(0).Background.FillStyle, SOLID) - self.assertEqual( - document.DrawPages.getByIndex(0).BorderLeft, 1016) - self.assertEqual( - document.DrawPages.getByIndex(0).BorderRight, 762) - self.assertEqual( - document.DrawPages.getByIndex(0).BorderTop, 508) - self.assertEqual( - document.DrawPages.getByIndex(0).BorderBottom, 254) - self.assertEqual( - document.MasterPages.getByIndex(0).BackgroundFullSize, False) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillStyle, SOLID) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderLeft, 1016) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderRight, 762) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderTop, 508) + self.assertEqual( + document.DrawPages.getByIndex(0).BorderBottom, 254) + self.assertEqual( + document.MasterPages.getByIndex(0).BackgroundFullSize, False) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf137729.py b/sd/qa/uitest/impress_tests/tdf137729.py index 4727a484d51f..1e4dfb050b5a 100644 --- a/sd/qa/uitest/impress_tests/tdf137729.py +++ b/sd/qa/uitest/impress_tests/tdf137729.py @@ -13,40 +13,42 @@ class tdf137729(UITestCase): def test_tdf137729(self): - with self.ui_test.create_doc_in_start_center("impress"): + self.ui_test.create_doc_in_start_center("impress") - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) - self.ui_test.execute_dialog_through_command(".uno:PageSetup") + self.ui_test.execute_dialog_through_command(".uno:PageSetup") - xPageSetupDlg = self.xUITest.getTopFocusWindow() - tabcontrol = xPageSetupDlg.getChild("tabcontrol") - select_pos(tabcontrol, "1") + xPageSetupDlg = self.xUITest.getTopFocusWindow() + tabcontrol = xPageSetupDlg.getChild("tabcontrol") + select_pos(tabcontrol, "1") - xBtn = xPageSetupDlg.getChild('btnhatch') - xBtn.executeAction("CLICK", tuple()) + xBtn = xPageSetupDlg.getChild('btnhatch') + xBtn.executeAction("CLICK", tuple()) - xDistance = xPageSetupDlg.getChild('distancemtr') - xDistance.executeAction("UP", tuple()) + xDistance = xPageSetupDlg.getChild('distancemtr') + xDistance.executeAction("UP", tuple()) - xOkBtn = xPageSetupDlg.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + xOkBtn = xPageSetupDlg.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - document = self.ui_test.get_component() - self.assertEqual( - document.DrawPages.getByIndex(0).Background.FillHatch.Style, SINGLE ) - self.assertEqual( - document.DrawPages.getByIndex(0).Background.FillHatch.Color, 0) - self.assertEqual( - document.DrawPages.getByIndex(0).Background.FillHatch.Distance, 152) - self.assertEqual( - document.DrawPages.getByIndex(0).Background.FillHatch.Angle, 0) + document = self.ui_test.get_component() + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillHatch.Style, SINGLE ) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillHatch.Color, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillHatch.Distance, 152) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillHatch.Angle, 0) - # Without the patch in place, this test would have failed with - # AssertionError: '' != 'hatch' - self.assertEqual( - document.DrawPages.getByIndex(0).Background.FillHatchName, 'hatch') + # Without the patch in place, this test would have failed with + # AssertionError: '' != 'hatch' + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillHatchName, 'hatch') + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf139511.py b/sd/qa/uitest/impress_tests/tdf139511.py index 225527d6b858..190d224f10d1 100644 --- a/sd/qa/uitest/impress_tests/tdf139511.py +++ b/sd/qa/uitest/impress_tests/tdf139511.py @@ -12,42 +12,44 @@ from uitest.uihelper.common import change_measurement_unit class tdf139511(UITestCase): def test_tdf139511(self): - with self.ui_test.create_doc_in_start_center("impress"): - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.create_doc_in_start_center("impress") + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) - change_measurement_unit(self, "Centimeter") + change_measurement_unit(self, "Centimeter") - self.xUITest.executeCommand(".uno:InsertTable?Columns:short=4&Rows:short=4") + self.xUITest.executeCommand(".uno:InsertTable?Columns:short=4&Rows:short=4") - document = self.ui_test.get_component() - self.assertEqual(8004, document.DrawPages[0].getByIndex(2).BoundRect.Height) - self.assertEqual(14104, document.DrawPages[0].getByIndex(2).BoundRect.Width) + document = self.ui_test.get_component() + self.assertEqual(8004, document.DrawPages[0].getByIndex(2).BoundRect.Height) + self.assertEqual(14104, document.DrawPages[0].getByIndex(2).BoundRect.Width) - self.ui_test.execute_dialog_through_command(".uno:TransformDialog") + self.ui_test.execute_dialog_through_command(".uno:TransformDialog") - xDialog = self.xUITest.getTopFocusWindow() + xDialog = self.xUITest.getTopFocusWindow() - xWidth = xDialog.getChild('MTR_FLD_WIDTH') - xHeight = xDialog.getChild('MTR_FLD_HEIGHT') + xWidth = xDialog.getChild('MTR_FLD_WIDTH') + xHeight = xDialog.getChild('MTR_FLD_HEIGHT') - xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) - xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) - xWidth.executeAction("TYPE", mkPropertyValues({"TEXT": "10"})) + xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) + xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + xWidth.executeAction("TYPE", mkPropertyValues({"TEXT": "10"})) - xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) - xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) - xHeight.executeAction("TYPE", mkPropertyValues({"TEXT": "5"})) + xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) + xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + xHeight.executeAction("TYPE", mkPropertyValues({"TEXT": "5"})) - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - document = self.ui_test.get_component() + document = self.ui_test.get_component() - # Without the fix in place, this test would have failed with - # AssertionError: 5005 != 8004 - self.assertEqual(5005, document.DrawPages[0].getByIndex(2).BoundRect.Height) - self.assertEqual(10005, document.DrawPages[0].getByIndex(2).BoundRect.Width) + # Without the fix in place, this test would have failed with + # AssertionError: 5005 != 8004 + self.assertEqual(5005, document.DrawPages[0].getByIndex(2).BoundRect.Height) + self.assertEqual(10005, document.DrawPages[0].getByIndex(2).BoundRect.Width) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf141297.py b/sd/qa/uitest/impress_tests/tdf141297.py index 8e01816135cf..cf6991414715 100644 --- a/sd/qa/uitest/impress_tests/tdf141297.py +++ b/sd/qa/uitest/impress_tests/tdf141297.py @@ -15,82 +15,82 @@ class tdf141297(UITestCase): def test_tdf141297(self): - with self.ui_test.create_doc_in_start_center("impress"): + self.ui_test.create_doc_in_start_center("impress") - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) - 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:ManageLinks") + self.ui_test.execute_dialog_through_command(".uno:ManageLinks") - 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, "tdf141297-tmp.odp") + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "tdf141297-tmp.odp") - # 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:ManageLinks") + self.xUITest.executeCommand(".uno:ManageLinks") - # 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("impress_win" 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("impress_win" in xMainWin.getChildren()) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf141708.py b/sd/qa/uitest/impress_tests/tdf141708.py index 9b6c3f3a9e53..613cc8938b4d 100644 --- a/sd/qa/uitest/impress_tests/tdf141708.py +++ b/sd/qa/uitest/impress_tests/tdf141708.py @@ -10,22 +10,23 @@ class tdf141708(UITestCase): def test_tdf141708(self): - with self.ui_test.create_doc_in_start_center("impress"): + self.ui_test.create_doc_in_start_center("impress") - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) - self.xUITest.executeCommand(".uno:Navigator") + self.xUITest.executeCommand(".uno:Navigator") - self.xUITest.executeCommand(".uno:CloseDoc") + self.xUITest.executeCommand(".uno:CloseDoc") - with self.ui_test.create_doc_in_start_center("impress"): + self.ui_test.create_doc_in_start_center("impress") - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) - # Without the fix in place, this test would have crashed here + # Without the fix in place, this test would have crashed here + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf82616.py b/sd/qa/uitest/impress_tests/tdf82616.py index 61595401ac2d..d8c4cb1bdcfc 100644 --- a/sd/qa/uitest/impress_tests/tdf82616.py +++ b/sd/qa/uitest/impress_tests/tdf82616.py @@ -13,52 +13,54 @@ from uitest.framework import UITestCase class Tdf82616(UITestCase): def test_tdf82616(self): - with self.ui_test.create_doc_in_start_center("impress"): + self.ui_test.create_doc_in_start_center("impress") - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) - change_measurement_unit(self, 'Centimeter') + change_measurement_unit(self, 'Centimeter') - xImpressDoc = self.xUITest.getTopFocusWindow() + xImpressDoc = self.xUITest.getTopFocusWindow() - document = self.ui_test.get_component() - self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X) - self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y) - self.assertEqual(1400, document.DrawPages[0].getByIndex(1).Position.X) - self.assertEqual(3685, document.DrawPages[0].getByIndex(1).Position.Y) + document = self.ui_test.get_component() + self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X) + self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y) + self.assertEqual(1400, document.DrawPages[0].getByIndex(1).Position.X) + self.assertEqual(3685, document.DrawPages[0].getByIndex(1).Position.Y) - self.assertIsNone(document.CurrentSelection) + self.assertIsNone(document.CurrentSelection) - xEditWin = xImpressDoc.getChild("impress_win") - xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) - self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + xEditWin = xImpressDoc.getChild("impress_win") + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) - xEditWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PosSizePropertyPanel"})) + xEditWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PosSizePropertyPanel"})) - xHorizontalPos = xImpressDoc.getChild("horizontalpos") - self.ui_test.wait_until_property_is_updated(xHorizontalPos, "Value", "1.4") - self.assertEqual("1.4", get_state_as_dict(xHorizontalPos)['Value']) + xHorizontalPos = xImpressDoc.getChild("horizontalpos") + self.ui_test.wait_until_property_is_updated(xHorizontalPos, "Value", "1.4") + self.assertEqual("1.4", get_state_as_dict(xHorizontalPos)['Value']) - xVerticalPos = xImpressDoc.getChild("verticalpos") - self.ui_test.wait_until_property_is_updated(xVerticalPos, "Value", "3.69") - self.assertEqual("3.69", get_state_as_dict(xVerticalPos)['Value']) + xVerticalPos = xImpressDoc.getChild("verticalpos") + self.ui_test.wait_until_property_is_updated(xVerticalPos, "Value", "3.69") + self.assertEqual("3.69", get_state_as_dict(xVerticalPos)['Value']) - xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1") - xDrawinglayerObject.executeAction("MOVE", mkPropertyValues({"X": "-5000", "Y":"-10000"})) + xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1") + xDrawinglayerObject.executeAction("MOVE", mkPropertyValues({"X": "-5000", "Y":"-10000"})) - self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X) - self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y) - self.assertEqual(-3600, document.DrawPages[0].getByIndex(1).Position.X) - self.assertEqual(-6315, document.DrawPages[0].getByIndex(1).Position.Y) + self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X) + self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y) + self.assertEqual(-3600, document.DrawPages[0].getByIndex(1).Position.X) + self.assertEqual(-6315, document.DrawPages[0].getByIndex(1).Position.Y) - # Without the fix in place, this test would have failed with - # AssertionError: '-3.6' != '0' - self.ui_test.wait_until_property_is_updated(xHorizontalPos, "Value", "-3.6") - self.assertEqual("-3.6", get_state_as_dict(xHorizontalPos)['Value']) + # Without the fix in place, this test would have failed with + # AssertionError: '-3.6' != '0' + self.ui_test.wait_until_property_is_updated(xHorizontalPos, "Value", "-3.6") + self.assertEqual("-3.6", get_state_as_dict(xHorizontalPos)['Value']) - self.ui_test.wait_until_property_is_updated(xVerticalPos, "Value", "-6.32") - self.assertEqual("-6.32", get_state_as_dict(xVerticalPos)['Value']) + self.ui_test.wait_until_property_is_updated(xVerticalPos, "Value", "-6.32") + self.assertEqual("-6.32", get_state_as_dict(xVerticalPos)['Value']) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf91762.py b/sd/qa/uitest/impress_tests/tdf91762.py index 25ac7d6b7d1b..8492e3425373 100644 --- a/sd/qa/uitest/impress_tests/tdf91762.py +++ b/sd/qa/uitest/impress_tests/tdf91762.py @@ -11,36 +11,38 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf91762(UITestCase): def test_tdf91762(self): - with self.ui_test.create_doc_in_start_center("impress"): - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) - - self.xUITest.executeCommand(".uno:AssignLayout?WhatLayout:long=1") - - self.ui_test.execute_dialog_through_command(".uno:InsertTable") - xDialog = self.xUITest.getTopFocusWindow() - self.assertEqual('5', get_state_as_dict(xDialog.getChild('columns'))['Text']) - self.assertEqual('2', get_state_as_dict(xDialog.getChild('rows'))['Text']) - xOkBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) - - document = self.ui_test.get_component() - self.assertEqual(1931, document.DrawPages[0].getByIndex(1).BoundRect.Height) - self.assertEqual(25198, document.DrawPages[0].getByIndex(1).Size.Width) - self.assertEqual(1925, document.DrawPages[0].getByIndex(1).Size.Height) - - self.assertEqual(1400, document.DrawPages[0].getByIndex(1).Position.X) - self.assertEqual(3685, document.DrawPages[0].getByIndex(1).Position.Y) - - xDoc = self.xUITest.getTopFocusWindow() - xEdit = xDoc.getChild("impress_win") - for i in range(5): - xEdit.executeAction("TYPE", mkPropertyValues({"TEXT":"test"})) - xEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - - # tdf#138011: Without the fix in place, this test would have failed with - # AssertionError: 5496 != 3559 - self.assertEqual(5496, document.DrawPages[0].getByIndex(1).BoundRect.Height) + self.ui_test.create_doc_in_start_center("impress") + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.xUITest.executeCommand(".uno:AssignLayout?WhatLayout:long=1") + + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + self.assertEqual('5', get_state_as_dict(xDialog.getChild('columns'))['Text']) + self.assertEqual('2', get_state_as_dict(xDialog.getChild('rows'))['Text']) + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + document = self.ui_test.get_component() + self.assertEqual(1931, document.DrawPages[0].getByIndex(1).BoundRect.Height) + self.assertEqual(25198, document.DrawPages[0].getByIndex(1).Size.Width) + self.assertEqual(1925, document.DrawPages[0].getByIndex(1).Size.Height) + + self.assertEqual(1400, document.DrawPages[0].getByIndex(1).Position.X) + self.assertEqual(3685, document.DrawPages[0].getByIndex(1).Position.Y) + + xDoc = self.xUITest.getTopFocusWindow() + xEdit = xDoc.getChild("impress_win") + for i in range(5): + xEdit.executeAction("TYPE", mkPropertyValues({"TEXT":"test"})) + xEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + # tdf#138011: Without the fix in place, this test would have failed with + # AssertionError: 5496 != 3559 + self.assertEqual(5496, document.DrawPages[0].getByIndex(1).BoundRect.Height) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/textColumnsDialog.py b/sd/qa/uitest/impress_tests/textColumnsDialog.py index 1f424fd2bd98..d6ae7d248000 100644 --- a/sd/qa/uitest/impress_tests/textColumnsDialog.py +++ b/sd/qa/uitest/impress_tests/textColumnsDialog.py @@ -16,7 +16,7 @@ from uitest.uihelper import guarded class textColumnsDialog(UITestCase): def test_textColumnsDialog(self): - with self.ui_test.create_doc_in_start_center("impress"): + with guarded.create_doc_in_start_center(self, "impress") as document: xTemplateDlg = self.xUITest.getTopFocusWindow() xCancelBtn = xTemplateDlg.getChild("close") @@ -25,9 +25,8 @@ class textColumnsDialog(UITestCase): change_measurement_unit(self, 'Centimeter') xImpressDoc = self.xUITest.getTopFocusWindow() - xEditWin = xImpressDoc.getChild("impress_win") - document = self.ui_test.get_component() + xEditWin = xImpressDoc.getChild("impress_win") xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) diff --git a/svx/qa/uitest/table/tablecontroller.py b/svx/qa/uitest/table/tablecontroller.py index 3cd502f41ae7..607df44a3a4f 100644 --- a/svx/qa/uitest/table/tablecontroller.py +++ b/svx/qa/uitest/table/tablecontroller.py @@ -14,68 +14,70 @@ class SvxTableControllerTest(UITestCase): def testOnFormatTable(self): # Create an Impress document with a single table in it. - with self.ui_test.create_doc_in_start_center("impress"): - template = self.xUITest.getTopFocusWindow() - self.ui_test.close_dialog_through_button(template.getChild("close")) - self.xUITest.executeCommand(".uno:SelectAll") - self.xUITest.executeCommand(".uno:Delete") - self.xUITest.executeCommand(".uno:InsertTable?Columns:short=2&Rows:short=2") + self.ui_test.create_doc_in_start_center("impress") + template = self.xUITest.getTopFocusWindow() + self.ui_test.close_dialog_through_button(template.getChild("close")) + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Delete") + self.xUITest.executeCommand(".uno:InsertTable?Columns:short=2&Rows:short=2") - # Enable shadow. - self.ui_test.execute_dialog_through_command(".uno:TableDialog") - tableDialog = self.xUITest.getTopFocusWindow() - tabs = tableDialog.getChild("tabcontrol") - # Select "shadow". - select_pos(tabs, "4") - shadowCheckbox = tableDialog.getChild("TSB_SHOW_SHADOW") - shadowCheckbox.executeAction("CLICK", tuple()) - self.ui_test.close_dialog_through_button(tableDialog.getChild("ok")) + # Enable shadow. + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + tableDialog = self.xUITest.getTopFocusWindow() + tabs = tableDialog.getChild("tabcontrol") + # Select "shadow". + select_pos(tabs, "4") + shadowCheckbox = tableDialog.getChild("TSB_SHOW_SHADOW") + shadowCheckbox.executeAction("CLICK", tuple()) + self.ui_test.close_dialog_through_button(tableDialog.getChild("ok")) - # Check if the shadow was enabled. - component = self.ui_test.get_component() - drawPage = component.getDrawPages().getByIndex(0) - shape = drawPage.getByIndex(0) - # Without the accompanying fix in place, this test would have failed with: - # AssertionError: False != True - # i.e. the table still had no shadow. - self.assertEqual(shape.Shadow, True) + # Check if the shadow was enabled. + component = self.ui_test.get_component() + drawPage = component.getDrawPages().getByIndex(0) + shape = drawPage.getByIndex(0) + # Without the accompanying fix in place, this test would have failed with: + # AssertionError: False != True + # i.e. the table still had no shadow. + self.assertEqual(shape.Shadow, True) - # Close the document. + # Close the document. + self.ui_test.close_doc() def testUndoCrash(self): # Given an Impress document with a single table in it: - with self.ui_test.create_doc_in_start_center("impress"): - template = self.xUITest.getTopFocusWindow() - self.ui_test.close_dialog_through_button(template.getChild("close")) - self.xUITest.executeCommand(".uno:SelectAll") - self.xUITest.executeCommand(".uno:Delete") - self.xUITest.executeCommand(".uno:InsertTable?Columns:short=3&Rows:short=3") - self.xUITest.executeCommand(".uno:SelectAll") + self.ui_test.create_doc_in_start_center("impress") + template = self.xUITest.getTopFocusWindow() + self.ui_test.close_dialog_through_button(template.getChild("close")) + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Delete") + self.xUITest.executeCommand(".uno:InsertTable?Columns:short=3&Rows:short=3") + self.xUITest.executeCommand(".uno:SelectAll") - # When enabling shadow on the shape while text edit is active: - doc = self.xUITest.getTopFocusWindow() - impress = doc.getChild("impress_win") - impress.executeAction("TYPE", mkPropertyValues({"TEXT": "A1"})) - for i in range(6): - impress.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+TAB"})) - impress.executeAction("TYPE", mkPropertyValues({"TEXT": "A3"})) - self.xUITest.executeCommand(".uno:SelectAll") - self.ui_test.execute_dialog_through_command(".uno:TableDialog") - tableDialog = self.xUITest.getTopFocusWindow() - tabs = tableDialog.getChild("tabcontrol") - # Select "shadow". - select_pos(tabs, "4") - shadowCheckbox = tableDialog.getChild("TSB_SHOW_SHADOW") - shadowCheckbox.executeAction("CLICK", tuple()) - self.ui_test.close_dialog_through_button(tableDialog.getChild("ok")) + # When enabling shadow on the shape while text edit is active: + doc = self.xUITest.getTopFocusWindow() + impress = doc.getChild("impress_win") + impress.executeAction("TYPE", mkPropertyValues({"TEXT": "A1"})) + for i in range(6): + impress.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+TAB"})) + impress.executeAction("TYPE", mkPropertyValues({"TEXT": "A3"})) + self.xUITest.executeCommand(".uno:SelectAll") + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + tableDialog = self.xUITest.getTopFocusWindow() + tabs = tableDialog.getChild("tabcontrol") + # Select "shadow". + select_pos(tabs, "4") + shadowCheckbox = tableDialog.getChild("TSB_SHOW_SHADOW") + shadowCheckbox.executeAction("CLICK", tuple()) + self.ui_test.close_dialog_through_button(tableDialog.getChild("ok")) - # Then make sure we don't crash: - # Without the accompanying fix in place, this test would have failed crashed due to a - # use-after-free: text edit ended but an undo action of the text edit remained on the undo - # stack. - for i in range(2): - self.xUITest.executeCommand(".uno:Undo") + # Then make sure we don't crash: + # Without the accompanying fix in place, this test would have failed crashed due to a + # use-after-free: text edit ended but an undo action of the text edit remained on the undo + # stack. + for i in range(2): + self.xUITest.executeCommand(".uno:Undo") - # Close the document. + # Close the document. + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/chapterNumbering/chapterNumbering.py b/sw/qa/uitest/chapterNumbering/chapterNumbering.py index 24e9f4eb22c5..b72e6b458ef2 100644 --- a/sw/qa/uitest/chapterNumbering/chapterNumbering.py +++ b/sw/qa/uitest/chapterNumbering/chapterNumbering.py @@ -17,74 +17,75 @@ from uitest.uihelper.common import change_measurement_unit class WriterChapterNumbering(UITestCase): def test_chapter_numbering_dialog(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() - change_measurement_unit(self, "Millimeter") + change_measurement_unit(self, "Millimeter") - self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xstyle = xDialog.getChild("style") - xnumbering = xDialog.getChild("numbering") - xcharstyle = xDialog.getChild("charstyle") - xprefix = xDialog.getChild("prefix") - xsuffix = xDialog.getChild("suffix") - xstartat = xDialog.getChild("startat") - xtab = xDialog.getChild("tabcontrol") - #second tab - xalignedatmf = xDialog.getChild("alignedatmf") - xnum2alignlb = xDialog.getChild("num2alignlb") - xnumfollowedbylb = xDialog.getChild("numfollowedbylb") - xatmf = xDialog.getChild("atmf") - xindentatmf = xDialog.getChild("indentatmf") - select_pos(xtab, "0") #first tab - select_by_text(xstyle, "Heading") - select_by_text(xnumbering, "1, 2, 3, ...") - select_by_text(xcharstyle, "Bullets") - xprefix.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) - xsuffix.executeAction("TYPE", mkPropertyValues({"TEXT":"B"})) - xstartat.executeAction("UP", tuple()) + self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xstyle = xDialog.getChild("style") + xnumbering = xDialog.getChild("numbering") + xcharstyle = xDialog.getChild("charstyle") + xprefix = xDialog.getChild("prefix") + xsuffix = xDialog.getChild("suffix") + xstartat = xDialog.getChild("startat") + xtab = xDialog.getChild("tabcontrol") + #second tab + xalignedatmf = xDialog.getChild("alignedatmf") + xnum2alignlb = xDialog.getChild("num2alignlb") + xnumfollowedbylb = xDialog.getChild("numfollowedbylb") + xatmf = xDialog.getChild("atmf") + xindentatmf = xDialog.getChild("indentatmf") + select_pos(xtab, "0") #first tab + select_by_text(xstyle, "Heading") + select_by_text(xnumbering, "1, 2, 3, ...") + select_by_text(xcharstyle, "Bullets") + xprefix.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) + xsuffix.executeAction("TYPE", mkPropertyValues({"TEXT":"B"})) + xstartat.executeAction("UP", tuple()) - select_pos(xtab, "1") #second tab Position - xalignedatmf.executeAction("UP", tuple()) - select_by_text(xnum2alignlb, "Centered") - select_by_text(xnumfollowedbylb, "Tab stop") - xatmf.executeAction("UP", tuple()) - xindentatmf.executeAction("UP", tuple()) + select_pos(xtab, "1") #second tab Position + xalignedatmf.executeAction("UP", tuple()) + select_by_text(xnum2alignlb, "Centered") + select_by_text(xnumfollowedbylb, "Tab stop") + xatmf.executeAction("UP", tuple()) + xindentatmf.executeAction("UP", 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.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() - xstyle = xDialog.getChild("style") - xnumbering = xDialog.getChild("numbering") - xcharstyle = xDialog.getChild("charstyle") - xprefix = xDialog.getChild("prefix") - xsuffix = xDialog.getChild("suffix") - xstartat = xDialog.getChild("startat") - xtab = xDialog.getChild("tabcontrol") - #second tab - xalignedatmf = xDialog.getChild("alignedatmf") - xnum2alignlb = xDialog.getChild("num2alignlb") - xnumfollowedbylb = xDialog.getChild("numfollowedbylb") - xatmf = xDialog.getChild("atmf") - xindentatmf = xDialog.getChild("indentatmf") - select_pos(xtab, "0") - self.assertEqual(get_state_as_dict(xstyle)["SelectEntryText"], "Heading") - self.assertEqual(get_state_as_dict(xnumbering)["SelectEntryText"], "1, 2, 3, ...") - self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "Bullets") - self.assertEqual(get_state_as_dict(xprefix)["Text"], "A") - self.assertEqual(get_state_as_dict(xsuffix)["Text"], "B") - self.assertEqual(get_state_as_dict(xstartat)["Text"], "2") - select_pos(xtab, "1") #second tab Position - self.assertEqual(get_state_as_dict(xalignedatmf)["Text"], "0.1 mm") - self.assertEqual(get_state_as_dict(xnum2alignlb)["SelectEntryText"], "Centered") - self.assertEqual(get_state_as_dict(xnumfollowedbylb)["SelectEntryText"], "Tab stop") - self.assertEqual(get_state_as_dict(xatmf)["Text"], "0.1 mm") - self.assertEqual(get_state_as_dict(xindentatmf)["Text"], "0.1 mm") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + xstyle = xDialog.getChild("style") + xnumbering = xDialog.getChild("numbering") + xcharstyle = xDialog.getChild("charstyle") + xprefix = xDialog.getChild("prefix") + xsuffix = xDialog.getChild("suffix") + xstartat = xDialog.getChild("startat") + xtab = xDialog.getChild("tabcontrol") + #second tab + xalignedatmf = xDialog.getChild("alignedatmf") + xnum2alignlb = xDialog.getChild("num2alignlb") + xnumfollowedbylb = xDialog.getChild("numfollowedbylb") + xatmf = xDialog.getChild("atmf") + xindentatmf = xDialog.getChild("indentatmf") + select_pos(xtab, "0") + self.assertEqual(get_state_as_dict(xstyle)["SelectEntryText"], "Heading") + self.assertEqual(get_state_as_dict(xnumbering)["SelectEntryText"], "1, 2, 3, ...") + self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "Bullets") + self.assertEqual(get_state_as_dict(xprefix)["Text"], "A") + self.assertEqual(get_state_as_dict(xsuffix)["Text"], "B") + self.assertEqual(get_state_as_dict(xstartat)["Text"], "2") + select_pos(xtab, "1") #second tab Position + self.assertEqual(get_state_as_dict(xalignedatmf)["Text"], "0.1 mm") + self.assertEqual(get_state_as_dict(xnum2alignlb)["SelectEntryText"], "Centered") + self.assertEqual(get_state_as_dict(xnumfollowedbylb)["SelectEntryText"], "Tab stop") + self.assertEqual(get_state_as_dict(xatmf)["Text"], "0.1 mm") + self.assertEqual(get_state_as_dict(xindentatmf)["Text"], "0.1 mm") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/chapterNumbering/tdf140528.py b/sw/qa/uitest/chapterNumbering/tdf140528.py index 6abf2b1f2838..c34d33c409b3 100644 --- a/sw/qa/uitest/chapterNumbering/tdf140528.py +++ b/sw/qa/uitest/chapterNumbering/tdf140528.py @@ -13,40 +13,42 @@ from uitest.uihelper.common import select_pos class Tdf140528(UITestCase): def test_tdf140528(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() - self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() - xTab = xDialog.getChild("tabcontrol") - select_pos(xTab, "0") + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "0") - xFormat = xDialog.getChild("format") + xFormat = xDialog.getChild("format") - with self.ui_test.execute_blocking_action(xFormat.executeAction, args=('OPENFROMLIST', mkPropertyValues({"POS": "10"}))) as dialog: - xEntry = dialog.getChild("entry") - self.assertEqual("Untitled 1", get_state_as_dict(xEntry)['Text']) + with self.ui_test.execute_blocking_action(xFormat.executeAction, args=('OPENFROMLIST', mkPropertyValues({"POS": "10"}))) as dialog: + xEntry = dialog.getChild("entry") + self.assertEqual("Untitled 1", get_state_as_dict(xEntry)['Text']) - xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xEntry.executeAction("TYPE", mkPropertyValues({"TEXT" : "newFormat"})) + xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xEntry.executeAction("TYPE", mkPropertyValues({"TEXT" : "newFormat"})) - self.assertEqual("saveas", get_state_as_dict(xFormat)['CurrentItem']) + self.assertEqual("saveas", get_state_as_dict(xFormat)['CurrentItem']) - # Go to Position tab - select_pos(xTab, "1") + # Go to Position tab + select_pos(xTab, "1") - # Go back to Numbering tab - select_pos(xTab, "0") + # Go back to Numbering tab + select_pos(xTab, "0") - xFormat.executeAction('OPENFROMLIST', mkPropertyValues({"POS": "0"})) - self.assertEqual("form1", get_state_as_dict(xFormat)['CurrentItem']) + xFormat.executeAction('OPENFROMLIST', mkPropertyValues({"POS": "0"})) + self.assertEqual("form1", get_state_as_dict(xFormat)['CurrentItem']) - # Without the fix in place, this test would have crashed here - select_pos(xTab, "1") + # Without the fix in place, this test would have crashed here + select_pos(xTab, "1") - 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.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/chart/tdf138556.py b/sw/qa/uitest/chart/tdf138556.py index 2396d644bb57..4a7f325c8df4 100644 --- a/sw/qa/uitest/chart/tdf138556.py +++ b/sw/qa/uitest/chart/tdf138556.py @@ -17,38 +17,39 @@ class tdf138556( UITestCase ): def test_stock_chart13_insert_series( self ): #Start LibreOffice Writer - with self.ui_test.create_doc_in_start_center( "writer" ): - xMainTop = self.xUITest.getTopFocusWindow() - - #Insert Chart - self.xUITest.executeCommand( ".uno:InsertObjectChart" ) - xChartMainTop = self.xUITest.getTopFocusWindow() - xChartMain = xChartMainTop.getChild( "chart_window" ) - xChart = xChartMain.getChild( "CID/Page=" ) - - #Change Chart Type to Stock 1 - #TODO: test other subtypes - self.ui_test.execute_dialog_through_action( xChart, "COMMAND", - mkPropertyValues({ "COMMAND" : "DiagramType" })) - xDialog = self.xUITest.getTopFocusWindow() - xChartType = xDialog.getChild( "charttype" ) - xStockType = xChartType.getChild( "8" ) - xStockType.executeAction( "SELECT", tuple()) - xOKBtn = xDialog.getChild( "ok" ) - self.ui_test.close_dialog_through_button( xOKBtn ) - - #Insert Data Series - self.ui_test.execute_dialog_through_action( xChart, "COMMAND", - mkPropertyValues({ "COMMAND" : "DiagramData" })) - xDialog = self.xUITest.getTopFocusWindow() - xToolbar = xDialog.getChild( "toolbar" ) - xToolbar.executeAction( "CLICK", mkPropertyValues({ "POS" : "1" })) - xOKBtn = xDialog.getChild( "close" ) - self.ui_test.close_dialog_through_button( xOKBtn ) - - #Check Number of Sequences - xDocument = self.ui_test.get_component() - nSequences = len( xDocument.FirstDiagram. - CoordinateSystems[0].ChartTypes[0].DataSeries[0].DataSequences ) - self.assertEqual( nSequences, 3 ) - + xDocument = self.ui_test.create_doc_in_start_center( "writer" ) + xMainTop = self.xUITest.getTopFocusWindow() + + #Insert Chart + self.xUITest.executeCommand( ".uno:InsertObjectChart" ) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild( "chart_window" ) + xChart = xChartMain.getChild( "CID/Page=" ) + + #Change Chart Type to Stock 1 + #TODO: test other subtypes + self.ui_test.execute_dialog_through_action( xChart, "COMMAND", + mkPropertyValues({ "COMMAND" : "DiagramType" })) + xDialog = self.xUITest.getTopFocusWindow() + xChartType = xDialog.getChild( "charttype" ) + xStockType = xChartType.getChild( "8" ) + xStockType.executeAction( "SELECT", tuple()) + xOKBtn = xDialog.getChild( "ok" ) + self.ui_test.close_dialog_through_button( xOKBtn ) + + #Insert Data Series + self.ui_test.execute_dialog_through_action( xChart, "COMMAND", + mkPropertyValues({ "COMMAND" : "DiagramData" })) + xDialog = self.xUITest.getTopFocusWindow() + xToolbar = xDialog.getChild( "toolbar" ) + xToolbar.executeAction( "CLICK", mkPropertyValues({ "POS" : "1" })) + xOKBtn = xDialog.getChild( "close" ) + self.ui_test.close_dialog_through_button( xOKBtn ) + + #Check Number of Sequences + xDocument = self.ui_test.get_component() + nSequences = len( xDocument.FirstDiagram. + CoordinateSystems[0].ChartTypes[0].DataSeries[0].DataSequences ) + self.assertEqual( nSequences, 3 ) + + self.ui_test.close_doc() diff --git a/sw/qa/uitest/classification/classification.py b/sw/qa/uitest/classification/classification.py index 37feb02c5a42..72f7dd16bb8a 100644 --- a/sw/qa/uitest/classification/classification.py +++ b/sw/qa/uitest/classification/classification.py @@ -38,131 +38,136 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class classification(UITestCase): def test_document_classification_dialog(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:ClassificationDialog") - xDialog = self.xUITest.getTopFocusWindow() - classificationEditWindow = xDialog.getChild("classificationEditWindow") - recentlyUsedCB = xDialog.getChild("recentlyUsedCB") - classificationCB = xDialog.getChild("classificationCB") - internationalClassificationCB = xDialog.getChild("internationalClassificationCB") - intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") - intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") - - select_by_text(classificationCB, "Confidential") - #verify International is set too - self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") - #verify textBox Content - # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - header = document.StyleFamilies.PageStyles.Standard.HeaderText.createEnumeration().nextElement() - self.assertEqual(header.String, "Confidential") - - controller = self.ui_test.get_component().getCurrentController() - self.assertTrue(controller.hasInfobar("classification")) - - #verify watermark - #Bug 122586 - Classification: by using the dialog, Watermark text from policy is not placed in the document - 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"], "Confidential") - self.assertEqual(get_state_as_dict(xAngle)["Text"], "45°") - self.assertEqual((get_state_as_dict(xTransparency)["Text"])[0:2], "50") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - - #TODO - #open dialog and add intellectualProperty text, save - #verify - #reopen and verify classification and Content - - #do the same for Paragraph classification - self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog") - xDialog = self.xUITest.getTopFocusWindow() - classificationEditWindow = xDialog.getChild("classificationEditWindow") - recentlyUsedCB = xDialog.getChild("recentlyUsedCB") - classificationCB = xDialog.getChild("classificationCB") - internationalClassificationCB = xDialog.getChild("internationalClassificationCB") - intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") - intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") - - select_by_text(classificationCB, "Confidential") - #verify International is set too - self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") - #verify textBox Content TODO textbox not supported - #self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") - # print(get_state_as_dict(classificationEditWindow)) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - self.assertEqual(document.Text.String[0:6], "(Conf)") - self.assertEqual(header.String, "Confidential") - self.assertTrue(controller.hasInfobar("classification")) + writer_doc = 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:ClassificationDialog") + xDialog = self.xUITest.getTopFocusWindow() + classificationEditWindow = xDialog.getChild("classificationEditWindow") + recentlyUsedCB = xDialog.getChild("recentlyUsedCB") + classificationCB = xDialog.getChild("classificationCB") + internationalClassificationCB = xDialog.getChild("internationalClassificationCB") + intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") + intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") + + select_by_text(classificationCB, "Confidential") + #verify International is set too + self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") + #verify textBox Content + # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + header = document.StyleFamilies.PageStyles.Standard.HeaderText.createEnumeration().nextElement() + self.assertEqual(header.String, "Confidential") + + controller = self.ui_test.get_component().getCurrentController() + self.assertTrue(controller.hasInfobar("classification")) + + #verify watermark + #Bug 122586 - Classification: by using the dialog, Watermark text from policy is not placed in the document + 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"], "Confidential") + self.assertEqual(get_state_as_dict(xAngle)["Text"], "45°") + self.assertEqual((get_state_as_dict(xTransparency)["Text"])[0:2], "50") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + #TODO + #open dialog and add intellectualProperty text, save + #verify + #reopen and verify classification and Content + + #do the same for Paragraph classification + self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog") + xDialog = self.xUITest.getTopFocusWindow() + classificationEditWindow = xDialog.getChild("classificationEditWindow") + recentlyUsedCB = xDialog.getChild("recentlyUsedCB") + classificationCB = xDialog.getChild("classificationCB") + internationalClassificationCB = xDialog.getChild("internationalClassificationCB") + intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") + intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") + + select_by_text(classificationCB, "Confidential") + #verify International is set too + self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") + #verify textBox Content TODO textbox not supported + #self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") + # print(get_state_as_dict(classificationEditWindow)) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.assertEqual(document.Text.String[0:6], "(Conf)") + self.assertEqual(header.String, "Confidential") + self.assertTrue(controller.hasInfobar("classification")) + + self.ui_test.close_doc() def test_paragraph_classification_dialog(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - #+ new file and do it only for Paragraph classification (no watermark!) - self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog") - xDialog = self.xUITest.getTopFocusWindow() - classificationEditWindow = xDialog.getChild("classificationEditWindow") - recentlyUsedCB = xDialog.getChild("recentlyUsedCB") - classificationCB = xDialog.getChild("classificationCB") - internationalClassificationCB = xDialog.getChild("internationalClassificationCB") - intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") - intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") - - select_by_text(classificationCB, "Confidential") - #verify International is set too - self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") - #verify textBox Content TODO - texbox not supported yet - # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") - # print(get_state_as_dict(classificationEditWindow)) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - controller = self.ui_test.get_component().getCurrentController() - self.assertEqual(document.Text.String[0:6], "(Conf)") - self.assertFalse(controller.hasInfobar("classification")) - self.assertFalse(document.StyleFamilies.PageStyles.Standard.HeaderIsOn) + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #+ new file and do it only for Paragraph classification (no watermark!) + self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog") + xDialog = self.xUITest.getTopFocusWindow() + classificationEditWindow = xDialog.getChild("classificationEditWindow") + recentlyUsedCB = xDialog.getChild("recentlyUsedCB") + classificationCB = xDialog.getChild("classificationCB") + internationalClassificationCB = xDialog.getChild("internationalClassificationCB") + intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") + intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") + + select_by_text(classificationCB, "Confidential") + #verify International is set too + self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") + #verify textBox Content TODO - texbox not supported yet + # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") + # print(get_state_as_dict(classificationEditWindow)) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + controller = self.ui_test.get_component().getCurrentController() + self.assertEqual(document.Text.String[0:6], "(Conf)") + self.assertFalse(controller.hasInfobar("classification")) + self.assertFalse(document.StyleFamilies.PageStyles.Standard.HeaderIsOn) + + self.ui_test.close_doc() def test_paragraph_classification_dialog_text(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - #+ new file and do it only for Paragraph classification (no watermark!) - self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog") - xDialog = self.xUITest.getTopFocusWindow() - classificationEditWindow = xDialog.getChild("classificationEditWindow") - recentlyUsedCB = xDialog.getChild("recentlyUsedCB") - classificationCB = xDialog.getChild("classificationCB") - internationalClassificationCB = xDialog.getChild("internationalClassificationCB") - intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") - intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") - #type text AA - intellectualPropertyPartEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"AA"})) - intellectualPropertyPartAddButton.executeAction("CLICK", tuple()) - select_by_text(classificationCB, "Internal Only") - #verify International is set too - self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Internal Only") - #verify textBox Content TODO - texbox not supported yet - # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - controller = self.ui_test.get_component().getCurrentController() - self.assertEqual(document.Text.String[0:6], "(AAIO)") - self.assertFalse(controller.hasInfobar("classification")) - self.assertFalse(document.StyleFamilies.PageStyles.Standard.HeaderIsOn) - + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #+ new file and do it only for Paragraph classification (no watermark!) + self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog") + xDialog = self.xUITest.getTopFocusWindow() + classificationEditWindow = xDialog.getChild("classificationEditWindow") + recentlyUsedCB = xDialog.getChild("recentlyUsedCB") + classificationCB = xDialog.getChild("classificationCB") + internationalClassificationCB = xDialog.getChild("internationalClassificationCB") + intellectualPropertyPartEntry = xDialog.getChild("intellectualPropertyPartEntry") + intellectualPropertyPartAddButton = xDialog.getChild("intellectualPropertyPartAddButton") + #type text AA + intellectualPropertyPartEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"AA"})) + intellectualPropertyPartAddButton.executeAction("CLICK", tuple()) + select_by_text(classificationCB, "Internal Only") + #verify International is set too + self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Internal Only") + #verify textBox Content TODO - texbox not supported yet + # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + controller = self.ui_test.get_component().getCurrentController() + self.assertEqual(document.Text.String[0:6], "(AAIO)") + self.assertFalse(controller.hasInfobar("classification")) + self.assertFalse(document.StyleFamilies.PageStyles.Standard.HeaderIsOn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findBar/findbar.py b/sw/qa/uitest/findBar/findbar.py index e539a1934ae9..75bfbb33abd9 100644 --- a/sw/qa/uitest/findBar/findbar.py +++ b/sw/qa/uitest/findBar/findbar.py @@ -16,52 +16,54 @@ class FindBar(UITestCase): def test_find_bar(self): - with self.ui_test.create_doc_in_start_center("writer"): - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - # Type some lines to search for words on them - xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice Writer"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice Calc"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "The Document Foundation"})) + # Type some lines to search for words on them + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice Writer"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice Calc"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "The Document Foundation"})) - # open the Find Bar - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+f"})) + # open the Find Bar + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+f"})) - # Type the Word that we want to search for it - xfind = xWriterDoc.getChild("find") - xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Libre"})) + # Type the Word that we want to search for it + xfind = xWriterDoc.getChild("find") + xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Libre"})) - # Select the Find Bar - xfind_bar = xWriterDoc.getChild("FindBar") - self.assertEqual(get_state_as_dict(xfind_bar)["ItemCount"], "14") + # Select the Find Bar + xfind_bar = xWriterDoc.getChild("FindBar") + self.assertEqual(get_state_as_dict(xfind_bar)["ItemCount"], "14") - # Press on FindAll in the Find Bar - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) - self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "5") # 5 is FindAll id for Pos 4 - self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find All") - self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:FindAll") - self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "LibreLibreLibre") + # Press on FindAll in the Find Bar + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "5") # 5 is FindAll id for Pos 4 + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find All") + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:FindAll") + self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "LibreLibreLibre") - # Press on Find Next in the Find Bar - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) # 3 is Find Next pos - self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "4") - self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find Next") - self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:DownSearch") - self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "Libre") + # Press on Find Next in the Find Bar + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) # 3 is Find Next pos + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "4") + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find Next") + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:DownSearch") + self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "Libre") - # Press on Find Previous in the Find Bar - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "2"})) # 2 is Find Previous pos - self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "3") - self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find Previous") - self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:UpSearch") - self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "Libre") + # Press on Find Previous in the Find Bar + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "2"})) # 2 is Find Previous pos + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "3") + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find Previous") + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:UpSearch") + self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "Libre") - # Close the Find Bar - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 0 is pos for close + # Close the Find Bar + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 0 is pos for close + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findBar/tdf136941.py b/sw/qa/uitest/findBar/tdf136941.py index e60073e3021f..c77a7e2a2277 100644 --- a/sw/qa/uitest/findBar/tdf136941.py +++ b/sw/qa/uitest/findBar/tdf136941.py @@ -12,53 +12,55 @@ class tdf136941(UITestCase): def test_tdf136941(self): - with self.ui_test.create_doc_in_start_center("writer"): - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello World"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello World"})) - self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar") + self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar") - xfind = xWriterDoc.getChild("find") - xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"})) + xfind = xWriterDoc.getChild("find") + xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"})) - self.assertEqual("Hello", get_state_as_dict(xfind)['Text']) + self.assertEqual("Hello", get_state_as_dict(xfind)['Text']) - xfind_bar = xWriterDoc.getChild("FindBar") + xfind_bar = xWriterDoc.getChild("FindBar") - # Search Next - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) + # Search Next + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) - # Close button - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) + # Close button + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) - # Check the toolbar is closed - self.assertTrue("find" not in xWriterDoc.getChildren()) - self.assertEqual("Hello", get_state_as_dict(xWriterEdit)['SelectedText']) + # Check the toolbar is closed + self.assertTrue("find" not in xWriterDoc.getChildren()) + self.assertEqual("Hello", get_state_as_dict(xWriterEdit)['SelectedText']) - self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar") + self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar") - xfind = xWriterDoc.getChild("find") - self.ui_test.wait_until_property_is_updated(xfind, 'SelectedText', "Hello") - self.assertEqual("Hello", get_state_as_dict(xfind)['SelectedText']) + xfind = xWriterDoc.getChild("find") + self.ui_test.wait_until_property_is_updated(xfind, 'SelectedText', "Hello") + self.assertEqual("Hello", get_state_as_dict(xfind)['SelectedText']) - xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "World"})) + xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "World"})) - # Without the fix in place, this test would have failed with - # AssertionError: 'World' != 'WorldHello' - self.assertEqual("World", get_state_as_dict(xfind)['Text']) + # Without the fix in place, this test would have failed with + # AssertionError: 'World' != 'WorldHello' + self.assertEqual("World", get_state_as_dict(xfind)['Text']) - xfind_bar = xWriterDoc.getChild("FindBar") + xfind_bar = xWriterDoc.getChild("FindBar") - # Search Next - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) + # Search Next + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) - # Close button - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) + # Close button + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) - # Check the toolbar is closed - self.assertTrue("find" not in xWriterDoc.getChildren()) - self.assertEqual("World", get_state_as_dict(xWriterEdit)['SelectedText']) + # Check the toolbar is closed + self.assertTrue("find" not in xWriterDoc.getChildren()) + self.assertEqual("World", get_state_as_dict(xWriterEdit)['SelectedText']) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findBar/tdf138232.py b/sw/qa/uitest/findBar/tdf138232.py index 21d1b011860f..62a79824ea4d 100644 --- a/sw/qa/uitest/findBar/tdf138232.py +++ b/sw/qa/uitest/findBar/tdf138232.py @@ -12,38 +12,40 @@ class tdf138232(UITestCase): def test_tdf138232(self): - with self.ui_test.create_doc_in_start_center("writer"): - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"})) - self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar") + self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar") - xfind = xWriterDoc.getChild("find") - self.ui_test.wait_until_property_is_updated(xfind, 'HasFocus', "true") - self.assertEqual("true", get_state_as_dict(xfind)['HasFocus']) + xfind = xWriterDoc.getChild("find") + self.ui_test.wait_until_property_is_updated(xfind, 'HasFocus', "true") + self.assertEqual("true", get_state_as_dict(xfind)['HasFocus']) - xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"})) - self.assertEqual("Hello", get_state_as_dict(xfind)['Text']) + xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"})) + self.assertEqual("Hello", get_state_as_dict(xfind)['Text']) - xfind_bar = xWriterDoc.getChild("FindBar") + xfind_bar = xWriterDoc.getChild("FindBar") - # Click on Find All - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) + # Click on Find All + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) - self.assertEqual("HelloHello", get_state_as_dict(xWriterEdit)['SelectedText']) + self.assertEqual("HelloHello", get_state_as_dict(xWriterEdit)['SelectedText']) - xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "World"})) + xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "World"})) - # Without the fix in place, this test would have failed with - # AssertionError: 'HelloWorld' != 'World' - self.assertEqual("HelloWorld", get_state_as_dict(xfind)['Text']) + # Without the fix in place, this test would have failed with + # AssertionError: 'HelloWorld' != 'World' + self.assertEqual("HelloWorld", get_state_as_dict(xfind)['Text']) - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) - self.assertEqual("", get_state_as_dict(xWriterEdit)['SelectedText']) + self.assertEqual("", get_state_as_dict(xWriterEdit)['SelectedText']) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findBar/tdf88608.py b/sw/qa/uitest/findBar/tdf88608.py index 920f0b4fb43f..b3576ec7587e 100644 --- a/sw/qa/uitest/findBar/tdf88608.py +++ b/sw/qa/uitest/findBar/tdf88608.py @@ -12,42 +12,44 @@ class tdf88608(UITestCase): def test_tdf88608(self): - with self.ui_test.create_doc_in_start_center("writer"): - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello World"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello World"})) - self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar") + self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar") - # Search a word that doesn't exist - xfind = xWriterDoc.getChild("find") - xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "X"})) - self.assertEqual("X", get_state_as_dict(xfind)['Text']) + # Search a word that doesn't exist + xfind = xWriterDoc.getChild("find") + xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "X"})) + self.assertEqual("X", get_state_as_dict(xfind)['Text']) - xfind_bar = xWriterDoc.getChild("FindBar") - self.assertEqual('', get_state_as_dict(xfind_bar.getChild('label'))['Text']) + xfind_bar = xWriterDoc.getChild("FindBar") + self.assertEqual('', get_state_as_dict(xfind_bar.getChild('label'))['Text']) - # Search Next - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) + # Search Next + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) - self.assertEqual('Search key not found', get_state_as_dict(xfind_bar.getChild('label'))['Text']) + self.assertEqual('Search key not found', get_state_as_dict(xfind_bar.getChild('label'))['Text']) - self.assertEqual("", get_state_as_dict(xWriterEdit)['SelectedText']) + self.assertEqual("", get_state_as_dict(xWriterEdit)['SelectedText']) - xfind.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) - xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "World"})) - self.assertEqual("World", get_state_as_dict(xfind)['Text']) + xfind.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "World"})) + self.assertEqual("World", get_state_as_dict(xfind)['Text']) - # Without the fix in place, this test would have failed with - # AssertionError: '' != 'Search key not found' - self.assertEqual('', get_state_as_dict(xfind_bar.getChild('label'))['Text']) + # Without the fix in place, this test would have failed with + # AssertionError: '' != 'Search key not found' + self.assertEqual('', get_state_as_dict(xfind_bar.getChild('label'))['Text']) - # Search Next - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) + # Search Next + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) - self.assertEqual('Reached the end of the document', get_state_as_dict(xfind_bar.getChild('label'))['Text']) + self.assertEqual('Reached the end of the document', get_state_as_dict(xfind_bar.getChild('label'))['Text']) - self.assertEqual("World", get_state_as_dict(xWriterEdit)['SelectedText']) + self.assertEqual("World", get_state_as_dict(xWriterEdit)['SelectedText']) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findReplace/findReplace.py b/sw/qa/uitest/findReplace/findReplace.py index 4db87ddd9e4e..0ef4f22ac1d9 100644 --- a/sw/qa/uitest/findReplace/findReplace.py +++ b/sw/qa/uitest/findReplace/findReplace.py @@ -95,28 +95,30 @@ class findReplace(UITestCase): #Bug 39022 - find-replace->$1, not pattern def test_tdf39022_replace_regexp(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") - type_text(xWriterEdit, "test number1 testnot") - - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - searchterm = xDialog.getChild("searchterm") - searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"T(est|other)\\>"})) #find - replaceterm = xDialog.getChild("replaceterm") - replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"replaced$1"})) #replace - regexp = xDialog.getChild("regexp") - regexp.executeAction("CLICK", tuple()) #regular expressions - replaceall = xDialog.getChild("replaceall") - replaceall.executeAction("CLICK", tuple()) - #verify - self.assertEqual(document.Text.String[0:27], "replacedest number1 testnot") - regexp.executeAction("CLICK", tuple()) - - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + type_text(xWriterEdit, "test number1 testnot") + + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"T(est|other)\\>"})) #find + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"replaced$1"})) #replace + regexp = xDialog.getChild("regexp") + regexp.executeAction("CLICK", tuple()) #regular expressions + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + #verify + self.assertEqual(document.Text.String[0:27], "replacedest number1 testnot") + regexp.executeAction("CLICK", tuple()) + + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + self.ui_test.close_doc() #tdf116242 ţ ț def test_tdf116242_replace_t_with_cedilla(self): @@ -168,32 +170,34 @@ class findReplace(UITestCase): self.ui_test.close_dialog_through_button(xcloseBtn) def test_tdf136577(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") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - document = self.ui_test.get_component() + document = self.ui_test.get_component() - type_text(xWriterEdit, "x") + type_text(xWriterEdit, "x") - self.assertEqual(document.Text.String, "x") + self.assertEqual(document.Text.String, "x") - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() - searchterm = xDialog.getChild("searchterm") - searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"x"})) + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"x"})) - replaceall = xDialog.getChild("replaceall") - replaceall.executeAction("CLICK", tuple()) + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + + self.assertEqual(document.Text.String, "") - self.assertEqual(document.Text.String, "") + self.xUITest.executeCommand(".uno:Undo") - self.xUITest.executeCommand(".uno:Undo") + # Without the fix in place, this test would have failed with AssertionError: '' != 'x' + self.assertEqual(document.Text.String, "x") - # Without the fix in place, this test would have failed with AssertionError: '' != 'x' - self.assertEqual(document.Text.String, "x") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findReplace/tdf106099.py b/sw/qa/uitest/findReplace/tdf106099.py index 0778520a7a6e..d0c1ad76f251 100644 --- a/sw/qa/uitest/findReplace/tdf106099.py +++ b/sw/qa/uitest/findReplace/tdf106099.py @@ -13,29 +13,30 @@ from uitest.uihelper.common import get_state_as_dict class tdf106099(UITestCase): def test_tdf106099_find_format_underline(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - #Find and replace - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - #2. Choose Format - format = xDialog.getChild("format") - with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())) as dialog: - #Font effects - Underline Single. OK. - xTabs = dialog.getChild("tabcontrol") - select_pos(xTabs, "1") #tab font effects - underlinelb = dialog.getChild("underlinelb") - select_by_text(underlinelb, "Single") + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #Find and replace + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + #2. Choose Format + format = xDialog.getChild("format") + with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())) as dialog: + #Font effects - Underline Single. OK. + xTabs = dialog.getChild("tabcontrol") + select_pos(xTabs, "1") #tab font effects + underlinelb = dialog.getChild("underlinelb") + select_by_text(underlinelb, "Single") - #verify label searchdesc - searchdesc = xDialog.getChild("searchdesc") - print(get_state_as_dict(searchdesc)) - self.assertEqual(get_state_as_dict(searchdesc)["Text"], "Single underline") - noformat = xDialog.getChild("noformat") - noformat.executeAction("CLICK", tuple()) #click No format button - self.assertEqual(get_state_as_dict(searchdesc)["Text"], "") - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) + #verify label searchdesc + searchdesc = xDialog.getChild("searchdesc") + print(get_state_as_dict(searchdesc)) + self.assertEqual(get_state_as_dict(searchdesc)["Text"], "Single underline") + noformat = xDialog.getChild("noformat") + noformat.executeAction("CLICK", tuple()) #click No format button + self.assertEqual(get_state_as_dict(searchdesc)["Text"], "") + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/findReplace/tdf119462.py b/sw/qa/uitest/findReplace/tdf119462.py index 2bd183b53ab1..4402d1acaedd 100644 --- a/sw/qa/uitest/findReplace/tdf119462.py +++ b/sw/qa/uitest/findReplace/tdf119462.py @@ -13,28 +13,29 @@ from uitest.uihelper.common import get_state_as_dict class tdf119462(UITestCase): def test_tdf119462_find_format(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - #1. Choose Edit > Find and Replace - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - #2. Choose Format - format = xDialog.getChild("format") - with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())) as dialog: - #3. Choose Bold - xTabs = dialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xweststylelbcjk = dialog.getChild("weststylelb-cjk") - xweststylelbcjk.executeAction("TYPE", mkPropertyValues({"TEXT":"Bold"})) + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #1. Choose Edit > Find and Replace + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + #2. Choose Format + format = xDialog.getChild("format") + with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())) as dialog: + #3. Choose Bold + xTabs = dialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = dialog.getChild("weststylelb-cjk") + xweststylelbcjk.executeAction("TYPE", mkPropertyValues({"TEXT":"Bold"})) - #verify label searchdesc - searchdesc = xDialog.getChild("searchdesc") - self.assertEqual(get_state_as_dict(searchdesc)["Text"], "bold") - noformat = xDialog.getChild("noformat") - noformat.executeAction("CLICK", tuple()) #click No format button - self.assertEqual(get_state_as_dict(searchdesc)["Text"], "") - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) + #verify label searchdesc + searchdesc = xDialog.getChild("searchdesc") + self.assertEqual(get_state_as_dict(searchdesc)["Text"], "bold") + noformat = xDialog.getChild("noformat") + noformat.executeAction("CLICK", tuple()) #click No format button + self.assertEqual(get_state_as_dict(searchdesc)["Text"], "") + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/librelogo/run.py b/sw/qa/uitest/librelogo/run.py index 11bc4dd3c3d1..26b8f5c7df44 100644 --- a/sw/qa/uitest/librelogo/run.py +++ b/sw/qa/uitest/librelogo/run.py @@ -28,68 +28,70 @@ class LibreLogoTest(UITestCase): self.xUITest.executeCommand(self.LIBRELOGO_PATH %command) def test_librelogo(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") - # to check the state of LibreLogo program execution - xIsAlive = self.getScript("__is_alive__") + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + # to check the state of LibreLogo program execution + xIsAlive = self.getScript("__is_alive__") - # run a program with basic drawing commands FORWARD and RIGHT - # using their abbreviated names FD and RT - type_text(xWriterEdit, "fd 100 rt 45 fd 100") - self.logo("run") - # wait for LibreLogo program termination - while xIsAlive.invoke((), (), ())[0]: - pass - # check shape count for - # a) program running: - # - turtle shape: result of program start - # - line shape: result of turtle drawing - # b) continuous line drawing (the regression - # related to the fix of tdf#106792 resulted shorter line - # segments than the turtle path and non-continuous line - # drawing, ie. in this example, three line shapes - # instead of a single one. See its fix in - # commit 502e8785085f9e8b54ee383080442c2dcaf95b15) - self.assertEqual(document.DrawPage.getCount(), 2) + # run a program with basic drawing commands FORWARD and RIGHT + # using their abbreviated names FD and RT + type_text(xWriterEdit, "fd 100 rt 45 fd 100") + self.logo("run") + # wait for LibreLogo program termination + while xIsAlive.invoke((), (), ())[0]: + pass + # check shape count for + # a) program running: + # - turtle shape: result of program start + # - line shape: result of turtle drawing + # b) continuous line drawing (the regression + # related to the fix of tdf#106792 resulted shorter line + # segments than the turtle path and non-continuous line + # drawing, ie. in this example, three line shapes + # instead of a single one. See its fix in + # commit 502e8785085f9e8b54ee383080442c2dcaf95b15) + self.assertEqual(document.DrawPage.getCount(), 2) - # check formatting by "magic wand" - self.logo("__translate__") - # a) check expansion of abbreviated commands : fd -> FORWARD, rt -> RIGHT, - # b) check line breaking (fix for tdf#100941: new line instead of the text "\" and "n") - self.assertEqual(document.Text.String.replace('\r\n', '\n'), "\nFORWARD 100 RIGHT 45 FORWARD 100") - # c) check usage of real paragraphs instead of line break (tdf#120422) - # first paragraph is empty (for working page break) - self.assertEqual(document.Text.createEnumeration().nextElement().String, "") + # check formatting by "magic wand" + self.logo("__translate__") + # a) check expansion of abbreviated commands : fd -> FORWARD, rt -> RIGHT, + # b) check line breaking (fix for tdf#100941: new line instead of the text "\" and "n") + self.assertEqual(document.Text.String.replace('\r\n', '\n'), "\nFORWARD 100 RIGHT 45 FORWARD 100") + # c) check usage of real paragraphs instead of line break (tdf#120422) + # first paragraph is empty (for working page break) + self.assertEqual(document.Text.createEnumeration().nextElement().String, "") - # function definitions and calls can be in arbitrary order - document.Text.String = """ - ; dragon curve - TO x n - IF n = 0 [ STOP ] - x n-1 - RIGHT 90 - y n-1 ; it worked only as "y(n-1)" - FORWARD 10 - END + # function definitions and calls can be in arbitrary order + document.Text.String = """ +; dragon curve +TO x n +IF n = 0 [ STOP ] +x n-1 +RIGHT 90 +y n-1 ; it worked only as "y(n-1)" +FORWARD 10 +END - TO y n - IF n = 0 [ STOP ] - FORWARD 10 - x n-1 - LEFT 90 - y n-1 - END +TO y n +IF n = 0 [ STOP ] +FORWARD 10 +x n-1 +LEFT 90 +y n-1 +END - PICTURE ; start new line draw - x 3 ; draw only a few levels - """ - self.logo("run") - # wait for LibreLogo program termination - while xIsAlive.invoke((), (), ())[0]: - pass - # new shape + previous two ones = 3 - self.assertEqual(document.DrawPage.getCount(), 3) +PICTURE ; start new line draw +x 3 ; draw only a few levels +""" + self.logo("run") + # wait for LibreLogo program termination + while xIsAlive.invoke((), (), ())[0]: + pass + # new shape + previous two ones = 3 + self.assertEqual(document.DrawPage.getCount(), 3) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/macro_tests/tdf124413.py b/sw/qa/uitest/macro_tests/tdf124413.py index a30afa6dedee..d0aaccd03929 100644 --- a/sw/qa/uitest/macro_tests/tdf124413.py +++ b/sw/qa/uitest/macro_tests/tdf124413.py @@ -12,32 +12,34 @@ class tdf124413(UITestCase): def test_copy_paste_overwriting_undo_redo_in_macro_editor_tdf124413(self): - with self.ui_test.create_doc_in_start_center("writer"): - #Start LibreOffice. Go to Tools > Macros > Organize Macros > Basic - self.ui_test.execute_dialog_through_command(".uno:MacroDialog") - xDialog = self.xUITest.getTopFocusWindow() - #Open Editor - xEditBtn = xDialog.getChild("edit") - xEditBtn.executeAction("CLICK", tuple()) - - resultText = "REM ***** BASIC *****\n\nSub Main\n\nEnd Sub\n" - - xMacroWin = self.xUITest.getTopFocusWindow() - xEditWin = xMacroWin.getChild('EditorWindow') - - self.assertEqual(get_state_as_dict(xEditWin)['Text'], resultText) - - self.xUITest.executeCommand(".uno:SelectAll") - self.xUITest.executeCommand(".uno:Copy") - self.xUITest.executeCommand(".uno:SelectAll") - self.xUITest.executeCommand(".uno:Paste") - self.xUITest.executeCommand(".uno:Undo") - self.xUITest.executeCommand(".uno:Redo") - self.xUITest.executeCommand(".uno:Undo") - self.xUITest.executeCommand(".uno:Redo") - self.xUITest.executeCommand(".uno:Undo") - self.xUITest.executeCommand(".uno:Redo") - - self.assertEqual(get_state_as_dict(xEditWin)['Text'], resultText) + self.ui_test.create_doc_in_start_center("writer") + #Start LibreOffice. Go to Tools > Macros > Organize Macros > Basic + self.ui_test.execute_dialog_through_command(".uno:MacroDialog") + xDialog = self.xUITest.getTopFocusWindow() + #Open Editor + xEditBtn = xDialog.getChild("edit") + xEditBtn.executeAction("CLICK", tuple()) + + resultText = "REM ***** BASIC *****\n\nSub Main\n\nEnd Sub\n" + + xMacroWin = self.xUITest.getTopFocusWindow() + xEditWin = xMacroWin.getChild('EditorWindow') + + self.assertEqual(get_state_as_dict(xEditWin)['Text'], resultText) + + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Copy") + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Paste") + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Redo") + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Redo") + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Redo") + + self.assertEqual(get_state_as_dict(xEditWin)['Text'], resultText) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/macro_tests/tdf64690.py b/sw/qa/uitest/macro_tests/tdf64690.py index fcb09fa74546..7798e3bbc995 100644 --- a/sw/qa/uitest/macro_tests/tdf64690.py +++ b/sw/qa/uitest/macro_tests/tdf64690.py @@ -13,61 +13,63 @@ class tdf64690(UITestCase): def test_tdf64690(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - self.ui_test.execute_dialog_through_command(".uno:MacroDialog") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:MacroDialog") + xDialog = self.xUITest.getTopFocusWindow() - xEditBtn = xDialog.getChild("edit") - xEditBtn.executeAction("CLICK", tuple()) + xEditBtn = xDialog.getChild("edit") + xEditBtn.executeAction("CLICK", tuple()) - xMacroWin = self.xUITest.getTopFocusWindow() - xEditWin = xMacroWin.getChild('EditorWindow') + xMacroWin = self.xUITest.getTopFocusWindow() + xEditWin = xMacroWin.getChild('EditorWindow') - self.xUITest.executeCommand(".uno:SelectAll") - xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + self.xUITest.executeCommand(".uno:SelectAll") + xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - self.assertEqual("\n", get_state_as_dict(xEditWin)['Text']) + self.assertEqual("\n", get_state_as_dict(xEditWin)['Text']) - xEditWin.executeAction("TYPE", mkPropertyValues({"TEXT":"'abc"})) - xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) - xEditWin.executeAction("TYPE", mkPropertyValues({"TEXT":"'def"})) + xEditWin.executeAction("TYPE", mkPropertyValues({"TEXT":"'abc"})) + xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + xEditWin.executeAction("TYPE", mkPropertyValues({"TEXT":"'def"})) - self.assertEqual("'abc\n'def\n", get_state_as_dict(xEditWin)['Text']) + self.assertEqual("'abc\n'def\n", get_state_as_dict(xEditWin)['Text']) - self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:SelectAll") - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() - searchterm = xDialog.getChild("searchterm") - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"."})) + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"."})) - replaceterm = xDialog.getChild("replaceterm") - replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"ABC"})) + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"ABC"})) - regexp = xDialog.getChild("regexp") - if get_state_as_dict(regexp)['Selected'] == 'false': - regexp.executeAction("CLICK", tuple()) - self.assertEqual("true", get_state_as_dict(regexp)['Selected']) + regexp = xDialog.getChild("regexp") + if get_state_as_dict(regexp)['Selected'] == 'false': + regexp.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(regexp)['Selected']) - selection = xDialog.getChild("selection") - if get_state_as_dict(selection)['Selected'] == 'false': - selection.executeAction("CLICK", tuple()) - self.assertEqual("true", get_state_as_dict(selection)['Selected']) + selection = xDialog.getChild("selection") + if get_state_as_dict(selection)['Selected'] == 'false': + selection.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(selection)['Selected']) - replaceall = xDialog.getChild("replaceall") + replaceall = xDialog.getChild("replaceall") - # Without the fix in place, this test would have hung here - with self.ui_test.execute_blocking_action(replaceall.executeAction, args=('CLICK', ())): - pass + # Without the fix in place, this test would have hung here + with self.ui_test.execute_blocking_action(replaceall.executeAction, args=('CLICK', ())): + pass - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) - self.assertEqual("ABCABCABCABC\nABCABCABCABC\n", get_state_as_dict(xEditWin)['Text']) + self.assertEqual("ABCABCABCABC\nABCABCABCABC\n", get_state_as_dict(xEditWin)['Text']) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf137274.py b/sw/qa/uitest/navigator/tdf137274.py index 4d36b38458e0..36f25f4c2d7a 100644 --- a/sw/qa/uitest/navigator/tdf137274.py +++ b/sw/qa/uitest/navigator/tdf137274.py @@ -12,52 +12,54 @@ class tdf137274(UITestCase): def test_tdf137274(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() - xWriterEdit = xMainWindow.getChild("writer_edit") + xMainWindow = self.xUITest.getTopFocusWindow() + xWriterEdit = xMainWindow.getChild("writer_edit") - xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Test"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Test"})) - # Insert first comment - xArgs = mkPropertyValues({"Text": "C1"}) - self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + # Insert first comment + xArgs = mkPropertyValues({"Text": "C1"}) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) - # wait until the comment is available - self.ui_test.wait_until_child_is_available('Comment1') + # wait until the comment is available + self.ui_test.wait_until_child_is_available('Comment1') - self.xUITest.executeCommand(".uno:Sidebar") + self.xUITest.executeCommand(".uno:Sidebar") - xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) - # wait until the navigator panel is available - xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') - xContentTree = xNavigatorPanel.getChild("contenttree") - xComments = xContentTree.getChild('10') - self.assertEqual('Comments', get_state_as_dict(xComments)['Text']) + xContentTree = xNavigatorPanel.getChild("contenttree") + xComments = xContentTree.getChild('10') + self.assertEqual('Comments', get_state_as_dict(xComments)['Text']) - xComments.executeAction("EXPAND", tuple()) + xComments.executeAction("EXPAND", tuple()) - self.assertEqual(1, len(xComments.getChildren())) - self.assertEqual('C1', get_state_as_dict(xComments.getChild('0'))['Text']) + self.assertEqual(1, len(xComments.getChildren())) + self.assertEqual('C1', get_state_as_dict(xComments.getChild('0'))['Text']) - xComments.executeAction("COLLAPSE", tuple()) + xComments.executeAction("COLLAPSE", tuple()) - xArgs = mkPropertyValues({"Text": "C2"}) - self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + xArgs = mkPropertyValues({"Text": "C2"}) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) - # wait until the second comment is available - self.ui_test.wait_until_child_is_available('Comment2') + # wait until the second comment is available + self.ui_test.wait_until_child_is_available('Comment2') - xComments.executeAction("EXPAND", tuple()) + xComments.executeAction("EXPAND", tuple()) - # Without the fix in place, this test would have failed with AssertionError: 2 != 0 - self.assertEqual(2, len(xComments.getChildren())) - self.assertEqual('C1', get_state_as_dict(xComments.getChild('0'))['Text']) + # Without the fix in place, this test would have failed with AssertionError: 2 != 0 + self.assertEqual(2, len(xComments.getChildren())) + self.assertEqual('C1', get_state_as_dict(xComments.getChild('0'))['Text']) - xComments.executeAction("COLLAPSE", tuple()) + xComments.executeAction("COLLAPSE", tuple()) - self.xUITest.executeCommand(".uno:Sidebar") + self.xUITest.executeCommand(".uno:Sidebar") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf140257.py b/sw/qa/uitest/navigator/tdf140257.py index 796a9e92a35d..9c923bedee4d 100644 --- a/sw/qa/uitest/navigator/tdf140257.py +++ b/sw/qa/uitest/navigator/tdf140257.py @@ -27,87 +27,89 @@ class Tdf140257(UITestCase): self.ui_test.close_dialog_through_button(xOKBtn) def test_tdf140257(self): - with self.ui_test.create_doc_in_start_center("writer"): - xMainWindow = self.xUITest.getTopFocusWindow() - xWriterEdit = xMainWindow.getChild("writer_edit") + self.ui_test.create_doc_in_start_center("writer") + xMainWindow = self.xUITest.getTopFocusWindow() + xWriterEdit = xMainWindow.getChild("writer_edit") - self.change_outline_level("Level 1") + self.change_outline_level("Level 1") - for i in range(4): - type_text(xWriterEdit, 'P' + str(i + 1)) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + for i in range(4): + type_text(xWriterEdit, 'P' + str(i + 1)) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - type_text(xWriterEdit, 'P5') + type_text(xWriterEdit, 'P5') - self.xUITest.executeCommand(".uno:Sidebar") + self.xUITest.executeCommand(".uno:Sidebar") - xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) - # wait until the navigator panel is available - xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') - xContentTree = xNavigatorPanel.getChild("contenttree") - xHeadings = xContentTree.getChild('0') - self.assertEqual('Headings', get_state_as_dict(xHeadings)['Text']) + xContentTree = xNavigatorPanel.getChild("contenttree") + xHeadings = xContentTree.getChild('0') + self.assertEqual('Headings', get_state_as_dict(xHeadings)['Text']) - xHeadings.executeAction("EXPAND", tuple()) + xHeadings.executeAction("EXPAND", tuple()) - self.assertEqual(5, len(xHeadings.getChildren())) + self.assertEqual(5, len(xHeadings.getChildren())) - for i in range(5): - self.assertEqual('P' + str(i + 1), get_state_as_dict(xHeadings.getChild(str(i)))['Text']) + for i in range(5): + self.assertEqual('P' + str(i + 1), get_state_as_dict(xHeadings.getChild(str(i)))['Text']) - self.xUITest.executeCommand(".uno:Sidebar") + self.xUITest.executeCommand(".uno:Sidebar") - document = self.ui_test.get_component() - cursor = document.getCurrentController().getViewCursor() + document = self.ui_test.get_component() + cursor = document.getCurrentController().getViewCursor() - # Use Adding Selection - selectionProperty = mkPropertyValues({"SelectionMode": 2}) - self.xUITest.executeCommandWithParameters(".uno:SelectionMode", selectionProperty) + # Use Adding Selection + selectionProperty = mkPropertyValues({"SelectionMode": 2}) + self.xUITest.executeCommandWithParameters(".uno:SelectionMode", selectionProperty) - # Go to P2 and select it - cursor.goUp(3, False) - cursor.gotoStartOfLine(False) - cursor.gotoEndOfLine(True) + # Go to P2 and select it + cursor.goUp(3, False) + cursor.gotoStartOfLine(False) + cursor.gotoEndOfLine(True) - # Go to P4 and select it - cursor.goDown(2, False) - cursor.gotoStartOfLine(False) - cursor.gotoEndOfLine(True) + # Go to P4 and select it + cursor.goDown(2, False) + cursor.gotoStartOfLine(False) + cursor.gotoEndOfLine(True) - self.change_outline_level("Level 2") + self.change_outline_level("Level 2") - self.xUITest.executeCommand(".uno:Sidebar") + self.xUITest.executeCommand(".uno:Sidebar") - xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) - # wait until the navigator panel is available - xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') - xContentTree = xNavigatorPanel.getChild("contenttree") - xHeadings = xContentTree.getChild('0') - self.assertEqual('Headings', get_state_as_dict(xHeadings)['Text']) + xContentTree = xNavigatorPanel.getChild("contenttree") + xHeadings = xContentTree.getChild('0') + self.assertEqual('Headings', get_state_as_dict(xHeadings)['Text']) - xHeadings.executeAction("EXPAND", tuple()) + xHeadings.executeAction("EXPAND", tuple()) - # Without the fix in place, this test would have failed with - # AssertionError: 3 != 4 - self.assertEqual(3, len(xHeadings.getChildren())) - xChild1 = xHeadings.getChild('0') - self.assertEqual('P1', get_state_as_dict(xChild1)['Text']) - xChild1.executeAction("EXPAND", tuple()) - self.assertEqual(1, len(xChild1.getChildren())) - self.assertEqual('P2', get_state_as_dict(xChild1.getChild('0'))['Text']) + # Without the fix in place, this test would have failed with + # AssertionError: 3 != 4 + self.assertEqual(3, len(xHeadings.getChildren())) + xChild1 = xHeadings.getChild('0') + self.assertEqual('P1', get_state_as_dict(xChild1)['Text']) + xChild1.executeAction("EXPAND", tuple()) + self.assertEqual(1, len(xChild1.getChildren())) + self.assertEqual('P2', get_state_as_dict(xChild1.getChild('0'))['Text']) - xChild2 = xHeadings.getChild('1') - self.assertEqual('P3', get_state_as_dict(xChild2)['Text']) - xChild2.executeAction("EXPAND", tuple()) - self.assertEqual(1, len(xChild2.getChildren())) - self.assertEqual('P4', get_state_as_dict(xChild2.getChild('0'))['Text']) + xChild2 = xHeadings.getChild('1') + self.assertEqual('P3', get_state_as_dict(xChild2)['Text']) + xChild2.executeAction("EXPAND", tuple()) + self.assertEqual(1, len(xChild2.getChildren())) + self.assertEqual('P4', get_state_as_dict(xChild2.getChild('0'))['Text']) - self.assertEqual('P5', get_state_as_dict(xHeadings.getChild('2'))['Text']) + self.assertEqual('P5', get_state_as_dict(xHeadings.getChild('2'))['Text']) - self.xUITest.executeCommand(".uno:Sidebar") + self.xUITest.executeCommand(".uno:Sidebar") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/options/optionsDialog.py b/sw/qa/uitest/options/optionsDialog.py index 57a3ad4d82bb..92494ab81ab1 100644 --- a/sw/qa/uitest/options/optionsDialog.py +++ b/sw/qa/uitest/options/optionsDialog.py @@ -9,46 +9,50 @@ from uitest.framework import UITestCase class optionsDialog(UITestCase): def test_moreIconsDialog(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") - xDialog = self.xUITest.getTopFocusWindow() - xPages = xDialog.getChild("pages") - xLOEntry = xPages.getChild('0') - xLOEntry.executeAction("EXPAND", tuple()) - xViewEntry = xLOEntry.getChild('2') - xViewEntry.executeAction("SELECT", tuple()) + xDialog = self.xUITest.getTopFocusWindow() + xPages = xDialog.getChild("pages") + xLOEntry = xPages.getChild('0') + xLOEntry.executeAction("EXPAND", tuple()) + xViewEntry = xLOEntry.getChild('2') + xViewEntry.executeAction("SELECT", tuple()) - xMoreIconsBtn = xDialog.getChild("btnMoreIcons") + xMoreIconsBtn = xDialog.getChild("btnMoreIcons") - with self.ui_test.execute_blocking_action(xMoreIconsBtn.executeAction, args=('CLICK', ()), close_button="buttonClose") as dialog: - # Check it doesn't crash while opening it - xCloseBtn = dialog.getChild("buttonClose") - self.ui_test.wait_until_property_is_updated(xCloseBtn, "Enabled", "true") + with self.ui_test.execute_blocking_action(xMoreIconsBtn.executeAction, args=('CLICK', ()), close_button="buttonClose") as dialog: + # Check it doesn't crash while opening it + xCloseBtn = dialog.getChild("buttonClose") + self.ui_test.wait_until_property_is_updated(xCloseBtn, "Enabled", "true") - 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.ui_test.close_doc() def test_tdf138596(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") + + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") + xDialog = self.xUITest.getTopFocusWindow() + xPages = xDialog.getChild("pages") + xWriterEntry = xPages.getChild('3') + xWriterEntry.executeAction("EXPAND", tuple()) + xFormattingAidsEntry = xWriterEntry.getChild('2') + xFormattingAidsEntry.executeAction("SELECT", tuple()) - self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") - xDialog = self.xUITest.getTopFocusWindow() - xPages = xDialog.getChild("pages") - xWriterEntry = xPages.getChild('3') - xWriterEntry.executeAction("EXPAND", tuple()) - xFormattingAidsEntry = xWriterEntry.getChild('2') - xFormattingAidsEntry.executeAction("SELECT", tuple()) + xApplyBtn = xDialog.getChild("apply") - xApplyBtn = xDialog.getChild("apply") + # Click apply button twice + # Without the fix in place, this test would have crashed here + xApplyBtn.executeAction("CLICK", tuple()) + xApplyBtn.executeAction("CLICK", tuple()) - # Click apply button twice - # Without the fix in place, this test would have crashed here - xApplyBtn.executeAction("CLICK", tuple()) - xApplyBtn.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.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/options/tdf131581.py b/sw/qa/uitest/options/tdf131581.py index 840f0305ba12..3acebd4ce507 100644 --- a/sw/qa/uitest/options/tdf131581.py +++ b/sw/qa/uitest/options/tdf131581.py @@ -10,27 +10,29 @@ from uitest.framework import UITestCase class tdf131581(UITestCase): def test_tdf131581(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - self.xUITest.getTopFocusWindow() + self.xUITest.getTopFocusWindow() - self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") - xDialogOpt = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") + xDialogOpt = self.xUITest.getTopFocusWindow() - xPages = xDialogOpt.getChild("pages") - xLOEntry = xPages.getChild('0') - xLOEntry.executeAction("EXPAND", tuple()) - xAdvancedEntry = xLOEntry.getChild('10') - xAdvancedEntry.executeAction("SELECT", tuple()) + xPages = xDialogOpt.getChild("pages") + xLOEntry = xPages.getChild('0') + xLOEntry.executeAction("EXPAND", tuple()) + xAdvancedEntry = xLOEntry.getChild('10') + xAdvancedEntry.executeAction("SELECT", tuple()) - xExpertBtn = xDialogOpt.getChild("expertconfig") + xExpertBtn = xDialogOpt.getChild("expertconfig") - with self.ui_test.execute_blocking_action(xExpertBtn.executeAction, args=('CLICK', ())) as dialog: - # Without the fix in place, this would have hung - xSearchBtn = dialog.getChild("searchButton") - xSearchBtn.executeAction("CLICK", tuple()) + with self.ui_test.execute_blocking_action(xExpertBtn.executeAction, args=('CLICK', ())) as dialog: + # Without the fix in place, this would have hung + xSearchBtn = dialog.getChild("searchButton") + xSearchBtn.executeAction("CLICK", tuple()) - xOKBtn = xDialogOpt.getChild("ok") - xOKBtn.executeAction("CLICK", tuple()) + xOKBtn = xDialogOpt.getChild("ok") + xOKBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/options/tdf78133.py b/sw/qa/uitest/options/tdf78133.py index df9affcf79e8..883c38231aa9 100644 --- a/sw/qa/uitest/options/tdf78133.py +++ b/sw/qa/uitest/options/tdf78133.py @@ -14,37 +14,38 @@ class tdf78133(UITestCase): def test_tdf78133_options_app_colors(self): - with self.ui_test.create_doc_in_start_center("writer"): - xWriterDoc = self.xUITest.getTopFocusWindow() - document = self.ui_test.get_component() - #New text document - #open option, go to App colors - self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + #New text document + #open option, go to App colors + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() - xPages = xDialog.getChild("pages") - xLOEntry = xPages.getChild('0') # Lo Dev - xLOEntry.executeAction("EXPAND", tuple()) - xLoAppColorsEntry = xLOEntry.getChild('8') - xLoAppColorsEntry.executeAction("SELECT", tuple()) #Applications Colors - #change text boundaries checkbox, save - docboundaries = xDialog.getChild("docboundaries") - docboundaries.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #verify - reopen dialog and check if "text boundaries" is still unchecked - self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog - xDialog = self.xUITest.getTopFocusWindow() + xPages = xDialog.getChild("pages") + xLOEntry = xPages.getChild('0') # Lo Dev + xLOEntry.executeAction("EXPAND", tuple()) + xLoAppColorsEntry = xLOEntry.getChild('8') + xLoAppColorsEntry.executeAction("SELECT", tuple()) #Applications Colors + #change text boundaries checkbox, save + docboundaries = xDialog.getChild("docboundaries") + docboundaries.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify - reopen dialog and check if "text boundaries" is still unchecked + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() - xPages = xDialog.getChild("pages") - xLOEntry = xPages.getChild('0') # Lo Dev - xLOEntry.executeAction("EXPAND", tuple()) - xLoAppColorsEntry = xLOEntry.getChild('8') - xLoAppColorsEntry.executeAction("SELECT", tuple()) #Applications Colors - #change text boundaries checkbox, save - docboundaries = xDialog.getChild("docboundaries") - self.assertEqual(get_state_as_dict(docboundaries)["Selected"], "false") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xPages = xDialog.getChild("pages") + xLOEntry = xPages.getChild('0') # Lo Dev + xLOEntry.executeAction("EXPAND", tuple()) + xLoAppColorsEntry = xLOEntry.getChild('8') + xLoAppColorsEntry.executeAction("SELECT", tuple()) #Applications Colors + #change text boundaries checkbox, save + docboundaries = xDialog.getChild("docboundaries") + self.assertEqual(get_state_as_dict(docboundaries)["Selected"], "false") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/sidebar/stylesSidebar.py b/sw/qa/uitest/sidebar/stylesSidebar.py index 3094be3d5379..8364334ad77e 100644 --- a/sw/qa/uitest/sidebar/stylesSidebar.py +++ b/sw/qa/uitest/sidebar/stylesSidebar.py @@ -12,66 +12,68 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class StylesSidebar(UITestCase): def test_load_styles_from_template(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - self.ui_test.execute_dialog_through_command(".uno:LoadStyles") + self.ui_test.execute_dialog_through_command(".uno:LoadStyles") - xDialog = self.xUITest.getTopFocusWindow() + xDialog = self.xUITest.getTopFocusWindow() - xText = xDialog.getChild("text") - xNumbering = xDialog.getChild("numbering") - xFrame = xDialog.getChild("frame") - xPages = xDialog.getChild("pages") + xText = xDialog.getChild("text") + xNumbering = xDialog.getChild("numbering") + xFrame = xDialog.getChild("frame") + xPages = xDialog.getChild("pages") - self.assertEqual('true', get_state_as_dict(xText)['Selected']) - self.assertEqual('false', get_state_as_dict(xNumbering)['Selected']) - self.assertEqual('false', get_state_as_dict(xFrame)['Selected']) - self.assertEqual('false', get_state_as_dict(xPages)['Selected']) + self.assertEqual('true', get_state_as_dict(xText)['Selected']) + self.assertEqual('false', get_state_as_dict(xNumbering)['Selected']) + self.assertEqual('false', get_state_as_dict(xFrame)['Selected']) + self.assertEqual('false', get_state_as_dict(xPages)['Selected']) - xNumbering.executeAction("CLICK", tuple()) - xFrame.executeAction("CLICK", tuple()) - xPages.executeAction("CLICK", tuple()) + xNumbering.executeAction("CLICK", tuple()) + xFrame.executeAction("CLICK", tuple()) + xPages.executeAction("CLICK", tuple()) - self.assertEqual('true', get_state_as_dict(xText)['Selected']) - self.assertEqual('true', get_state_as_dict(xNumbering)['Selected']) - self.assertEqual('true', get_state_as_dict(xFrame)['Selected']) - self.assertEqual('true', get_state_as_dict(xPages)['Selected']) + self.assertEqual('true', get_state_as_dict(xText)['Selected']) + self.assertEqual('true', get_state_as_dict(xNumbering)['Selected']) + self.assertEqual('true', get_state_as_dict(xFrame)['Selected']) + self.assertEqual('true', get_state_as_dict(xPages)['Selected']) - xFileName = xDialog.getChild("fromfile") - xFileName.executeAction("CLICK", tuple()) + xFileName = xDialog.getChild("fromfile") + xFileName.executeAction("CLICK", tuple()) - xOpenDialog = self.xUITest.getTopFocusWindow() - xFileName = xOpenDialog.getChild("file_name") - xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("customStyles.odt")})) + xOpenDialog = self.xUITest.getTopFocusWindow() + xFileName = xOpenDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("customStyles.odt")})) - xOpenBtn = xOpenDialog.getChild("open") - xOpenBtn.executeAction("CLICK", tuple()) + xOpenBtn = xOpenDialog.getChild("open") + xOpenBtn.executeAction("CLICK", tuple()) - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - self.xUITest.executeCommand(".uno:Sidebar") - xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "StyleListPanel"})) + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "StyleListPanel"})) - xFilter = xWriterEdit.getChild('filter') - select_by_text(xFilter, "Custom Styles") + xFilter = xWriterEdit.getChild('filter') + select_by_text(xFilter, "Custom Styles") - expectedResults = ["customParagraphStyle", "customCharacterStyle", "customFrameStyle", - "customPageStyle", "customNumberingStyle"] + expectedResults = ["customParagraphStyle", "customCharacterStyle", "customFrameStyle", + "customPageStyle", "customNumberingStyle"] - for i in range(5): - xLeft = xWriterEdit.getChild('left') + for i in range(5): + xLeft = xWriterEdit.getChild('left') - #change to another style type - xLeft.executeAction("CLICK", mkPropertyValues({"POS": str( i )})) + #change to another style type + xLeft.executeAction("CLICK", mkPropertyValues({"POS": str( i )})) - xFlatView = xWriterEdit.getChild("flatview") + xFlatView = xWriterEdit.getChild("flatview") - self.assertEqual(1, len(xFlatView.getChildren())) + self.assertEqual(1, len(xFlatView.getChildren())) - xFlatView.getChild('0').executeAction("SELECT", tuple()) - self.assertEqual(expectedResults[i], get_state_as_dict(xFlatView)['SelectEntryText']) + xFlatView.getChild('0').executeAction("SELECT", tuple()) + self.assertEqual(expectedResults[i], get_state_as_dict(xFlatView)['SelectEntryText']) - self.xUITest.executeCommand(".uno:Sidebar") + self.xUITest.executeCommand(".uno:Sidebar") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/sidebar/tdf133189.py b/sw/qa/uitest/sidebar/tdf133189.py index 26859e64e61b..30bd35d4c451 100644 --- a/sw/qa/uitest/sidebar/tdf133189.py +++ b/sw/qa/uitest/sidebar/tdf133189.py @@ -11,67 +11,69 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf133189(UITestCase): def test_tdf133189(self): - with self.ui_test.create_doc_in_start_center("writer"): - - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - - self.xUITest.executeCommand(".uno:Sidebar") - xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PageStylesPanel"})) - - xPaperSize = xWriterEdit.getChild('papersize') - xPaperWidth = xWriterEdit.getChild('paperwidth') - xPaperHeight = xWriterEdit.getChild('paperheight') - xPaperOrient = xWriterEdit.getChild('paperorientation') - xPaperMargin = xWriterEdit.getChild('marginLB') - - #change measurement to Inches - change_measurement_unit(self, 'Inch') - - self.ui_test.execute_dialog_through_command(".uno:PageDialog") - xDialog = self.xUITest.getTopFocusWindow() - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") - - xWidth = xDialog.getChild('spinWidth') - xHeight = xDialog.getChild('spinHeight') - - props = {"VALUE": '8.0'} - actionProps = mkPropertyValues(props) - - xWidth.executeAction("VALUE", actionProps) - xHeight.executeAction("VALUE", actionProps) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (0.75″)") - self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (0.75″)") - self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User") - self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User") - self.ui_test.wait_until_property_is_updated(xPaperOrient, "SelectEntryText", "Portrait") - self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait") - self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "8.00″") - self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "8.00″") - self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "8.00″") - self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "8.00″") - - #change measurement again to Centimeters - change_measurement_unit(self, 'Centimeter') - - self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (1.90 cm)") - # tdf#129267 - self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (1.90 cm)") - self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User") - self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User") - self.ui_test.wait_until_property_is_updated(xPaperOrient, "SelectEntryText", "Portrait") - self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait") - self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "20.32 cm") - self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "20.32 cm") - self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "20.32 cm") - self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "20.32 cm") - - self.xUITest.executeCommand(".uno:Sidebar") + writer_doc = self.ui_test.create_doc_in_start_center("writer") + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PageStylesPanel"})) + + xPaperSize = xWriterEdit.getChild('papersize') + xPaperWidth = xWriterEdit.getChild('paperwidth') + xPaperHeight = xWriterEdit.getChild('paperheight') + xPaperOrient = xWriterEdit.getChild('paperorientation') + xPaperMargin = xWriterEdit.getChild('marginLB') + + #change measurement to Inches + change_measurement_unit(self, 'Inch') + + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + xWidth = xDialog.getChild('spinWidth') + xHeight = xDialog.getChild('spinHeight') + + props = {"VALUE": '8.0'} + actionProps = mkPropertyValues(props) + + xWidth.executeAction("VALUE", actionProps) + xHeight.executeAction("VALUE", actionProps) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (0.75″)") + self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (0.75″)") + self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User") + self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User") + self.ui_test.wait_until_property_is_updated(xPaperOrient, "SelectEntryText", "Portrait") + self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait") + self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "8.00″") + self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "8.00″") + self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "8.00″") + self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "8.00″") + + #change measurement again to Centimeters + change_measurement_unit(self, 'Centimeter') + + self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (1.90 cm)") + # tdf#129267 + self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (1.90 cm)") + self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User") + self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User") + self.ui_test.wait_until_property_is_updated(xPaperOrient, "SelectEntryText", "Portrait") + self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait") + self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "20.32 cm") + self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "20.32 cm") + self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "20.32 cm") + self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "20.32 cm") + + self.xUITest.executeCommand(".uno:Sidebar") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/sidebar/tdf135590.py b/sw/qa/uitest/sidebar/tdf135590.py index d0a255a47acd..6a061b7a1f96 100644 --- a/sw/qa/uitest/sidebar/tdf135590.py +++ b/sw/qa/uitest/sidebar/tdf135590.py @@ -12,68 +12,70 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf135590(UITestCase): def test_tdf135590(self): - with self.ui_test.create_doc_in_start_center("writer"): + writer_doc = self.ui_test.create_doc_in_start_center("writer") - #change measurement to Centimeter - change_measurement_unit(self, 'Centimeter') + #change measurement to Centimeter + change_measurement_unit(self, 'Centimeter') - self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope") + self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope") - xDialog = self.xUITest.getTopFocusWindow() + xDialog = self.xUITest.getTopFocusWindow() - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") - xWidth = xDialog.getChild('width') - xHeight = xDialog.getChild('height') - xFormat = xDialog.getChild("format") + xWidth = xDialog.getChild('width') + xHeight = xDialog.getChild('height') + xFormat = xDialog.getChild("format") - select_by_text(xFormat, "C6 Envelope") + select_by_text(xFormat, "C6 Envelope") - self.assertEqual("16.2", get_state_as_dict(xWidth)['Value']) - self.assertEqual("11.4", get_state_as_dict(xHeight)['Value']) + self.assertEqual("16.2", get_state_as_dict(xWidth)['Value']) + self.assertEqual("11.4", get_state_as_dict(xHeight)['Value']) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - # A new document is created - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + # A new document is created + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - self.ui_test.execute_dialog_through_command(".uno:PageDialog") - xDialog = self.xUITest.getTopFocusWindow() - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") - xWidth = xDialog.getChild('spinWidth') - xHeight = xDialog.getChild('spinHeight') - xFormatList = xDialog.getChild("comboPageFormat") + xWidth = xDialog.getChild('spinWidth') + xHeight = xDialog.getChild('spinHeight') + xFormatList = xDialog.getChild("comboPageFormat") - # Without the fix in place, this test would have failed with - # AssertionError: '16.2' != '11.4' - self.assertEqual("16.2", get_state_as_dict(xWidth)['Value']) - self.assertEqual("11.4", get_state_as_dict(xHeight)['Value']) - self.assertEqual("User", get_state_as_dict(xFormatList)['SelectEntryText']) + # Without the fix in place, this test would have failed with + # AssertionError: '16.2' != '11.4' + self.assertEqual("16.2", get_state_as_dict(xWidth)['Value']) + self.assertEqual("11.4", get_state_as_dict(xHeight)['Value']) + self.assertEqual("User", get_state_as_dict(xFormatList)['SelectEntryText']) - 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:Sidebar") - xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PageStylesPanel"})) + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PageStylesPanel"})) - xPaperSize = xWriterEdit.getChild('papersize') - self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User") - self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User") + xPaperSize = xWriterEdit.getChild('papersize') + self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User") + self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User") - xPaperHeight = xWriterEdit.getChild('paperheight') - self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "11.40 cm") - self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "11.40 cm") + xPaperHeight = xWriterEdit.getChild('paperheight') + self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "11.40 cm") + self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "11.40 cm") - xPaperWidth = xWriterEdit.getChild('paperwidth') - self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "16.20 cm") - self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "16.20 cm") + xPaperWidth = xWriterEdit.getChild('paperwidth') + self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "16.20 cm") + self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "16.20 cm") - self.xUITest.executeCommand(".uno:Sidebar") + self.xUITest.executeCommand(".uno:Sidebar") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/styleInspector/tdf137105.py b/sw/qa/uitest/styleInspector/tdf137105.py index 7b080b3a6485..b0a6b709d1e8 100644 --- a/sw/qa/uitest/styleInspector/tdf137105.py +++ b/sw/qa/uitest/styleInspector/tdf137105.py @@ -9,28 +9,30 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file class tdf137105(UITestCase): def test_tdf137105(self): - with self.ui_test.create_doc_in_start_center("writer"): - xWriterDoc = self.xUITest.getTopFocusWindow() - document = self.ui_test.get_component() - text = document.getText() - cursor = text.createTextCursor() - textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject') - provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider') - graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice.jpg")})) - textGraphic.Graphic = graphic - text.insertTextContent(cursor, textGraphic, False) - #select image - document.getCurrentController().select(document.getDrawPage()[0]) - - xWriterEdit = xWriterDoc.getChild("writer_edit") - - self.xUITest.executeCommand(".uno:Sidebar") - # Without the fix in place, this test would have crashed here - xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"})) - - # if the image is selected, there is nothing in the panel - self.assertEqual('0', get_state_as_dict(xWriterEdit.getChild('listbox_fonts'))['Children']) - - self.xUITest.executeCommand(".uno:Sidebar") + writer_doc = self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + text = document.getText() + cursor = text.createTextCursor() + textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject') + provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider') + graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice.jpg")})) + textGraphic.Graphic = graphic + text.insertTextContent(cursor, textGraphic, False) + #select image + document.getCurrentController().select(document.getDrawPage()[0]) + + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + # Without the fix in place, this test would have crashed here + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"})) + + # if the image is selected, there is nothing in the panel + self.assertEqual('0', get_state_as_dict(xWriterEdit.getChild('listbox_fonts'))['Children']) + + self.xUITest.executeCommand(".uno:Sidebar") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/styleInspector/tdf137513.py b/sw/qa/uitest/styleInspector/tdf137513.py index fedc3d48c569..6c216b40f33a 100644 --- a/sw/qa/uitest/styleInspector/tdf137513.py +++ b/sw/qa/uitest/styleInspector/tdf137513.py @@ -9,48 +9,50 @@ from uitest.uihelper.common import get_state_as_dict, type_text class tdf137513(UITestCase): def test_tdf137513(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - self.xUITest.executeCommand(".uno:InsertTable?Columns:short=2&Rows:short=2") + self.xUITest.executeCommand(".uno:InsertTable?Columns:short=2&Rows:short=2") - 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:SelectAll") + self.xUITest.executeCommand(".uno:SelectAll") - self.xUITest.executeCommand(".uno:Bold") + self.xUITest.executeCommand(".uno:Bold") - self.xUITest.executeCommand(".uno:Sidebar") - xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"})) + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"})) - xListBox = xWriterEdit.getChild('listbox_fonts') + xListBox = xWriterEdit.getChild('listbox_fonts') - # The cursor is on text inside the table with direct formatting - self.assertEqual(2, len(xListBox.getChild('0').getChildren())) - self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) - self.assertEqual("Table Contents\t", get_state_as_dict(xListBox.getChild('0').getChild('1'))['Text']) - self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren())) + # The cursor is on text inside the table with direct formatting + self.assertEqual(2, len(xListBox.getChild('0').getChildren())) + self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text']) + self.assertEqual("Table Contents\t", get_state_as_dict(xListBox.getChild('0').getChild('1'))['Text']) + self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren())) - xTableContent = xListBox.getChild('0').getChild('1') - self.assertEqual(5, len(xTableContent.getChildren())) - self.assertEqual("Follow Style\tTable Contents", get_state_as_dict(xTableContent.getChild('0'))['Text']) - self.assertEqual("Para Line Number Count\tFalse", get_state_as_dict(xTableContent.getChild('1'))['Text']) - self.assertEqual("Para Line Number Start Value\t0", get_state_as_dict(xTableContent.getChild('2'))['Text']) - self.assertEqual("Para Orphans\t0", get_state_as_dict(xTableContent.getChild('3'))['Text']) - self.assertEqual("Para Widows\t0", get_state_as_dict(xTableContent.getChild('4'))['Text']) + xTableContent = xListBox.getChild('0').getChild('1') + self.assertEqual(5, len(xTableContent.getChildren())) + self.assertEqual("Follow Style\tTable Contents", get_state_as_dict(xTableContent.getChild('0'))['Text']) + self.assertEqual("Para Line Number Count\tFalse", get_state_as_dict(xTableContent.getChild('1'))['Text']) + self.assertEqual("Para Line Number Start Value\t0", get_state_as_dict(xTableContent.getChild('2'))['Text']) + self.assertEqual("Para Orphans\t0", get_state_as_dict(xTableContent.getChild('3'))['Text']) + self.assertEqual("Para Widows\t0", get_state_as_dict(xTableContent.getChild('4'))['Text']) - xParDirFormatting = xListBox.getChild('1') + xParDirFormatting = xListBox.getChild('1') - # Without the fix in place, this test would have failed here with - # AssertionError: 3 != 0 - self.assertEqual(3, len(xParDirFormatting.getChildren())) - self.assertEqual("Char Weight\tBold", get_state_as_dict(xParDirFormatting.getChild('0'))['Text']) - self.assertEqual("Char Weight Asian\tBold", get_state_as_dict(xParDirFormatting.getChild('1'))['Text']) - self.assertEqual("Char Weight Complex\tBold", get_state_as_dict(xParDirFormatting.getChild('2'))['Text']) - self.assertEqual(0, len(xListBox.getChild('2').getChildren())) - self.assertEqual(0, len(xListBox.getChild('3').getChildren())) + # Without the fix in place, this test would have failed here with + # AssertionError: 3 != 0 + self.assertEqual(3, len(xParDirFormatting.getChildren())) + self.assertEqual("Char Weight\tBold", get_state_as_dict(xParDirFormatting.getChild('0'))['Text']) + self.assertEqual("Char Weight Asian\tBold", get_state_as_dict(xParDirFormatting.getChild('1'))['Text']) + self.assertEqual("Char Weight Complex\tBold", get_state_as_dict(xParDirFormatting.getChild('2'))['Text']) + self.assertEqual(0, len(xListBox.getChild('2').getChildren())) + self.assertEqual(0, len(xListBox.getChild('3').getChildren())) - self.xUITest.executeCommand(".uno:Sidebar") + self.xUITest.executeCommand(".uno:Sidebar") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/insertTableDialog.py b/sw/qa/uitest/table/insertTableDialog.py index 2017dda1ca2b..427920e1985c 100644 --- a/sw/qa/uitest/table/insertTableDialog.py +++ b/sw/qa/uitest/table/insertTableDialog.py @@ -10,57 +10,69 @@ from uitest.uihelper.common import get_state_as_dict class WriterInsertTableDialog(UITestCase): - def test_tdf104158(self): + def insert_table(self, name, rows, cols): + + self.ui_test.create_doc_in_start_center("writer") + + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + + xNameEdit = xDialog.getChild("nameedit") - with self.ui_test.create_doc_in_start_center("writer"): + xNameEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xNameEdit.executeAction("TYPE", mkPropertyValues({"TEXT": name})) - self.ui_test.execute_dialog_through_command(".uno:InsertTable") - xDialog = self.xUITest.getTopFocusWindow() + xColSpin = xDialog.getChild("colspin") + xColSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xColSpin.executeAction("TYPE", mkPropertyValues({"TEXT": str(cols)})) - xNameEdit = xDialog.getChild("nameedit") + xRowSpin = xDialog.getChild("rowspin") + xRowSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xRowSpin.executeAction("TYPE", mkPropertyValues({"TEXT": str(rows)})) - xNameEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xNameEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Test3"})) + self.assertEqual(get_state_as_dict(xNameEdit)["Text"], name) + self.assertEqual(get_state_as_dict(xColSpin)["Text"], str(cols)) + self.assertEqual(get_state_as_dict(xRowSpin)["Text"], str(rows)) - xColSpin = xDialog.getChild("colspin") - xColSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xColSpin.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - xRowSpin = xDialog.getChild("rowspin") - xRowSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xRowSpin.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) + document = self.ui_test.get_component() - self.assertEqual(get_state_as_dict(xNameEdit)["Text"], "Test3") - self.assertEqual(get_state_as_dict(xColSpin)["Text"], "2") - self.assertEqual(get_state_as_dict(xRowSpin)["Text"], "2") + tables = document.getTextTables() - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + self.assertEqual(tables[0].getName(), name) + self.assertEqual(len(tables[0].getRows()), rows) + self.assertEqual(len(tables[0].getColumns()), cols) - document = self.ui_test.get_component() + def insertTextIntoCell(self, table, cellName, text ): + tableText = table.getCellByName( cellName ) + tableText.setString( text ) - tables = document.getTextTables() + def test_tdf104158(self): + + self.insert_table("Test3", 2, 2) - self.assertEqual(tables[0].getName(), "Test3") - self.assertEqual(len(tables[0].getRows()), 2) - self.assertEqual(len(tables[0].getColumns()), 2) + self.ui_test.execute_dialog_through_command(".uno:TableNumberFormatDialog") - self.ui_test.execute_dialog_through_command(".uno:TableNumberFormatDialog") + xNumberFormatDlg = self.xUITest.getTopFocusWindow() - xNumberFormatDlg = self.xUITest.getTopFocusWindow() + xOkBtn = xNumberFormatDlg.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - xOkBtn = xNumberFormatDlg.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + self.ui_test.close_doc() def test_cancel_button_insert_table_dialog(self): - with self.ui_test.create_doc_in_start_center("writer"): - self.ui_test.execute_dialog_through_command(".uno:InsertTable") - Dialog = self.xUITest.getTopFocusWindow() - CancelBtn = Dialog.getChild("cancel") - self.ui_test.close_dialog_through_button(CancelBtn) - - document = self.ui_test.get_component() - tables = document.getTextTables() - self.assertEqual(len(tables), 0) + self.ui_test.create_doc_in_start_center("writer") + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + Dialog = self.xUITest.getTopFocusWindow() + CancelBtn = Dialog.getChild("cancel") + self.ui_test.close_dialog_through_button(CancelBtn) + + document = self.ui_test.get_component() + tables = document.getTextTables() + self.assertEqual(len(tables), 0) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/sheetToTable.py b/sw/qa/uitest/table/sheetToTable.py index e16ea93f85d5..4f48eeb644db 100644 --- a/sw/qa/uitest/table/sheetToTable.py +++ b/sw/qa/uitest/table/sheetToTable.py @@ -61,20 +61,22 @@ class sheetToTable(UITestCase): self.assertEqual(table.getCellByName("A2").getString(), "3") def test_tdf129083(self): - with self.ui_test.create_doc_in_start_center("calc"): + calc_doc = self.ui_test.create_doc_in_start_center("calc") - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() - enter_text_to_cell(gridwin, "A1", "Test 1") - enter_text_to_cell(gridwin, "A2", "Test 2") - enter_text_to_cell(gridwin, "A3", "Test 3") - enter_text_to_cell(gridwin, "A4", "Test 4") + enter_text_to_cell(gridwin, "A1", "Test 1") + enter_text_to_cell(gridwin, "A2", "Test 2") + enter_text_to_cell(gridwin, "A3", "Test 3") + enter_text_to_cell(gridwin, "A4", "Test 4") - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) - self.xUITest.executeCommand(".uno:Copy") + self.xUITest.executeCommand(".uno:Copy") + + self.ui_test.close_doc() with self.ui_test.load_file(get_url_for_data_file("tdf129083.odt")) as writer_doc: document = self.ui_test.get_component() diff --git a/sw/qa/uitest/table/tdf115026.py b/sw/qa/uitest/table/tdf115026.py index 8f994335af9e..92314753a8c3 100644 --- a/sw/qa/uitest/table/tdf115026.py +++ b/sw/qa/uitest/table/tdf115026.py @@ -11,25 +11,26 @@ from uitest.uihelper.common import get_state_as_dict class tdf115026(UITestCase): def test_pageBreak_and_tableAutoFormat(self): - with self.ui_test.create_doc_in_start_center("writer"): - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - self.xUITest.executeCommand(".uno:InsertPagebreak") - self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + self.xUITest.executeCommand(".uno:InsertPagebreak") + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") - self.ui_test.execute_dialog_through_command(".uno:InsertTable") - xDialog = self.xUITest.getTopFocusWindow() + 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.ui_test.execute_dialog_through_command(".uno:AutoFormat") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:AutoFormat") + 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.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf116737.py b/sw/qa/uitest/table/tdf116737.py index cc285d993ebd..139fcea3a812 100644 --- a/sw/qa/uitest/table/tdf116737.py +++ b/sw/qa/uitest/table/tdf116737.py @@ -13,39 +13,40 @@ from uitest.uihelper.common import select_pos class tdf116737(UITestCase): def test_tdf116737_select_table_style(self): - with self.ui_test.create_doc_in_start_center("writer"): - xWriterDoc = self.xUITest.getTopFocusWindow() - document = self.ui_test.get_component() - - #Insert => Insert Table / It's not possible to select a table style - self.ui_test.execute_dialog_through_command(".uno:InsertTable") - xDialog = self.xUITest.getTopFocusWindow() - - formatlbinstable = xDialog.getChild("formatlbinstable") - entry = formatlbinstable.getChild("11") #Simple List Shaded - entry.executeAction("SELECT", tuple()) - - xOkBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) - - #verify .uno:TableDialog - 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()) - - R_custom = xDialog.getChild("R_custom") - G_custom = xDialog.getChild("G_custom") - B_custom = xDialog.getChild("B_custom") - #"Simple List Shaded" -> header should be black - self.assertEqual(get_state_as_dict(R_custom)["Text"], "0") - self.assertEqual(get_state_as_dict(G_custom)["Text"], "0") - self.assertEqual(get_state_as_dict(B_custom)["Text"], "0") - - xOkBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) - + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + + #Insert => Insert Table / It's not possible to select a table style + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + + formatlbinstable = xDialog.getChild("formatlbinstable") + entry = formatlbinstable.getChild("11") #Simple List Shaded + entry.executeAction("SELECT", tuple()) + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + #verify .uno:TableDialog + 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()) + + R_custom = xDialog.getChild("R_custom") + G_custom = xDialog.getChild("G_custom") + B_custom = xDialog.getChild("B_custom") + #"Simple List Shaded" -> header should be black + self.assertEqual(get_state_as_dict(R_custom)["Text"], "0") + self.assertEqual(get_state_as_dict(G_custom)["Text"], "0") + self.assertEqual(get_state_as_dict(B_custom)["Text"], "0") + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf128593.py b/sw/qa/uitest/table/tdf128593.py index c631fa87db16..3306a58d2b09 100755 --- a/sw/qa/uitest/table/tdf128593.py +++ b/sw/qa/uitest/table/tdf128593.py @@ -9,28 +9,30 @@ from uitest.uihelper.common import get_state_as_dict class tdf128593(UITestCase): def test_tdf128593_table_background_color(self): - with self.ui_test.create_doc_in_start_center("writer"): - MainWindow = self.xUITest.getTopFocusWindow() + MainDoc = self.ui_test.create_doc_in_start_center("writer") + MainWindow = self.xUITest.getTopFocusWindow() - self.ui_test.execute_dialog_through_command(".uno:InsertTable") - InsertTableDialog = self.xUITest.getTopFocusWindow() - xok = InsertTableDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xok) + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + InsertTableDialog = self.xUITest.getTopFocusWindow() + xok = InsertTableDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xok) - self.xUITest.executeCommandWithParameters(".uno:TableCellBackgroundColor", mkPropertyValues({"TableCellBackgroundColor" : 16776960 }) ) - self.ui_test.execute_dialog_through_command(".uno:TableDialog") - writer_edit = MainWindow.getChild("writer_edit") - writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "0", "START_POS": "0"})) - TablePropertiesDialog = self.xUITest.getTopFocusWindow() - tabcontrol = TablePropertiesDialog.getChild("tabcontrol") - tabcontrol.executeAction("SELECT", mkPropertyValues({"POS": "4"})) - Rcustom = TablePropertiesDialog.getChild("R_custom") #255 - self.assertEqual(get_state_as_dict(Rcustom)["Text"], "255") - Gcustom = TablePropertiesDialog.getChild("G_custom") #255 - self.assertEqual(get_state_as_dict(Gcustom)["Text"], "255") - Bcustom = TablePropertiesDialog.getChild("B_custom") #0 - self.assertEqual(get_state_as_dict(Bcustom)["Text"], "0") - xok = TablePropertiesDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xok) + self.xUITest.executeCommandWithParameters(".uno:TableCellBackgroundColor", mkPropertyValues({"TableCellBackgroundColor" : 16776960 }) ) + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + writer_edit = MainWindow.getChild("writer_edit") + writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "0", "START_POS": "0"})) + TablePropertiesDialog = self.xUITest.getTopFocusWindow() + tabcontrol = TablePropertiesDialog.getChild("tabcontrol") + tabcontrol.executeAction("SELECT", mkPropertyValues({"POS": "4"})) + Rcustom = TablePropertiesDialog.getChild("R_custom") #255 + self.assertEqual(get_state_as_dict(Rcustom)["Text"], "255") + Gcustom = TablePropertiesDialog.getChild("G_custom") #255 + self.assertEqual(get_state_as_dict(Gcustom)["Text"], "255") + Bcustom = TablePropertiesDialog.getChild("B_custom") #0 + self.assertEqual(get_state_as_dict(Bcustom)["Text"], "0") + xok = TablePropertiesDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xok) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/textToTable.py b/sw/qa/uitest/table/textToTable.py index c40f2a726d41..2b820b360653 100644 --- a/sw/qa/uitest/table/textToTable.py +++ b/sw/qa/uitest/table/textToTable.py @@ -12,28 +12,30 @@ from uitest.uihelper.common import get_url_for_data_file, type_text class textToTable(UITestCase): def test_text_to_table(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") - #Enter A;B ; select the text ; dialog Text to table - Semicolon; verify - type_text(xWriterEdit, "A;B;C") - xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "5"})) - self.ui_test.execute_dialog_through_command(".uno:ConvertTextToTable") - xDialog = self.xUITest.getTopFocusWindow() - semicolons = xDialog.getChild("semicolons") - semicolons.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #verify - self.assertEqual(document.TextTables.getCount(), 1) - tables = document.getTextTables() - self.assertEqual(len(tables[0].getRows()), 1) - self.assertEqual(len(tables[0].getColumns()), 3) - #undo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.TextTables.getCount(), 0) - self.assertEqual(document.Text.String[0:5], "A;B;C") + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #Enter A;B ; select the text ; dialog Text to table - Semicolon; verify + type_text(xWriterEdit, "A;B;C") + xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "5"})) + self.ui_test.execute_dialog_through_command(".uno:ConvertTextToTable") + xDialog = self.xUITest.getTopFocusWindow() + semicolons = xDialog.getChild("semicolons") + semicolons.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(document.TextTables.getCount(), 1) + tables = document.getTextTables() + self.assertEqual(len(tables[0].getRows()), 1) + self.assertEqual(len(tables[0].getColumns()), 3) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 0) + self.assertEqual(document.Text.String[0:5], "A;B;C") + + self.ui_test.close_doc() def test_text_to_table_header(self): with self.ui_test.load_file(get_url_for_data_file("textToTable.odt")) as writer_doc: diff --git a/sw/qa/uitest/ui/fmtui/fmtui.py b/sw/qa/uitest/ui/fmtui/fmtui.py index caf03a1af7b7..36e00c95a479 100644 --- a/sw/qa/uitest/ui/fmtui/fmtui.py +++ b/sw/qa/uitest/ui/fmtui/fmtui.py @@ -15,22 +15,23 @@ class TestTmpdlg(UITestCase): def test_para_style_semi_transparent_text(self): - with self.ui_test.create_doc_in_start_center("writer"): - xWriterDoc = self.xUITest.getTopFocusWindow() - document = self.ui_test.get_component() - self.ui_test.execute_dialog_through_command(".uno:EditStyle") - xDialog = self.xUITest.getTopFocusWindow() - - xTabs = xDialog.getChild("tabcontrol") - # Select RID_SVXPAGE_CHAR_EFFECTS. - select_pos(xTabs, "1") - xFontTransparency = xDialog.getChild("fonttransparencymtr") - # Without the accompanying fix in place, this test would have failed with: - # AssertionError: 'false' != 'true' - # i.e. the control was hidden in the paragraph style dialog. - self.assertEqual(get_state_as_dict(xFontTransparency)["Visible"], "true") - - xCancBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancBtn) + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + self.ui_test.execute_dialog_through_command(".uno:EditStyle") + xDialog = self.xUITest.getTopFocusWindow() + + xTabs = xDialog.getChild("tabcontrol") + # Select RID_SVXPAGE_CHAR_EFFECTS. + select_pos(xTabs, "1") + xFontTransparency = xDialog.getChild("fonttransparencymtr") + # Without the accompanying fix in place, this test would have failed with: + # AssertionError: 'false' != 'true' + # i.e. the control was hidden in the paragraph style dialog. + self.assertEqual(get_state_as_dict(xFontTransparency)["Visible"], "true") + + 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/ui/index/index.py b/sw/qa/uitest/ui/index/index.py index 172589392e4d..71d9e165bbaf 100644 --- a/sw/qa/uitest/ui/index/index.py +++ b/sw/qa/uitest/ui/index/index.py @@ -17,40 +17,41 @@ class TestSwuiidxmrk(UITestCase): def test_bibliography_page_number_insert(self): # Given an empty Writer document: - with self.ui_test.create_doc_in_start_center("writer"): - - self.ui_test.execute_modeless_dialog_through_command(".uno:InsertAuthoritiesEntry") - insert_entry = self.xUITest.getTopFocusWindow() - from_document = insert_entry.getChild("fromdocument") - from_document.executeAction("CLICK", tuple()) - new = insert_entry.getChild("new") - - # When inserting a biblio entry field with a page number: - with self.ui_test.execute_blocking_action(new.executeAction, args=('CLICK', ())) as define_entry: - entry = define_entry.getChild("entry") - type_text(entry, "aaa") - listbox = define_entry.getChild("listbox") - select_pos(listbox, "16") # WWW document - pagecb = define_entry.getChild("pagecb-visible") - pagecb.executeAction("CLICK", tuple()) - - insert = insert_entry.getChild("insert") - insert.executeAction("CLICK", tuple()) - close = insert_entry.getChild("close") - self.ui_test.close_dialog_through_button(close) - - # Then make sure the URL contains that page number: - component = self.ui_test.get_component() - paragraphs = component.Text.createEnumeration() - paragraph = paragraphs.nextElement() - portions = paragraph.createEnumeration() - portion = portions.nextElement() - for field in portion.TextField.Fields: - if field.Name != "URL": - continue - # Without the accompanying fix in place, this test would have failed with: - # AssertionError: '' != '#page=1' - # i.e. the page number was not part of the URL. - self.assertEqual(field.Value, "#page=1") + self.ui_test.create_doc_in_start_center("writer") + + self.ui_test.execute_modeless_dialog_through_command(".uno:InsertAuthoritiesEntry") + insert_entry = self.xUITest.getTopFocusWindow() + from_document = insert_entry.getChild("fromdocument") + from_document.executeAction("CLICK", tuple()) + new = insert_entry.getChild("new") + + # When inserting a biblio entry field with a page number: + with self.ui_test.execute_blocking_action(new.executeAction, args=('CLICK', ())) as define_entry: + entry = define_entry.getChild("entry") + type_text(entry, "aaa") + listbox = define_entry.getChild("listbox") + select_pos(listbox, "16") # WWW document + pagecb = define_entry.getChild("pagecb-visible") + pagecb.executeAction("CLICK", tuple()) + + insert = insert_entry.getChild("insert") + insert.executeAction("CLICK", tuple()) + close = insert_entry.getChild("close") + self.ui_test.close_dialog_through_button(close) + + # Then make sure the URL contains that page number: + component = self.ui_test.get_component() + paragraphs = component.Text.createEnumeration() + paragraph = paragraphs.nextElement() + portions = paragraph.createEnumeration() + portion = portions.nextElement() + for field in portion.TextField.Fields: + if field.Name != "URL": + continue + # Without the accompanying fix in place, this test would have failed with: + # AssertionError: '' != '#page=1' + # i.e. the page number was not part of the URL. + self.assertEqual(field.Value, "#page=1") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: 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: diff --git a/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py b/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py index 7764742cea5b..39ba7eb3595a 100644 --- a/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py +++ b/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py @@ -11,30 +11,31 @@ from uitest.uihelper.common import select_by_text class asianPhoneticGuide(UITestCase): def test_asian_phonetic_guide(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() - self.ui_test.execute_modeless_dialog_through_command(".uno:RubyDialog") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_modeless_dialog_through_command(".uno:RubyDialog") + xDialog = self.xUITest.getTopFocusWindow() - xLeft1ED = xDialog.getChild("Left1ED") - xRight1ED = xDialog.getChild("Right1ED") - xadjustlb = xDialog.getChild("adjustlb") - xpositionlb = xDialog.getChild("positionlb") - xstylelb = xDialog.getChild("stylelb") + xLeft1ED = xDialog.getChild("Left1ED") + xRight1ED = xDialog.getChild("Right1ED") + xadjustlb = xDialog.getChild("adjustlb") + xpositionlb = xDialog.getChild("positionlb") + xstylelb = xDialog.getChild("stylelb") - xLeft1ED.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) - xRight1ED.executeAction("TYPE", mkPropertyValues({"TEXT":"w"})) - select_by_text(xadjustlb, "Right") - select_by_text(xpositionlb, "Right") - select_by_text(xstylelb, "Quotation") + xLeft1ED.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) + xRight1ED.executeAction("TYPE", mkPropertyValues({"TEXT":"w"})) + select_by_text(xadjustlb, "Right") + select_by_text(xpositionlb, "Right") + select_by_text(xstylelb, "Quotation") - xApplyBtn = xDialog.getChild("ok") - xApplyBtn.executeAction("CLICK", tuple()) + xApplyBtn = xDialog.getChild("ok") + xApplyBtn.executeAction("CLICK", tuple()) - xCloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xCloseBtn) + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) - self.assertEqual(document.Text.String[0:1], "a") + self.assertEqual(document.Text.String[0:1], "a") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/bookmark.py b/sw/qa/uitest/writer_tests2/bookmark.py index 5bddc9440f76..d41fd2ff81e8 100644 --- a/sw/qa/uitest/writer_tests2/bookmark.py +++ b/sw/qa/uitest/writer_tests2/bookmark.py @@ -15,111 +15,117 @@ class bookmarkDialog(UITestCase): def test_bookmark_dialog(self): - with self.ui_test.create_doc_in_start_center("writer"): - - self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") - xBookDlg = self.xUITest.getTopFocusWindow() - xInsertBtn = xBookDlg.getChild("insert") - xInsertBtn.executeAction("CLICK", tuple()) # first bookmark - - self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") - xBookDlg = self.xUITest.getTopFocusWindow() - xInsertBtn = xBookDlg.getChild("insert") - xBmk = xBookDlg.getChild("bookmarks") - self.assertEqual(get_state_as_dict(xBmk)["VisibleCount"], "1") #check for 1st bookmark exist - xInsertBtn.executeAction("CLICK", tuple()) # add 2nd bookmark - - self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") - xBookDlg = self.xUITest.getTopFocusWindow() - xCloseBtn = xBookDlg.getChild("close") - xCloseBtn.executeAction("CLICK", tuple()) # close - - self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") - xBookDlg = self.xUITest.getTopFocusWindow() - xBmk = xBookDlg.getChild("bookmarks") - self.assertEqual(get_state_as_dict(xBmk)["VisibleCount"], "2") #check for 2 bookmarks - xCloseBtn = xBookDlg.getChild("close") - xCloseBtn.executeAction("CLICK", tuple()) # close dialog - - #now delete one bookmark - self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") - xBookDlg = self.xUITest.getTopFocusWindow() - xBmk = xBookDlg.getChild("bookmarks") - xSecondListEntry = xBmk.getChild("1") # select second bookmark - xSecondListEntry.executeAction("SELECT", tuple()) - xDelBtn = xBookDlg.getChild("delete") - xDelBtn.executeAction("CLICK", tuple()) # delete one bookmark - xCloseBtn = xBookDlg.getChild("close") - xCloseBtn.executeAction("CLICK", tuple()) # close dialog - - self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") - xBookDlg = self.xUITest.getTopFocusWindow() - xCloseBtn = xBookDlg.getChild("close") - xBmk2 = xBookDlg.getChild("bookmarks") - self.assertEqual(get_state_as_dict(xBmk2)["VisibleCount"], "1") #check for 1 bookmark - xCloseBtn.executeAction("CLICK", tuple()) # now we have only 1 bookmark + self.ui_test.create_doc_in_start_center("writer") + + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xInsertBtn = xBookDlg.getChild("insert") + xInsertBtn.executeAction("CLICK", tuple()) # first bookmark + + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xInsertBtn = xBookDlg.getChild("insert") + xBmk = xBookDlg.getChild("bookmarks") + self.assertEqual(get_state_as_dict(xBmk)["VisibleCount"], "1") #check for 1st bookmark exist + xInsertBtn.executeAction("CLICK", tuple()) # add 2nd bookmark + + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xCloseBtn = xBookDlg.getChild("close") + xCloseBtn.executeAction("CLICK", tuple()) # close + + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xBmk = xBookDlg.getChild("bookmarks") + self.assertEqual(get_state_as_dict(xBmk)["VisibleCount"], "2") #check for 2 bookmarks + xCloseBtn = xBookDlg.getChild("close") + xCloseBtn.executeAction("CLICK", tuple()) # close dialog + +#now delete one bookmark + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xBmk = xBookDlg.getChild("bookmarks") + xSecondListEntry = xBmk.getChild("1") # select second bookmark + xSecondListEntry.executeAction("SELECT", tuple()) + xDelBtn = xBookDlg.getChild("delete") + xDelBtn.executeAction("CLICK", tuple()) # delete one bookmark + xCloseBtn = xBookDlg.getChild("close") + xCloseBtn.executeAction("CLICK", tuple()) # close dialog + + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xCloseBtn = xBookDlg.getChild("close") + xBmk2 = xBookDlg.getChild("bookmarks") + self.assertEqual(get_state_as_dict(xBmk2)["VisibleCount"], "1") #check for 1 bookmark + xCloseBtn.executeAction("CLICK", tuple()) # now we have only 1 bookmark + + self.ui_test.close_doc() def test_bookmark_dialog_rename(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") - xBookDlg = self.xUITest.getTopFocusWindow() - xInsertBtn = xBookDlg.getChild("insert") - xInsertBtn.executeAction("CLICK", tuple()) # first bookmark + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xInsertBtn = xBookDlg.getChild("insert") + xInsertBtn.executeAction("CLICK", tuple()) # first bookmark - self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") - xBookDlg = self.xUITest.getTopFocusWindow() - xBmk = xBookDlg.getChild("bookmarks") - xFirstListEntry = xBmk.getChild("0") # select first bookmark - xFirstListEntry.executeAction("SELECT", tuple()) - xRenameBtn = xBookDlg.getChild("rename") + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xBmk = xBookDlg.getChild("bookmarks") + xFirstListEntry = xBmk.getChild("0") # select first bookmark + xFirstListEntry.executeAction("SELECT", tuple()) + xRenameBtn = xBookDlg.getChild("rename") - with self.ui_test.execute_blocking_action(xRenameBtn.executeAction, args=('CLICK', ())) as dialog: - xNewNameTxt=dialog.getChild("entry") - xNewNameTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"newname"})) + with self.ui_test.execute_blocking_action(xRenameBtn.executeAction, args=('CLICK', ())) as dialog: + xNewNameTxt=dialog.getChild("entry") + xNewNameTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"newname"})) - xBookDlg = self.xUITest.getTopFocusWindow() - x1stListEntry = xBmk.getChild("O") # select first bookmark - name "newname" - x1stListEntry.executeAction("SELECT", tuple()) + xBookDlg = self.xUITest.getTopFocusWindow() + x1stListEntry = xBmk.getChild("O") # select first bookmark - name "newname" + x1stListEntry.executeAction("SELECT", tuple()) - self.assertEqual(get_state_as_dict(x1stListEntry)["Text"], "1\tnewname\t\tNo\t") #check the new name "newname" + self.assertEqual(get_state_as_dict(x1stListEntry)["Text"], "1\tnewname\t\tNo\t") #check the new name "newname" - xCloseBtn = xBookDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCloseBtn) + xCloseBtn = xBookDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() def test_bookmark_dialog_goto(self): - with self.ui_test.create_doc_in_start_center("writer"): - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xInsertBtn = xBookDlg.getChild("insert") + xInsertBtn.executeAction("CLICK", tuple()) # first bookmark - self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") - xBookDlg = self.xUITest.getTopFocusWindow() - xInsertBtn = xBookDlg.getChild("insert") - xInsertBtn.executeAction("CLICK", tuple()) # first bookmark + type_text(xWriterEdit, "Test for bookmark") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + type_text(xWriterEdit, "Test2 for bookmark") - type_text(xWriterEdit, "Test for bookmark") - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - type_text(xWriterEdit, "Test2 for bookmark") + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xInsertBtn = xBookDlg.getChild("insert") + xInsertBtn.executeAction("CLICK", tuple()) # second bookmark - self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") - xBookDlg = self.xUITest.getTopFocusWindow() - xInsertBtn = xBookDlg.getChild("insert") - xInsertBtn.executeAction("CLICK", tuple()) # second bookmark + self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") + xBookDlg = self.xUITest.getTopFocusWindow() + xBmk = xBookDlg.getChild("bookmarks") + xFirstListEntry = xBmk.getChild("0") # select first bookmark + xFirstListEntry.executeAction("SELECT", tuple()) + xGoToBtn = xBookDlg.getChild("goto") + xGoToBtn.executeAction("CLICK", tuple()) # goto 1st bookmark + xCloseBtn = xBookDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) - self.ui_test.execute_dialog_through_command(".uno:InsertBookmark") - xBookDlg = self.xUITest.getTopFocusWindow() - xBmk = xBookDlg.getChild("bookmarks") - xFirstListEntry = xBmk.getChild("0") # select first bookmark - xFirstListEntry.executeAction("SELECT", tuple()) - xGoToBtn = xBookDlg.getChild("goto") - xGoToBtn.executeAction("CLICK", tuple()) # goto 1st bookmark - xCloseBtn = xBookDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/deleteAllComments.py b/sw/qa/uitest/writer_tests2/deleteAllComments.py index 35d05079e9c3..e6832af6cb62 100644 --- a/sw/qa/uitest/writer_tests2/deleteAllComments.py +++ b/sw/qa/uitest/writer_tests2/deleteAllComments.py @@ -11,39 +11,42 @@ class DeleteAllComments(UITestCase): def test_comments_delete(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") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - type_text(xWriterEdit, "Test LibreOffice") + type_text(xWriterEdit, "Test LibreOffice") - document = self.ui_test.get_component() + document = self.ui_test.get_component() - selection = self.xUITest.executeCommand(".uno:SelectAll") - self.xUITest.executeCommand(".uno:InsertAnnotation") - cursor = document.getCurrentController().getViewCursor() - type_text(xWriterEdit, "EEEEE") - self.xUITest.executeCommand(".uno:InsertAnnotation") - self.xUITest.executeCommand(".uno:DeleteAllNotes") - self.assertEqual(document.Text.String[0:4], "Test") + selection = self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:InsertAnnotation") + cursor = document.getCurrentController().getViewCursor() + type_text(xWriterEdit, "EEEEE") + self.xUITest.executeCommand(".uno:InsertAnnotation") + self.xUITest.executeCommand(".uno:DeleteAllNotes") + self.assertEqual(document.Text.String[0:4], "Test") + + self.ui_test.close_doc() def test_comment_trackchanges(self): #tdf111524 - 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") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - type_text(xWriterEdit, "foo") + type_text(xWriterEdit, "foo") - document = self.ui_test.get_component() + document = self.ui_test.get_component() - selection = self.xUITest.executeCommand(".uno:SelectAll") - self.xUITest.executeCommand(".uno:InsertAnnotation") - self.xUITest.executeCommand(".uno:TrackChanges") - self.xUITest.executeCommand(".uno:DeleteAllNotes") + selection = self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:InsertAnnotation") + self.xUITest.executeCommand(".uno:TrackChanges") + self.xUITest.executeCommand(".uno:DeleteAllNotes") + self.ui_test.close_doc() diff --git a/sw/qa/uitest/writer_tests2/documentProperties.py b/sw/qa/uitest/writer_tests2/documentProperties.py index a3dc933ede8e..8afbac9be533 100644 --- a/sw/qa/uitest/writer_tests2/documentProperties.py +++ b/sw/qa/uitest/writer_tests2/documentProperties.py @@ -29,100 +29,102 @@ class documentProperties(UITestCase): self.assertEqual(aExpected, get_state_as_dict(xRemoveBtn)['ReallyVisible']) def test_open_documentProperties_writer(self): - with self.ui_test.create_doc_in_start_center("writer"): - self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") - xDialog = self.xUITest.getTopFocusWindow() - xResetBtn = xDialog.getChild("reset") - xResetBtn.executeAction("CLICK", tuple()) - - xUserDataCheckbox = xDialog.getChild("userdatacb") # apply user data - xUserDataCheckbox.executeAction("CLICK", tuple()) - xThumbSaveCheckbox = xDialog.getChild("thumbnailsavecb") # save preview image with document - xThumbSaveCheckbox.executeAction("CLICK", tuple()) - - #digital signature - xDigSignBtn = xDialog.getChild("signature") - - with self.ui_test.execute_blocking_action(xDigSignBtn.executeAction, args=('CLICK', ()), close_button="no"): - pass - - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") #tab Description - - xTitleText = xDialog.getChild("title") - xTitleText.executeAction("TYPE", mkPropertyValues({"TEXT":"Title text"})) - xSubjectText = xDialog.getChild("subject") - xSubjectText.executeAction("TYPE", mkPropertyValues({"TEXT":"Subject text"})) - xKeywordsText = xDialog.getChild("keywords") - xKeywordsText.executeAction("TYPE", mkPropertyValues({"TEXT":"Keywords text"})) - xCommentsText = xDialog.getChild("comments") - xCommentsText.executeAction("TYPE", mkPropertyValues({"TEXT":"Comments text"})) - - - #Font tab - select_pos(xTabs, "4") #tab Fonts - xFontEmbedCheckbox = xDialog.getChild("embedFonts") - xFontEmbedCheckbox.executeAction("CLICK", tuple()) - - #Security tab - select_pos(xTabs, "3") #tab Security - xReadOnlyCheckbox = xDialog.getChild("readonly") - xReadOnlyCheckbox.executeAction("CLICK", tuple()) - xRecordChangesCheckbox = xDialog.getChild("recordchanges") - xRecordChangesCheckbox.executeAction("CLICK", tuple()) - xProtectBtn = xDialog.getChild("protect") - - with self.ui_test.execute_blocking_action(xProtectBtn.executeAction, args=('CLICK', ())) as dialog: - xPasswordText = dialog.getChild("pass1ed") - xPasswordText.executeAction("TYPE", mkPropertyValues({"TEXT":"password"})) - xConfirmText = dialog.getChild("confirm1ed") - xConfirmText.executeAction("TYPE", mkPropertyValues({"TEXT":"password"})) - - select_pos(xTabs, "2") #tab Custom properties - - self.assert_custom_properties(xDialog, False) - - xAddBtn = xDialog.getChild("add") - xAddBtn.executeAction("CLICK", tuple()) - - self.assert_custom_properties(xDialog, True) - - xRemoveBtn = xDialog.getChild("remove1") - xRemoveBtn.executeAction("CLICK", tuple()) - - self.assert_custom_properties(xDialog, False) - - select_pos(xTabs, "5") #tab Statistics - xUpdateBtn = xDialog.getChild("update") - xUpdateBtn.executeAction("CLICK", tuple()) - - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - #now open the dialog again and read the properties - self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") - xDialog = self.xUITest.getTopFocusWindow() - xTitleText = xDialog.getChild("title") - xSubjectText = xDialog.getChild("subject") - xKeywordsText = xDialog.getChild("keywords") - xCommentsText = xDialog.getChild("comments") - xReadOnlyCheckbox = xDialog.getChild("readonly") - xRecordChangesCheckbox = xDialog.getChild("recordchanges") - xFontEmbedCheckbox = xDialog.getChild("embedFonts") - xUserDataCheckbox = xDialog.getChild("userdatacb") - xThumbSaveCheckbox = xDialog.getChild("thumbnailsavecb") - self.assertEqual(get_state_as_dict(xTitleText)["Text"], "Title text") - self.assertEqual(get_state_as_dict(xSubjectText)["Text"], "Subject text") - self.assertEqual(get_state_as_dict(xKeywordsText)["Text"], "Keywords text") - self.assertEqual(get_state_as_dict(xReadOnlyCheckbox)["Selected"], "true") - self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true") - self.assertEqual(get_state_as_dict(xReadOnlyCheckbox)["Selected"], "true") - self.assertEqual(get_state_as_dict(xFontEmbedCheckbox)["Selected"], "true") - self.assertEqual(get_state_as_dict(xUserDataCheckbox)["Selected"], "false") - self.assertEqual(get_state_as_dict(xThumbSaveCheckbox)["Selected"], "false") - self.assertEqual(get_state_as_dict(xCommentsText)["Text"], "Comments text") - xResetBtn = xDialog.getChild("reset") - xResetBtn.executeAction("CLICK", tuple()) - xCancBtn = xDialog.getChild("cancel") - xCancBtn.executeAction("CLICK", tuple()) + self.ui_test.create_doc_in_start_center("writer") + self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") + xDialog = self.xUITest.getTopFocusWindow() + xResetBtn = xDialog.getChild("reset") + xResetBtn.executeAction("CLICK", tuple()) + + xUserDataCheckbox = xDialog.getChild("userdatacb") # apply user data + xUserDataCheckbox.executeAction("CLICK", tuple()) + xThumbSaveCheckbox = xDialog.getChild("thumbnailsavecb") # save preview image with document + xThumbSaveCheckbox.executeAction("CLICK", tuple()) + +#digital signature + xDigSignBtn = xDialog.getChild("signature") + + with self.ui_test.execute_blocking_action(xDigSignBtn.executeAction, args=('CLICK', ()), close_button="no"): + pass + + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") #tab Description + + xTitleText = xDialog.getChild("title") + xTitleText.executeAction("TYPE", mkPropertyValues({"TEXT":"Title text"})) + xSubjectText = xDialog.getChild("subject") + xSubjectText.executeAction("TYPE", mkPropertyValues({"TEXT":"Subject text"})) + xKeywordsText = xDialog.getChild("keywords") + xKeywordsText.executeAction("TYPE", mkPropertyValues({"TEXT":"Keywords text"})) + xCommentsText = xDialog.getChild("comments") + xCommentsText.executeAction("TYPE", mkPropertyValues({"TEXT":"Comments text"})) + + +#Font tab + select_pos(xTabs, "4") #tab Fonts + xFontEmbedCheckbox = xDialog.getChild("embedFonts") + xFontEmbedCheckbox.executeAction("CLICK", tuple()) + +#Security tab + select_pos(xTabs, "3") #tab Security + xReadOnlyCheckbox = xDialog.getChild("readonly") + xReadOnlyCheckbox.executeAction("CLICK", tuple()) + xRecordChangesCheckbox = xDialog.getChild("recordchanges") + xRecordChangesCheckbox.executeAction("CLICK", tuple()) + xProtectBtn = xDialog.getChild("protect") + + with self.ui_test.execute_blocking_action(xProtectBtn.executeAction, args=('CLICK', ())) as dialog: + xPasswordText = dialog.getChild("pass1ed") + xPasswordText.executeAction("TYPE", mkPropertyValues({"TEXT":"password"})) + xConfirmText = dialog.getChild("confirm1ed") + xConfirmText.executeAction("TYPE", mkPropertyValues({"TEXT":"password"})) + + select_pos(xTabs, "2") #tab Custom properties + + self.assert_custom_properties(xDialog, False) + + xAddBtn = xDialog.getChild("add") + xAddBtn.executeAction("CLICK", tuple()) + + self.assert_custom_properties(xDialog, True) + + xRemoveBtn = xDialog.getChild("remove1") + xRemoveBtn.executeAction("CLICK", tuple()) + + self.assert_custom_properties(xDialog, False) + + select_pos(xTabs, "5") #tab Statistics + xUpdateBtn = xDialog.getChild("update") + xUpdateBtn.executeAction("CLICK", tuple()) + + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) +#now open the dialog again and read the properties + self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") + xDialog = self.xUITest.getTopFocusWindow() + xTitleText = xDialog.getChild("title") + xSubjectText = xDialog.getChild("subject") + xKeywordsText = xDialog.getChild("keywords") + xCommentsText = xDialog.getChild("comments") + xReadOnlyCheckbox = xDialog.getChild("readonly") + xRecordChangesCheckbox = xDialog.getChild("recordchanges") + xFontEmbedCheckbox = xDialog.getChild("embedFonts") + xUserDataCheckbox = xDialog.getChild("userdatacb") + xThumbSaveCheckbox = xDialog.getChild("thumbnailsavecb") + self.assertEqual(get_state_as_dict(xTitleText)["Text"], "Title text") + self.assertEqual(get_state_as_dict(xSubjectText)["Text"], "Subject text") + self.assertEqual(get_state_as_dict(xKeywordsText)["Text"], "Keywords text") + self.assertEqual(get_state_as_dict(xReadOnlyCheckbox)["Selected"], "true") + self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true") + self.assertEqual(get_state_as_dict(xReadOnlyCheckbox)["Selected"], "true") + self.assertEqual(get_state_as_dict(xFontEmbedCheckbox)["Selected"], "true") + self.assertEqual(get_state_as_dict(xUserDataCheckbox)["Selected"], "false") + self.assertEqual(get_state_as_dict(xThumbSaveCheckbox)["Selected"], "false") + self.assertEqual(get_state_as_dict(xCommentsText)["Text"], "Comments text") + xResetBtn = xDialog.getChild("reset") + xResetBtn.executeAction("CLICK", tuple()) + xCancBtn = xDialog.getChild("cancel") + xCancBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/exchangeDatabase.py b/sw/qa/uitest/writer_tests2/exchangeDatabase.py index 1b2385e869fa..3f3a49660bfc 100644 --- a/sw/qa/uitest/writer_tests2/exchangeDatabase.py +++ b/sw/qa/uitest/writer_tests2/exchangeDatabase.py @@ -12,40 +12,44 @@ class exchangeDB(UITestCase): def test_exchange_database(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField") - xExDBDlg = self.xUITest.getTopFocusWindow() - xCloseBtn = xExDBDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField") + xExDBDlg = self.xUITest.getTopFocusWindow() + xCloseBtn = xExDBDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() def test_exchange_database2(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") + + self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField") + xExDBDlg = self.xUITest.getTopFocusWindow() + xTreelist = xExDBDlg.getChild("availablelb") - self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField") - xExDBDlg = self.xUITest.getTopFocusWindow() - xTreelist = xExDBDlg.getChild("availablelb") + xLabeldb = xExDBDlg.getChild("dbnameft") + self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "[None]") - xLabeldb = xExDBDlg.getChild("dbnameft") - self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "[None]") + xTreeEntry = xTreelist.getChild('0') #Available Databases + xTreeEntry.executeAction("EXPAND", tuple()) #Click on the Bibliography + xTreeEntry.executeAction("COLLAPSE", tuple()) + xTreeEntry.executeAction("EXPAND", tuple()) + xTreeEntry2 = xTreeEntry.getChild('0') #Available Databases + xTreeEntry2.executeAction("SELECT", tuple()) #Click on the biblio - xTreeEntry = xTreelist.getChild('0') #Available Databases - xTreeEntry.executeAction("EXPAND", tuple()) #Click on the Bibliography - xTreeEntry.executeAction("COLLAPSE", tuple()) - xTreeEntry.executeAction("EXPAND", tuple()) - xTreeEntry2 = xTreeEntry.getChild('0') #Available Databases - xTreeEntry2.executeAction("SELECT", tuple()) #Click on the biblio + xDefineBtn = xExDBDlg.getChild("ok") + xDefineBtn.executeAction("CLICK", tuple()) - xDefineBtn = xExDBDlg.getChild("ok") - xDefineBtn.executeAction("CLICK", tuple()) + self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField") + xExDBDlg = self.xUITest.getTopFocusWindow() + xLabeldb = xExDBDlg.getChild("dbnameft") + self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "Bibliography.biblio") - self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField") - xExDBDlg = self.xUITest.getTopFocusWindow() - xLabeldb = xExDBDlg.getChild("dbnameft") - self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "Bibliography.biblio") + xCloseBtn = xExDBDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) - xCloseBtn = xExDBDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/fontworks.py b/sw/qa/uitest/writer_tests2/fontworks.py index 9c415a7f60a5..d9ef76c10602 100644 --- a/sw/qa/uitest/writer_tests2/fontworks.py +++ b/sw/qa/uitest/writer_tests2/fontworks.py @@ -15,24 +15,26 @@ from uitest.uihelper import guarded class fontWorksDialog(UITestCase): def test_fontwork_selector(self): - with self.ui_test.create_doc_in_start_center("writer"): - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - with guarded.execute_dialog_through_command(self, ".uno:FontworkGalleryFloater", close_button="cancel") as xDialog: - FontWorkSelector = xDialog.getChild("ctlFavoriteswin") - # Select element with id (3) - element3 = FontWorkSelector.getChild("2") - element3.executeAction("SELECT", mkPropertyValues({})) - print(get_state_as_dict(FontWorkSelector)) - self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemPos"], "2") - self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemId"], "3") - self.assertEqual(get_state_as_dict(FontWorkSelector)["VisibleCount"], "36") + with guarded.execute_dialog_through_command(self, ".uno:FontworkGalleryFloater", close_button="cancel") as xDialog: + FontWorkSelector = xDialog.getChild("ctlFavoriteswin") + # Select element with id (3) + element3 = FontWorkSelector.getChild("2") + element3.executeAction("SELECT", mkPropertyValues({})) + print(get_state_as_dict(FontWorkSelector)) + self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemPos"], "2") + self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemId"], "3") + self.assertEqual(get_state_as_dict(FontWorkSelector)["VisibleCount"], "36") - # Select element with id (7) - element7 = FontWorkSelector.getChild("6") - element7.executeAction("SELECT", mkPropertyValues({})) - self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemPos"], "6") - self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemId"], "7") + # Select element with id (7) + element7 = FontWorkSelector.getChild("6") + element7.executeAction("SELECT", mkPropertyValues({})) + self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemPos"], "6") + self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemId"], "7") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py index af99ebc7f647..4633666f468d 100644 --- a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py +++ b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py @@ -15,304 +15,315 @@ from uitest.uihelper.common import change_measurement_unit class formatBulletsNumbering(UITestCase): def test_bullets_and_numbering_dialog_tab_position(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - - change_measurement_unit(self, "Millimeter") - - self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xalignedatmf = xDialog.getChild("alignedatmf") - xnum2alignlb = xDialog.getChild("num2alignlb") - xatmf = xDialog.getChild("atmf") - xindentatmf = xDialog.getChild("indentatmf") - xokbtn = xDialog.getChild("ok") - - xalignedatmf.executeAction("UP", tuple()) - select_by_text(xnum2alignlb, "Centered") - xatmf.executeAction("UP", tuple()) - xindentatmf.executeAction("UP", tuple()) - - self.ui_test.close_dialog_through_button(xokbtn) - - self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xalignedatmf = xDialog.getChild("alignedatmf") - xnum2alignlb = xDialog.getChild("num2alignlb") - xatmf = xDialog.getChild("atmf") - xindentatmf = xDialog.getChild("indentatmf") - - self.assertEqual(get_state_as_dict(xalignedatmf)["Text"], "6.5 mm") - self.assertEqual(get_state_as_dict(xnum2alignlb)["SelectEntryText"], "Centered") - self.assertEqual(get_state_as_dict(xatmf)["Text"], "12.8 mm") - self.assertEqual(get_state_as_dict(xindentatmf)["Text"], "12.8 mm") - - 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() + + change_measurement_unit(self, "Millimeter") + + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xalignedatmf = xDialog.getChild("alignedatmf") + xnum2alignlb = xDialog.getChild("num2alignlb") + xatmf = xDialog.getChild("atmf") + xindentatmf = xDialog.getChild("indentatmf") + xokbtn = xDialog.getChild("ok") + + xalignedatmf.executeAction("UP", tuple()) + select_by_text(xnum2alignlb, "Centered") + xatmf.executeAction("UP", tuple()) + xindentatmf.executeAction("UP", tuple()) + + self.ui_test.close_dialog_through_button(xokbtn) + + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xalignedatmf = xDialog.getChild("alignedatmf") + xnum2alignlb = xDialog.getChild("num2alignlb") + xatmf = xDialog.getChild("atmf") + xindentatmf = xDialog.getChild("indentatmf") + + self.assertEqual(get_state_as_dict(xalignedatmf)["Text"], "6.5 mm") + self.assertEqual(get_state_as_dict(xnum2alignlb)["SelectEntryText"], "Centered") + self.assertEqual(get_state_as_dict(xatmf)["Text"], "12.8 mm") + self.assertEqual(get_state_as_dict(xindentatmf)["Text"], "12.8 mm") + + xcancbtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancbtn) + + self.ui_test.close_doc() def test_bullets_and_numbering_dialog_tab_position2(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:BulletsAndNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xnumfollowedbylb = xDialog.getChild("numfollowedbylb") - select_by_text(xnumfollowedbylb, "Space") - - xokbtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xokbtn) - - self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xnumfollowedbylb = xDialog.getChild("numfollowedbylb") - self.assertEqual(get_state_as_dict(xnumfollowedbylb)["SelectEntryText"], "Space") - - 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:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xnumfollowedbylb = xDialog.getChild("numfollowedbylb") + select_by_text(xnumfollowedbylb, "Space") + + xokbtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xokbtn) + + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xnumfollowedbylb = xDialog.getChild("numfollowedbylb") + self.assertEqual(get_state_as_dict(xnumfollowedbylb)["SelectEntryText"], "Space") + + xcancbtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancbtn) + + self.ui_test.close_doc() def test_bullets_and_numbering_dialog_tab_customize(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:BulletsAndNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") - xnumfmtlb = xDialog.getChild("numfmtlb") - xstartat = xDialog.getChild("startat") - xcharstyle = xDialog.getChild("charstyle") - xprefix = xDialog.getChild("prefix") - xsuffix = xDialog.getChild("suffix") - xallsame = xDialog.getChild("allsame") - - select_by_text(xnumfmtlb, "A, B, C, ...") - xstartat.executeAction("UP", tuple()) - select_by_text(xcharstyle, "Bullets") - xprefix.executeAction("TYPE", mkPropertyValues({"TEXT":"o"})) - xsuffix.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xsuffix.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) - xallsame.executeAction("CLICK", tuple()) - - xokbtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xokbtn) - - self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") - xnumfmtlb = xDialog.getChild("numfmtlb") - xstartat = xDialog.getChild("startat") - xcharstyle = xDialog.getChild("charstyle") - xprefix = xDialog.getChild("prefix") - xsuffix = xDialog.getChild("suffix") - xallsame = xDialog.getChild("allsame") - - self.assertEqual(get_state_as_dict(xnumfmtlb)["SelectEntryText"], "A, B, C, ...") - self.assertEqual(get_state_as_dict(xstartat)["Text"], "2") - self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "Bullets") - self.assertEqual(get_state_as_dict(xprefix)["Text"], "o") - self.assertEqual(get_state_as_dict(xsuffix)["Text"], "a") - self.assertEqual(get_state_as_dict(xallsame)["Selected"], "true") - - xcancbtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xcancbtn) - - self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") - - xremovebtn = xDialog.getChild("user") - self.ui_test.close_dialog_through_button(xremovebtn) #remove new settings, back to default - - self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") - xnumfmtlb = xDialog.getChild("numfmtlb") - xstartat = xDialog.getChild("startat") - xcharstyle = xDialog.getChild("charstyle") - xprefix = xDialog.getChild("prefix") - xsuffix = xDialog.getChild("suffix") - xallsame = xDialog.getChild("allsame") - - self.assertEqual(get_state_as_dict(xnumfmtlb)["SelectEntryText"], "1, 2, 3, ...") - self.assertEqual(get_state_as_dict(xstartat)["Text"], "1") - self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "None") - self.assertEqual(get_state_as_dict(xprefix)["Text"], "") - self.assertEqual(get_state_as_dict(xsuffix)["Text"], ".") - self.assertEqual(get_state_as_dict(xallsame)["Selected"], "false") - - 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:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + xnumfmtlb = xDialog.getChild("numfmtlb") + xstartat = xDialog.getChild("startat") + xcharstyle = xDialog.getChild("charstyle") + xprefix = xDialog.getChild("prefix") + xsuffix = xDialog.getChild("suffix") + xallsame = xDialog.getChild("allsame") + + select_by_text(xnumfmtlb, "A, B, C, ...") + xstartat.executeAction("UP", tuple()) + select_by_text(xcharstyle, "Bullets") + xprefix.executeAction("TYPE", mkPropertyValues({"TEXT":"o"})) + xsuffix.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xsuffix.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) + xallsame.executeAction("CLICK", tuple()) + + xokbtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xokbtn) + + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + xnumfmtlb = xDialog.getChild("numfmtlb") + xstartat = xDialog.getChild("startat") + xcharstyle = xDialog.getChild("charstyle") + xprefix = xDialog.getChild("prefix") + xsuffix = xDialog.getChild("suffix") + xallsame = xDialog.getChild("allsame") + + self.assertEqual(get_state_as_dict(xnumfmtlb)["SelectEntryText"], "A, B, C, ...") + self.assertEqual(get_state_as_dict(xstartat)["Text"], "2") + self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "Bullets") + self.assertEqual(get_state_as_dict(xprefix)["Text"], "o") + self.assertEqual(get_state_as_dict(xsuffix)["Text"], "a") + self.assertEqual(get_state_as_dict(xallsame)["Selected"], "true") + + xcancbtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancbtn) + + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xremovebtn = xDialog.getChild("user") + self.ui_test.close_dialog_through_button(xremovebtn) #remove new settings, back to default + + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + xnumfmtlb = xDialog.getChild("numfmtlb") + xstartat = xDialog.getChild("startat") + xcharstyle = xDialog.getChild("charstyle") + xprefix = xDialog.getChild("prefix") + xsuffix = xDialog.getChild("suffix") + xallsame = xDialog.getChild("allsame") + + self.assertEqual(get_state_as_dict(xnumfmtlb)["SelectEntryText"], "1, 2, 3, ...") + self.assertEqual(get_state_as_dict(xstartat)["Text"], "1") + self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "None") + self.assertEqual(get_state_as_dict(xprefix)["Text"], "") + self.assertEqual(get_state_as_dict(xsuffix)["Text"], ".") + self.assertEqual(get_state_as_dict(xallsame)["Selected"], "false") + + xcancbtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancbtn) + + self.ui_test.close_doc() def test_bullets_and_numbering_tab_move(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") - - change_measurement_unit(self, "Millimeter") - - self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xindentatmf = xDialog.getChild("indentatmf") - indentValue = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] - - xokbtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xokbtn) #create bullets - - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) #TAB to move indent right - self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xindentatmf = xDialog.getChild("indentatmf") - indentValue2 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] - self.assertEqual(indentValue < indentValue2 , True) - xcancbtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xcancbtn) - - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) - self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xindentatmf = xDialog.getChild("indentatmf") - indentValue3 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] - self.assertEqual(indentValue == indentValue3 , True) - 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() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + change_measurement_unit(self, "Millimeter") + + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xindentatmf = xDialog.getChild("indentatmf") + indentValue = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] + + xokbtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xokbtn) #create bullets + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) #TAB to move indent right + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xindentatmf = xDialog.getChild("indentatmf") + indentValue2 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] + self.assertEqual(indentValue < indentValue2 , True) + xcancbtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancbtn) + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xindentatmf = xDialog.getChild("indentatmf") + indentValue3 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] + self.assertEqual(indentValue == indentValue3 , True) + xcancbtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancbtn) + + self.ui_test.close_doc() def test_bullets_and_numbering_button_move(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - - change_measurement_unit(self, "Millimeter") - - self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xindentatmf = xDialog.getChild("indentatmf") - indentValue = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] - - xokbtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xokbtn) #create bullets - - self.xUITest.executeCommand(".uno:DecrementSubLevels") - self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xindentatmf = xDialog.getChild("indentatmf") - indentValue2 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] - self.assertEqual(indentValue < indentValue2 , True) - xcancbtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xcancbtn) - - self.xUITest.executeCommand(".uno:IncrementLevel") - self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xindentatmf = xDialog.getChild("indentatmf") - indentValue3 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] - self.assertEqual(indentValue == indentValue3 , True) - 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() + + change_measurement_unit(self, "Millimeter") + + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xindentatmf = xDialog.getChild("indentatmf") + indentValue = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] + + xokbtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xokbtn) #create bullets + + self.xUITest.executeCommand(".uno:DecrementSubLevels") + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xindentatmf = xDialog.getChild("indentatmf") + indentValue2 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] + self.assertEqual(indentValue < indentValue2 , True) + xcancbtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancbtn) + + self.xUITest.executeCommand(".uno:IncrementLevel") + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xindentatmf = xDialog.getChild("indentatmf") + indentValue3 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] + self.assertEqual(indentValue == indentValue3 , True) + xcancbtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancbtn) + + self.ui_test.close_doc() def test_bullets_and_numbering_selection(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - - # Test Bullet Page - self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - - # Select the BulletPage's Selector - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xBulletPage = xDialog.getChild("PickBulletPage") - xselector = xBulletPage.getChild("valueset") - self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "8") - # Select element num 3 - xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "3"})) - self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "2") - self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "3") - self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Solid diamond bullets") - # Select element num 7 - xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "7"})) - self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "6") - self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "7") - self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Cross mark bullets") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - # Test other Pages - self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - # Select the NumberingPage's Selector - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - xNumberingPage = xDialog.getChild("PickNumberingPage") - xselector = xNumberingPage.getChild("valueset") - self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "8") - # Select element num 5 - xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "5"})) - self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "4") - self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "5") - self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Uppercase letter A) B) C)") - # Select element num 8 - xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "8"})) - self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "7") - self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "8") - self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Lowercase Roman number i. ii. iii.") - - # Select the OutlinePage's Selector - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "2") - xOutlinePage = xDialog.getChild("PickOutlinePage") - xselector = xOutlinePage.getChild("valueset") - self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "8") - # Select element num 1 - xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "1"})) - self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "0") - self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "1") - self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Numeric, numeric, lowercase letters, solid small circular bullet") - - # Select the GraphicPage's Selector - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "3") - xGraphicPage = xDialog.getChild("PickGraphicPage") - xselector = xGraphicPage.getChild("valueset") - self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "92") - # Select element num 22 - xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "22"})) - self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "21") - self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "22") - # Select element num 73 - xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "73"})) - self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "72") - self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "73") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + # Test Bullet Page + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + + # Select the BulletPage's Selector + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xBulletPage = xDialog.getChild("PickBulletPage") + xselector = xBulletPage.getChild("valueset") + self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "8") + # Select element num 3 + xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "3"})) + self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "2") + self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "3") + self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Solid diamond bullets") + # Select element num 7 + xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "7"})) + self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "6") + self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "7") + self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Cross mark bullets") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + # Test other Pages + self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + # Select the NumberingPage's Selector + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + xNumberingPage = xDialog.getChild("PickNumberingPage") + xselector = xNumberingPage.getChild("valueset") + self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "8") + # Select element num 5 + xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "5"})) + self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "4") + self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "5") + self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Uppercase letter A) B) C)") + # Select element num 8 + xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "8"})) + self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "7") + self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "8") + self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Lowercase Roman number i. ii. iii.") + + # Select the OutlinePage's Selector + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + xOutlinePage = xDialog.getChild("PickOutlinePage") + xselector = xOutlinePage.getChild("valueset") + self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "8") + # Select element num 1 + xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "1"})) + self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "0") + self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "1") + self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Numeric, numeric, lowercase letters, solid small circular bullet") + + # Select the GraphicPage's Selector + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + xGraphicPage = xDialog.getChild("PickGraphicPage") + xselector = xGraphicPage.getChild("valueset") + self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "92") + # Select element num 22 + xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "22"})) + self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "21") + self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "22") + # Select element num 73 + xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "73"})) + self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "72") + self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "73") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/formatCharacter.py b/sw/qa/uitest/writer_tests2/formatCharacter.py index 8c4e447953d4..c0106ddcd47e 100644 --- a/sw/qa/uitest/writer_tests2/formatCharacter.py +++ b/sw/qa/uitest/writer_tests2/formatCharacter.py @@ -14,258 +14,268 @@ from uitest.uihelper.common import select_by_text class formatCharacter(UITestCase): def test_format_character_tab_font(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:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - - xSizeFont = xDialog.getChild("westsizelb-cjk") - xSizeFontEast = xDialog.getChild("eastsizelb") - xSizeFontCTL = xDialog.getChild("ctlsizelb") - xLangFont = xDialog.getChild("westlanglb-cjk") - xLangFontEast = xDialog.getChild("eastlanglb") - xLangFontCTL = xDialog.getChild("ctllanglb") - - xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 - xSizeFontEast.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xSizeFontEast.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 - xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 - select_pos(xLangFont, "0") - select_pos(xLangFontEast, "0") - select_pos(xLangFontCTL, "0") - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xSizeFont = xDialog.getChild("westsizelb-cjk") - xSizeFontEast = xDialog.getChild("eastsizelb") - xSizeFontCTL = xDialog.getChild("ctlsizelb") - xLangFont = xDialog.getChild("westlanglb-cjk") - xLangFontEast = xDialog.getChild("eastlanglb") - xLangFontCTL = xDialog.getChild("ctllanglb") - - self.assertEqual(get_state_as_dict(xSizeFont)["Text"], "18 pt") - self.assertEqual(get_state_as_dict(xSizeFontEast)["Text"], "18 pt") - self.assertEqual(get_state_as_dict(xSizeFontCTL)["Text"], "18 pt") #check font size - self.assertEqual(get_state_as_dict(xLangFont)["Text"], "[None]") - self.assertEqual(get_state_as_dict(xLangFontEast)["SelectEntryText"], "[None]") - self.assertEqual(get_state_as_dict(xLangFontCTL)["SelectEntryText"], "[None]") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + 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:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + + xSizeFont = xDialog.getChild("westsizelb-cjk") + xSizeFontEast = xDialog.getChild("eastsizelb") + xSizeFontCTL = xDialog.getChild("ctlsizelb") + xLangFont = xDialog.getChild("westlanglb-cjk") + xLangFontEast = xDialog.getChild("eastlanglb") + xLangFontCTL = xDialog.getChild("ctllanglb") + + xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 + xSizeFontEast.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFontEast.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 + xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 + select_pos(xLangFont, "0") + select_pos(xLangFontEast, "0") + select_pos(xLangFontCTL, "0") + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xSizeFont = xDialog.getChild("westsizelb-cjk") + xSizeFontEast = xDialog.getChild("eastsizelb") + xSizeFontCTL = xDialog.getChild("ctlsizelb") + xLangFont = xDialog.getChild("westlanglb-cjk") + xLangFontEast = xDialog.getChild("eastlanglb") + xLangFontCTL = xDialog.getChild("ctllanglb") + + self.assertEqual(get_state_as_dict(xSizeFont)["Text"], "18 pt") + self.assertEqual(get_state_as_dict(xSizeFontEast)["Text"], "18 pt") + self.assertEqual(get_state_as_dict(xSizeFontCTL)["Text"], "18 pt") #check font size + self.assertEqual(get_state_as_dict(xLangFont)["Text"], "[None]") + self.assertEqual(get_state_as_dict(xLangFontEast)["SelectEntryText"], "[None]") + self.assertEqual(get_state_as_dict(xLangFontCTL)["SelectEntryText"], "[None]") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() def test_format_character_tab_font_effects(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:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - - xEffects = xDialog.getChild("effectslb") - xRelief = xDialog.getChild("relieflb") - xHidden = xDialog.getChild("hiddencb") - xOverline = xDialog.getChild("overlinelb") - xStrikeout = xDialog.getChild("strikeoutlb") - xUnderline = xDialog.getChild("underlinelb") - xEmphasis = xDialog.getChild("emphasislb") - xPosition = xDialog.getChild("positionlb") - - select_pos(xEffects, "1") - select_pos(xRelief, "1") - xHidden.executeAction("CLICK", tuple()) - select_pos(xOverline, "1") - select_pos(xStrikeout, "1") - select_pos(xUnderline, "1") - select_pos(xEmphasis, "1") - select_pos(xPosition, "1") - - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - - xEffects = xDialog.getChild("effectslb") - xRelief = xDialog.getChild("relieflb") - xHidden = xDialog.getChild("hiddencb") - xOverline = xDialog.getChild("overlinelb") - xStrikeout = xDialog.getChild("strikeoutlb") - xUnderline = xDialog.getChild("underlinelb") - xEmphasis = xDialog.getChild("emphasislb") - xPosition = xDialog.getChild("positionlb") - - self.assertEqual(get_state_as_dict(xEffects)["SelectEntryText"], "UPPERCASE") - self.assertEqual(get_state_as_dict(xRelief)["SelectEntryText"], "Embossed") - self.assertEqual(get_state_as_dict(xHidden)["Selected"], "true") - self.assertEqual(get_state_as_dict(xOverline)["SelectEntryText"], "Single") - self.assertEqual(get_state_as_dict(xStrikeout)["SelectEntryText"], "Single") - self.assertEqual(get_state_as_dict(xUnderline)["SelectEntryText"], "Single") - self.assertEqual(get_state_as_dict(xEmphasis)["SelectEntryText"], "Dot") - self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "Below text") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + 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:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + xEffects = xDialog.getChild("effectslb") + xRelief = xDialog.getChild("relieflb") + xHidden = xDialog.getChild("hiddencb") + xOverline = xDialog.getChild("overlinelb") + xStrikeout = xDialog.getChild("strikeoutlb") + xUnderline = xDialog.getChild("underlinelb") + xEmphasis = xDialog.getChild("emphasislb") + xPosition = xDialog.getChild("positionlb") + + select_pos(xEffects, "1") + select_pos(xRelief, "1") + xHidden.executeAction("CLICK", tuple()) + select_pos(xOverline, "1") + select_pos(xStrikeout, "1") + select_pos(xUnderline, "1") + select_pos(xEmphasis, "1") + select_pos(xPosition, "1") + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + xEffects = xDialog.getChild("effectslb") + xRelief = xDialog.getChild("relieflb") + xHidden = xDialog.getChild("hiddencb") + xOverline = xDialog.getChild("overlinelb") + xStrikeout = xDialog.getChild("strikeoutlb") + xUnderline = xDialog.getChild("underlinelb") + xEmphasis = xDialog.getChild("emphasislb") + xPosition = xDialog.getChild("positionlb") + + self.assertEqual(get_state_as_dict(xEffects)["SelectEntryText"], "UPPERCASE") + self.assertEqual(get_state_as_dict(xRelief)["SelectEntryText"], "Embossed") + self.assertEqual(get_state_as_dict(xHidden)["Selected"], "true") + self.assertEqual(get_state_as_dict(xOverline)["SelectEntryText"], "Single") + self.assertEqual(get_state_as_dict(xStrikeout)["SelectEntryText"], "Single") + self.assertEqual(get_state_as_dict(xUnderline)["SelectEntryText"], "Single") + self.assertEqual(get_state_as_dict(xEmphasis)["SelectEntryText"], "Dot") + self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "Below text") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() def test_format_character_tab_hyperlink(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:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - - xURL = xDialog.getChild("urled") - xURL.executeAction("TYPE", mkPropertyValues({"TEXT":"libreoffice.org"})) - xTexted = xDialog.getChild("texted") - xTexted.executeAction("TYPE", mkPropertyValues({"TEXT":"LibreOffice"})) - xName = xDialog.getChild("nameed") - xName.executeAction("TYPE", mkPropertyValues({"TEXT":"hyperlink"})) - - xVisited = xDialog.getChild("visitedlb") - select_by_text(xVisited, "Bullets") - xUnVisited = xDialog.getChild("unvisitedlb") - select_by_text(xUnVisited, "Bullets") - - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - - self.xUITest.executeCommand(".uno:GoLeft") - self.assertEqual(document.Text.String[0:11], "LibreOffice") - - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xURL = xDialog.getChild("urled") - xTexted = xDialog.getChild("texted") - xName = xDialog.getChild("nameed") - xVisited = xDialog.getChild("visitedlb") - xUnVisited = xDialog.getChild("unvisitedlb") - - self.assertEqual(get_state_as_dict(xURL)["Text"], "http://libreoffice.org/") - self.assertEqual(get_state_as_dict(xTexted)["Text"], "LibreOffice") - self.assertEqual(get_state_as_dict(xName)["Text"], "hyperlink") - self.assertEqual(get_state_as_dict(xVisited)["SelectEntryText"], "Bullets") - self.assertEqual(get_state_as_dict(xUnVisited)["SelectEntryText"], "Bullets") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + 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:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + xURL = xDialog.getChild("urled") + xURL.executeAction("TYPE", mkPropertyValues({"TEXT":"libreoffice.org"})) + xTexted = xDialog.getChild("texted") + xTexted.executeAction("TYPE", mkPropertyValues({"TEXT":"LibreOffice"})) + xName = xDialog.getChild("nameed") + xName.executeAction("TYPE", mkPropertyValues({"TEXT":"hyperlink"})) + + xVisited = xDialog.getChild("visitedlb") + select_by_text(xVisited, "Bullets") + xUnVisited = xDialog.getChild("unvisitedlb") + select_by_text(xUnVisited, "Bullets") + + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.xUITest.executeCommand(".uno:GoLeft") + self.assertEqual(document.Text.String[0:11], "LibreOffice") + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xURL = xDialog.getChild("urled") + xTexted = xDialog.getChild("texted") + xName = xDialog.getChild("nameed") + xVisited = xDialog.getChild("visitedlb") + xUnVisited = xDialog.getChild("unvisitedlb") + + self.assertEqual(get_state_as_dict(xURL)["Text"], "http://libreoffice.org/") + self.assertEqual(get_state_as_dict(xTexted)["Text"], "LibreOffice") + self.assertEqual(get_state_as_dict(xName)["Text"], "hyperlink") + self.assertEqual(get_state_as_dict(xVisited)["SelectEntryText"], "Bullets") + self.assertEqual(get_state_as_dict(xUnVisited)["SelectEntryText"], "Bullets") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + self.ui_test.close_doc() def test_format_character_tab_asian_layout(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() + 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:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "3") + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") - xTwolines = xDialog.getChild("twolines") - xTwolines.executeAction("CLICK", tuple()) + xTwolines = xDialog.getChild("twolines") + xTwolines.executeAction("CLICK", tuple()) - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "3") - xTwolines = xDialog.getChild("twolines") + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + xTwolines = xDialog.getChild("twolines") - self.assertEqual(get_state_as_dict(xTwolines)["Selected"], "true") - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + self.assertEqual(get_state_as_dict(xTwolines)["Selected"], "true") + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + self.ui_test.close_doc() def test_format_character_tab_position(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:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "2") - - xSuperscript = xDialog.getChild("superscript") - xRelFontSize = xDialog.getChild("fontsizesb") - x90deg = xDialog.getChild("90deg") - xScalewidth = xDialog.getChild("scalewidthsb") - xKerning = xDialog.getChild("kerningsb") - xPairKerning = xDialog.getChild("pairkerning") - xFitToLine = xDialog.getChild("fittoline") - - xSuperscript.executeAction("CLICK", tuple()) - xRelFontSize.executeAction("UP", tuple()) - x90deg.executeAction("CLICK", tuple()) - xScalewidth.executeAction("UP", tuple()) - xKerning.executeAction("UP", tuple()) - xPairKerning.executeAction("CLICK", tuple()) - xFitToLine.executeAction("CLICK", tuple()) - - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "2") - xSuperscript = xDialog.getChild("superscript") - xRelFontSize = xDialog.getChild("fontsizesb") - x90deg = xDialog.getChild("90deg") - xScalewidth = xDialog.getChild("scalewidthsb") - xKerning = xDialog.getChild("kerningsb") - xPairKerning = xDialog.getChild("pairkerning") - xFitToLine = xDialog.getChild("fittoline") - - self.assertEqual(get_state_as_dict(xSuperscript)["Checked"], "true") - self.assertEqual(get_state_as_dict(x90deg)["Checked"], "true") - self.assertEqual(get_state_as_dict(xScalewidth)["Text"], "100%") - self.assertEqual(get_state_as_dict(xKerning)["Text"], "0.1 pt") - self.assertEqual(get_state_as_dict(xPairKerning)["Selected"], "false") - self.assertEqual(get_state_as_dict(xFitToLine)["Selected"], "true") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + 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:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + + xSuperscript = xDialog.getChild("superscript") + xRelFontSize = xDialog.getChild("fontsizesb") + x90deg = xDialog.getChild("90deg") + xScalewidth = xDialog.getChild("scalewidthsb") + xKerning = xDialog.getChild("kerningsb") + xPairKerning = xDialog.getChild("pairkerning") + xFitToLine = xDialog.getChild("fittoline") + + xSuperscript.executeAction("CLICK", tuple()) + xRelFontSize.executeAction("UP", tuple()) + x90deg.executeAction("CLICK", tuple()) + xScalewidth.executeAction("UP", tuple()) + xKerning.executeAction("UP", tuple()) + xPairKerning.executeAction("CLICK", tuple()) + xFitToLine.executeAction("CLICK", tuple()) + + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + xSuperscript = xDialog.getChild("superscript") + xRelFontSize = xDialog.getChild("fontsizesb") + x90deg = xDialog.getChild("90deg") + xScalewidth = xDialog.getChild("scalewidthsb") + xKerning = xDialog.getChild("kerningsb") + xPairKerning = xDialog.getChild("pairkerning") + xFitToLine = xDialog.getChild("fittoline") + + self.assertEqual(get_state_as_dict(xSuperscript)["Checked"], "true") + self.assertEqual(get_state_as_dict(x90deg)["Checked"], "true") + self.assertEqual(get_state_as_dict(xScalewidth)["Text"], "100%") + self.assertEqual(get_state_as_dict(xKerning)["Text"], "0.1 pt") + self.assertEqual(get_state_as_dict(xPairKerning)["Selected"], "false") + self.assertEqual(get_state_as_dict(xFitToLine)["Selected"], "true") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() def test_format_character_tab_position_scalewidthsb(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:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "2") - - xScalewidth = xDialog.getChild("scalewidthsb") - xScalewidth.executeAction("UP", tuple()) - - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "2") - xScalewidth = xDialog.getChild("scalewidthsb") - self.assertEqual(get_state_as_dict(xScalewidth)["Text"], "101%") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + 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:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + + xScalewidth = xDialog.getChild("scalewidthsb") + xScalewidth.executeAction("UP", tuple()) + + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + xScalewidth = xDialog.getChild("scalewidthsb") + self.assertEqual(get_state_as_dict(xScalewidth)["Text"], "101%") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/formatParagraph.py b/sw/qa/uitest/writer_tests2/formatParagraph.py index 92b19a5c313f..00cce192cb0b 100644 --- a/sw/qa/uitest/writer_tests2/formatParagraph.py +++ b/sw/qa/uitest/writer_tests2/formatParagraph.py @@ -15,608 +15,625 @@ from uitest.uihelper.common import change_measurement_unit class formatParagraph(UITestCase): def test_format_paragraph_tab_indents_spacing(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:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - - xBeforeText = xDialog.getChild("spinED_LEFTINDENT") - xAfterText = xDialog.getChild("spinED_RIGHTINDENT") - xFirstLine = xDialog.getChild("spinED_FLINEINDENT") - xAutomaticChk = xDialog.getChild("checkCB_AUTO") - xAbovePar = xDialog.getChild("spinED_TOPDIST") - xBelowPar = xDialog.getChild("spinED_BOTTOMDIST") - xChkspace = xDialog.getChild("checkCB_CONTEXTUALSPACING") - xLineSpacing = xDialog.getChild("comboLB_LINEDIST") - xActivate = xDialog.getChild("checkCB_REGISTER") - - xBeforeText.executeAction("UP", tuple()) - xAfterText.executeAction("UP", tuple()) - xFirstLine.executeAction("UP", tuple()) - xAutomaticChk.executeAction("CLICK", tuple()) - xAbovePar.executeAction("UP", tuple()) - xBelowPar.executeAction("UP", tuple()) - xChkspace.executeAction("CLICK", tuple()) - select_by_text(xLineSpacing, "Double") - xActivate.executeAction("CLICK", tuple()) - - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xBeforeText = xDialog.getChild("spinED_LEFTINDENT") - xAfterText = xDialog.getChild("spinED_RIGHTINDENT") - xFirstLine = xDialog.getChild("spinED_FLINEINDENT") - xAutomaticChk = xDialog.getChild("checkCB_AUTO") - xAbovePar = xDialog.getChild("spinED_TOPDIST") - xBelowPar = xDialog.getChild("spinED_BOTTOMDIST") - xChkspace = xDialog.getChild("checkCB_CONTEXTUALSPACING") - xLineSpacing = xDialog.getChild("comboLB_LINEDIST") - xActivate = xDialog.getChild("checkCB_REGISTER") - - self.assertEqual(get_state_as_dict(xBeforeText)["Text"], "0.50 ch") - self.assertEqual(get_state_as_dict(xAfterText)["Text"], "0.50 ch") - self.assertEqual(get_state_as_dict(xFirstLine)["Text"], "0.50 ch") - self.assertEqual(get_state_as_dict(xAutomaticChk)["Selected"], "true") - self.assertEqual(get_state_as_dict(xAbovePar)["Text"], "0.50 line") - self.assertEqual(get_state_as_dict(xBelowPar)["Text"], "0.50 line") - self.assertEqual(get_state_as_dict(xChkspace)["Selected"], "true") - self.assertEqual(get_state_as_dict(xLineSpacing)["SelectEntryText"], "Double") - self.assertEqual(get_state_as_dict(xActivate)["Selected"], "true") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + 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:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + + xBeforeText = xDialog.getChild("spinED_LEFTINDENT") + xAfterText = xDialog.getChild("spinED_RIGHTINDENT") + xFirstLine = xDialog.getChild("spinED_FLINEINDENT") + xAutomaticChk = xDialog.getChild("checkCB_AUTO") + xAbovePar = xDialog.getChild("spinED_TOPDIST") + xBelowPar = xDialog.getChild("spinED_BOTTOMDIST") + xChkspace = xDialog.getChild("checkCB_CONTEXTUALSPACING") + xLineSpacing = xDialog.getChild("comboLB_LINEDIST") + xActivate = xDialog.getChild("checkCB_REGISTER") + + xBeforeText.executeAction("UP", tuple()) + xAfterText.executeAction("UP", tuple()) + xFirstLine.executeAction("UP", tuple()) + xAutomaticChk.executeAction("CLICK", tuple()) + xAbovePar.executeAction("UP", tuple()) + xBelowPar.executeAction("UP", tuple()) + xChkspace.executeAction("CLICK", tuple()) + select_by_text(xLineSpacing, "Double") + xActivate.executeAction("CLICK", tuple()) + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xBeforeText = xDialog.getChild("spinED_LEFTINDENT") + xAfterText = xDialog.getChild("spinED_RIGHTINDENT") + xFirstLine = xDialog.getChild("spinED_FLINEINDENT") + xAutomaticChk = xDialog.getChild("checkCB_AUTO") + xAbovePar = xDialog.getChild("spinED_TOPDIST") + xBelowPar = xDialog.getChild("spinED_BOTTOMDIST") + xChkspace = xDialog.getChild("checkCB_CONTEXTUALSPACING") + xLineSpacing = xDialog.getChild("comboLB_LINEDIST") + xActivate = xDialog.getChild("checkCB_REGISTER") + + self.assertEqual(get_state_as_dict(xBeforeText)["Text"], "0.50 ch") + self.assertEqual(get_state_as_dict(xAfterText)["Text"], "0.50 ch") + self.assertEqual(get_state_as_dict(xFirstLine)["Text"], "0.50 ch") + self.assertEqual(get_state_as_dict(xAutomaticChk)["Selected"], "true") + self.assertEqual(get_state_as_dict(xAbovePar)["Text"], "0.50 line") + self.assertEqual(get_state_as_dict(xBelowPar)["Text"], "0.50 line") + self.assertEqual(get_state_as_dict(xChkspace)["Selected"], "true") + self.assertEqual(get_state_as_dict(xLineSpacing)["SelectEntryText"], "Double") + self.assertEqual(get_state_as_dict(xActivate)["Selected"], "true") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() def test_format_paragraph_tab_alignment(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:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - - xTextDirection = xDialog.getChild("comboLB_TEXTDIRECTION") - xAlignment = xDialog.getChild("comboLB_VERTALIGN") - xSnapToText = xDialog.getChild("checkCB_SNAP") - xJustified = xDialog.getChild("radioBTN_JUSTIFYALIGN") - xLastLine = xDialog.getChild("comboLB_LASTLINE") - xExpandChk = xDialog.getChild("checkCB_EXPAND") - - select_by_text(xTextDirection, "Left-to-right (LTR)") - select_by_text(xAlignment, "Top") - xSnapToText.executeAction("CLICK", tuple()) - xJustified.executeAction("CLICK", tuple()) - select_by_text(xLastLine, "Justified") - xExpandChk.executeAction("CLICK", tuple()) - - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - - xTextDirection = xDialog.getChild("comboLB_TEXTDIRECTION") - xAlignment = xDialog.getChild("comboLB_VERTALIGN") - xSnapToText = xDialog.getChild("checkCB_SNAP") - xJustified = xDialog.getChild("radioBTN_JUSTIFYALIGN") - xLastLine = xDialog.getChild("comboLB_LASTLINE") - xExpandChk = xDialog.getChild("checkCB_EXPAND") - - self.assertEqual(get_state_as_dict(xTextDirection)["SelectEntryText"], "Left-to-right (LTR)") - self.assertEqual(get_state_as_dict(xAlignment)["SelectEntryText"], "Top") - self.assertEqual(get_state_as_dict(xSnapToText)["Selected"], "false") - self.assertEqual(get_state_as_dict(xJustified)["Checked"], "true") - self.assertEqual(get_state_as_dict(xLastLine)["SelectEntryText"], "Justified") - self.assertEqual(get_state_as_dict(xExpandChk)["Selected"], "true") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + 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:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + xTextDirection = xDialog.getChild("comboLB_TEXTDIRECTION") + xAlignment = xDialog.getChild("comboLB_VERTALIGN") + xSnapToText = xDialog.getChild("checkCB_SNAP") + xJustified = xDialog.getChild("radioBTN_JUSTIFYALIGN") + xLastLine = xDialog.getChild("comboLB_LASTLINE") + xExpandChk = xDialog.getChild("checkCB_EXPAND") + + select_by_text(xTextDirection, "Left-to-right (LTR)") + select_by_text(xAlignment, "Top") + xSnapToText.executeAction("CLICK", tuple()) + xJustified.executeAction("CLICK", tuple()) + select_by_text(xLastLine, "Justified") + xExpandChk.executeAction("CLICK", tuple()) + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + xTextDirection = xDialog.getChild("comboLB_TEXTDIRECTION") + xAlignment = xDialog.getChild("comboLB_VERTALIGN") + xSnapToText = xDialog.getChild("checkCB_SNAP") + xJustified = xDialog.getChild("radioBTN_JUSTIFYALIGN") + xLastLine = xDialog.getChild("comboLB_LASTLINE") + xExpandChk = xDialog.getChild("checkCB_EXPAND") + + self.assertEqual(get_state_as_dict(xTextDirection)["SelectEntryText"], "Left-to-right (LTR)") + self.assertEqual(get_state_as_dict(xAlignment)["SelectEntryText"], "Top") + self.assertEqual(get_state_as_dict(xSnapToText)["Selected"], "false") + self.assertEqual(get_state_as_dict(xJustified)["Checked"], "true") + self.assertEqual(get_state_as_dict(xLastLine)["SelectEntryText"], "Justified") + self.assertEqual(get_state_as_dict(xExpandChk)["Selected"], "true") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() def test_format_paragraph_tab_text_flow(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:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "2") - - xAutomaticaly = xDialog.getChild("checkAuto") - xEnd = xDialog.getChild("spinLineEnd") - xBegin = xDialog.getChild("spinLineBegin") - xMax = xDialog.getChild("spinMaxNum") - xIns = xDialog.getChild("checkInsert") - xType = xDialog.getChild("comboBreakType") - xPosition = xDialog.getChild("comboBreakPosition") - xspinOrphan = xDialog.getChild("spinOrphan") - xspinWidow = xDialog.getChild("spinWidow") - xcheckWidow = xDialog.getChild("checkWidow") - xcheckOrphan = xDialog.getChild("checkOrphan") - xcheckSplitPara = xDialog.getChild("checkSplitPara") - xcheckKeepPara = xDialog.getChild("checkKeepPara") - - xAutomaticaly.executeAction("CLICK", tuple()) - xEnd.executeAction("UP", tuple()) - xBegin.executeAction("UP", tuple()) - xMax.executeAction("UP", tuple()) - xIns.executeAction("CLICK", tuple()) - select_by_text(xType, "Column") - select_by_text(xPosition, "After") - xspinOrphan.executeAction("UP", tuple()) - xspinWidow.executeAction("UP", tuple()) - xcheckWidow.executeAction("CLICK", tuple()) - xcheckOrphan.executeAction("CLICK", tuple()) - xcheckSplitPara.executeAction("CLICK", tuple()) - xcheckKeepPara.executeAction("CLICK", tuple()) - - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "2") - - xAutomaticaly = xDialog.getChild("checkAuto") - xEnd = xDialog.getChild("spinLineEnd") - xBegin = xDialog.getChild("spinLineBegin") - xMax = xDialog.getChild("spinMaxNum") - xIns = xDialog.getChild("checkInsert") - xType = xDialog.getChild("comboBreakType") - xPosition = xDialog.getChild("comboBreakPosition") - xspinOrphan = xDialog.getChild("spinOrphan") - xspinWidow = xDialog.getChild("spinWidow") - xcheckWidow = xDialog.getChild("checkWidow") - xcheckOrphan = xDialog.getChild("checkOrphan") - xcheckSplitPara = xDialog.getChild("checkSplitPara") - xcheckKeepPara = xDialog.getChild("checkKeepPara") - - self.assertEqual(get_state_as_dict(xAutomaticaly)["Selected"], "true") - self.assertEqual(get_state_as_dict(xEnd)["Text"], "3") - self.assertEqual(get_state_as_dict(xBegin)["Text"], "3") - self.assertEqual(get_state_as_dict(xMax)["Text"], "1") - self.assertEqual(get_state_as_dict(xIns)["Selected"], "true") - self.assertEqual(get_state_as_dict(xType)["SelectEntryText"], "Column") - self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "After") - self.assertEqual(get_state_as_dict(xspinOrphan)["Text"], "2") - self.assertEqual(get_state_as_dict(xspinWidow)["Text"], "2") - self.assertEqual(get_state_as_dict(xcheckWidow)["Selected"], "false") - self.assertEqual(get_state_as_dict(xcheckOrphan)["Selected"], "false") - self.assertEqual(get_state_as_dict(xcheckSplitPara)["Selected"], "true") - self.assertEqual(get_state_as_dict(xcheckKeepPara)["Selected"], "true") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + 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:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + + xAutomaticaly = xDialog.getChild("checkAuto") + xEnd = xDialog.getChild("spinLineEnd") + xBegin = xDialog.getChild("spinLineBegin") + xMax = xDialog.getChild("spinMaxNum") + xIns = xDialog.getChild("checkInsert") + xType = xDialog.getChild("comboBreakType") + xPosition = xDialog.getChild("comboBreakPosition") + xspinOrphan = xDialog.getChild("spinOrphan") + xspinWidow = xDialog.getChild("spinWidow") + xcheckWidow = xDialog.getChild("checkWidow") + xcheckOrphan = xDialog.getChild("checkOrphan") + xcheckSplitPara = xDialog.getChild("checkSplitPara") + xcheckKeepPara = xDialog.getChild("checkKeepPara") + + xAutomaticaly.executeAction("CLICK", tuple()) + xEnd.executeAction("UP", tuple()) + xBegin.executeAction("UP", tuple()) + xMax.executeAction("UP", tuple()) + xIns.executeAction("CLICK", tuple()) + select_by_text(xType, "Column") + select_by_text(xPosition, "After") + xspinOrphan.executeAction("UP", tuple()) + xspinWidow.executeAction("UP", tuple()) + xcheckWidow.executeAction("CLICK", tuple()) + xcheckOrphan.executeAction("CLICK", tuple()) + xcheckSplitPara.executeAction("CLICK", tuple()) + xcheckKeepPara.executeAction("CLICK", tuple()) + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + + xAutomaticaly = xDialog.getChild("checkAuto") + xEnd = xDialog.getChild("spinLineEnd") + xBegin = xDialog.getChild("spinLineBegin") + xMax = xDialog.getChild("spinMaxNum") + xIns = xDialog.getChild("checkInsert") + xType = xDialog.getChild("comboBreakType") + xPosition = xDialog.getChild("comboBreakPosition") + xspinOrphan = xDialog.getChild("spinOrphan") + xspinWidow = xDialog.getChild("spinWidow") + xcheckWidow = xDialog.getChild("checkWidow") + xcheckOrphan = xDialog.getChild("checkOrphan") + xcheckSplitPara = xDialog.getChild("checkSplitPara") + xcheckKeepPara = xDialog.getChild("checkKeepPara") + + self.assertEqual(get_state_as_dict(xAutomaticaly)["Selected"], "true") + self.assertEqual(get_state_as_dict(xEnd)["Text"], "3") + self.assertEqual(get_state_as_dict(xBegin)["Text"], "3") + self.assertEqual(get_state_as_dict(xMax)["Text"], "1") + self.assertEqual(get_state_as_dict(xIns)["Selected"], "true") + self.assertEqual(get_state_as_dict(xType)["SelectEntryText"], "Column") + self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "After") + self.assertEqual(get_state_as_dict(xspinOrphan)["Text"], "2") + self.assertEqual(get_state_as_dict(xspinWidow)["Text"], "2") + self.assertEqual(get_state_as_dict(xcheckWidow)["Selected"], "false") + self.assertEqual(get_state_as_dict(xcheckOrphan)["Selected"], "false") + self.assertEqual(get_state_as_dict(xcheckSplitPara)["Selected"], "true") + self.assertEqual(get_state_as_dict(xcheckKeepPara)["Selected"], "true") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() def test_format_paragraph_tab_asian_typography(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() + 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:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "3") + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") - xcheckForbidList = xDialog.getChild("checkForbidList") - xcheckHangPunct = xDialog.getChild("checkHangPunct") - xcheckApplySpacing = xDialog.getChild("checkApplySpacing") + xcheckForbidList = xDialog.getChild("checkForbidList") + xcheckHangPunct = xDialog.getChild("checkHangPunct") + xcheckApplySpacing = xDialog.getChild("checkApplySpacing") - xcheckForbidList.executeAction("CLICK", tuple()) - xcheckHangPunct.executeAction("CLICK", tuple()) - xcheckApplySpacing.executeAction("CLICK", tuple()) + xcheckForbidList.executeAction("CLICK", tuple()) + xcheckHangPunct.executeAction("CLICK", tuple()) + xcheckApplySpacing.executeAction("CLICK", tuple()) - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "3") + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") - xcheckForbidList = xDialog.getChild("checkForbidList") - xcheckHangPunct = xDialog.getChild("checkHangPunct") - xcheckApplySpacing = xDialog.getChild("checkApplySpacing") + xcheckForbidList = xDialog.getChild("checkForbidList") + xcheckHangPunct = xDialog.getChild("checkHangPunct") + xcheckApplySpacing = xDialog.getChild("checkApplySpacing") - self.assertEqual(get_state_as_dict(xcheckForbidList)["Selected"], "false") - self.assertEqual(get_state_as_dict(xcheckHangPunct)["Selected"], "false") - self.assertEqual(get_state_as_dict(xcheckApplySpacing)["Selected"], "false") + self.assertEqual(get_state_as_dict(xcheckForbidList)["Selected"], "false") + self.assertEqual(get_state_as_dict(xcheckHangPunct)["Selected"], "false") + self.assertEqual(get_state_as_dict(xcheckApplySpacing)["Selected"], "false") - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() def test_format_paragraph_tab_outline_numbering(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:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - - xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL") - xNumbering = xDialog.getChild("comboLB_NUMBER_STYLE") - xPara = xDialog.getChild("checkCB_RESTART_PARACOUNT") - xParaSpin = xDialog.getChild("spinNF_RESTART_PARA") - - select_by_text(xOutline, "Level 1") - select_by_text(xNumbering, "Bullet •") - xPara.executeAction("CLICK", tuple()) - xParaSpin.executeAction("UP", tuple()) - - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - - xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL") - xNumbering = xDialog.getChild("comboLB_NUMBER_STYLE") - xPara = xDialog.getChild("checkCB_RESTART_PARACOUNT") - xParaSpin = xDialog.getChild("spinNF_RESTART_PARA") - - self.assertEqual(get_state_as_dict(xOutline)["SelectEntryText"], "Level 1") - self.assertEqual(get_state_as_dict(xNumbering)["SelectEntryText"], "Bullet •") - self.assertEqual(get_state_as_dict(xPara)["Selected"], "true") - self.assertEqual(get_state_as_dict(xParaSpin)["Text"], "2") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + 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:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL") + xNumbering = xDialog.getChild("comboLB_NUMBER_STYLE") + xPara = xDialog.getChild("checkCB_RESTART_PARACOUNT") + xParaSpin = xDialog.getChild("spinNF_RESTART_PARA") + + select_by_text(xOutline, "Level 1") + select_by_text(xNumbering, "Bullet •") + xPara.executeAction("CLICK", tuple()) + xParaSpin.executeAction("UP", tuple()) + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL") + xNumbering = xDialog.getChild("comboLB_NUMBER_STYLE") + xPara = xDialog.getChild("checkCB_RESTART_PARACOUNT") + xParaSpin = xDialog.getChild("spinNF_RESTART_PARA") + + self.assertEqual(get_state_as_dict(xOutline)["SelectEntryText"], "Level 1") + self.assertEqual(get_state_as_dict(xNumbering)["SelectEntryText"], "Bullet •") + self.assertEqual(get_state_as_dict(xPara)["Selected"], "true") + self.assertEqual(get_state_as_dict(xParaSpin)["Text"], "2") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() def test_format_paragraph_tab_tabs(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - - change_measurement_unit(self, "Centimeter") - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") - - xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL") - xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR") - xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER") - xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER") - xNewButtn = xDialog.getChild("buttonBTN_NEW") - xED_TABPOS = xDialog.getChild("ED_TABPOS") - - xDecimal.executeAction("CLICK", tuple()) - xDecimalTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xDecimalTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"i"})) - xFill.executeAction("CLICK", tuple()) - xFillTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xFillTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"p"})) - xED_TABPOS.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xED_TABPOS.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - xNewButtn.executeAction("CLICK", tuple()) - - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") - - xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL") - xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR") - xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER") - xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER") - xNewButtn = xDialog.getChild("buttonBTN_NEW") - xED_TABPOS = xDialog.getChild("ED_TABPOS") - - self.assertEqual(get_state_as_dict(xDecimal)["Checked"], "true") - self.assertEqual(get_state_as_dict(xDecimalTxt)["Text"], "i") - self.assertEqual(get_state_as_dict(xFill)["Checked"], "true") - self.assertEqual(get_state_as_dict(xFillTxt)["Text"], "p") - self.assertEqual(get_state_as_dict(xED_TABPOS)["Text"], "1.00 cm") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") - - xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER") - xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE") - xNewButtn = xDialog.getChild("buttonBTN_NEW") - - xCentered.executeAction("CLICK", tuple()) - xUnderscore.executeAction("CLICK", tuple()) - xNewButtn.executeAction("CLICK", tuple()) - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") - - xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER") - xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE") - self.assertEqual(get_state_as_dict(xCentered)["Checked"], "true") - self.assertEqual(get_state_as_dict(xUnderscore)["Checked"], "true") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") - - xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN") - xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE") - xNewButtn = xDialog.getChild("buttonBTN_NEW") - - xRight.executeAction("CLICK", tuple()) - xDashLine.executeAction("CLICK", tuple()) - xNewButtn.executeAction("CLICK", tuple()) - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") - - xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN") - xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE") - self.assertEqual(get_state_as_dict(xRight)["Checked"], "true") - self.assertEqual(get_state_as_dict(xDashLine)["Checked"], "true") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") - - xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN") - xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS") - xNewButtn = xDialog.getChild("buttonBTN_NEW") - - xLeft.executeAction("CLICK", tuple()) - xPointsLine.executeAction("CLICK", tuple()) - xNewButtn.executeAction("CLICK", tuple()) - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") - - xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN") - xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS") - self.assertEqual(get_state_as_dict(xLeft)["Checked"], "true") - self.assertEqual(get_state_as_dict(xPointsLine)["Checked"], "true") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + change_measurement_unit(self, "Centimeter") + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL") + xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR") + xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER") + xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER") + xNewButtn = xDialog.getChild("buttonBTN_NEW") + xED_TABPOS = xDialog.getChild("ED_TABPOS") + + xDecimal.executeAction("CLICK", tuple()) + xDecimalTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xDecimalTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"i"})) + xFill.executeAction("CLICK", tuple()) + xFillTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFillTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"p"})) + xED_TABPOS.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xED_TABPOS.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + xNewButtn.executeAction("CLICK", tuple()) + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL") + xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR") + xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER") + xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER") + xNewButtn = xDialog.getChild("buttonBTN_NEW") + xED_TABPOS = xDialog.getChild("ED_TABPOS") + + self.assertEqual(get_state_as_dict(xDecimal)["Checked"], "true") + self.assertEqual(get_state_as_dict(xDecimalTxt)["Text"], "i") + self.assertEqual(get_state_as_dict(xFill)["Checked"], "true") + self.assertEqual(get_state_as_dict(xFillTxt)["Text"], "p") + self.assertEqual(get_state_as_dict(xED_TABPOS)["Text"], "1.00 cm") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER") + xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE") + xNewButtn = xDialog.getChild("buttonBTN_NEW") + + xCentered.executeAction("CLICK", tuple()) + xUnderscore.executeAction("CLICK", tuple()) + xNewButtn.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER") + xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE") + self.assertEqual(get_state_as_dict(xCentered)["Checked"], "true") + self.assertEqual(get_state_as_dict(xUnderscore)["Checked"], "true") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN") + xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE") + xNewButtn = xDialog.getChild("buttonBTN_NEW") + + xRight.executeAction("CLICK", tuple()) + xDashLine.executeAction("CLICK", tuple()) + xNewButtn.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN") + xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE") + self.assertEqual(get_state_as_dict(xRight)["Checked"], "true") + self.assertEqual(get_state_as_dict(xDashLine)["Checked"], "true") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN") + xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS") + xNewButtn = xDialog.getChild("buttonBTN_NEW") + + xLeft.executeAction("CLICK", tuple()) + xPointsLine.executeAction("CLICK", tuple()) + xNewButtn.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN") + xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS") + self.assertEqual(get_state_as_dict(xLeft)["Checked"], "true") + self.assertEqual(get_state_as_dict(xPointsLine)["Checked"], "true") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() def test_format_paragraph_tab_drop_caps(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:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "6") - - xDisplay = xDialog.getChild("checkCB_SWITCH") - xWholeWord = xDialog.getChild("checkCB_WORD") - xLines = xDialog.getChild("spinFLD_LINES") - xSpaceToText = xDialog.getChild("spinFLD_DISTANCE") - xText = xDialog.getChild("entryEDT_TEXT") - xCharStyle = xDialog.getChild("comboBOX_TEMPLATE") - - xDisplay.executeAction("CLICK", tuple()) - xWholeWord.executeAction("CLICK", tuple()) - xLines.executeAction("UP", tuple()) - xSpaceToText.executeAction("UP", tuple()) - xText.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) - select_by_text(xCharStyle, "Definition") - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "6") - - xDisplay = xDialog.getChild("checkCB_SWITCH") - xWholeWord = xDialog.getChild("checkCB_WORD") - xLines = xDialog.getChild("spinFLD_LINES") - xSpaceToText = xDialog.getChild("spinFLD_DISTANCE") - xText = xDialog.getChild("entryEDT_TEXT") - xCharStyle = xDialog.getChild("comboBOX_TEMPLATE") - - self.assertEqual(get_state_as_dict(xDisplay)["Selected"], "true") - self.assertEqual(get_state_as_dict(xWholeWord)["Selected"], "true") - self.assertEqual(get_state_as_dict(xText)["Text"], "A") - self.assertEqual(get_state_as_dict(xCharStyle)["SelectEntryText"], "Definition") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + 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:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "6") + + xDisplay = xDialog.getChild("checkCB_SWITCH") + xWholeWord = xDialog.getChild("checkCB_WORD") + xLines = xDialog.getChild("spinFLD_LINES") + xSpaceToText = xDialog.getChild("spinFLD_DISTANCE") + xText = xDialog.getChild("entryEDT_TEXT") + xCharStyle = xDialog.getChild("comboBOX_TEMPLATE") + + xDisplay.executeAction("CLICK", tuple()) + xWholeWord.executeAction("CLICK", tuple()) + xLines.executeAction("UP", tuple()) + xSpaceToText.executeAction("UP", tuple()) + xText.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) + select_by_text(xCharStyle, "Definition") + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "6") + + xDisplay = xDialog.getChild("checkCB_SWITCH") + xWholeWord = xDialog.getChild("checkCB_WORD") + xLines = xDialog.getChild("spinFLD_LINES") + xSpaceToText = xDialog.getChild("spinFLD_DISTANCE") + xText = xDialog.getChild("entryEDT_TEXT") + xCharStyle = xDialog.getChild("comboBOX_TEMPLATE") + + self.assertEqual(get_state_as_dict(xDisplay)["Selected"], "true") + self.assertEqual(get_state_as_dict(xWholeWord)["Selected"], "true") + self.assertEqual(get_state_as_dict(xText)["Text"], "A") + self.assertEqual(get_state_as_dict(xCharStyle)["SelectEntryText"], "Definition") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() def test_format_paragraph_tab_borders(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - - change_measurement_unit(self, "Centimeter") - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "7") - - xStyle = xDialog.getChild("linestylelb") - xwidth = xDialog.getChild("linewidthmf") - xSync = xDialog.getChild("sync") - xLeft = xDialog.getChild("leftmf") - xRight = xDialog.getChild("rightmf") - xTop = xDialog.getChild("topmf") - xBottom = xDialog.getChild("bottommf") - xMerge = xDialog.getChild("mergewithnext") - - xwidth.executeAction("UP", tuple()) - xSync.executeAction("CLICK", tuple()) - xLeft.executeAction("UP", tuple()) - xLeft.executeAction("UP", tuple()) - xRight.executeAction("UP", tuple()) - xTop.executeAction("UP", tuple()) - xBottom.executeAction("UP", tuple()) - xMerge.executeAction("CLICK", tuple()) - - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "7") - - xStyle = xDialog.getChild("linestylelb") - xwidth = xDialog.getChild("linewidthmf") - xSync = xDialog.getChild("sync") - xLeft = xDialog.getChild("leftmf") - xRight = xDialog.getChild("rightmf") - xTop = xDialog.getChild("topmf") - xBottom = xDialog.getChild("bottommf") - xMerge = xDialog.getChild("mergewithnext") - - self.assertEqual(get_state_as_dict(xSync)["Selected"], "false") - self.assertEqual(get_state_as_dict(xMerge)["Selected"], "false") - self.assertEqual(get_state_as_dict(xLeft)["Text"], "0.20 cm") - self.assertEqual(get_state_as_dict(xRight)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(xTop)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(xBottom)["Text"], "0.10 cm") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + change_measurement_unit(self, "Centimeter") + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "7") + + xStyle = xDialog.getChild("linestylelb") + xwidth = xDialog.getChild("linewidthmf") + xSync = xDialog.getChild("sync") + xLeft = xDialog.getChild("leftmf") + xRight = xDialog.getChild("rightmf") + xTop = xDialog.getChild("topmf") + xBottom = xDialog.getChild("bottommf") + xMerge = xDialog.getChild("mergewithnext") + + xwidth.executeAction("UP", tuple()) + xSync.executeAction("CLICK", tuple()) + xLeft.executeAction("UP", tuple()) + xLeft.executeAction("UP", tuple()) + xRight.executeAction("UP", tuple()) + xTop.executeAction("UP", tuple()) + xBottom.executeAction("UP", tuple()) + xMerge.executeAction("CLICK", tuple()) + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "7") + + xStyle = xDialog.getChild("linestylelb") + xwidth = xDialog.getChild("linewidthmf") + xSync = xDialog.getChild("sync") + xLeft = xDialog.getChild("leftmf") + xRight = xDialog.getChild("rightmf") + xTop = xDialog.getChild("topmf") + xBottom = xDialog.getChild("bottommf") + xMerge = xDialog.getChild("mergewithnext") + + self.assertEqual(get_state_as_dict(xSync)["Selected"], "false") + self.assertEqual(get_state_as_dict(xMerge)["Selected"], "false") + self.assertEqual(get_state_as_dict(xLeft)["Text"], "0.20 cm") + self.assertEqual(get_state_as_dict(xRight)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTop)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xBottom)["Text"], "0.10 cm") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + self.ui_test.close_doc() def test_format_paragraph_area(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:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "8") - - xColor = xDialog.getChild("btncolor") - xGradient = xDialog.getChild("btngradient") - xBitmap = xDialog.getChild("btnbitmap") - xPattern = xDialog.getChild("btnpattern") - xHatch = xDialog.getChild("btnhatch") - - xColor.executeAction("CLICK", tuple()) - xGradient.executeAction("CLICK", tuple()) - xBitmap.executeAction("CLICK", tuple()) - xPattern.executeAction("CLICK", tuple()) - xHatch.executeAction("CLICK", tuple()) - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + 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:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "8") + + xColor = xDialog.getChild("btncolor") + xGradient = xDialog.getChild("btngradient") + xBitmap = xDialog.getChild("btnbitmap") + xPattern = xDialog.getChild("btnpattern") + xHatch = xDialog.getChild("btnhatch") + + xColor.executeAction("CLICK", tuple()) + xGradient.executeAction("CLICK", tuple()) + xBitmap.executeAction("CLICK", tuple()) + xPattern.executeAction("CLICK", tuple()) + xHatch.executeAction("CLICK", tuple()) + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + self.ui_test.close_doc() def test_format_paragraph_transparency(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:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "9") - - xTran = xDialog.getChild("RBT_TRANS_LINEAR") - xTranText = xDialog.getChild("MTR_TRANSPARENT") - - xTran.executeAction("CLICK", tuple()) - xTranText.executeAction("UP", tuple()) - - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "9") - - xTran = xDialog.getChild("RBT_TRANS_LINEAR") - xTranText = xDialog.getChild("MTR_TRANSPARENT") - - self.assertEqual(get_state_as_dict(xTran)["Checked"], "true") - self.assertEqual(get_state_as_dict(xTranText)["Text"], "51%") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "9") - - xGradient = xDialog.getChild("RBT_TRANS_GRADIENT") - xType = xDialog.getChild("LB_TRGR_GRADIENT_TYPES") - xAngle = xDialog.getChild("MTR_TRGR_ANGLE") - xBorder = xDialog.getChild("MTR_TRGR_BORDER") - xStart = xDialog.getChild("MTR_TRGR_START_VALUE") - xEnd = xDialog.getChild("MTR_TRGR_END_VALUE") - - xGradient.executeAction("CLICK", tuple()) - select_by_text(xType, "Axial") - xAngle.executeAction("UP", tuple()) - xBorder.executeAction("UP", tuple()) - xStart.executeAction("UP", tuple()) - xEnd.executeAction("UP", tuple()) - - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "9") - - xGradient = xDialog.getChild("RBT_TRANS_GRADIENT") - xType = xDialog.getChild("LB_TRGR_GRADIENT_TYPES") - xAngle = xDialog.getChild("MTR_TRGR_ANGLE") - xBorder = xDialog.getChild("MTR_TRGR_BORDER") - xStart = xDialog.getChild("MTR_TRGR_START_VALUE") - xEnd = xDialog.getChild("MTR_TRGR_END_VALUE") - - self.assertEqual(get_state_as_dict(xGradient)["Checked"], "true") - self.assertEqual(get_state_as_dict(xType)["SelectEntryText"], "Axial") - self.assertEqual(get_state_as_dict(xAngle)["Text"], "1°") - self.assertEqual(get_state_as_dict(xBorder)["Text"], "1%") - self.assertEqual(get_state_as_dict(xStart)["Text"], "1%") - self.assertEqual(get_state_as_dict(xEnd)["Text"], "1%") - - xCanc = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCanc) + 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:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "9") + + xTran = xDialog.getChild("RBT_TRANS_LINEAR") + xTranText = xDialog.getChild("MTR_TRANSPARENT") + + xTran.executeAction("CLICK", tuple()) + xTranText.executeAction("UP", tuple()) + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "9") + + xTran = xDialog.getChild("RBT_TRANS_LINEAR") + xTranText = xDialog.getChild("MTR_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xTran)["Checked"], "true") + self.assertEqual(get_state_as_dict(xTranText)["Text"], "51%") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "9") + + xGradient = xDialog.getChild("RBT_TRANS_GRADIENT") + xType = xDialog.getChild("LB_TRGR_GRADIENT_TYPES") + xAngle = xDialog.getChild("MTR_TRGR_ANGLE") + xBorder = xDialog.getChild("MTR_TRGR_BORDER") + xStart = xDialog.getChild("MTR_TRGR_START_VALUE") + xEnd = xDialog.getChild("MTR_TRGR_END_VALUE") + + xGradient.executeAction("CLICK", tuple()) + select_by_text(xType, "Axial") + xAngle.executeAction("UP", tuple()) + xBorder.executeAction("UP", tuple()) + xStart.executeAction("UP", tuple()) + xEnd.executeAction("UP", tuple()) + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "9") + + xGradient = xDialog.getChild("RBT_TRANS_GRADIENT") + xType = xDialog.getChild("LB_TRGR_GRADIENT_TYPES") + xAngle = xDialog.getChild("MTR_TRGR_ANGLE") + xBorder = xDialog.getChild("MTR_TRGR_BORDER") + xStart = xDialog.getChild("MTR_TRGR_START_VALUE") + xEnd = xDialog.getChild("MTR_TRGR_END_VALUE") + + self.assertEqual(get_state_as_dict(xGradient)["Checked"], "true") + self.assertEqual(get_state_as_dict(xType)["SelectEntryText"], "Axial") + self.assertEqual(get_state_as_dict(xAngle)["Text"], "1°") + self.assertEqual(get_state_as_dict(xBorder)["Text"], "1%") + self.assertEqual(get_state_as_dict(xStart)["Text"], "1%") + self.assertEqual(get_state_as_dict(xEnd)["Text"], "1%") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/horizontalLine.py b/sw/qa/uitest/writer_tests2/horizontalLine.py index 2324ed663495..f004badfc6ec 100644 --- a/sw/qa/uitest/writer_tests2/horizontalLine.py +++ b/sw/qa/uitest/writer_tests2/horizontalLine.py @@ -11,29 +11,30 @@ from uitest.uihelper.common import get_state_as_dict, type_text class WriterInsertHorizontalLine(UITestCase): def test_insert_horizontal_line(self): - with self.ui_test.create_doc_in_start_center("writer"): - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - type_text(xWriterEdit, "Test horizontal line") #write the text + type_text(xWriterEdit, "Test horizontal line") #write the text - self.xUITest.executeCommand(".uno:StyleApply?Style:string=Horizontal%20Line&FamilyName:string=ParagraphStyles") #insert horizontal line + self.xUITest.executeCommand(".uno:StyleApply?Style:string=Horizontal%20Line&FamilyName:string=ParagraphStyles") #insert horizontal line - self.ui_test.execute_dialog_through_command(".uno:EditStyle") #open style dialog - xDialog = self.xUITest.getTopFocusWindow() - xStyleNametxt = xDialog.getChild("name") - self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name - xCancBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancBtn) + self.ui_test.execute_dialog_through_command(".uno:EditStyle") #open style dialog + xDialog = self.xUITest.getTopFocusWindow() + xStyleNametxt = xDialog.getChild("name") + self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name + xCancBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancBtn) - self.xUITest.executeCommand(".uno:Undo") - self.xUITest.executeCommand(".uno:Redo") + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Redo") - self.ui_test.execute_dialog_through_command(".uno:EditStyle") #open style dialog - xDialog = self.xUITest.getTopFocusWindow() - xStyleNametxt = xDialog.getChild("name") - self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name - xCancBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancBtn) + self.ui_test.execute_dialog_through_command(".uno:EditStyle") #open style dialog + xDialog = self.xUITest.getTopFocusWindow() + xStyleNametxt = xDialog.getChild("name") + self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name + 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_tests2/insertFootnote.py b/sw/qa/uitest/writer_tests2/insertFootnote.py index 4144d2898d5c..e391f6520477 100644 --- a/sw/qa/uitest/writer_tests2/insertFootnote.py +++ b/sw/qa/uitest/writer_tests2/insertFootnote.py @@ -10,25 +10,26 @@ from uitest.uihelper.common import type_text class insertFootnote(UITestCase): def test_insert_footnote(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:InsertFootnote") + self.xUITest.executeCommand(".uno:InsertFootnote") - type_text(xWriterEdit, "LibreOffice") - self.assertEqual(document.Footnotes[0].String, "LibreOffice") - self.assertEqual(document.Footnotes.getCount(), 1) + type_text(xWriterEdit, "LibreOffice") + self.assertEqual(document.Footnotes[0].String, "LibreOffice") + self.assertEqual(document.Footnotes.getCount(), 1) - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.Footnotes[0].String, "") - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.Footnotes.getCount(), 0) - self.xUITest.executeCommand(".uno:Redo") - self.assertEqual(document.Footnotes[0].String, "") - self.assertEqual(document.Footnotes.getCount(), 1) - self.xUITest.executeCommand(".uno:Redo") - self.assertEqual(document.Footnotes[0].String, "LibreOffice") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Footnotes[0].String, "") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Footnotes.getCount(), 0) + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(document.Footnotes[0].String, "") + self.assertEqual(document.Footnotes.getCount(), 1) + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(document.Footnotes[0].String, "LibreOffice") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/pasteSpecial.py b/sw/qa/uitest/writer_tests2/pasteSpecial.py index 178b9d61d043..2af43215d99d 100644 --- a/sw/qa/uitest/writer_tests2/pasteSpecial.py +++ b/sw/qa/uitest/writer_tests2/pasteSpecial.py @@ -10,30 +10,32 @@ from uitest.uihelper.common import type_text class PasteSpecial(UITestCase): def test_pasteSpecial(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") - type_text(xWriterEdit, "test") + type_text(xWriterEdit, "test") - for i in range(5): - self.xUITest.executeCommand(".uno:SelectAll") - self.xUITest.executeCommand(".uno:Copy") + for i in range(5): + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Copy") - self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + xDialog = self.xUITest.getTopFocusWindow() - xList = xDialog.getChild('list') - xChild = xList.getChild(str(i)) + xList = xDialog.getChild('list') + xChild = xList.getChild(str(i)) - xChild.executeAction("SELECT", tuple()) + xChild.executeAction("SELECT", 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.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.Text.String, "test") + self.assertEqual(document.Text.String, "test") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/tdf116474.py b/sw/qa/uitest/writer_tests2/tdf116474.py index 81de4397ec47..e6436b73fd73 100644 --- a/sw/qa/uitest/writer_tests2/tdf116474.py +++ b/sw/qa/uitest/writer_tests2/tdf116474.py @@ -11,36 +11,37 @@ from uitest.uihelper.common import get_url_for_data_file class tdf116474(UITestCase): def test_tdf116474_insert_caption_undo(self): - with self.ui_test.create_doc_in_start_center("writer"): - xWriterDoc = self.xUITest.getTopFocusWindow() - document = self.ui_test.get_component() - text = document.getText() - cursor = text.createTextCursor() - textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject') - provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider') - graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice.jpg")})) - textGraphic.Graphic = graphic - text.insertTextContent(cursor, textGraphic, False) - #select image - document.getCurrentController().select(document.getDrawPage()[0]) - - 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"})) - - xOkBtn=xDialogCaption.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - - xFrame = document.TextFrames[0] - self.assertEqual(document.TextFrames[0].Text.String, "Figure 1: Caption") - self.assertEqual(document.GraphicObjects.getCount(), 1) #nr. of images - #Undo, redo - self.xUITest.executeCommand(".uno:Undo") - self.xUITest.executeCommand(".uno:Redo") - #Verify - self.assertEqual(document.TextFrames[0].Text.String, "Figure 1: Caption") - self.assertEqual(document.GraphicObjects.getCount(), 1) #nr. of images - + writer_doc = self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + text = document.getText() + cursor = text.createTextCursor() + textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject') + provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider') + graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice.jpg")})) + textGraphic.Graphic = graphic + text.insertTextContent(cursor, textGraphic, False) + #select image + document.getCurrentController().select(document.getDrawPage()[0]) + + 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"})) + + xOkBtn=xDialogCaption.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + xFrame = document.TextFrames[0] + self.assertEqual(document.TextFrames[0].Text.String, "Figure 1: Caption") + self.assertEqual(document.GraphicObjects.getCount(), 1) #nr. of images + #Undo, redo + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Redo") + #Verify + self.assertEqual(document.TextFrames[0].Text.String, "Figure 1: Caption") + self.assertEqual(document.GraphicObjects.getCount(), 1) #nr. of images + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/autoredactDialog.py b/sw/qa/uitest/writer_tests3/autoredactDialog.py index be0a794c2353..9d3281456ca1 100644 --- a/sw/qa/uitest/writer_tests3/autoredactDialog.py +++ b/sw/qa/uitest/writer_tests3/autoredactDialog.py @@ -46,82 +46,30 @@ class AutoRedactDialog(UITestCase): def test_open_AutoRedactDialog_writer(self): - with self.ui_test.create_doc_in_start_center("writer"): - xDialog = self.launch_and_get_autoredact_dialog() - xcancBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xcancBtn) + self.ui_test.create_doc_in_start_center("writer") + xDialog = self.launch_and_get_autoredact_dialog() + xcancBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancBtn) + self.ui_test.close_doc() def test_add_target(self): - with self.ui_test.create_doc_in_start_center("writer"): - xDialog = self.launch_and_get_autoredact_dialog() - xAddBtn = xDialog.getChild("add") - - # Make sure we are starting with an empty targets list - self.clearTargetsbox(xDialog) - - # Names need to be distinct - # ["target name", "target content"], - targets_list = [ - ["target1", "content1"], - ["target2", "content2"], - ["target3", "content3"], - ] - - for i in range(0, len(targets_list)): - self.add_target_counter = i - with self.ui_test.execute_blocking_action(xAddBtn.executeAction, args=('CLICK', ()), close_button="close") as dialog: - xNewNameTxt=dialog.getChild("name") - xNewContentTxt=dialog.getChild("content") - xTypeList = dialog.getChild("type") #0: Text, 1: Regex, 2: Predefined - - select_pos(xTypeList, 0) #Text - self.assertEqual(int(get_state_as_dict(xTypeList)["SelectEntryPos"]), 0) - - type_text(xNewNameTxt, targets_list[self.add_target_counter][0]) - type_text(xNewContentTxt, targets_list[self.add_target_counter][1]) - - # Make sure targets are added successfully - xTargetsListbox = xDialog.getChild("targets") - targets_box_state_dict = get_state_as_dict(xTargetsListbox) - self.assertEqual(int(targets_box_state_dict["Children"]), len(targets_list)) - - # Make sure targets are added with correct names and contents - for i in range(0, len(targets_list)): - child = xTargetsListbox.getChild(i) - child_text = self.parseTargetContent(child) - self.assertEqual(child_text[0], targets_list[i][0]) #name - self.assertEqual(child_text[2], targets_list[i][1]) #content - - xcancBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xcancBtn) - - # Now let's make sure the dialog remembers last state - xDialog = self.launch_and_get_autoredact_dialog() - xTargetsListbox = xDialog.getChild("targets") - targets_box_state_dict = get_state_as_dict(xTargetsListbox) - self.assertEqual(int(targets_box_state_dict["Children"]), len(targets_list)) - - # Make sure targets are remembered with correct names and contents - for i in range(0, len(targets_list)): - child = xTargetsListbox.getChild(i) - child_text = self.parseTargetContent(child) - self.assertEqual(child_text[0], targets_list[i][0]) #name - self.assertEqual(child_text[2], targets_list[i][1]) #content - - xcancBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xcancBtn) - - - def test_edit_target(self): - with self.ui_test.create_doc_in_start_center("writer"): - xDialog = self.launch_and_get_autoredact_dialog() - xAddBtn = xDialog.getChild("add") - xEditBtn = xDialog.getChild("edit") - - # Make sure we are starting with an empty targets list - self.clearTargetsbox(xDialog) - - # We first need to add a target so that we can edit it + self.ui_test.create_doc_in_start_center("writer") + xDialog = self.launch_and_get_autoredact_dialog() + xAddBtn = xDialog.getChild("add") + + # Make sure we are starting with an empty targets list + self.clearTargetsbox(xDialog) + + # Names need to be distinct + # ["target name", "target content"], + targets_list = [ + ["target1", "content1"], + ["target2", "content2"], + ["target3", "content3"], + ] + + for i in range(0, len(targets_list)): + self.add_target_counter = i with self.ui_test.execute_blocking_action(xAddBtn.executeAction, args=('CLICK', ()), close_button="close") as dialog: xNewNameTxt=dialog.getChild("name") xNewContentTxt=dialog.getChild("content") @@ -130,42 +78,99 @@ class AutoRedactDialog(UITestCase): select_pos(xTypeList, 0) #Text self.assertEqual(int(get_state_as_dict(xTypeList)["SelectEntryPos"]), 0) - type_text(xNewNameTxt, "TestTarget") - type_text(xNewContentTxt, "TestContent") + type_text(xNewNameTxt, targets_list[self.add_target_counter][0]) + type_text(xNewContentTxt, targets_list[self.add_target_counter][1]) + + # Make sure targets are added successfully + xTargetsListbox = xDialog.getChild("targets") + targets_box_state_dict = get_state_as_dict(xTargetsListbox) + self.assertEqual(int(targets_box_state_dict["Children"]), len(targets_list)) + + # Make sure targets are added with correct names and contents + for i in range(0, len(targets_list)): + child = xTargetsListbox.getChild(i) + child_text = self.parseTargetContent(child) + self.assertEqual(child_text[0], targets_list[i][0]) #name + self.assertEqual(child_text[2], targets_list[i][1]) #content + + xcancBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancBtn) + + # Now let's make sure the dialog remembers last state + xDialog = self.launch_and_get_autoredact_dialog() + xTargetsListbox = xDialog.getChild("targets") + targets_box_state_dict = get_state_as_dict(xTargetsListbox) + self.assertEqual(int(targets_box_state_dict["Children"]), len(targets_list)) + + # Make sure targets are remembered with correct names and contents + for i in range(0, len(targets_list)): + child = xTargetsListbox.getChild(i) + child_text = self.parseTargetContent(child) + self.assertEqual(child_text[0], targets_list[i][0]) #name + self.assertEqual(child_text[2], targets_list[i][1]) #content - # Make sure target is added successfully - xTargetsListbox = xDialog.getChild("targets") - targets_box_state_dict = get_state_as_dict(xTargetsListbox) - self.assertEqual(int(targets_box_state_dict["Children"]), 1) + xcancBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancBtn) - # Select the added target - target_entry = xTargetsListbox.getChild(0) - target_entry.executeAction("SELECT", tuple()) + self.ui_test.close_doc() - # Now edit the target - with self.ui_test.execute_blocking_action(xEditBtn.executeAction, args=('CLICK', ()), close_button="close") as dialog: - xNameTxt=dialog.getChild("name") - xContentTxt=dialog.getChild("content") - xNameTxt.executeAction("CLEAR", tuple()) - xContentTxt.executeAction("CLEAR", tuple()) + def test_edit_target(self): + self.ui_test.create_doc_in_start_center("writer") + xDialog = self.launch_and_get_autoredact_dialog() + xAddBtn = xDialog.getChild("add") + xEditBtn = xDialog.getChild("edit") + + # Make sure we are starting with an empty targets list + self.clearTargetsbox(xDialog) + + # We first need to add a target so that we can edit it + with self.ui_test.execute_blocking_action(xAddBtn.executeAction, args=('CLICK', ()), close_button="close") as dialog: + xNewNameTxt=dialog.getChild("name") + xNewContentTxt=dialog.getChild("content") + xTypeList = dialog.getChild("type") #0: Text, 1: Regex, 2: Predefined + + select_pos(xTypeList, 0) #Text + self.assertEqual(int(get_state_as_dict(xTypeList)["SelectEntryPos"]), 0) + + type_text(xNewNameTxt, "TestTarget") + type_text(xNewContentTxt, "TestContent") + + # Make sure target is added successfully + xTargetsListbox = xDialog.getChild("targets") + targets_box_state_dict = get_state_as_dict(xTargetsListbox) + self.assertEqual(int(targets_box_state_dict["Children"]), 1) + + # Select the added target + target_entry = xTargetsListbox.getChild(0) + target_entry.executeAction("SELECT", tuple()) + + # Now edit the target + with self.ui_test.execute_blocking_action(xEditBtn.executeAction, args=('CLICK', ()), close_button="close") as dialog: + xNameTxt=dialog.getChild("name") + xContentTxt=dialog.getChild("content") - type_text(xNameTxt, "TestTargetEdited") - type_text(xContentTxt, "TestContentEdited") + xNameTxt.executeAction("CLEAR", tuple()) + xContentTxt.executeAction("CLEAR", tuple()) + + type_text(xNameTxt, "TestTargetEdited") + type_text(xContentTxt, "TestContentEdited") + + # Make sure target is still there + xTargetsListbox = xDialog.getChild("targets") + targets_box_state_dict = get_state_as_dict(xTargetsListbox) + self.assertEqual(int(targets_box_state_dict["Children"]), 1) - # Make sure target is still there - xTargetsListbox = xDialog.getChild("targets") - targets_box_state_dict = get_state_as_dict(xTargetsListbox) - self.assertEqual(int(targets_box_state_dict["Children"]), 1) + # Make sure target has the new values + target_entry = xTargetsListbox.getChild(0) + target_text = self.parseTargetContent(target_entry) + self.assertEqual(target_text[0], "TestTargetEdited") #name + self.assertEqual(target_text[2], "TestContentEdited") #content - # Make sure target has the new values - target_entry = xTargetsListbox.getChild(0) - target_text = self.parseTargetContent(target_entry) - self.assertEqual(target_text[0], "TestTargetEdited") #name - self.assertEqual(target_text[2], "TestContentEdited") #content + xcancBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancBtn) - 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_tests3/customizeDialog.py b/sw/qa/uitest/writer_tests3/customizeDialog.py index 195a8e0bbffb..ca97fbe4e10e 100644 --- a/sw/qa/uitest/writer_tests3/customizeDialog.py +++ b/sw/qa/uitest/writer_tests3/customizeDialog.py @@ -15,113 +15,120 @@ class ConfigureDialog(UITestCase): def test_open_ConfigureDialog_writer(self): - with self.ui_test.create_doc_in_start_center("writer"): - self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.create_doc_in_start_center("writer") + self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") + xDialog = self.xUITest.getTopFocusWindow() - xcancBtn = xDialog.getChild("cancel") - xcancBtn.executeAction("CLICK", tuple()) + xcancBtn = xDialog.getChild("cancel") + xcancBtn.executeAction("CLICK", tuple()) - def test_search_filter(self): - with self.ui_test.create_doc_in_start_center("writer"): - self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") - xDialog = self.xUITest.getTopFocusWindow() - - xfunc = xDialog.getChild("functions") - xSearch = xDialog.getChild("searchEntry") - - initialEntryCount = get_state_as_dict(xfunc)["Children"] - self.assertTrue(initialEntryCount != 0) + self.ui_test.close_doc() - xSearch.executeAction("TYPE", mkPropertyValues({"TEXT":"format"})) - - # Wait for the search/filter op to be completed - timeout = time.time() + 1 - while time.time() < timeout: - filteredEntryCount = get_state_as_dict(xfunc)["Children"] - if filteredEntryCount != initialEntryCount: - break - time.sleep(0.1) + def test_search_filter(self): + self.ui_test.create_doc_in_start_center("writer") + self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") + xDialog = self.xUITest.getTopFocusWindow() - self.assertTrue(filteredEntryCount < initialEntryCount) + xfunc = xDialog.getChild("functions") + xSearch = xDialog.getChild("searchEntry") - xSearch.executeAction("CLEAR", tuple()) + initialEntryCount = get_state_as_dict(xfunc)["Children"] + self.assertTrue(initialEntryCount != 0) - # Wait for the search/filter op to be completed - timeout = time.time() + 1 - while time.time() < timeout: - finalEntryCount = get_state_as_dict(xfunc)["Children"] - if finalEntryCount != filteredEntryCount: - break - time.sleep(0.1) + xSearch.executeAction("TYPE", mkPropertyValues({"TEXT":"format"})) - self.assertEqual(initialEntryCount, finalEntryCount) + # Wait for the search/filter op to be completed + timeout = time.time() + 1 + while time.time() < timeout: + filteredEntryCount = get_state_as_dict(xfunc)["Children"] + if filteredEntryCount != initialEntryCount: + break + time.sleep(0.1) + self.assertTrue(filteredEntryCount < initialEntryCount) - xcancBtn = xDialog.getChild("cancel") #button Cancel - xcancBtn.executeAction("CLICK", tuple()) #click the button + xSearch.executeAction("CLEAR", tuple()) - def test_category_listbox(self): - with self.ui_test.create_doc_in_start_center("writer"): - self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") - xDialog = self.xUITest.getTopFocusWindow() + # Wait for the search/filter op to be completed + timeout = time.time() + 1 + while time.time() < timeout: + finalEntryCount = get_state_as_dict(xfunc)["Children"] + if finalEntryCount != filteredEntryCount: + break + time.sleep(0.1) - xFunc = xDialog.getChild("functions") - xCategory = xDialog.getChild("commandcategorylist") + self.assertEqual(initialEntryCount, finalEntryCount) - initialEntryCount = get_state_as_dict(xFunc)["Children"] - self.assertTrue(initialEntryCount != 0) - select_pos(xCategory, "1") - filteredEntryCount = get_state_as_dict(xFunc)["Children"] - self.assertTrue(filteredEntryCount < initialEntryCount) + xcancBtn = xDialog.getChild("cancel") #button Cancel + xcancBtn.executeAction("CLICK", tuple()) #click the button - select_pos(xCategory, "0") - finalEntryCount = get_state_as_dict(xFunc)["Children"] - self.assertEqual(initialEntryCount, finalEntryCount) + self.ui_test.close_doc() - xcancBtn = xDialog.getChild("cancel") #button Cancel - xcancBtn.executeAction("CLICK", tuple()) #click the button + def test_category_listbox(self): + self.ui_test.create_doc_in_start_center("writer") + self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") + xDialog = self.xUITest.getTopFocusWindow() - def test_tdf133862(self): - with self.ui_test.create_doc_in_start_center("writer"): + xFunc = xDialog.getChild("functions") + xCategory = xDialog.getChild("commandcategorylist") - self.xUITest.executeCommand(".uno:InsertObjectStarMath") + initialEntryCount = get_state_as_dict(xFunc)["Children"] + self.assertTrue(initialEntryCount != 0) - # Without the fix in place, calling customize dialog after inserting - # a formula object would crash - self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") - xDialog = self.xUITest.getTopFocusWindow() + select_pos(xCategory, "1") + filteredEntryCount = get_state_as_dict(xFunc)["Children"] + self.assertTrue(filteredEntryCount < initialEntryCount) - xcancBtn = xDialog.getChild("cancel") - xcancBtn.executeAction("CLICK", tuple()) + select_pos(xCategory, "0") + finalEntryCount = get_state_as_dict(xFunc)["Children"] + self.assertEqual(initialEntryCount, finalEntryCount) - def test_gear_button_menu(self): - with self.ui_test.create_doc_in_start_center("writer"): + xcancBtn = xDialog.getChild("cancel") #button Cancel + xcancBtn.executeAction("CLICK", tuple()) #click the button - self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") + self.ui_test.close_doc() - # Open the New Menu Dialog with id = 0 - xDialog = self.xUITest.getTopFocusWindow() - xmenugearbtn=xDialog.getChild("menugearbtn") + def test_tdf133862(self): + self.ui_test.create_doc_in_start_center("writer") - def show_dialog0(): - xmenugearbtn.executeAction("OPENFROMLIST", mkPropertyValues({"POS": "0" })) + self.xUITest.executeCommand(".uno:InsertObjectStarMath") - with self.ui_test.execute_blocking_action( action=show_dialog0, close_button="cancel"): - pass + # Without the fix in place, calling customize dialog after inserting + # a formula object would crash + self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") + xDialog = self.xUITest.getTopFocusWindow() - # Open the Rename Menu Dialog with id = 2 - xDialog = self.xUITest.getTopFocusWindow() - xmenugearbtn=xDialog.getChild("menugearbtn") - def show_dialog2(): - xmenugearbtn.executeAction("OPENFROMLIST", mkPropertyValues({"POS": "2"})) + xcancBtn = xDialog.getChild("cancel") + xcancBtn.executeAction("CLICK", tuple()) - with self.ui_test.execute_blocking_action( action=show_dialog2, close_button="cancel"): - pass + self.ui_test.close_doc() - xDialog = self.xUITest.getTopFocusWindow() - xcancBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xcancBtn) + def test_gear_button_menu(self): + self.ui_test.create_doc_in_start_center("writer") + + self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") + + # Open the New Menu Dialog with id = 0 + xDialog = self.xUITest.getTopFocusWindow() + xmenugearbtn=xDialog.getChild("menugearbtn") + def show_dialog0(): + xmenugearbtn.executeAction("OPENFROMLIST", mkPropertyValues({"POS": "0" })) + with self.ui_test.execute_blocking_action( action=show_dialog0, close_button="cancel"): + pass + + # Open the Rename Menu Dialog with id = 2 + xDialog = self.xUITest.getTopFocusWindow() + xmenugearbtn=xDialog.getChild("menugearbtn") + def show_dialog2(): + xmenugearbtn.executeAction("OPENFROMLIST", mkPropertyValues({"POS": "2"})) + with self.ui_test.execute_blocking_action( action=show_dialog2, close_button="cancel"): + pass + + xDialog = self.xUITest.getTopFocusWindow() + 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_tests3/hyperlinkdialog.py b/sw/qa/uitest/writer_tests3/hyperlinkdialog.py index 66535e04eecf..be48fa6a750d 100644 --- a/sw/qa/uitest/writer_tests3/hyperlinkdialog.py +++ b/sw/qa/uitest/writer_tests3/hyperlinkdialog.py @@ -18,63 +18,67 @@ class HyperlinkDialog(UITestCase): def test_hyperlink_dialog_vertical_tab(self): - with self.ui_test.create_doc_in_start_center("writer"): - MainWindow = self.xUITest.getTopFocusWindow() + self.ui_test.create_doc_in_start_center("writer") + MainWindow = self.xUITest.getTopFocusWindow() - self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") + xDialog = self.xUITest.getTopFocusWindow() - # Test the vertical tab - xtab=xDialog.getChild("tabcontrol") - self.assertEqual(get_state_as_dict(xtab)["PageCount"], "4") + # Test the vertical tab + xtab=xDialog.getChild("tabcontrol") + self.assertEqual(get_state_as_dict(xtab)["PageCount"], "4") - xtab.executeAction("SELECT", mkPropertyValues({"POS": "0"})) - self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~Internet") - self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "0") + xtab.executeAction("SELECT", mkPropertyValues({"POS": "0"})) + self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~Internet") + self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "0") - xtab.executeAction("SELECT", mkPropertyValues({"POS": "1"})) - self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~Mail") - self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "1") + xtab.executeAction("SELECT", mkPropertyValues({"POS": "1"})) + self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~Mail") + self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "1") - xtab.executeAction("SELECT", mkPropertyValues({"POS": "2"})) - self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~Document") - self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "2") + xtab.executeAction("SELECT", mkPropertyValues({"POS": "2"})) + self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~Document") + self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "2") - xtab.executeAction("SELECT", mkPropertyValues({"POS": "3"})) - self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~New Document") - self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "3") + xtab.executeAction("SELECT", mkPropertyValues({"POS": "3"})) + self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~New Document") + self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "3") - xcancel = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xcancel) + xcancel = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancel) + + self.ui_test.close_doc() def test_insert_hyperlink(self): - with self.ui_test.create_doc_in_start_center("writer"): - xMainWindow = self.xUITest.getTopFocusWindow() + self.ui_test.create_doc_in_start_center("writer") + xMainWindow = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") + xDialog = self.xUITest.getTopFocusWindow() - self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") - xDialog = self.xUITest.getTopFocusWindow() + # insert link + xtab=xDialog.getChild("tabcontrol") + xtab.executeAction("SELECT", mkPropertyValues({"POS": "0"})) - # insert link - xtab=xDialog.getChild("tabcontrol") - xtab.executeAction("SELECT", mkPropertyValues({"POS": "0"})) + xtarget = xDialog.getChild("target") + xtarget.executeAction("TYPE", mkPropertyValues({"TEXT": "http://www.libreoffice.org/"})) + self.assertEqual(get_state_as_dict(xtarget)["Text"], "http://www.libreoffice.org/") - xtarget = xDialog.getChild("target") - xtarget.executeAction("TYPE", mkPropertyValues({"TEXT": "http://www.libreoffice.org/"})) - self.assertEqual(get_state_as_dict(xtarget)["Text"], "http://www.libreoffice.org/") + xindication = xDialog.getChild("indication") + xindication.executeAction("TYPE", mkPropertyValues({"TEXT": "link"})) + self.assertEqual(get_state_as_dict(xindication)["Text"], "link") - xindication = xDialog.getChild("indication") - xindication.executeAction("TYPE", mkPropertyValues({"TEXT": "link"})) - self.assertEqual(get_state_as_dict(xindication)["Text"], "link") + xok = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xok) - xok = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xok) + # Check that the link is added + xMainWindow = self.xUITest.getTopFocusWindow() + xedit = xMainWindow.getChild("writer_edit") + xedit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "4"})) + self.assertEqual(get_state_as_dict(xedit)["SelectedText"], "link") - # Check that the link is added - xMainWindow = self.xUITest.getTopFocusWindow() - xedit = xMainWindow.getChild("writer_edit") - xedit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "4"})) - self.assertEqual(get_state_as_dict(xedit)["SelectedText"], "link") + self.ui_test.close_doc() def test_tdf141166(self): # Skip this test for --with-help=html and --with-help=online, as that would fail with a @@ -91,18 +95,19 @@ class HyperlinkDialog(UITestCase): if re.compile(r'XMLHELP\b').search(os.getenv('BUILD_TYPE')): return - with self.ui_test.create_doc_in_start_center("writer"): - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") - xDialog = self.xUITest.getTopFocusWindow() - xHelp = xDialog.getChild("help") - xHelp.executeAction('FOCUS', tuple()) + self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") + xDialog = self.xUITest.getTopFocusWindow() + xHelp = xDialog.getChild("help") + xHelp.executeAction('FOCUS', tuple()) - # Without the fix in place, this test would have crashed here - with self.ui_test.execute_blocking_action(xHelp.executeAction, - args=("CLICK", tuple()), close_button="cancel"): - pass + # Without the fix in place, this test would have crashed here + with self.ui_test.execute_blocking_action(xHelp.executeAction, + args=("CLICK", tuple()), close_button="cancel"): + pass + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/insertEndnote.py b/sw/qa/uitest/writer_tests3/insertEndnote.py index 940844a5d563..54dd15e346b5 100644 --- a/sw/qa/uitest/writer_tests3/insertEndnote.py +++ b/sw/qa/uitest/writer_tests3/insertEndnote.py @@ -10,25 +10,26 @@ from uitest.uihelper.common import type_text class insertEndnote(UITestCase): def test_insert_endnote(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:InsertEndnote") + self.xUITest.executeCommand(".uno:InsertEndnote") - type_text(xWriterEdit, "LibreOffice") + type_text(xWriterEdit, "LibreOffice") - self.assertEqual(document.Endnotes[0].String, "LibreOffice") - self.assertEqual(document.Endnotes.getCount(), 1) - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.Endnotes[0].String, "") - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.Endnotes.getCount(), 0) - self.xUITest.executeCommand(".uno:Redo") - self.assertEqual(document.Endnotes[0].String, "") - self.assertEqual(document.Endnotes.getCount(), 1) - self.xUITest.executeCommand(".uno:Redo") - self.assertEqual(document.Endnotes[0].String, "LibreOffice") + self.assertEqual(document.Endnotes[0].String, "LibreOffice") + self.assertEqual(document.Endnotes.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Endnotes[0].String, "") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Endnotes.getCount(), 0) + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(document.Endnotes[0].String, "") + self.assertEqual(document.Endnotes.getCount(), 1) + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(document.Endnotes[0].String, "LibreOffice") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/insertEnvelope.py b/sw/qa/uitest/writer_tests3/insertEnvelope.py index 4956965bfaae..0b5a8cfe99fb 100644 --- a/sw/qa/uitest/writer_tests3/insertEnvelope.py +++ b/sw/qa/uitest/writer_tests3/insertEnvelope.py @@ -14,35 +14,36 @@ from uitest.uihelper.common import get_state_as_dict class WriterInsertEnvelope(UITestCase): def test_insert_envelope(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:InsertEnvelope") + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope") - xDialog = self.xUITest.getTopFocusWindow() + xDialog = self.xUITest.getTopFocusWindow() - xAddrTxt= xDialog.getChild("addredit") - xSenderTxt = xDialog.getChild("senderedit") - xSenderCheckBox = xDialog.getChild("sender") + xAddrTxt= xDialog.getChild("addredit") + xSenderTxt = xDialog.getChild("senderedit") + xSenderCheckBox = xDialog.getChild("sender") - xAddrTxt.executeAction("SELECT", mkPropertyValues({"FROM": "1", "TO": "200"})) - xAddrTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xAddrTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"Address"})) + xAddrTxt.executeAction("SELECT", mkPropertyValues({"FROM": "1", "TO": "200"})) + xAddrTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xAddrTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"Address"})) - xSenderTxt.executeAction("SELECT", mkPropertyValues({"FROM": "1", "TO": "200"})) - xSenderTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xSenderTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"Sender"})) + xSenderTxt.executeAction("SELECT", mkPropertyValues({"FROM": "1", "TO": "200"})) + xSenderTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSenderTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"Sender"})) - xInsBtn = xDialog.getChild("user") - xInsBtn.executeAction("CLICK", tuple()) + xInsBtn = xDialog.getChild("user") + xInsBtn.executeAction("CLICK", tuple()) - self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope") - xDialog = self.xUITest.getTopFocusWindow() - xAddrTxt= xDialog.getChild("addredit") - xSenderTxt = xDialog.getChild("senderedit") - self.assertEqual(get_state_as_dict(xAddrTxt)["Text"], "Address") - self.assertEqual(get_state_as_dict(xSenderTxt)["Text"], "Sender") + self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope") + xDialog = self.xUITest.getTopFocusWindow() + xAddrTxt= xDialog.getChild("addredit") + xSenderTxt = xDialog.getChild("senderedit") + self.assertEqual(get_state_as_dict(xAddrTxt)["Text"], "Address") + self.assertEqual(get_state_as_dict(xSenderTxt)["Text"], "Sender") - xcancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xcancelBtn) + xcancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancelBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/insertFootEndnote.py b/sw/qa/uitest/writer_tests3/insertFootEndnote.py index 725f6577f64e..575abc9ab477 100644 --- a/sw/qa/uitest/writer_tests3/insertFootEndnote.py +++ b/sw/qa/uitest/writer_tests3/insertFootEndnote.py @@ -10,67 +10,68 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class insertFootEndnote(UITestCase): def test_insert_foot_endnote(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() - #Automatic - Footnote - self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") - xDialog = self.xUITest.getTopFocusWindow() - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - self.assertEqual(document.Footnotes.getCount(), 1) - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.Footnotes.getCount(), 0) - #Automatic - Endnote - self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") - xDialog = self.xUITest.getTopFocusWindow() +#Automatic - Footnote + self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") + xDialog = self.xUITest.getTopFocusWindow() + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + self.assertEqual(document.Footnotes.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Footnotes.getCount(), 0) +#Automatic - Endnote + self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") + xDialog = self.xUITest.getTopFocusWindow() - xEndnote = xDialog.getChild("endnote") - xEndnote.executeAction("CLICK", tuple()) + xEndnote = xDialog.getChild("endnote") + xEndnote.executeAction("CLICK", tuple()) - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - self.assertEqual(document.Endnotes.getCount(), 1) - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.Endnotes.getCount(), 0) - #Character - Footnote - self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") - xDialog = self.xUITest.getTopFocusWindow() + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + self.assertEqual(document.Endnotes.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Endnotes.getCount(), 0) +#Character - Footnote + self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") + xDialog = self.xUITest.getTopFocusWindow() - xChar = xDialog.getChild("character") - xChar.executeAction("CLICK", tuple()) - xCharentry = xDialog.getChild("characterentry") - xCharentry.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) + xChar = xDialog.getChild("character") + xChar.executeAction("CLICK", tuple()) + xCharentry = xDialog.getChild("characterentry") + xCharentry.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - self.assertEqual(document.Footnotes.getCount(), 1) - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.Footnotes.getCount(), 0) + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + self.assertEqual(document.Footnotes.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Footnotes.getCount(), 0) - #Character - Endnote - self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") - xDialog = self.xUITest.getTopFocusWindow() +#Character - Endnote + self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") + xDialog = self.xUITest.getTopFocusWindow() - xChar = xDialog.getChild("character") - xChar.executeAction("CLICK", tuple()) - xCharentry = xDialog.getChild("characterentry") - xCharentry.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) + xChar = xDialog.getChild("character") + xChar.executeAction("CLICK", tuple()) + xCharentry = xDialog.getChild("characterentry") + xCharentry.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) - xEndnote = xDialog.getChild("endnote") - xEndnote.executeAction("CLICK", tuple()) + xEndnote = xDialog.getChild("endnote") + xEndnote.executeAction("CLICK", tuple()) - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - self.assertEqual(document.Endnotes.getCount(), 1) - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.Endnotes.getCount(), 0) + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + self.assertEqual(document.Endnotes.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Endnotes.getCount(), 0) - #Cancel button - self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) +#Cancel button + self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/insertPageFooter.py b/sw/qa/uitest/writer_tests3/insertPageFooter.py index 5300074ab2e1..4bec545965f0 100644 --- a/sw/qa/uitest/writer_tests3/insertPageFooter.py +++ b/sw/qa/uitest/writer_tests3/insertPageFooter.py @@ -39,32 +39,35 @@ class WriterInsertPageFooter(UITestCase): document.StyleFamilies.PageStyles.Standard.FooterIsOn, False) def test_footer(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - self.insert_footer() + self.insert_footer() - self.delete_footer() + self.delete_footer() + + self.ui_test.close_doc() def test_tdf107427(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - self.insert_footer() + self.insert_footer() - self.ui_test.execute_dialog_through_command(".uno:InsertTable") + self.ui_test.execute_dialog_through_command(".uno:InsertTable") - xInsertDlg = self.xUITest.getTopFocusWindow() + xInsertDlg = self.xUITest.getTopFocusWindow() - xOkBtn = xInsertDlg.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + xOkBtn = xInsertDlg.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - document = self.ui_test.get_component() + document = self.ui_test.get_component() - tables = document.getTextTables() - self.assertEqual(len(tables[0].getRows()), 2) - self.assertEqual(len(tables[0].getColumns()), 2) + tables = document.getTextTables() + self.assertEqual(len(tables[0].getRows()), 2) + self.assertEqual(len(tables[0].getColumns()), 2) - self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:SelectAll") - self.delete_footer() + self.delete_footer() + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/insertQrCodeGen.py b/sw/qa/uitest/writer_tests3/insertQrCodeGen.py index 7f0b28d857ea..26bb21b89159 100644 --- a/sw/qa/uitest/writer_tests3/insertQrCodeGen.py +++ b/sw/qa/uitest/writer_tests3/insertQrCodeGen.py @@ -11,65 +11,68 @@ from com.sun.star.lang import IndexOutOfBoundsException class insertQrCode(UITestCase): def test_insert_qr_code(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - - # cancel the dialog without doing anything - self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") - xDialog = self.xUITest.getTopFocusWindow() - - xURL = xDialog.getChild("edit_text") - type_text(xURL, "www.libreoffice.org") - - xCloseBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCloseBtn) - with self.assertRaises(IndexOutOfBoundsException): - document.DrawPage.getByIndex(0) - - # Reopen the dialog box - self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") - xDialog = self.xUITest.getTopFocusWindow() - - # Get elements in the Dialog Box - xURL = xDialog.getChild("edit_text") - xECC_Low = xDialog.getChild("button_low") #How radio button input is written in text. - xBorder = xDialog.getChild("edit_margin") - - type_text(xURL, "www.libreoffice.org") #set the QR code - xECC_Low.executeAction("CLICK", tuple()) - xBorder.executeAction("UP", tuple()) - xBorder.executeAction("DOWN", tuple()) - xOKBtn = xDialog.getChild("ok") - xOKBtn.executeAction("CLICK", tuple()) - - # check the QR code in the document - self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Payload, "www.libreoffice.org") - self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.ErrorCorrection, 1) - self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Border, 1) + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() - def test_insert_qr_code_gen2(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() + # cancel the dialog without doing anything + self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") + xDialog = self.xUITest.getTopFocusWindow() + + xURL = xDialog.getChild("edit_text") + type_text(xURL, "www.libreoffice.org") + + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + with self.assertRaises(IndexOutOfBoundsException): + document.DrawPage.getByIndex(0) - self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") - xDialog = self.xUITest.getTopFocusWindow() + # Reopen the dialog box + self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") + xDialog = self.xUITest.getTopFocusWindow() - xURL = xDialog.getChild("edit_text") - xECC_Low = xDialog.getChild("button_low") - xBorder = xDialog.getChild("edit_margin") + # Get elements in the Dialog Box + xURL = xDialog.getChild("edit_text") + xECC_Low = xDialog.getChild("button_low") #How radio button input is written in text. + xBorder = xDialog.getChild("edit_margin") - type_text(xURL, "www.libreoffice.org") #set the QR code - xECC_Low.executeAction("CLICK", tuple()) - xBorder.executeAction("UP", tuple()) - xBorder.executeAction("DOWN", tuple()) - xOKBtn = xDialog.getChild("ok") - xOKBtn.executeAction("CLICK", tuple()) + type_text(xURL, "www.libreoffice.org") #set the QR code + xECC_Low.executeAction("CLICK", tuple()) + xBorder.executeAction("UP", tuple()) + xBorder.executeAction("DOWN", tuple()) + xOKBtn = xDialog.getChild("ok") + xOKBtn.executeAction("CLICK", tuple()) - #check the QR Code in the document - self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Payload, "www.libreoffice.org") - self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.ErrorCorrection, 1) - self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Border, 1) + # check the QR code in the document + self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Payload, "www.libreoffice.org") + self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.ErrorCorrection, 1) + self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Border, 1) + self.ui_test.close_doc() + + def test_insert_qr_code_gen2(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") + xDialog = self.xUITest.getTopFocusWindow() + + xURL = xDialog.getChild("edit_text") + xECC_Low = xDialog.getChild("button_low") + xBorder = xDialog.getChild("edit_margin") + + type_text(xURL, "www.libreoffice.org") #set the QR code + xECC_Low.executeAction("CLICK", tuple()) + xBorder.executeAction("UP", tuple()) + xBorder.executeAction("DOWN", tuple()) + xOKBtn = xDialog.getChild("ok") + xOKBtn.executeAction("CLICK", tuple()) + + #check the QR Code in the document + self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Payload, "www.libreoffice.org") + self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.ErrorCorrection, 1) + self.assertEqual(document.DrawPage.getByIndex(0).QRCodeProperties.Border, 1) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/insertSignatureLine.py b/sw/qa/uitest/writer_tests3/insertSignatureLine.py index 4ebfebbf29c6..ecfc1c61a1d2 100644 --- a/sw/qa/uitest/writer_tests3/insertSignatureLine.py +++ b/sw/qa/uitest/writer_tests3/insertSignatureLine.py @@ -11,82 +11,85 @@ from com.sun.star.lang import IndexOutOfBoundsException class insertSignatureLine(UITestCase): def test_insert_signature_line(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - - # cancel the dialog without doing anything - self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") - xDialog = self.xUITest.getTopFocusWindow() - - xName = xDialog.getChild("edit_name") - xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line - - xCloseBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCloseBtn) - with self.assertRaises(IndexOutOfBoundsException): - document.DrawPage.getByIndex(0) - - # set the signature line - self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") - xDialog = self.xUITest.getTopFocusWindow() - - xName = xDialog.getChild("edit_name") - xTitle = xDialog.getChild("edit_title") - xEmail = xDialog.getChild("edit_email") - xComment = xDialog.getChild("checkbox_can_add_comments") - xInstructions = xDialog.getChild("edit_instructions") - - xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line - xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"})) - xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"})) - xComment.executeAction("CLICK", tuple()) - xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"})) - xOKBtn = xDialog.getChild("ok") - xOKBtn.executeAction("CLICK", tuple()) - - #check the signature Line in the document - element = document.DrawPage.getByIndex(0) - self.assertEqual(element.SignatureLineSuggestedSignerName, "Name") - self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title") - self.assertEqual(element.SignatureLineSuggestedSignerEmail, "Email") - self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title") - self.assertEqual(element.SignatureLineCanAddComment, False) - self.assertEqual(element.SignatureLineShowSignDate, True) - self.assertEqual(element.SignatureLineSigningInstructions, "Instructions") + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + # cancel the dialog without doing anything + self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") + xDialog = self.xUITest.getTopFocusWindow() + + xName = xDialog.getChild("edit_name") + xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line + + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + with self.assertRaises(IndexOutOfBoundsException): + document.DrawPage.getByIndex(0) + + # set the signature line + self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") + xDialog = self.xUITest.getTopFocusWindow() + + xName = xDialog.getChild("edit_name") + xTitle = xDialog.getChild("edit_title") + xEmail = xDialog.getChild("edit_email") + xComment = xDialog.getChild("checkbox_can_add_comments") + xInstructions = xDialog.getChild("edit_instructions") + + xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line + xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"})) + xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"})) + xComment.executeAction("CLICK", tuple()) + xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"})) + xOKBtn = xDialog.getChild("ok") + xOKBtn.executeAction("CLICK", tuple()) + + #check the signature Line in the document + element = document.DrawPage.getByIndex(0) + self.assertEqual(element.SignatureLineSuggestedSignerName, "Name") + self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(element.SignatureLineSuggestedSignerEmail, "Email") + self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(element.SignatureLineCanAddComment, False) + self.assertEqual(element.SignatureLineShowSignDate, True) + self.assertEqual(element.SignatureLineSigningInstructions, "Instructions") + + self.ui_test.close_doc() def test_insert_signature_line2(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:InsertSignatureLine") - xDialog = self.xUITest.getTopFocusWindow() - - xName = xDialog.getChild("edit_name") - xTitle = xDialog.getChild("edit_title") - xEmail = xDialog.getChild("edit_email") - xComment = xDialog.getChild("checkbox_can_add_comments") - xDate = xDialog.getChild("checkbox_show_sign_date") - xInstructions = xDialog.getChild("edit_instructions") - - xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line - xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"})) - xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"})) - xDate.executeAction("CLICK", tuple()) - xComment.executeAction("CLICK", tuple()) - xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"})) - xOKBtn = xDialog.getChild("ok") - xOKBtn.executeAction("CLICK", tuple()) - - #check the signature Line in the document - element = document.DrawPage.getByIndex(0) - self.assertEqual(element.SignatureLineSuggestedSignerName, "Name") - self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title") - self.assertEqual(element.SignatureLineSuggestedSignerEmail, "Email") - self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title") - self.assertEqual(element.SignatureLineCanAddComment, False) - self.assertEqual(element.SignatureLineShowSignDate, False) - self.assertEqual(element.SignatureLineSigningInstructions, "Instructions") - + 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:InsertSignatureLine") + xDialog = self.xUITest.getTopFocusWindow() + + xName = xDialog.getChild("edit_name") + xTitle = xDialog.getChild("edit_title") + xEmail = xDialog.getChild("edit_email") + xComment = xDialog.getChild("checkbox_can_add_comments") + xDate = xDialog.getChild("checkbox_show_sign_date") + xInstructions = xDialog.getChild("edit_instructions") + + xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line + xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"})) + xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"})) + xDate.executeAction("CLICK", tuple()) + xComment.executeAction("CLICK", tuple()) + xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"})) + xOKBtn = xDialog.getChild("ok") + xOKBtn.executeAction("CLICK", tuple()) + + #check the signature Line in the document + element = document.DrawPage.getByIndex(0) + self.assertEqual(element.SignatureLineSuggestedSignerName, "Name") + self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(element.SignatureLineSuggestedSignerEmail, "Email") + self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(element.SignatureLineCanAddComment, False) + self.assertEqual(element.SignatureLineShowSignDate, False) + self.assertEqual(element.SignatureLineSigningInstructions, "Instructions") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/lineNumbering.py b/sw/qa/uitest/writer_tests3/lineNumbering.py index f3704646bd31..ec51b4132f80 100644 --- a/sw/qa/uitest/writer_tests3/lineNumbering.py +++ b/sw/qa/uitest/writer_tests3/lineNumbering.py @@ -14,85 +14,87 @@ from uitest.uihelper.common import change_measurement_unit class WriterLineNumbering(UITestCase): def test_line_numbering_dialog(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() - change_measurement_unit(self, "Centimeter") + change_measurement_unit(self, "Centimeter") - self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xshownumbering = xDialog.getChild("shownumbering") - xstyledropdown = xDialog.getChild("styledropdown") - xformatdropdown = xDialog.getChild("formatdropdown") - xpositiondropdown = xDialog.getChild("positiondropdown") - xspacingspin = xDialog.getChild("spacingspin") - xintervalspin = xDialog.getChild("intervalspin") - xtextentry = xDialog.getChild("textentry") - xlinesspin = xDialog.getChild("linesspin") - xblanklines = xDialog.getChild("blanklines") - xlinesintextframes = xDialog.getChild("linesintextframes") - xshowfooterheadernumbering = xDialog.getChild("showfooterheadernumbering") - xrestarteverynewpage = xDialog.getChild("restarteverynewpage") + self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xshownumbering = xDialog.getChild("shownumbering") + xstyledropdown = xDialog.getChild("styledropdown") + xformatdropdown = xDialog.getChild("formatdropdown") + xpositiondropdown = xDialog.getChild("positiondropdown") + xspacingspin = xDialog.getChild("spacingspin") + xintervalspin = xDialog.getChild("intervalspin") + xtextentry = xDialog.getChild("textentry") + xlinesspin = xDialog.getChild("linesspin") + xblanklines = xDialog.getChild("blanklines") + xlinesintextframes = xDialog.getChild("linesintextframes") + xshowfooterheadernumbering = xDialog.getChild("showfooterheadernumbering") + xrestarteverynewpage = xDialog.getChild("restarteverynewpage") - xshownumbering.executeAction("CLICK", tuple()) - select_by_text(xstyledropdown, "Bullets") - select_by_text(xformatdropdown, "A, B, C, ...") - select_by_text(xpositiondropdown, "Right") - xspacingspin.executeAction("UP", tuple()) - xintervalspin.executeAction("UP", tuple()) - xtextentry.executeAction("TYPE", mkPropertyValues({"TEXT":";"})) - xlinesspin.executeAction("UP", tuple()) - xblanklines.executeAction("CLICK", tuple()) - xlinesintextframes.executeAction("CLICK", tuple()) - xshowfooterheadernumbering.executeAction("CLICK", tuple()) - xrestarteverynewpage.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xshownumbering.executeAction("CLICK", tuple()) + select_by_text(xstyledropdown, "Bullets") + select_by_text(xformatdropdown, "A, B, C, ...") + select_by_text(xpositiondropdown, "Right") + xspacingspin.executeAction("UP", tuple()) + xintervalspin.executeAction("UP", tuple()) + xtextentry.executeAction("TYPE", mkPropertyValues({"TEXT":";"})) + xlinesspin.executeAction("UP", tuple()) + xblanklines.executeAction("CLICK", tuple()) + xlinesintextframes.executeAction("CLICK", tuple()) + xshowfooterheadernumbering.executeAction("CLICK", tuple()) + xrestarteverynewpage.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xshownumbering = xDialog.getChild("shownumbering") - xstyledropdown = xDialog.getChild("styledropdown") - xformatdropdown = xDialog.getChild("formatdropdown") - xpositiondropdown = xDialog.getChild("positiondropdown") - xspacingspin = xDialog.getChild("spacingspin") - xintervalspin = xDialog.getChild("intervalspin") - xtextentry = xDialog.getChild("textentry") - xlinesspin = xDialog.getChild("linesspin") - xblanklines = xDialog.getChild("blanklines") - xlinesintextframes = xDialog.getChild("linesintextframes") - xshowfooterheadernumbering = xDialog.getChild("showfooterheadernumbering") - xrestarteverynewpage = xDialog.getChild("restarteverynewpage") + self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xshownumbering = xDialog.getChild("shownumbering") + xstyledropdown = xDialog.getChild("styledropdown") + xformatdropdown = xDialog.getChild("formatdropdown") + xpositiondropdown = xDialog.getChild("positiondropdown") + xspacingspin = xDialog.getChild("spacingspin") + xintervalspin = xDialog.getChild("intervalspin") + xtextentry = xDialog.getChild("textentry") + xlinesspin = xDialog.getChild("linesspin") + xblanklines = xDialog.getChild("blanklines") + xlinesintextframes = xDialog.getChild("linesintextframes") + xshowfooterheadernumbering = xDialog.getChild("showfooterheadernumbering") + xrestarteverynewpage = xDialog.getChild("restarteverynewpage") - self.assertEqual(get_state_as_dict(xshownumbering)["Selected"], "true") - self.assertEqual(get_state_as_dict(xstyledropdown)["SelectEntryText"], "Bullets") - self.assertEqual(get_state_as_dict(xformatdropdown)["SelectEntryText"], "A, B, C, ...") - self.assertEqual(get_state_as_dict(xpositiondropdown)["SelectEntryText"], "Right") - self.assertEqual(get_state_as_dict(xspacingspin)["Text"], "0.60 cm") - self.assertEqual(get_state_as_dict(xintervalspin)["Text"], "6") - self.assertEqual(get_state_as_dict(xtextentry)["Text"], ";") - self.assertEqual(get_state_as_dict(xlinesspin)["Text"], "4") - self.assertEqual(get_state_as_dict(xblanklines)["Selected"], "false") - self.assertEqual(get_state_as_dict(xlinesintextframes)["Selected"], "true") - self.assertEqual(get_state_as_dict(xshowfooterheadernumbering)["Selected"], "true") - self.assertEqual(get_state_as_dict(xrestarteverynewpage)["Selected"], "true") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + self.assertEqual(get_state_as_dict(xshownumbering)["Selected"], "true") + self.assertEqual(get_state_as_dict(xstyledropdown)["SelectEntryText"], "Bullets") + self.assertEqual(get_state_as_dict(xformatdropdown)["SelectEntryText"], "A, B, C, ...") + self.assertEqual(get_state_as_dict(xpositiondropdown)["SelectEntryText"], "Right") + self.assertEqual(get_state_as_dict(xspacingspin)["Text"], "0.60 cm") + self.assertEqual(get_state_as_dict(xintervalspin)["Text"], "6") + self.assertEqual(get_state_as_dict(xtextentry)["Text"], ";") + self.assertEqual(get_state_as_dict(xlinesspin)["Text"], "4") + self.assertEqual(get_state_as_dict(xblanklines)["Selected"], "false") + self.assertEqual(get_state_as_dict(xlinesintextframes)["Selected"], "true") + self.assertEqual(get_state_as_dict(xshowfooterheadernumbering)["Selected"], "true") + self.assertEqual(get_state_as_dict(xrestarteverynewpage)["Selected"], "true") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.close_doc() def test_tdf86185(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() - self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xshownumbering = xDialog.getChild("shownumbering") - xformatdropdown = xDialog.getChild("formatdropdown") + self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xshownumbering = xDialog.getChild("shownumbering") + xformatdropdown = xDialog.getChild("formatdropdown") - xshownumbering.executeAction("CLICK", tuple()) - itemFormat = ["1, 2, 3, ...", "A, B, C, ...", "a, b, c, ...", "I, II, III, ...", "i, ii, iii, ...", "A, .., AA, .., AAA, ..."] - for i in range(6): - select_by_text(xformatdropdown, itemFormat[i]) - self.assertEqual(get_state_as_dict(xformatdropdown)["SelectEntryText"], itemFormat[i]) - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + xshownumbering.executeAction("CLICK", tuple()) + itemFormat = ["1, 2, 3, ...", "A, B, C, ...", "a, b, c, ...", "I, II, III, ...", "i, ii, iii, ...", "A, .., AA, .., AAA, ..."] + for i in range(6): + select_by_text(xformatdropdown, itemFormat[i]) + self.assertEqual(get_state_as_dict(xformatdropdown)["SelectEntryText"], itemFormat[i]) + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/pageDialog.py b/sw/qa/uitest/writer_tests3/pageDialog.py index dd01f3681068..942aa6d2e96f 100644 --- a/sw/qa/uitest/writer_tests3/pageDialog.py +++ b/sw/qa/uitest/writer_tests3/pageDialog.py @@ -122,26 +122,28 @@ class WriterPageDialog(UITestCase): def test_area_tab(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern'] - for index, button in enumerate(buttons): + buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern'] + for index, button in enumerate(buttons): - xDialog = self.launch_dialog_and_select_tab(2) + xDialog = self.launch_dialog_and_select_tab(2) - self.click_button(xDialog, button) + self.click_button(xDialog, button) - self.click_button(xDialog, 'ok') + self.click_button(xDialog, 'ok') - self.check_default_area(button) + self.check_default_area(button) - xDialog = self.launch_dialog_and_select_tab(2) + xDialog = self.launch_dialog_and_select_tab(2) - self.click_button(xDialog, 'btnnone') + self.click_button(xDialog, 'btnnone') - self.click_button(xDialog, 'ok') + self.click_button(xDialog, 'ok') + + self.check_default_area('btnnone') - self.check_default_area('btnnone') + self.ui_test.close_doc() def test_paper_format(self): @@ -151,77 +153,85 @@ class WriterPageDialog(UITestCase): "C5 Envelope", "C4 Envelope", "#6¾ Envelope", "#7¾ (Monarch) Envelope", "#9 Envelope", "#10 Envelope", "#11 Envelope", "#12 Envelope", "Japanese Postcard"] - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - for i in range(30): - with self.subTest(i=i): - xDialog = self.launch_dialog_and_select_tab(1) + for i in range(30): + with self.subTest(i=i): + xDialog = self.launch_dialog_and_select_tab(1) - xFormatList = xDialog.getChild("comboPageFormat") - select_pos(xFormatList, str(i)) + xFormatList = xDialog.getChild("comboPageFormat") + select_pos(xFormatList, str(i)) - self.assertEqual( - get_state_as_dict(xFormatList)["SelectEntryText"], lPaperFormat[i]) + self.assertEqual( + get_state_as_dict(xFormatList)["SelectEntryText"], lPaperFormat[i]) - self.click_button(xDialog, 'ok') + self.click_button(xDialog, 'ok') + + self.ui_test.close_doc() def test_orientation(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.assertEqual( - document.StyleFamilies.PageStyles.Standard.IsLandscape, False) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.IsLandscape, False) - xDialog = self.launch_dialog_and_select_tab(1) + xDialog = self.launch_dialog_and_select_tab(1) - self.click_button(xDialog, 'radiobuttonLandscape') + self.click_button(xDialog, 'radiobuttonLandscape') - self.click_button(xDialog, 'ok') + self.click_button(xDialog, 'ok') - self.assertEqual( - document.StyleFamilies.PageStyles.Standard.IsLandscape, True) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.IsLandscape, True) - xDialog = self.launch_dialog_and_select_tab(1) + xDialog = self.launch_dialog_and_select_tab(1) - self.click_button(xDialog, 'radiobuttonPortrait') + self.click_button(xDialog, 'radiobuttonPortrait') - self.click_button(xDialog, 'ok') + self.click_button(xDialog, 'ok') - self.assertEqual( - document.StyleFamilies.PageStyles.Standard.IsLandscape, False) + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.IsLandscape, False) + + self.ui_test.close_doc() def test_text_direction(self): lTextDirection = ['Left-to-right (horizontal)', 'Right-to-left (horizontal)', 'Right-to-left (vertical)', 'Left-to-right (vertical)'] - 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() + for i in range(4): + with self.subTest(i=i): + xDialog = self.launch_dialog_and_select_tab(1) - for i in range(4): - with self.subTest(i=i): - xDialog = self.launch_dialog_and_select_tab(1) + xTextDirectionList = xDialog.getChild("comboTextFlowBox") + select_pos(xTextDirectionList, str(i)) - xTextDirectionList = xDialog.getChild("comboTextFlowBox") - select_pos(xTextDirectionList, str(i)) + self.assertEqual( + get_state_as_dict(xTextDirectionList)["SelectEntryText"], lTextDirection[i]) - self.assertEqual( - get_state_as_dict(xTextDirectionList)["SelectEntryText"], lTextDirection[i]) + self.click_button(xDialog, 'ok') - self.click_button(xDialog, 'ok') + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.WritingMode, i) - self.assertEqual( - document.StyleFamilies.PageStyles.Standard.WritingMode, i) + self.ui_test.close_doc() def test_cancel_button_page_dialog(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") + + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) - self.ui_test.execute_dialog_through_command(".uno:PageDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/sort.py b/sw/qa/uitest/writer_tests3/sort.py index ccebbe2ba4e4..2868c9f8a49e 100644 --- a/sw/qa/uitest/writer_tests3/sort.py +++ b/sw/qa/uitest/writer_tests3/sort.py @@ -12,54 +12,57 @@ from uitest.uihelper.common import type_text class WriterSort(UITestCase): def test_sort(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") - type_text(xWriterEdit, "a") - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - type_text(xWriterEdit, "c") - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - type_text(xWriterEdit, "v") + type_text(xWriterEdit, "a") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + type_text(xWriterEdit, "c") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + type_text(xWriterEdit, "v") - selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text - #Tools - Sort - self.ui_test.execute_dialog_through_command(".uno:SortDialog") - xDialog = self.xUITest.getTopFocusWindow() - xDown = xDialog.getChild("down1") - xDown.executeAction("CLICK", tuple()) - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - #check - self.assertEqual(document.Text.String[0:1], "v") + selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text + #Tools - Sort + self.ui_test.execute_dialog_through_command(".uno:SortDialog") + xDialog = self.xUITest.getTopFocusWindow() + xDown = xDialog.getChild("down1") + xDown.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #check + self.assertEqual(document.Text.String[0:1], "v") + + self.ui_test.close_doc() def test_sort_numerical(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") - type_text(xWriterEdit, "1;2;3") - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - type_text(xWriterEdit, "2;8;3") + type_text(xWriterEdit, "1;2;3") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + type_text(xWriterEdit, "2;8;3") - selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text - #Tools - Sort - self.ui_test.execute_dialog_through_command(".uno:SortDialog") - xDialog = self.xUITest.getTopFocusWindow() - xDown = xDialog.getChild("down1") - xcolsb1 = xDialog.getChild("colsb1") - xtypelb1 = xDialog.getChild("typelb1") - xcharacter = xDialog.getChild("character") - xseparator = xDialog.getChild("separator") - xDown.executeAction("CLICK", tuple()) - select_by_text(xtypelb1, "Numerical") - xcharacter.executeAction("CLICK", tuple()) - xseparator.executeAction("TYPE", mkPropertyValues({"TEXT":";"})) - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - #check - self.assertEqual(document.Text.String[0:5], "2;8;3") + selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text + #Tools - Sort + self.ui_test.execute_dialog_through_command(".uno:SortDialog") + xDialog = self.xUITest.getTopFocusWindow() + xDown = xDialog.getChild("down1") + xcolsb1 = xDialog.getChild("colsb1") + xtypelb1 = xDialog.getChild("typelb1") + xcharacter = xDialog.getChild("character") + xseparator = xDialog.getChild("separator") + xDown.executeAction("CLICK", tuple()) + select_by_text(xtypelb1, "Numerical") + xcharacter.executeAction("CLICK", tuple()) + xseparator.executeAction("TYPE", mkPropertyValues({"TEXT":";"})) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #check + self.assertEqual(document.Text.String[0:5], "2;8;3") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/specialCharacter.py b/sw/qa/uitest/writer_tests3/specialCharacter.py index bda94ff63c53..20955856ba88 100644 --- a/sw/qa/uitest/writer_tests3/specialCharacter.py +++ b/sw/qa/uitest/writer_tests3/specialCharacter.py @@ -15,75 +15,76 @@ from uitest.uihelper.common import select_pos class specialCharacter(UITestCase): def test_special_character(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterDoc = self.xUITest.getTopFocusWindow() - document = self.ui_test.get_component() + document = self.ui_test.get_component() - self.ui_test.execute_dialog_through_command(".uno:InsertSymbol") # specialCharacter dialog - xDialog = self.xUITest.getTopFocusWindow() - xCharSet = xDialog.getChild("showcharset") # default charset + self.ui_test.execute_dialog_through_command(".uno:InsertSymbol") # specialCharacter dialog + xDialog = self.xUITest.getTopFocusWindow() + xCharSet = xDialog.getChild("showcharset") # default charset - xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "1", "ROW": "4"})) # digit 4 selected + xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "1", "ROW": "4"})) # digit 4 selected - xHexText = xDialog.getChild("hexvalue") - xDecText = xDialog.getChild("decimalvalue") + xHexText = xDialog.getChild("hexvalue") + xDecText = xDialog.getChild("decimalvalue") - self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values Hex and decimal - self.assertEqual(get_state_as_dict(xDecText)["Text"], "52") + self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values Hex and decimal + self.assertEqual(get_state_as_dict(xDecText)["Text"], "52") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) - self.ui_test.execute_dialog_through_command(".uno:InsertSymbol") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:InsertSymbol") + xDialog = self.xUITest.getTopFocusWindow() - xComboFont = xDialog.getChild("fontlb") - select_pos(xComboFont, "0") # select font - xComboFont2 = xDialog.getChild("subsetlb") - select_pos(xComboFont2, "0") # select font subset + xComboFont = xDialog.getChild("fontlb") + select_pos(xComboFont, "0") # select font + xComboFont2 = xDialog.getChild("subsetlb") + select_pos(xComboFont2, "0") # select font subset - xSearchText = xDialog.getChild("search") # test search textBox - xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "d"})) - xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "i"})) - xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "g"})) - xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "i"})) - xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "t"})) - xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": " "})) - xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "f"})) - xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "o"})) - xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "u"})) - xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "r"})) + xSearchText = xDialog.getChild("search") # test search textBox + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "d"})) + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "i"})) + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "g"})) + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "i"})) + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "t"})) + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": " "})) + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "f"})) + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "o"})) + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "u"})) + xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "r"})) - # works locally and linux_gcc_release_64, but fails at linux_clang_dbgutil_64. - # Markus: Actually after a round of debugging I think the problem is actually that the test depends on the used font. - # Therefore, if the font is not available or not selected by default the test fails. - # xCharSet = xDialog.getChild("searchcharset") #another charset -> search charset - # xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "0", "ROW": "0"})) #digit 4 selected, we have only one result; - # sleep(1) #try sleep here - # xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "0", "ROW": "0"})) #try it twice, because it works at local,but fail on gerrit - ##gerrit:self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values for digit 4; AssertionError: '1' != '34' + # works locally and linux_gcc_release_64, but fails at linux_clang_dbgutil_64. + # Markus: Actually after a round of debugging I think the problem is actually that the test depends on the used font. + # Therefore, if the font is not available or not selected by default the test fails. + # xCharSet = xDialog.getChild("searchcharset") #another charset -> search charset + # xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "0", "ROW": "0"})) #digit 4 selected, we have only one result; + # sleep(1) #try sleep here + # xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "0", "ROW": "0"})) #try it twice, because it works at local,but fail on gerrit + ##gerrit:self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values for digit 4; AssertionError: '1' != '34' - # xHexText = xDialog.getChild("hexvalue") - # xDecText = xDialog.getChild("decimalvalue") - # self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values for digit 4 - # self.assertEqual(get_state_as_dict(xDecText)["Text"], "52") + # xHexText = xDialog.getChild("hexvalue") + # xDecText = xDialog.getChild("decimalvalue") + # self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values for digit 4 + # self.assertEqual(get_state_as_dict(xDecText)["Text"], "52") - # xAddFavBtn = xDialog.getChild("favbtn") - # xAddFavBtn.executeAction("CLICK", tuple()) # Add to favorites button + # xAddFavBtn = xDialog.getChild("favbtn") + # xAddFavBtn.executeAction("CLICK", tuple()) # Add to favorites button - # xInsrBtn = xDialog.getChild("insert") - # xInsrBtn.executeAction("CLICK", tuple()) # Insert to document + # xInsrBtn = xDialog.getChild("insert") + # xInsrBtn.executeAction("CLICK", tuple()) # Insert to document - # self.assertEqual(document.Text.String[0:1], "4") # check inserted character + # self.assertEqual(document.Text.String[0:1], "4") # check inserted character - # self.xUITest.executeCommand(".uno:Undo") - # self.xUITest.executeCommand(".uno:Redo") #undo, redo + # self.xUITest.executeCommand(".uno:Undo") + # self.xUITest.executeCommand(".uno:Redo") #undo, redo - # self.assertEqual(document.Text.String[0:1], "4") # check inserted character after undo, redo + # self.assertEqual(document.Text.String[0:1], "4") # check inserted character after undo, redo - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests3/tdf79236.py b/sw/qa/uitest/writer_tests3/tdf79236.py index 886120444ac9..bd3862b5e27a 100644 --- a/sw/qa/uitest/writer_tests3/tdf79236.py +++ b/sw/qa/uitest/writer_tests3/tdf79236.py @@ -11,111 +11,113 @@ class tdf79236(UITestCase): def test_paragraph(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") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - type_text(xWriterEdit, "Test for tdf79236") + type_text(xWriterEdit, "Test for tdf79236") - document = self.ui_test.get_component() + document = self.ui_test.get_component() - selection = self.xUITest.executeCommand(".uno:SelectAll") + selection = self.xUITest.executeCommand(".uno:SelectAll") - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).String, "Test for tdf79236") + self.assertEqual(document.CurrentSelection.getByIndex(0).String, "Test for tdf79236") - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xParagraphDlg = self.xUITest.getTopFocusWindow() + xParagraphDlg = self.xUITest.getTopFocusWindow() - xLeftSpnBtn = xParagraphDlg.getChild("spinED_LEFTINDENT") - for _ in range(0,20): - xLeftSpnBtn.executeAction("UP", tuple()) + xLeftSpnBtn = xParagraphDlg.getChild("spinED_LEFTINDENT") + for _ in range(0,20): + xLeftSpnBtn.executeAction("UP", tuple()) - xRightSpnBtn = xParagraphDlg.getChild("spinED_RIGHTINDENT") - for _ in range(0,20): - xRightSpnBtn.executeAction("UP", tuple()) + xRightSpnBtn = xParagraphDlg.getChild("spinED_RIGHTINDENT") + for _ in range(0,20): + xRightSpnBtn.executeAction("UP", tuple()) - xLineSpnBtn = xParagraphDlg.getChild("spinED_FLINEINDENT") - for _ in range(0,20): - xLineSpnBtn.executeAction("UP", tuple()) + xLineSpnBtn = xParagraphDlg.getChild("spinED_FLINEINDENT") + for _ in range(0,20): + xLineSpnBtn.executeAction("UP", tuple()) - xBottomSpnBtn = xParagraphDlg.getChild("spinED_BOTTOMDIST") - for _ in range(0,20): - xBottomSpnBtn.executeAction("UP", tuple()) + xBottomSpnBtn = xParagraphDlg.getChild("spinED_BOTTOMDIST") + for _ in range(0,20): + xBottomSpnBtn.executeAction("UP", tuple()) - xTopSpnBtn = xParagraphDlg.getChild("spinED_TOPDIST") - for _ in range(0,20): - xTopSpnBtn.executeAction("UP", tuple()) + xTopSpnBtn = xParagraphDlg.getChild("spinED_TOPDIST") + for _ in range(0,20): + xTopSpnBtn.executeAction("UP", tuple()) - xOkBtn = xParagraphDlg.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + xOkBtn = xParagraphDlg.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 3704) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 3704) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 5503) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 5503) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 3704) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 3704) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 3704) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 5503) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 5503) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 3704) - self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") + self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") - xParagraphDlg = self.xUITest.getTopFocusWindow() + xParagraphDlg = self.xUITest.getTopFocusWindow() - xLeftSpnBtn = xParagraphDlg.getChild("spinED_LEFTINDENT") - for _ in range(0,20): - xLeftSpnBtn.executeAction("DOWN", tuple()) + xLeftSpnBtn = xParagraphDlg.getChild("spinED_LEFTINDENT") + for _ in range(0,20): + xLeftSpnBtn.executeAction("DOWN", tuple()) - xRightSpnBtn = xParagraphDlg.getChild("spinED_RIGHTINDENT") - for _ in range(0,20): - xRightSpnBtn.executeAction("DOWN", tuple()) + xRightSpnBtn = xParagraphDlg.getChild("spinED_RIGHTINDENT") + for _ in range(0,20): + xRightSpnBtn.executeAction("DOWN", tuple()) - xLineSpnBtn = xParagraphDlg.getChild("spinED_FLINEINDENT") - for _ in range(0,20): - xLineSpnBtn.executeAction("DOWN", tuple()) + xLineSpnBtn = xParagraphDlg.getChild("spinED_FLINEINDENT") + for _ in range(0,20): + xLineSpnBtn.executeAction("DOWN", tuple()) - xBottomSpnBtn = xParagraphDlg.getChild("spinED_BOTTOMDIST") - for _ in range(0,20): - xBottomSpnBtn.executeAction("DOWN", tuple()) + xBottomSpnBtn = xParagraphDlg.getChild("spinED_BOTTOMDIST") + for _ in range(0,20): + xBottomSpnBtn.executeAction("DOWN", tuple()) - xTopSpnBtn = xParagraphDlg.getChild("spinED_TOPDIST") - for _ in range(0,20): - xTopSpnBtn.executeAction("DOWN", tuple()) + xTopSpnBtn = xParagraphDlg.getChild("spinED_TOPDIST") + for _ in range(0,20): + xTopSpnBtn.executeAction("DOWN", tuple()) - xOkBtn = xParagraphDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + xOkBtn = xParagraphDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0) - self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 3704) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 3704) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 5503) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 5503) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 3704) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 3704) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 3704) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 5503) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 5503) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 3704) - self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0) + self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0) - self.assertEqual(document.CurrentSelection.getByIndex(0).String, "Test for tdf79236") + self.assertEqual(document.CurrentSelection.getByIndex(0).String, "Test for tdf79236") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/insertBreakDialog.py b/sw/qa/uitest/writer_tests4/insertBreakDialog.py index d9a1535f0d6d..6dda5b2fcf94 100644 --- a/sw/qa/uitest/writer_tests4/insertBreakDialog.py +++ b/sw/qa/uitest/writer_tests4/insertBreakDialog.py @@ -26,49 +26,57 @@ class WriterInsertBreakDialog(UITestCase): def test_insert_line_break(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - xDialog = self.launch_dialog_and_select_option("linerb") - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + xDialog = self.launch_dialog_and_select_option("linerb") + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - self.getPages(1) + self.getPages(1) + + self.ui_test.close_doc() def test_insert_column_break(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") + + xDialog = self.launch_dialog_and_select_option("columnrb") + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - xDialog = self.launch_dialog_and_select_option("columnrb") - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + self.getPages(1) - self.getPages(1) + self.ui_test.close_doc() def test_insert_page_break(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") + + for i in range(9): + with self.subTest(i=i): + xDialog = self.launch_dialog_and_select_option("pagerb") - for i in range(9): - with self.subTest(i=i): - xDialog = self.launch_dialog_and_select_option("pagerb") + xStyleList = xDialog.getChild("stylelb") + xStyleList.executeAction("SELECT", mkPropertyValues({"POS": str(i)})) - xStyleList = xDialog.getChild("stylelb") - xStyleList.executeAction("SELECT", mkPropertyValues({"POS": str(i)})) + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + self.getPages(i + 2) - self.getPages(i + 2) + self.ui_test.close_doc() def test_cancel_button_insert_line_break_dialog(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") + + self.ui_test.execute_dialog_through_command(".uno:InsertBreak") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) - self.ui_test.execute_dialog_through_command(".uno:InsertBreak") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + self.getPages(1) - self.getPages(1) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/insertPageHeader.py b/sw/qa/uitest/writer_tests4/insertPageHeader.py index 28e7ff29a314..245073ace5a5 100644 --- a/sw/qa/uitest/writer_tests4/insertPageHeader.py +++ b/sw/qa/uitest/writer_tests4/insertPageHeader.py @@ -38,31 +38,35 @@ class WriterInsertPageHeader(UITestCase): document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False) def test_header(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - self.insert_header() + self.insert_header() - self.delete_header() + self.delete_header() + + self.ui_test.close_doc() def test_tdf107427(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") + + self.insert_header() - self.insert_header() + self.ui_test.execute_dialog_through_command(".uno:InsertTable") - self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xInsertDlg = self.xUITest.getTopFocusWindow() - xInsertDlg = self.xUITest.getTopFocusWindow() + xOkBtn = xInsertDlg.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - xOkBtn = xInsertDlg.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + document = self.ui_test.get_component() - document = self.ui_test.get_component() + tables = document.getTextTables() + self.assertEqual(len(tables[0].getRows()), 2) + self.assertEqual(len(tables[0].getColumns()), 2) - tables = document.getTextTables() - self.assertEqual(len(tables[0].getRows()), 2) - self.assertEqual(len(tables[0].getColumns()), 2) + self.xUITest.executeCommand(".uno:SelectAll") - self.xUITest.executeCommand(".uno:SelectAll") + self.delete_header() - self.delete_header() + self.ui_test.close_doc() diff --git a/sw/qa/uitest/writer_tests4/spellDialog.py b/sw/qa/uitest/writer_tests4/spellDialog.py index b1458933830d..fea337bd2c3f 100644 --- a/sw/qa/uitest/writer_tests4/spellDialog.py +++ b/sw/qa/uitest/writer_tests4/spellDialog.py @@ -59,46 +59,46 @@ frog, dogg, catt""" # This automates the steps described in the bug report tdf#46852 # Step 1: Create a document with repetitious misspelled words - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - cursor = document.getCurrentController().getViewCursor() - # Inserted text must be en_US, so make sure to set language in current location - cursor.CharLocale = Locale("en", "US", "") - input_text = self.TDF46852_INPUT.replace('\n', '\r') # \r = para break - document.Text.insertString(cursor, input_text, False) - - # Step 2: Place cursor on 4th line after second "frogg" - cursor.goUp(2, False) - cursor.goLeft(1, False) + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + cursor = document.getCurrentController().getViewCursor() + # Inserted text must be en_US, so make sure to set language in current location + cursor.CharLocale = Locale("en", "US", "") + input_text = self.TDF46852_INPUT.replace('\n', '\r') # \r = para break + document.Text.insertString(cursor, input_text, False) + + # Step 2: Place cursor on 4th line after second "frogg" + cursor.goUp(2, False) + cursor.goLeft(1, False) + + # Step 3: Initiate spellchecking, and make sure "Check grammar" is + # unchecked + spell_dialog = self.launch_dialog() + checkgrammar = spell_dialog.getChild('checkgrammar') + if get_state_as_dict(checkgrammar)['Selected'] == 'true': + checkgrammar.executeAction('CLICK', ()) + self.assertTrue(get_state_as_dict(checkgrammar)['Selected'] == 'false') + + # Step 4: Repetitively click on "Correct all" for each misspelling + # prompt until end of document is reached. + changeall = spell_dialog.getChild('changeall') + changeall.executeAction("CLICK", ()) + changeall.executeAction("CLICK", ()) + # The third time we click on changeall, the click action is going to + # block while two message boxes are shown, so we need to do this third + # click specially + # Use empty close_button to open consecutive dialogs + with self.ui_test.execute_blocking_action( + changeall.executeAction, args=('CLICK', ()), close_button="") as dialog: + # Step 5: Confirm to "Continue check at beginning of document" + xYesBtn = dialog.getChild("yes") - # Step 3: Initiate spellchecking, and make sure "Check grammar" is - # unchecked - spell_dialog = self.launch_dialog() - checkgrammar = spell_dialog.getChild('checkgrammar') - if get_state_as_dict(checkgrammar)['Selected'] == 'true': - checkgrammar.executeAction('CLICK', ()) - self.assertTrue(get_state_as_dict(checkgrammar)['Selected'] == 'false') - - # Step 4: Repetitively click on "Correct all" for each misspelling - # prompt until end of document is reached. - changeall = spell_dialog.getChild('changeall') - changeall.executeAction("CLICK", ()) - changeall.executeAction("CLICK", ()) - # The third time we click on changeall, the click action is going to - # block while two message boxes are shown, so we need to do this third - # click specially - # Use empty close_button to open consecutive dialogs with self.ui_test.execute_blocking_action( - changeall.executeAction, args=('CLICK', ()), close_button="") as dialog: - # Step 5: Confirm to "Continue check at beginning of document" - xYesBtn = dialog.getChild("yes") - - with self.ui_test.execute_blocking_action( - xYesBtn.executeAction, args=('CLICK', ())): - pass + xYesBtn.executeAction, args=('CLICK', ())): + pass - output_text = document.Text.getString().replace('\r\n', '\n') - self.assertTrue(re.match(self.TDF46852_REGEX, output_text)) + output_text = document.Text.getString().replace('\r\n', '\n') + self.assertTrue(re.match(self.TDF46852_REGEX, output_text)) def test_tdf66043(self): supported_locale = self.is_supported_locale("en", "US") diff --git a/sw/qa/uitest/writer_tests4/start.py b/sw/qa/uitest/writer_tests4/start.py index 83b28d616818..1ee80f604013 100644 --- a/sw/qa/uitest/writer_tests4/start.py +++ b/sw/qa/uitest/writer_tests4/start.py @@ -14,32 +14,36 @@ class SimpleWriterTest(UITestCase): def test_start_writer(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + xWriterEdit = xWriterDoc.getChild("writer_edit") - xWriterEdit.executeAction("SET", mkPropertyValues({"ZOOM": "200"})) + xWriterEdit.executeAction("SET", mkPropertyValues({"ZOOM": "200"})) - self.assertEqual(get_state_as_dict(xWriterEdit)["Zoom"], "200") + self.assertEqual(get_state_as_dict(xWriterEdit)["Zoom"], "200") + + self.ui_test.close_doc() def test_goto_first_page(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") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + state = get_state_as_dict(xWriterEdit) + while state["CurrentPage"] == "1": + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) state = get_state_as_dict(xWriterEdit) - while state["CurrentPage"] == "1": - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - state = get_state_as_dict(xWriterEdit) - self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + + xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "1"})) - xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "1"})) + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") - self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf113252.py b/sw/qa/uitest/writer_tests4/tdf113252.py index 11d85e108eeb..5e3f868f37ad 100644 --- a/sw/qa/uitest/writer_tests4/tdf113252.py +++ b/sw/qa/uitest/writer_tests4/tdf113252.py @@ -12,27 +12,28 @@ from uitest.uihelper.common import select_pos class tdf113252(UITestCase): def test_tdf113252_macro_dialog(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") - - #Start LibreOffice. Go to Tools > Macros > Organize Macros > Basic - self.ui_test.execute_dialog_through_command(".uno:MacroDialog") - xDialog = self.xUITest.getTopFocusWindow() - - #Click Button Organizer - xorganize = xDialog.getChild("organize") - with self.ui_test.execute_blocking_action(xorganize.executeAction, args=('CLICK', ()), close_button="close") as dialog: - xTabs = dialog.getChild("tabcontrol") - select_pos(xTabs, "0") - select_pos(xTabs, "1") - select_pos(xTabs, "2") - #Click button Close in the next dialog -> crash. - - xClose = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xClose) - - self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") - + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + #Start LibreOffice. Go to Tools > Macros > Organize Macros > Basic + self.ui_test.execute_dialog_through_command(".uno:MacroDialog") + xDialog = self.xUITest.getTopFocusWindow() + + #Click Button Organizer + xorganize = xDialog.getChild("organize") + with self.ui_test.execute_blocking_action(xorganize.executeAction, args=('CLICK', ()), close_button="close") as dialog: + xTabs = dialog.getChild("tabcontrol") + select_pos(xTabs, "0") + select_pos(xTabs, "1") + select_pos(xTabs, "2") + #Click button Close in the next dialog -> crash. + + xClose = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xClose) + + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf115572.py b/sw/qa/uitest/writer_tests4/tdf115572.py index 6289aa9dd1a8..511da669ccc9 100644 --- a/sw/qa/uitest/writer_tests4/tdf115572.py +++ b/sw/qa/uitest/writer_tests4/tdf115572.py @@ -15,60 +15,63 @@ class tdf115572(UITestCase): tableText.setString( text ) def test_tdf115572_table_format_gets_reset_deleting_row(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - #insert table 2x2 - 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) - #select font format - Bold and write text "abc" - self.xUITest.executeCommand(".uno:Bold") - tables = document.getTextTables() - self.insertTextIntoCell(tables[0], "A1", "abc" ) - #go to second row - arrow down - self.xUITest.executeCommand(".uno:GoDown") - #delete row - self.xUITest.executeCommand(".uno:DeleteRows") - #now the cursor is in the second column - go left - self.xUITest.executeCommand(".uno:GoLeft") - self.xUITest.executeCommand(".uno:GoLeft") - #check the format of the text (should be still bold) Format-Character-Font-Style-Bold - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xweststylelbcjk = xDialog.getChild("weststylelb-cjk") - self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") - xCloseBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert table 2x2 + 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) + #select font format - Bold and write text "abc" + self.xUITest.executeCommand(".uno:Bold") + tables = document.getTextTables() + self.insertTextIntoCell(tables[0], "A1", "abc" ) + #go to second row - arrow down + self.xUITest.executeCommand(".uno:GoDown") + #delete row + self.xUITest.executeCommand(".uno:DeleteRows") + #now the cursor is in the second column - go left + self.xUITest.executeCommand(".uno:GoLeft") + self.xUITest.executeCommand(".uno:GoLeft") + #check the format of the text (should be still bold) Format-Character-Font-Style-Bold + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("weststylelb-cjk") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() def test_tdf115572_table_format_gets_reset_deleting_column(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - #insert table 2x2 - 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) - #select font format - Bold and write text "abc" - self.xUITest.executeCommand(".uno:Bold") - tables = document.getTextTables() - self.insertTextIntoCell(tables[0], "A1", "abc" ) - #go to second column - self.xUITest.executeCommand(".uno:GoRight") - #delete column - self.xUITest.executeCommand(".uno:DeleteColumns") - #check the format of the text (should be still bold) Format-Character-Font-Style-Bold - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xweststylelbcjk = xDialog.getChild("weststylelb-cjk") - self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") - xCloseBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert table 2x2 + 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) + #select font format - Bold and write text "abc" + self.xUITest.executeCommand(".uno:Bold") + tables = document.getTextTables() + self.insertTextIntoCell(tables[0], "A1", "abc" ) + #go to second column + self.xUITest.executeCommand(".uno:GoRight") + #delete column + self.xUITest.executeCommand(".uno:DeleteColumns") + #check the format of the text (should be still bold) Format-Character-Font-Style-Bold + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("weststylelb-cjk") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf115573.py b/sw/qa/uitest/writer_tests4/tdf115573.py index b931cbcdcbd6..af22c155b21e 100644 --- a/sw/qa/uitest/writer_tests4/tdf115573.py +++ b/sw/qa/uitest/writer_tests4/tdf115573.py @@ -15,114 +15,121 @@ class tdf115573(UITestCase): tableText.setString( text ) def test_tdf115573_Table_loses_formatting_inserting_row_before(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - #insert table 2x2 - 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) - #select font format - Bold and write text "abc" - self.xUITest.executeCommand(".uno:Bold") - tables = document.getTextTables() - self.insertTextIntoCell(tables[0], "A1", "abc" ) - #go to second row - arrow down - self.xUITest.executeCommand(".uno:GoDown") - #insert row - self.xUITest.executeCommand(".uno:InsertRowsBefore") - #go up - self.xUITest.executeCommand(".uno:GoUp") - self.xUITest.executeCommand(".uno:GoUp") - #check the format of the text (should be still bold) Format-Character-Font-Style-Bold - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xweststylelbcjk = xDialog.getChild("weststylelb-cjk") - self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") - xCloseBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert table 2x2 + 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) + #select font format - Bold and write text "abc" + self.xUITest.executeCommand(".uno:Bold") + tables = document.getTextTables() + self.insertTextIntoCell(tables[0], "A1", "abc" ) + #go to second row - arrow down + self.xUITest.executeCommand(".uno:GoDown") + #insert row + self.xUITest.executeCommand(".uno:InsertRowsBefore") + #go up + self.xUITest.executeCommand(".uno:GoUp") + self.xUITest.executeCommand(".uno:GoUp") + #check the format of the text (should be still bold) Format-Character-Font-Style-Bold + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("weststylelb-cjk") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() def test_tdf115573_Table_loses_formatting_inserting_row_after(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - #insert table 2x2 - 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) - #select font format - Bold and write text "abc" - self.xUITest.executeCommand(".uno:Bold") - tables = document.getTextTables() - self.insertTextIntoCell(tables[0], "A1", "abc" ) - #go to second row - arrow down - self.xUITest.executeCommand(".uno:GoDown") - #insert row - self.xUITest.executeCommand(".uno:InsertRowsAfter") - #go up - self.xUITest.executeCommand(".uno:GoUp") - self.xUITest.executeCommand(".uno:GoUp") - #check the format of the text (should be still bold) Format-Character-Font-Style-Bold - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xweststylelbcjk = xDialog.getChild("weststylelb-cjk") - self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") - xCloseBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert table 2x2 + 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) + #select font format - Bold and write text "abc" + self.xUITest.executeCommand(".uno:Bold") + tables = document.getTextTables() + self.insertTextIntoCell(tables[0], "A1", "abc" ) + #go to second row - arrow down + self.xUITest.executeCommand(".uno:GoDown") + #insert row + self.xUITest.executeCommand(".uno:InsertRowsAfter") + #go up + self.xUITest.executeCommand(".uno:GoUp") + self.xUITest.executeCommand(".uno:GoUp") + #check the format of the text (should be still bold) Format-Character-Font-Style-Bold + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("weststylelb-cjk") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() def test_tdf115573_Table_loses_formatting_inserting_column_left(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - #insert table 2x2 - 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) - #select font format - Bold and write text "abc" - self.xUITest.executeCommand(".uno:Bold") - tables = document.getTextTables() - self.insertTextIntoCell(tables[0], "A1", "abc" ) - #insert column left - self.xUITest.executeCommand(".uno:InsertColumnsBefore") - #check the format of the text (should be still bold) Format-Character-Font-Style-Bold - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xweststylelbcjk = xDialog.getChild("weststylelb-cjk") - self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") - xCloseBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert table 2x2 + 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) + #select font format - Bold and write text "abc" + self.xUITest.executeCommand(".uno:Bold") + tables = document.getTextTables() + self.insertTextIntoCell(tables[0], "A1", "abc" ) + #insert column left + self.xUITest.executeCommand(".uno:InsertColumnsBefore") + #check the format of the text (should be still bold) Format-Character-Font-Style-Bold + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("weststylelb-cjk") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() def test_tdf115573_Table_loses_formatting_inserting_column_right(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - #insert table 2x2 - 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) - #select font format - Bold and write text "abc" - self.xUITest.executeCommand(".uno:Bold") - tables = document.getTextTables() - self.insertTextIntoCell(tables[0], "A1", "abc" ) - #insert column left - self.xUITest.executeCommand(".uno:InsertColumnsAfter") - #check the format of the text (should be still bold) Format-Character-Font-Style-Bold - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") - xweststylelbcjk = xDialog.getChild("weststylelb-cjk") - self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") - xCloseBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert table 2x2 + 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) + #select font format - Bold and write text "abc" + self.xUITest.executeCommand(".uno:Bold") + tables = document.getTextTables() + self.insertTextIntoCell(tables[0], "A1", "abc" ) + #insert column left + self.xUITest.executeCommand(".uno:InsertColumnsAfter") + #check the format of the text (should be still bold) Format-Character-Font-Style-Bold + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("weststylelb-cjk") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf51352.py b/sw/qa/uitest/writer_tests4/tdf51352.py index 1dd766afbfce..fdc5c66b7e85 100644 --- a/sw/qa/uitest/writer_tests4/tdf51352.py +++ b/sw/qa/uitest/writer_tests4/tdf51352.py @@ -12,40 +12,41 @@ class tdf51352(UITestCase): def test_convert_nested_table_to_text_tdf51352(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. New a text document - #2. Insert a table and then in one cell create another table - #-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()) - #3. Select the first table - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) - self.assertEqual(document.TextTables.getCount(), 2) - #4. From menu "Table->Convert->Table to Text - self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") - xDialog = self.xUITest.getTopFocusWindow() - xOkBtn = xDialog.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) - self.assertEqual(document.TextTables.getCount(), 0) - #5. Undo/Redo - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.TextTables.getCount(), 2) - self.xUITest.executeCommand(".uno:Redo") - self.assertEqual(document.TextTables.getCount(), 0) + 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. New a text document + #2. Insert a table and then in one cell create another table + #-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()) + #3. Select the first table + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + self.assertEqual(document.TextTables.getCount(), 2) + #4. From menu "Table->Convert->Table to Text + self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") + xDialog = self.xUITest.getTopFocusWindow() + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + self.assertEqual(document.TextTables.getCount(), 0) + #5. Undo/Redo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 2) + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(document.TextTables.getCount(), 0) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf92611.py b/sw/qa/uitest/writer_tests4/tdf92611.py index be2971055f79..8fee6143c4c7 100644 --- a/sw/qa/uitest/writer_tests4/tdf92611.py +++ b/sw/qa/uitest/writer_tests4/tdf92611.py @@ -10,10 +10,12 @@ class tdf92611(UITestCase): def test_launch_and_close_bibliography(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - self.xUITest.executeCommand(".uno:BibliographyComponent") + self.xUITest.executeCommand(".uno:BibliographyComponent") - self.xUITest.executeCommand(".uno:CloseWin") + self.xUITest.executeCommand(".uno:CloseWin") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/about_test.py b/sw/qa/uitest/writer_tests5/about_test.py index 0ab691dcc35b..7005dbb65221 100644 --- a/sw/qa/uitest/writer_tests5/about_test.py +++ b/sw/qa/uitest/writer_tests5/about_test.py @@ -11,13 +11,15 @@ class AboutDlgTest(UITestCase): def test_about_dlg(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - self.ui_test.execute_dialog_through_command(".uno:About") + self.ui_test.execute_dialog_through_command(".uno:About") - xAboutDlg = self.xUITest.getTopFocusWindow() + xAboutDlg = self.xUITest.getTopFocusWindow() - xCloseBtn = xAboutDlg.getChild("btnClose") - self.ui_test.close_dialog_through_button(xCloseBtn) + xCloseBtn = xAboutDlg.getChild("btnClose") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/autocorrectOptions.py b/sw/qa/uitest/writer_tests5/autocorrectOptions.py index bdf28325a700..645a334187eb 100644 --- a/sw/qa/uitest/writer_tests5/autocorrectOptions.py +++ b/sw/qa/uitest/writer_tests5/autocorrectOptions.py @@ -12,87 +12,89 @@ from uitest.uihelper.common import select_pos class autocorrectOptions(UITestCase): def test_autocorrect_options_writer(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:AutoCorrectDlg") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "0") #tab replace - origtext = xDialog.getChild("origtext") - newtext = xDialog.getChild("newtext") - xnew = xDialog.getChild("new") - xdelete = xDialog.getChild("delete") - xtabview = xDialog.getChild("tabview") - xreset = xDialog.getChild("reset") - nrRows = get_state_as_dict(xtabview)["VisibleCount"] - - self.assertTrue(int(nrRows) > 0) - - #add new rule - origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) - newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) - xnew.executeAction("CLICK", tuple()) - nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"] - nrRowsDiff = int(nrRowsNew) - int(nrRows) - self.assertEqual(nrRowsDiff, 1) #we have +1 rule - #delete rule - origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) - newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) - xdelete.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules - - select_pos(xTabs, "1") #tab Exceptions - #abbreviations - abbrev = xDialog.getChild("abbrev") - newabbrev = xDialog.getChild("newabbrev") - delabbrev = xDialog.getChild("delabbrev") - abbrevlist = xDialog.getChild("abbrevlist") - - nrRowsAbb = get_state_as_dict(abbrevlist)["VisibleCount"] - - self.assertTrue(int(nrRowsAbb) > 0) - - abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"})) - newabbrev.executeAction("CLICK", tuple()) - nrRowsAbbNew = get_state_as_dict(abbrevlist)["VisibleCount"] - nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb) - self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule - delabbrev.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(abbrevlist)["VisibleCount"], nrRowsAbb) #we have default nr of rules - - #words with two initial capitals - double = xDialog.getChild("double") - newdouble = xDialog.getChild("newdouble") - deldouble = xDialog.getChild("deldouble") - doublelist = xDialog.getChild("doublelist") - - nrRowsDouble = get_state_as_dict(doublelist)["VisibleCount"] - - self.assertTrue(int(nrRowsDouble) > 0) - - double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"})) - newdouble.executeAction("CLICK", tuple()) - nrRowsDoubleNew = get_state_as_dict(doublelist)["VisibleCount"] - nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and - self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule - deldouble.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(doublelist)["VisibleCount"], nrRowsDouble) #we have default nr of rules - - xCancelButton = xDialog.getChild("cancel") - xCancelButton.executeAction("CLICK", tuple()) + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab replace + origtext = xDialog.getChild("origtext") + newtext = xDialog.getChild("newtext") + xnew = xDialog.getChild("new") + xdelete = xDialog.getChild("delete") + xtabview = xDialog.getChild("tabview") + xreset = xDialog.getChild("reset") + nrRows = get_state_as_dict(xtabview)["VisibleCount"] + + self.assertTrue(int(nrRows) > 0) + + #add new rule + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) + xnew.executeAction("CLICK", tuple()) + nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"] + nrRowsDiff = int(nrRowsNew) - int(nrRows) + self.assertEqual(nrRowsDiff, 1) #we have +1 rule + #delete rule + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) + xdelete.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules + + select_pos(xTabs, "1") #tab Exceptions + #abbreviations + abbrev = xDialog.getChild("abbrev") + newabbrev = xDialog.getChild("newabbrev") + delabbrev = xDialog.getChild("delabbrev") + abbrevlist = xDialog.getChild("abbrevlist") + + nrRowsAbb = get_state_as_dict(abbrevlist)["VisibleCount"] + + self.assertTrue(int(nrRowsAbb) > 0) + + abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"})) + newabbrev.executeAction("CLICK", tuple()) + nrRowsAbbNew = get_state_as_dict(abbrevlist)["VisibleCount"] + nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb) + self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule + delabbrev.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(abbrevlist)["VisibleCount"], nrRowsAbb) #we have default nr of rules + + #words with two initial capitals + double = xDialog.getChild("double") + newdouble = xDialog.getChild("newdouble") + deldouble = xDialog.getChild("deldouble") + doublelist = xDialog.getChild("doublelist") + + nrRowsDouble = get_state_as_dict(doublelist)["VisibleCount"] + + self.assertTrue(int(nrRowsDouble) > 0) + + double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"})) + newdouble.executeAction("CLICK", tuple()) + nrRowsDoubleNew = get_state_as_dict(doublelist)["VisibleCount"] + nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and + self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule + deldouble.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(doublelist)["VisibleCount"], nrRowsDouble) #we have default nr of rules + + xCancelButton = xDialog.getChild("cancel") + xCancelButton.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/columns.py b/sw/qa/uitest/writer_tests5/columns.py index bede4b0f16db..03ca73b083ad 100644 --- a/sw/qa/uitest/writer_tests5/columns.py +++ b/sw/qa/uitest/writer_tests5/columns.py @@ -12,41 +12,43 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class columns(UITestCase): def test_columns(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() - change_measurement_unit(self, "Centimeter") + change_measurement_unit(self, "Centimeter") - #dialog Columns - self.ui_test.execute_dialog_through_command(".uno:FormatColumns") - xDialog = self.xUITest.getTopFocusWindow() + #dialog Columns + self.ui_test.execute_dialog_through_command(".uno:FormatColumns") + xDialog = self.xUITest.getTopFocusWindow() - colsnf = xDialog.getChild("colsnf") - colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - colsnf.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) - colsnf.executeAction("UP", tuple()) - colsnf.executeAction("DOWN", tuple()) - spacing1mf = xDialog.getChild("spacing1mf") - spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - spacing1mf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - autowidth = xDialog.getChild("autowidth") - autowidth.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - #verify - self.ui_test.execute_dialog_through_command(".uno:FormatColumns") - xDialog = self.xUITest.getTopFocusWindow() - colsnf = xDialog.getChild("colsnf") - spacing1mf = xDialog.getChild("spacing1mf") - autowidth = xDialog.getChild("autowidth") + colsnf = xDialog.getChild("colsnf") + colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + colsnf.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + colsnf.executeAction("UP", tuple()) + colsnf.executeAction("DOWN", tuple()) + spacing1mf = xDialog.getChild("spacing1mf") + spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + spacing1mf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + autowidth = xDialog.getChild("autowidth") + autowidth.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.ui_test.execute_dialog_through_command(".uno:FormatColumns") + xDialog = self.xUITest.getTopFocusWindow() + colsnf = xDialog.getChild("colsnf") + spacing1mf = xDialog.getChild("spacing1mf") + autowidth = xDialog.getChild("autowidth") - self.assertEqual(get_state_as_dict(colsnf)["Text"], "2") - self.assertEqual(get_state_as_dict(spacing1mf)["Text"], "1.00 cm") - self.assertEqual(get_state_as_dict(autowidth)["Selected"], "false") - xOKBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xOKBtn) + self.assertEqual(get_state_as_dict(colsnf)["Text"], "2") + self.assertEqual(get_state_as_dict(spacing1mf)["Text"], "1.00 cm") + self.assertEqual(get_state_as_dict(autowidth)["Selected"], "false") + xOKBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf107494.py b/sw/qa/uitest/writer_tests5/tdf107494.py index 98de7442e5f3..0657f33f0635 100644 --- a/sw/qa/uitest/writer_tests5/tdf107494.py +++ b/sw/qa/uitest/writer_tests5/tdf107494.py @@ -12,71 +12,74 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf107494(UITestCase): def test_tdf107494_delete_header_with_image(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - #insert header - self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False) - self.xUITest.executeCommand(".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=true") - self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True) - #insert image - text = document.getText() - cursor = text.createTextCursor() - oStyleFamilies = document.getStyleFamilies() - #https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=71227 - obj2 = oStyleFamilies.getByName("PageStyles") - obj3 = obj2.getByName("Standard") - oHeaderText = obj3.HeaderText - oHeaderText.setString("New text for header") #write text to header - obj4 = oHeaderText.createTextCursor() - text = obj4.getText() - cursor = text.createTextCursor() + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert header + self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False) + self.xUITest.executeCommand(".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=true") + self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True) + #insert image + text = document.getText() + cursor = text.createTextCursor() + oStyleFamilies = document.getStyleFamilies() + #https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=71227 + obj2 = oStyleFamilies.getByName("PageStyles") + obj3 = obj2.getByName("Standard") + oHeaderText = obj3.HeaderText + oHeaderText.setString("New text for header") #write text to header + obj4 = oHeaderText.createTextCursor() + text = obj4.getText() + cursor = text.createTextCursor() - textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject') - provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider') - graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice_external_logo_100px.png")})) - textGraphic.Graphic = graphic - text.insertTextContent(cursor, textGraphic, False) - # Delete the header - self.ui_test.execute_dialog_through_command(".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=false") - xDialog = self.xUITest.getTopFocusWindow() #question dialog - xOption = xDialog.getChild("yes") - xOption.executeAction("CLICK", tuple()) + textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject') + provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider') + graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice_external_logo_100px.png")})) + textGraphic.Graphic = graphic + text.insertTextContent(cursor, textGraphic, False) + # Delete the header + self.ui_test.execute_dialog_through_command(".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=false") + xDialog = self.xUITest.getTopFocusWindow() #question dialog + xOption = xDialog.getChild("yes") + xOption.executeAction("CLICK", tuple()) - self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False) + self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False) + + self.ui_test.close_doc() def test_tdf107494_delete_footer_with_image(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - #insert footer - self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, False) - self.xUITest.executeCommand(".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=true") - self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, True) - #insert image - text = document.getText() - cursor = text.createTextCursor() - oStyleFamilies = document.getStyleFamilies() - #https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=71227 - obj2 = oStyleFamilies.getByName("PageStyles") - obj3 = obj2.getByName("Standard") - oFooterText = obj3.FooterText - oFooterText.setString("New text for footer") #write text to footer - obj4 = oFooterText.createTextCursor() - text = obj4.getText() - cursor = text.createTextCursor() + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #insert footer + self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, False) + self.xUITest.executeCommand(".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=true") + self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, True) + #insert image + text = document.getText() + cursor = text.createTextCursor() + oStyleFamilies = document.getStyleFamilies() + #https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=71227 + obj2 = oStyleFamilies.getByName("PageStyles") + obj3 = obj2.getByName("Standard") + oFooterText = obj3.FooterText + oFooterText.setString("New text for footer") #write text to footer + obj4 = oFooterText.createTextCursor() + text = obj4.getText() + cursor = text.createTextCursor() - textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject') - provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider') - graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice_external_logo_100px.png")})) - textGraphic.Graphic = graphic - text.insertTextContent(cursor, textGraphic, False) - # Delete the footer - self.ui_test.execute_dialog_through_command(".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=false") - xDialog = self.xUITest.getTopFocusWindow() #question dialog - xOption = xDialog.getChild("yes") - xOption.executeAction("CLICK", tuple()) + textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject') + provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider') + graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice_external_logo_100px.png")})) + textGraphic.Graphic = graphic + text.insertTextContent(cursor, textGraphic, False) + # Delete the footer + self.ui_test.execute_dialog_through_command(".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=false") + xDialog = self.xUITest.getTopFocusWindow() #question dialog + xOption = xDialog.getChild("yes") + xOption.executeAction("CLICK", tuple()) - self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, False) + self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, False) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf122045.py b/sw/qa/uitest/writer_tests5/tdf122045.py index 4b410aad9d3c..c40469a70de8 100644 --- a/sw/qa/uitest/writer_tests5/tdf122045.py +++ b/sw/qa/uitest/writer_tests5/tdf122045.py @@ -12,29 +12,31 @@ class tdf122045(UITestCase): def test_tdf122045(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_dialog_through_command(".uno:PageDialog") - xDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "2") + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") - btncolor = xDialog.getChild("btncolor") - btncolor.executeAction("CLICK", tuple()) + btncolor = xDialog.getChild("btncolor") + btncolor.executeAction("CLICK", tuple()) - xApplyBtn = xDialog.getChild("apply") - xApplyBtn.executeAction("CLICK", tuple()) + xApplyBtn = xDialog.getChild("apply") + xApplyBtn.executeAction("CLICK", tuple()) - self.assertTrue(document.isModified()) - self.assertEqual("0x729fcf", hex(document.StyleFamilies.PageStyles.Standard.BackColor)) + self.assertTrue(document.isModified()) + self.assertEqual("0x729fcf", hex(document.StyleFamilies.PageStyles.Standard.BackColor)) - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) - self.assertTrue(document.isModified()) - self.assertEqual("0x729fcf", hex(document.StyleFamilies.PageStyles.Standard.BackColor)) + self.assertTrue(document.isModified()) + self.assertEqual("0x729fcf", hex(document.StyleFamilies.PageStyles.Standard.BackColor)) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf122722.py b/sw/qa/uitest/writer_tests5/tdf122722.py index 9b3e43565ce4..4e91519a37af 100644 --- a/sw/qa/uitest/writer_tests5/tdf122722.py +++ b/sw/qa/uitest/writer_tests5/tdf122722.py @@ -12,60 +12,61 @@ from uitest.uihelper.common import select_pos class tdf122722(UITestCase): def test_tdf122722_format_character_hidden(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") - #1. Start LibreOffice - #2. Create New Writer Document - #3. Type "LibreOffice" in Writer - type_text(xWriterEdit, "LibreOffice") - #4. Select "LibreOffice" with mouse, and right click - self.xUITest.executeCommand(".uno:SelectAll") - self.assertEqual(document.Text.String[0:11], "LibreOffice") - #5. Appear Context Menu, Character -> Character - #6. Opened Character, Select "Font Effect" tab - #7. Check Hidden, and click [OK] - #8. Crash a LibreOffice - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #1. Start LibreOffice + #2. Create New Writer Document + #3. Type "LibreOffice" in Writer + type_text(xWriterEdit, "LibreOffice") + #4. Select "LibreOffice" with mouse, and right click + self.xUITest.executeCommand(".uno:SelectAll") + self.assertEqual(document.Text.String[0:11], "LibreOffice") + #5. Appear Context Menu, Character -> Character + #6. Opened Character, Select "Font Effect" tab + #7. Check Hidden, and click [OK] + #8. Crash a LibreOffice + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") - xEffects = xDialog.getChild("effectslb") - xRelief = xDialog.getChild("relieflb") - xHidden = xDialog.getChild("hiddencb") - xOverline = xDialog.getChild("overlinelb") - xStrikeout = xDialog.getChild("strikeoutlb") - xUnderline = xDialog.getChild("underlinelb") - xEmphasis = xDialog.getChild("emphasislb") - xPosition = xDialog.getChild("positionlb") + xEffects = xDialog.getChild("effectslb") + xRelief = xDialog.getChild("relieflb") + xHidden = xDialog.getChild("hiddencb") + xOverline = xDialog.getChild("overlinelb") + xStrikeout = xDialog.getChild("strikeoutlb") + xUnderline = xDialog.getChild("underlinelb") + xEmphasis = xDialog.getChild("emphasislb") + xPosition = xDialog.getChild("positionlb") - xHidden.executeAction("CLICK", tuple()) + xHidden.executeAction("CLICK", tuple()) - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) - #un-hidden - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #un-hidden + self.ui_test.execute_dialog_through_command(".uno:FontDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") - xEffects = xDialog.getChild("effectslb") - xRelief = xDialog.getChild("relieflb") - xHidden = xDialog.getChild("hiddencb") - xOverline = xDialog.getChild("overlinelb") - xStrikeout = xDialog.getChild("strikeoutlb") - xUnderline = xDialog.getChild("underlinelb") - xEmphasis = xDialog.getChild("emphasislb") - xPosition = xDialog.getChild("positionlb") + xEffects = xDialog.getChild("effectslb") + xRelief = xDialog.getChild("relieflb") + xHidden = xDialog.getChild("hiddencb") + xOverline = xDialog.getChild("overlinelb") + xStrikeout = xDialog.getChild("strikeoutlb") + xUnderline = xDialog.getChild("underlinelb") + xEmphasis = xDialog.getChild("emphasislb") + xPosition = xDialog.getChild("positionlb") - self.assertEqual(get_state_as_dict(xHidden)["Selected"], "true") - xHidden.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xHidden)["Selected"], "true") + xHidden.executeAction("CLICK", tuple()) - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - self.assertEqual(document.Text.String[0:11], "LibreOffice") + self.assertEqual(document.Text.String[0:11], "LibreOffice") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf123378.py b/sw/qa/uitest/writer_tests5/tdf123378.py index 444a92c0a028..d7b832e25c8c 100644 --- a/sw/qa/uitest/writer_tests5/tdf123378.py +++ b/sw/qa/uitest/writer_tests5/tdf123378.py @@ -12,15 +12,16 @@ class tdf123378(UITestCase): def test_tdf123378_print_sets_modified(self): # FIXME unstable test return - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() - self.xUITest.executeCommand(".uno:Print") - xDialog = self.xUITest.getTopFocusWindow() - xOK = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xOK) + self.xUITest.executeCommand(".uno:Print") + xDialog = self.xUITest.getTopFocusWindow() + xOK = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xOK) - self.assertEqual(document.isModified(), False) + self.assertEqual(document.isModified(), False) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/tdf123446.py b/sw/qa/uitest/writer_tests5/tdf123446.py index 15aa646ff93b..5a48578fa593 100644 --- a/sw/qa/uitest/writer_tests5/tdf123446.py +++ b/sw/qa/uitest/writer_tests5/tdf123446.py @@ -11,32 +11,33 @@ from uitest.uihelper.common import type_text class tdf123446(UITestCase): def test_tsd123446_undo_redo_ToC_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 a word to an empty document. - type_text(xWriterEdit, "LibreOffice") - #- Change its style to Heading 2. - self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%202&FamilyName:string=ParagraphStyles") - #- Position cursor somewhere in the middle of the word, and add Table of Contents - #(no need to change anything in the dialog). - self.xUITest.executeCommand(".uno:GoLeft") - self.xUITest.executeCommand(".uno:GoLeft") - self.xUITest.executeCommand(".uno:GoLeft") - self.xUITest.executeCommand(".uno:GoLeft") + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #- Add a word to an empty document. + type_text(xWriterEdit, "LibreOffice") + #- Change its style to Heading 2. + self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%202&FamilyName:string=ParagraphStyles") + #- Position cursor somewhere in the middle of the word, and add Table of Contents + #(no need to change anything in the dialog). + self.xUITest.executeCommand(".uno:GoLeft") + self.xUITest.executeCommand(".uno:GoLeft") + self.xUITest.executeCommand(".uno:GoLeft") + self.xUITest.executeCommand(".uno:GoLeft") - self.ui_test.execute_dialog_through_command(".uno:InsertMultiIndex") - xDialog = self.xUITest.getTopFocusWindow() - xokbtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xokbtn) - #- Undo the ToC insertion. - self.xUITest.executeCommand(".uno:Undo") - #- Redo the ToC insertion. - self.xUITest.executeCommand(".uno:Redo") - #=> Crash. Now we verify the text - # This second undo crash in Clang build https://bugs.documentfoundation.org/show_bug.cgi?id=123313#c9 - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.Text.String[0:7], "LibreOf") + self.ui_test.execute_dialog_through_command(".uno:InsertMultiIndex") + xDialog = self.xUITest.getTopFocusWindow() + xokbtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xokbtn) + #- Undo the ToC insertion. + self.xUITest.executeCommand(".uno:Undo") + #- Redo the ToC insertion. + self.xUITest.executeCommand(".uno:Redo") + #=> Crash. Now we verify the text + # This second undo crash in Clang build https://bugs.documentfoundation.org/show_bug.cgi?id=123313#c9 + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Text.String[0:7], "LibreOf") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/titlePage.py b/sw/qa/uitest/writer_tests5/titlePage.py index 5f3e9f8fcf91..f048bc6ea006 100644 --- a/sw/qa/uitest/writer_tests5/titlePage.py +++ b/sw/qa/uitest/writer_tests5/titlePage.py @@ -9,28 +9,30 @@ from uitest.framework import UITestCase class titlePage(UITestCase): def test_title_page(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - #dialog Title Page - self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") - xDialog = self.xUITest.getTopFocusWindow() - #print(xDialog.getChildren()) + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #dialog Title Page + self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") + xDialog = self.xUITest.getTopFocusWindow() + #print(xDialog.getChildren()) - #select new Pages; nr of pages =2 (click UP), save; verify pageCount = 3 - newPages = xDialog.getChild("RB_INSERT_NEW_PAGES") - newPages.executeAction("CLICK", tuple()) - xpageCount = xDialog.getChild("NF_PAGE_COUNT") - xpageCount.executeAction("UP", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - self.assertEqual(document.CurrentController.PageCount, 3) + #select new Pages; nr of pages =2 (click UP), save; verify pageCount = 3 + newPages = xDialog.getChild("RB_INSERT_NEW_PAGES") + newPages.executeAction("CLICK", tuple()) + xpageCount = xDialog.getChild("NF_PAGE_COUNT") + xpageCount.executeAction("UP", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.assertEqual(document.CurrentController.PageCount, 3) - # check cancel button - self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - self.assertEqual(document.CurrentController.PageCount, 3) + # check cancel button + self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + self.assertEqual(document.CurrentController.PageCount, 3) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/xwindow.py b/sw/qa/uitest/writer_tests5/xwindow.py index 05db1a8f3b4d..cdacffcb70ae 100644 --- a/sw/qa/uitest/writer_tests5/xwindow.py +++ b/sw/qa/uitest/writer_tests5/xwindow.py @@ -76,100 +76,101 @@ class XWindow(UITestCase): def test_listeners(self): global mouseListenerCount - with self.ui_test.create_doc_in_start_center("writer"): - xDoc = self.ui_test.get_component() - - # create new mouse listener - xFrame = xDoc.getCurrentController().getFrame() - self.assertIsNotNone(xFrame) - xWindow = xFrame.getContainerWindow() - self.assertIsNotNone(xWindow) - - # add new mouse listener - xMouseListener = XMouseListenerExtended() - self.assertIsNotNone(xMouseListener) - xWindow.addMouseListener(xMouseListener) - self.assertEqual(1, mouseListenerCount) - - # add new key listener - xKeyListener = XKeyListenerExtended() - self.assertIsNotNone(xKeyListener) - xWindow.addKeyListener(xKeyListener) - - # create dummy mouse event - xMouseEvent = MouseEvent() - xMouseEvent.Modifiers = 0 - xMouseEvent.Buttons = MouseButton.LEFT - xMouseEvent.X = 10 - xMouseEvent.Y = 10 - xMouseEvent.ClickCount = 1 - xMouseEvent.PopupTrigger = False - xMouseEvent.Source = xWindow - - xMouseEvent2 = MouseEvent() - xMouseEvent2.Modifiers = 0 - xMouseEvent2.Buttons = MouseButton.LEFT - xMouseEvent2.X = 300 - xMouseEvent2.Y = 300 - xMouseEvent2.ClickCount = 1 - xMouseEvent2.PopupTrigger = False - xMouseEvent2.Source = xWindow - - # send mouse event - xToolkitRobot = xWindow.getToolkit() - self.assertIsNotNone(xToolkitRobot) - - # Click in the menubar/toolbar area - xToolkitRobot.mouseMove(xMouseEvent) - xToolkitRobot.mousePress(xMouseEvent) - xToolkitRobot.mouseRelease(xMouseEvent) - - # Click into the document content - xToolkitRobot.mousePress(xMouseEvent2) - xToolkitRobot.mouseRelease(xMouseEvent2) - - # send key press event - xKeyEvent = KeyEvent() - xKeyEvent.Modifiers = 0 - xKeyEvent.KeyCode = 70 - xKeyEvent.KeyChar = 70 - xKeyEvent.Source = xWindow - - xToolkitRobot.keyPress(xKeyEvent) - xToolkitRobot.keyRelease(xKeyEvent) - - # Wait for async events to be processed - xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') - xToolkit.processEventsToIdle() - - # remove mouse listener - xWindow.removeMouseListener(xMouseListener) - self.assertEqual(1, mouseListenerCount) - del xMouseListener - - # remove key listener - xWindow.removeKeyListener(xKeyListener) - del xKeyListener - - global keymousePressedEventsIntercepted - # Not expected any interceptions - self.assertEqual(0, keymousePressedEventsIntercepted) - - global keymouseReleasedEventsIntercepted - # Not expected any interceptions - self.assertEqual(0, keymouseReleasedEventsIntercepted) - - global mousePressedEventsIntercepted - self.assertEqual(0, mousePressedEventsIntercepted) - - global mouseReleasedEventsIntercepted - self.assertEqual(0, mouseReleasedEventsIntercepted) - - global mouseEventsIntercepted - # Not expected 3 interceptions - self.assertEqual(0, mouseEventsIntercepted) - - # close document + self.ui_test.create_doc_in_start_center("writer") + xDoc = self.ui_test.get_component() + + # create new mouse listener + xFrame = xDoc.getCurrentController().getFrame() + self.assertIsNotNone(xFrame) + xWindow = xFrame.getContainerWindow() + self.assertIsNotNone(xWindow) + + # add new mouse listener + xMouseListener = XMouseListenerExtended() + self.assertIsNotNone(xMouseListener) + xWindow.addMouseListener(xMouseListener) + self.assertEqual(1, mouseListenerCount) + + # add new key listener + xKeyListener = XKeyListenerExtended() + self.assertIsNotNone(xKeyListener) + xWindow.addKeyListener(xKeyListener) + + # create dummy mouse event + xMouseEvent = MouseEvent() + xMouseEvent.Modifiers = 0 + xMouseEvent.Buttons = MouseButton.LEFT + xMouseEvent.X = 10 + xMouseEvent.Y = 10 + xMouseEvent.ClickCount = 1 + xMouseEvent.PopupTrigger = False + xMouseEvent.Source = xWindow + + xMouseEvent2 = MouseEvent() + xMouseEvent2.Modifiers = 0 + xMouseEvent2.Buttons = MouseButton.LEFT + xMouseEvent2.X = 300 + xMouseEvent2.Y = 300 + xMouseEvent2.ClickCount = 1 + xMouseEvent2.PopupTrigger = False + xMouseEvent2.Source = xWindow + + # send mouse event + xToolkitRobot = xWindow.getToolkit() + self.assertIsNotNone(xToolkitRobot) + + # Click in the menubar/toolbar area + xToolkitRobot.mouseMove(xMouseEvent) + xToolkitRobot.mousePress(xMouseEvent) + xToolkitRobot.mouseRelease(xMouseEvent) + + # Click into the document content + xToolkitRobot.mousePress(xMouseEvent2) + xToolkitRobot.mouseRelease(xMouseEvent2) + + # send key press event + xKeyEvent = KeyEvent() + xKeyEvent.Modifiers = 0 + xKeyEvent.KeyCode = 70 + xKeyEvent.KeyChar = 70 + xKeyEvent.Source = xWindow + + xToolkitRobot.keyPress(xKeyEvent) + xToolkitRobot.keyRelease(xKeyEvent) + + # Wait for async events to be processed + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + # remove mouse listener + xWindow.removeMouseListener(xMouseListener) + self.assertEqual(1, mouseListenerCount) + del xMouseListener + + # remove key listener + xWindow.removeKeyListener(xKeyListener) + del xKeyListener + + global keymousePressedEventsIntercepted + # Not expected any interceptions + self.assertEqual(0, keymousePressedEventsIntercepted) + + global keymouseReleasedEventsIntercepted + # Not expected any interceptions + self.assertEqual(0, keymouseReleasedEventsIntercepted) + + global mousePressedEventsIntercepted + self.assertEqual(0, mousePressedEventsIntercepted) + + global mouseReleasedEventsIntercepted + self.assertEqual(0, mouseReleasedEventsIntercepted) + + global mouseEventsIntercepted + # Not expected 3 interceptions + self.assertEqual(0, mouseEventsIntercepted) + + # close document + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/zoom.py b/sw/qa/uitest/writer_tests5/zoom.py index 405c1b584b10..df92b35e929e 100644 --- a/sw/qa/uitest/writer_tests5/zoom.py +++ b/sw/qa/uitest/writer_tests5/zoom.py @@ -11,92 +11,94 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class writerZoom(UITestCase): def test_zoom_writer(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - #dialog View-Zoom-Zoom - self.ui_test.execute_dialog_through_command(".uno:Zoom") - xDialog = self.xUITest.getTopFocusWindow() + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #dialog View-Zoom-Zoom + self.ui_test.execute_dialog_through_command(".uno:Zoom") + xDialog = self.xUITest.getTopFocusWindow() - #select Optimal & Automatic - OK - open and verify - optimal = xDialog.getChild("optimal") - optimal.executeAction("CLICK", tuple()) - automatic = xDialog.getChild("automatic") - automatic.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + #select Optimal & Automatic - OK - open and verify + optimal = xDialog.getChild("optimal") + optimal.executeAction("CLICK", tuple()) + automatic = xDialog.getChild("automatic") + automatic.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - self.ui_test.execute_dialog_through_command(".uno:Zoom") - xDialog = self.xUITest.getTopFocusWindow() - optimal = xDialog.getChild("optimal") - automatic = xDialog.getChild("automatic") - self.assertEqual(get_state_as_dict(optimal)["Checked"], "true") - self.assertEqual(get_state_as_dict(automatic)["Checked"], "true") - #select fit weight & Single page - OK - open and verify - fitwandh = xDialog.getChild("fitwandh") - singlepage = xDialog.getChild("singlepage") - fitwandh.executeAction("CLICK", tuple()) - singlepage.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.execute_dialog_through_command(".uno:Zoom") + xDialog = self.xUITest.getTopFocusWindow() + optimal = xDialog.getChild("optimal") + automatic = xDialog.getChild("automatic") + self.assertEqual(get_state_as_dict(optimal)["Checked"], "true") + self.assertEqual(get_state_as_dict(automatic)["Checked"], "true") + #select fit weight & Single page - OK - open and verify + fitwandh = xDialog.getChild("fitwandh") + singlepage = xDialog.getChild("singlepage") + fitwandh.executeAction("CLICK", tuple()) + singlepage.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - self.ui_test.execute_dialog_through_command(".uno:Zoom") - xDialog = self.xUITest.getTopFocusWindow() - singlepage = xDialog.getChild("singlepage") - fitwandh = xDialog.getChild("fitwandh") - self.assertEqual(get_state_as_dict(singlepage)["Checked"], "true") - self.assertEqual(get_state_as_dict(fitwandh)["Checked"], "true") - #select fit width & columns - OK - open and verify - fitw = xDialog.getChild("fitw") - columnssb = xDialog.getChild("columnssb") - columns = xDialog.getChild("columns") - fitw.executeAction("CLICK", tuple()) - columns.executeAction("CLICK", tuple()) - columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - columnssb.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.execute_dialog_through_command(".uno:Zoom") + xDialog = self.xUITest.getTopFocusWindow() + singlepage = xDialog.getChild("singlepage") + fitwandh = xDialog.getChild("fitwandh") + self.assertEqual(get_state_as_dict(singlepage)["Checked"], "true") + self.assertEqual(get_state_as_dict(fitwandh)["Checked"], "true") + #select fit width & columns - OK - open and verify + fitw = xDialog.getChild("fitw") + columnssb = xDialog.getChild("columnssb") + columns = xDialog.getChild("columns") + fitw.executeAction("CLICK", tuple()) + columns.executeAction("CLICK", tuple()) + columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + columnssb.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - self.ui_test.execute_dialog_through_command(".uno:Zoom") - xDialog = self.xUITest.getTopFocusWindow() - fitw = xDialog.getChild("fitw") - columnssb = xDialog.getChild("columnssb") - columns = xDialog.getChild("columns") - self.assertEqual(get_state_as_dict(fitw)["Checked"], "true") - self.assertEqual(get_state_as_dict(columns)["Checked"], "true") - self.assertEqual(get_state_as_dict(columnssb)["Text"], "3") - #select 100% & Automatic - OK - open and verify - automatic = xDialog.getChild("automatic") - x100pc = xDialog.getChild("100pc") - x100pc.executeAction("CLICK", tuple()) - automatic.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.execute_dialog_through_command(".uno:Zoom") + xDialog = self.xUITest.getTopFocusWindow() + fitw = xDialog.getChild("fitw") + columnssb = xDialog.getChild("columnssb") + columns = xDialog.getChild("columns") + self.assertEqual(get_state_as_dict(fitw)["Checked"], "true") + self.assertEqual(get_state_as_dict(columns)["Checked"], "true") + self.assertEqual(get_state_as_dict(columnssb)["Text"], "3") + #select 100% & Automatic - OK - open and verify + automatic = xDialog.getChild("automatic") + x100pc = xDialog.getChild("100pc") + x100pc.executeAction("CLICK", tuple()) + automatic.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - self.ui_test.execute_dialog_through_command(".uno:Zoom") - xDialog = self.xUITest.getTopFocusWindow() - automatic = xDialog.getChild("automatic") - x100pc = xDialog.getChild("100pc") - self.assertEqual(get_state_as_dict(automatic)["Checked"], "true") - self.assertEqual(get_state_as_dict(x100pc)["Checked"], "true") - #select variable 103% & Automatic - OK - open and verify - variable = xDialog.getChild("variable") - zoomsb = xDialog.getChild("zoomsb") - variable.executeAction("CLICK", tuple()) - zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - zoomsb.executeAction("TYPE", mkPropertyValues({"TEXT":"101"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.execute_dialog_through_command(".uno:Zoom") + xDialog = self.xUITest.getTopFocusWindow() + automatic = xDialog.getChild("automatic") + x100pc = xDialog.getChild("100pc") + self.assertEqual(get_state_as_dict(automatic)["Checked"], "true") + self.assertEqual(get_state_as_dict(x100pc)["Checked"], "true") + #select variable 103% & Automatic - OK - open and verify + variable = xDialog.getChild("variable") + zoomsb = xDialog.getChild("zoomsb") + variable.executeAction("CLICK", tuple()) + zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + zoomsb.executeAction("TYPE", mkPropertyValues({"TEXT":"101"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) - self.ui_test.execute_dialog_through_command(".uno:Zoom") - xDialog = self.xUITest.getTopFocusWindow() - variable = xDialog.getChild("variable") - zoomsb = xDialog.getChild("zoomsb") - self.assertEqual(get_state_as_dict(variable)["Checked"], "true") - self.assertEqual(get_state_as_dict(zoomsb)["Text"], "101%") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.execute_dialog_through_command(".uno:Zoom") + xDialog = self.xUITest.getTopFocusWindow() + variable = xDialog.getChild("variable") + zoomsb = xDialog.getChild("zoomsb") + self.assertEqual(get_state_as_dict(variable)["Checked"], "true") + self.assertEqual(get_state_as_dict(zoomsb)["Text"], "101%") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/infobar.py b/sw/qa/uitest/writer_tests6/infobar.py index 0f850690e462..84dfdb3ac887 100644 --- a/sw/qa/uitest/writer_tests6/infobar.py +++ b/sw/qa/uitest/writer_tests6/infobar.py @@ -16,44 +16,45 @@ from com.sun.star.container import NoSuchElementException class tdf97926(UITestCase): def test_infobar_add(self): - with self.ui_test.create_doc_in_start_center("writer"): - controller = self.ui_test.get_component().getCurrentController() - buttons = [StringPair("Close", ".uno:CloseDoc")] + self.ui_test.create_doc_in_start_center("writer") + controller = self.ui_test.get_component().getCurrentController() + buttons = [StringPair("Close", ".uno:CloseDoc")] + controller.appendInfobar( + "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True) + + # Adding another infobar with the same ID should throw an exception + with self.assertRaises(IllegalArgumentException): controller.appendInfobar( "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True) - - # Adding another infobar with the same ID should throw an exception - with self.assertRaises(IllegalArgumentException): - controller.appendInfobar( - "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True) + self.ui_test.close_doc() def test_infobar_update(self): - with self.ui_test.create_doc_in_start_center("writer"): - controller = self.ui_test.get_component().getCurrentController() - buttons = [StringPair("Close", ".uno:CloseDoc")] - controller.appendInfobar( - "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True) - controller.updateInfobar("my", "Hello universe", "", InfobarType.WARNING) + self.ui_test.create_doc_in_start_center("writer") + controller = self.ui_test.get_component().getCurrentController() + buttons = [StringPair("Close", ".uno:CloseDoc")] + controller.appendInfobar( + "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True) + controller.updateInfobar("my", "Hello universe", "", InfobarType.WARNING) - # Updating non-existing infobars should throw an exception - with self.assertRaises(NoSuchElementException): - controller.updateInfobar("notexisting", "", "", InfobarType.WARNING) + # Updating non-existing infobars should throw an exception + with self.assertRaises(NoSuchElementException): + controller.updateInfobar("notexisting", "", "", InfobarType.WARNING) - # Passing invalid values for InfobarType should throw an exception - with self.assertRaises(IllegalArgumentException): - controller.updateInfobar("my", "", "", 120) + # Passing invalid values for InfobarType should throw an exception + with self.assertRaises(IllegalArgumentException): + controller.updateInfobar("my", "", "", 120) def test_infobar_remove(self): - with self.ui_test.create_doc_in_start_center("writer"): - controller = self.ui_test.get_component().getCurrentController() - buttons = [StringPair("Close", ".uno:CloseDoc")] - controller.appendInfobar( - "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True) + self.ui_test.create_doc_in_start_center("writer") + controller = self.ui_test.get_component().getCurrentController() + buttons = [StringPair("Close", ".uno:CloseDoc")] + controller.appendInfobar( + "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True) - controller.removeInfobar("my") + controller.removeInfobar("my") - # Removing an already removed infobar should throw an exception - with self.assertRaises(NoSuchElementException): - controller.removeInfobar("my") + # Removing an already removed infobar should throw an exception + with self.assertRaises(NoSuchElementException): + controller.removeInfobar("my") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf107847.py b/sw/qa/uitest/writer_tests6/tdf107847.py index 4fd2aaf1b86a..522fe99beba1 100644 --- a/sw/qa/uitest/writer_tests6/tdf107847.py +++ b/sw/qa/uitest/writer_tests6/tdf107847.py @@ -11,25 +11,26 @@ from uitest.uihelper.common import select_pos class tdf107847(UITestCase): def test_tdf_107847_macro_tab_crash(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() + 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:InsertFrame") # insert frame - xDialog = self.xUITest.getTopFocusWindow() - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - select_pos(xTabs, "2") - select_pos(xTabs, "3") - select_pos(xTabs, "4") - select_pos(xTabs, "5") - select_pos(xTabs, "6") - select_pos(xTabs, "7") - select_pos(xTabs, "8") #tab Macro - xokbtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xokbtn) + self.ui_test.execute_dialog_through_command(".uno:InsertFrame") # insert frame + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + select_pos(xTabs, "2") + select_pos(xTabs, "3") + select_pos(xTabs, "4") + select_pos(xTabs, "5") + select_pos(xTabs, "6") + select_pos(xTabs, "7") + select_pos(xTabs, "8") #tab Macro + xokbtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xokbtn) - self.assertEqual(document.TextFrames.getCount(), 1) - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.TextFrames.getCount(), 0) + self.assertEqual(document.TextFrames.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextFrames.getCount(), 0) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf118883.py b/sw/qa/uitest/writer_tests6/tdf118883.py index 1affcec41bd7..9a7397d413b1 100644 --- a/sw/qa/uitest/writer_tests6/tdf118883.py +++ b/sw/qa/uitest/writer_tests6/tdf118883.py @@ -10,30 +10,31 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class Tdf118883(UITestCase): def test_tdf118883(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - # Insert shape with Ctrl key - xArgs = mkPropertyValues({"KeyModifier": 8192}) - self.xUITest.executeCommandWithParameters(".uno:BasicShapes.rectangle", xArgs) + # Insert shape with Ctrl key + xArgs = mkPropertyValues({"KeyModifier": 8192}) + self.xUITest.executeCommandWithParameters(".uno:BasicShapes.rectangle", xArgs) - writer_document = self.ui_test.get_component() - self.assertEqual(1, writer_document.DrawPage.getCount()) + writer_document = self.ui_test.get_component() + self.assertEqual(1, writer_document.DrawPage.getCount()) - self.xUITest.executeCommand(".uno:Copy") + self.xUITest.executeCommand(".uno:Copy") - self.ui_test.execute_dialog_through_command(".uno:CloseDoc") - xDialog = self.xUITest.getTopFocusWindow() - xDiscardBtn = xDialog.getChild("discard") - self.ui_test.close_dialog_through_button(xDiscardBtn) + self.ui_test.execute_dialog_through_command(".uno:CloseDoc") + xDialog = self.xUITest.getTopFocusWindow() + xDiscardBtn = xDialog.getChild("discard") + self.ui_test.close_dialog_through_button(xDiscardBtn) - with self.ui_test.create_doc_in_start_center("calc"): + calc_doc = self.ui_test.create_doc_in_start_center("calc") - self.xUITest.executeCommand(".uno:Paste") + self.xUITest.executeCommand(".uno:Paste") - calc_document = self.ui_test.get_component() + calc_document = self.ui_test.get_component() - # Without the fix in place, this test would have failed with - # AssertionError: 1 != 0 - self.assertEqual(1, calc_document.DrawPages[0].getCount()) + # Without the fix in place, this test would have failed with + # AssertionError: 1 != 0 + self.assertEqual(1, calc_document.DrawPages[0].getCount()) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf125104.py b/sw/qa/uitest/writer_tests6/tdf125104.py index feda505caed1..0fa36587b20e 100644 --- a/sw/qa/uitest/writer_tests6/tdf125104.py +++ b/sw/qa/uitest/writer_tests6/tdf125104.py @@ -25,39 +25,41 @@ class tdf125104(UITestCase): self.ui_test.close_dialog_through_button(okBtn) def test_tdf125104_pageFormat_numbering(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - - # insert page numbers on multiple pages - self.xUITest.executeCommand(".uno:InsertPageNumberField") - self.xUITest.executeCommand(".uno:InsertPagebreak") - self.xUITest.executeCommand(".uno:InsertPageNumberField") - text = document.Text.String.replace('\r\n', '\n') - self.assertEqual(text[0:1], "1") - self.assertEqual(text[2:3], "2") - - # Bug 125104 - Changing page numbering to "1st, 2nd, 3rd,..." causes crashes when trying to change Page settings later - self.set_combo_layout_format(self.open_page_style_dialog(), "1st, 2nd, 3rd, ...") - text = document.Text.String.replace('\r\n', '\n') - self.assertEqual(text[0:3], "1st") - self.assertEqual(text[4:7], "2nd") - - xDialog = self.open_page_style_dialog() - comboLayoutFormat = xDialog.getChild("comboLayoutFormat") - self.assertEqual(get_state_as_dict(comboLayoutFormat)["SelectEntryText"], "1st, 2nd, 3rd, ...") - cancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(cancelBtn) - - # change to devanagari alphabet format - self.set_combo_layout_format(self.open_page_style_dialog(), "क, ख, ग, ...") - text = document.Text.String.replace('\r\n', '\n') - self.assertEqual(text[0:1], "क") - self.assertEqual(text[2:3], "ख") - - # change to devanagari number format - self.set_combo_layout_format(self.open_page_style_dialog(), "१, २, ३, ...") - text = document.Text.String.replace('\r\n', '\n') - self.assertEqual(text[0:1], "१") - self.assertEqual(text[2:3], "२") + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + + # insert page numbers on multiple pages + self.xUITest.executeCommand(".uno:InsertPageNumberField") + self.xUITest.executeCommand(".uno:InsertPagebreak") + self.xUITest.executeCommand(".uno:InsertPageNumberField") + text = document.Text.String.replace('\r\n', '\n') + self.assertEqual(text[0:1], "1") + self.assertEqual(text[2:3], "2") + + # Bug 125104 - Changing page numbering to "1st, 2nd, 3rd,..." causes crashes when trying to change Page settings later + self.set_combo_layout_format(self.open_page_style_dialog(), "1st, 2nd, 3rd, ...") + text = document.Text.String.replace('\r\n', '\n') + self.assertEqual(text[0:3], "1st") + self.assertEqual(text[4:7], "2nd") + + xDialog = self.open_page_style_dialog() + comboLayoutFormat = xDialog.getChild("comboLayoutFormat") + self.assertEqual(get_state_as_dict(comboLayoutFormat)["SelectEntryText"], "1st, 2nd, 3rd, ...") + cancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(cancelBtn) + + # change to devanagari alphabet format + self.set_combo_layout_format(self.open_page_style_dialog(), "क, ख, ग, ...") + text = document.Text.String.replace('\r\n', '\n') + self.assertEqual(text[0:1], "क") + self.assertEqual(text[2:3], "ख") + + # change to devanagari number format + self.set_combo_layout_format(self.open_page_style_dialog(), "१, २, ३, ...") + text = document.Text.String.replace('\r\n', '\n') + self.assertEqual(text[0:1], "१") + self.assertEqual(text[2:3], "२") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf126168.py b/sw/qa/uitest/writer_tests6/tdf126168.py index f3af18638b37..db60e9edbea0 100644 --- a/sw/qa/uitest/writer_tests6/tdf126168.py +++ b/sw/qa/uitest/writer_tests6/tdf126168.py @@ -11,37 +11,38 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf126168(UITestCase): def test_tdf126168_frame_undo_redo_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") + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - #2) Menu > Insert > Frame > Frame - #3) Press OK in Frame dialog - self.ui_test.execute_dialog_through_command(".uno:InsertFrame") # insert frame - xDialog = self.xUITest.getTopFocusWindow() - xokbtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xokbtn) - self.assertEqual(document.TextFrames.getCount(), 1) - #New Style from Selection [uno:StyleNewByExample] - self.ui_test.execute_dialog_through_command(".uno:StyleNewByExample") - #5) Enter a name in the Create Style dialog and press OK - xDialog = self.xUITest.getTopFocusWindow() - stylename = xDialog.getChild("stylename") - stylename.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) - xokbtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xokbtn) - #6) ctrl+z 3 times - self.xUITest.executeCommand(".uno:Undo") - self.xUITest.executeCommand(".uno:Undo") - self.xUITest.executeCommand(".uno:Undo") - self.assertEqual(document.TextFrames.getCount(), 0) - #7) shift+ctrl+z 3 times - self.xUITest.executeCommand(".uno:Redo") - self.xUITest.executeCommand(".uno:Redo") - self.xUITest.executeCommand(".uno:Redo") + #2) Menu > Insert > Frame > Frame + #3) Press OK in Frame dialog + self.ui_test.execute_dialog_through_command(".uno:InsertFrame") # insert frame + xDialog = self.xUITest.getTopFocusWindow() + xokbtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xokbtn) + self.assertEqual(document.TextFrames.getCount(), 1) + #New Style from Selection [uno:StyleNewByExample] + self.ui_test.execute_dialog_through_command(".uno:StyleNewByExample") + #5) Enter a name in the Create Style dialog and press OK + xDialog = self.xUITest.getTopFocusWindow() + stylename = xDialog.getChild("stylename") + stylename.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) + xokbtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xokbtn) + #6) ctrl+z 3 times + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextFrames.getCount(), 0) + #7) shift+ctrl+z 3 times + self.xUITest.executeCommand(".uno:Redo") + self.xUITest.executeCommand(".uno:Redo") + self.xUITest.executeCommand(".uno:Redo") - #Results: crash - self.assertEqual(document.CurrentController.PageCount, 1) + #Results: crash + self.assertEqual(document.CurrentController.PageCount, 1) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf128431.py b/sw/qa/uitest/writer_tests6/tdf128431.py index 498a44300e24..17d876bb9a4c 100644 --- a/sw/qa/uitest/writer_tests6/tdf128431.py +++ b/sw/qa/uitest/writer_tests6/tdf128431.py @@ -12,30 +12,32 @@ from uitest.uihelper.common import change_measurement_unit class tdf128431(UITestCase): def test_tdf128431_pageFormat_sync_padding(self): - with self.ui_test.create_doc_in_start_center("writer"): - document = self.ui_test.get_component() - - change_measurement_unit(self, "Centimeter") - - self.ui_test.execute_dialog_through_command(".uno:PageDialog") - xDialog = self.xUITest.getTopFocusWindow() - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, 6) #borders - - sync = xDialog.getChild("sync") - bottomft = xDialog.getChild("bottommf") - topft = xDialog.getChild("topmf") - rightft = xDialog.getChild("rightmf") - leftft = xDialog.getChild("leftmf") - - self.assertEqual(get_state_as_dict(sync)["Selected"], "true") - bottomft.executeAction("UP", tuple()) - self.assertEqual(get_state_as_dict(bottomft)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(topft)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(rightft)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(leftft)["Text"], "0.10 cm") - - okBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(okBtn) + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + + change_measurement_unit(self, "Centimeter") + + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, 6) #borders + + sync = xDialog.getChild("sync") + bottomft = xDialog.getChild("bottommf") + topft = xDialog.getChild("topmf") + rightft = xDialog.getChild("rightmf") + leftft = xDialog.getChild("leftmf") + + self.assertEqual(get_state_as_dict(sync)["Selected"], "true") + bottomft.executeAction("UP", tuple()) + self.assertEqual(get_state_as_dict(bottomft)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(topft)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(rightft)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(leftft)["Text"], "0.10 cm") + + okBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf131041.py b/sw/qa/uitest/writer_tests6/tdf131041.py index 237112c7195a..94a6f2b750e7 100644 --- a/sw/qa/uitest/writer_tests6/tdf131041.py +++ b/sw/qa/uitest/writer_tests6/tdf131041.py @@ -10,39 +10,41 @@ from uitest.uihelper.common import select_pos, get_state_as_dict class tdf131041(UITestCase): def test_run(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() - self.ui_test.execute_dialog_through_command(".uno:PageDialog") - xDialog = self.xUITest.getTopFocusWindow() - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, 4) #header + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, 4) #header - xHeaderOn = xDialog.getChild("checkHeaderOn") - xMoreBtn = xDialog.getChild("buttonMore") + xHeaderOn = xDialog.getChild("checkHeaderOn") + xMoreBtn = xDialog.getChild("buttonMore") - self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "false") - self.assertEqual(get_state_as_dict(xMoreBtn)["Enabled"], "false") + self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "false") + self.assertEqual(get_state_as_dict(xMoreBtn)["Enabled"], "false") - xHeaderOn.executeAction("CLICK", tuple()) + xHeaderOn.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "true") - self.assertEqual(get_state_as_dict(xMoreBtn)["Enabled"], "true") + self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "true") + self.assertEqual(get_state_as_dict(xMoreBtn)["Enabled"], "true") - self.ui_test.execute_dialog_through_action(xMoreBtn, "CLICK") + self.ui_test.execute_dialog_through_action(xMoreBtn, "CLICK") - xBorderDlg = self.xUITest.getTopFocusWindow() + xBorderDlg = self.xUITest.getTopFocusWindow() - #modify any property - bottomft = xBorderDlg.getChild("bottommf") - bottomft.executeAction("UP", tuple()) + #modify any property + bottomft = xBorderDlg.getChild("bottommf") + bottomft.executeAction("UP", tuple()) - #it would crash here - okBtn = xBorderDlg.getChild("ok") - self.ui_test.close_dialog_through_button(okBtn) + #it would crash here + okBtn = xBorderDlg.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) - xDialog = self.xUITest.getTopFocusWindow() - okBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(okBtn) + xDialog = self.xUITest.getTopFocusWindow() + okBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf44837.py b/sw/qa/uitest/writer_tests6/tdf44837.py index 0245939b1938..9373d6c89901 100644 --- a/sw/qa/uitest/writer_tests6/tdf44837.py +++ b/sw/qa/uitest/writer_tests6/tdf44837.py @@ -12,32 +12,33 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf44837(UITestCase): def test_tdf448373_Replace_All_clears_current_selection(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, "asd asd") - self.xUITest.executeCommand(".uno:SelectAll") - - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - searchterm = xDialog.getChild("searchterm") - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) - replaceterm = xDialog.getChild("replaceterm") - replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"b"})) #replace textbox - - selectionOnly = xDialog.getChild("selection") - selectionOnly.executeAction("CLICK", tuple()) - replaceall = xDialog.getChild("replaceall") - replaceall.executeAction("CLICK", tuple()) - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) - - self.assertEqual(document.Text.String[0:8], "bsd bsd") - self.assertEqual(len(document.CurrentSelection[0].String) > 1, True) - #follow-up bug 125663 + 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, "asd asd") + self.xUITest.executeCommand(".uno:SelectAll") + + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"b"})) #replace textbox + + selectionOnly = xDialog.getChild("selection") + selectionOnly.executeAction("CLICK", tuple()) + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + self.assertEqual(document.Text.String[0:8], "bsd bsd") + self.assertEqual(len(document.CurrentSelection[0].String) > 1, True) + #follow-up bug 125663 + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests7/tdf109083.py b/sw/qa/uitest/writer_tests7/tdf109083.py index cfc3b5660888..bf61a0e4ee3f 100644 --- a/sw/qa/uitest/writer_tests7/tdf109083.py +++ b/sw/qa/uitest/writer_tests7/tdf109083.py @@ -12,55 +12,56 @@ 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): - 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"})) + 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") + #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() # 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 c9a5a2d53c8a..42cddb2b388b 100644 --- a/sw/qa/uitest/writer_tests7/tdf115853.py +++ b/sw/qa/uitest/writer_tests7/tdf115853.py @@ -15,28 +15,30 @@ from uitest.uihelper.common import select_pos class tdf115853(UITestCase): def test_tdf115853(self): - with self.ui_test.create_doc_in_start_center("writer"): - self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") - xDialog = self.xUITest.getTopFocusWindow() + 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()) + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() # 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 f0b1049e7825..9ad178f8a722 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): - with self.ui_test.create_doc_in_start_center("writer"): + 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 a05541f8f96b..e9f91d8f17b6 100644 --- a/sw/qa/uitest/writer_tests7/tdf133348.py +++ b/sw/qa/uitest/writer_tests7/tdf133348.py @@ -10,52 +10,54 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf133348(UITestCase): def test_tdf133348(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() - - 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.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() # 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 2b6864459c10..79972c8ad7f8 100644 --- a/sw/qa/uitest/writer_tests7/tdf140731.py +++ b/sw/qa/uitest/writer_tests7/tdf140731.py @@ -11,46 +11,47 @@ from uitest.uihelper.common import type_text class tdf140731(UITestCase): def test_tdf140731(self): - 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.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") - 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") - + 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() # 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 b78fc15f61a7..f0355e4684ed 100644 --- a/sw/qa/uitest/writer_tests7/tdf140863.py +++ b/sw/qa/uitest/writer_tests7/tdf140863.py @@ -12,62 +12,64 @@ class tdf140863(UITestCase): def test_tdf140863(self): - with self.ui_test.create_doc_in_start_center("writer"): + 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") + # 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() # 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 32c523c85a61..cb70c401b142 100644 --- a/sw/qa/uitest/writer_tests7/tdf90401.py +++ b/sw/qa/uitest/writer_tests7/tdf90401.py @@ -98,4 +98,6 @@ 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: diff --git a/uitest/demo_ui/char_dialog.py b/uitest/demo_ui/char_dialog.py index c261dda1e3a9..5dd0212ee719 100644 --- a/uitest/demo_ui/char_dialog.py +++ b/uitest/demo_ui/char_dialog.py @@ -11,16 +11,18 @@ from uitest.framework import UITestCase class CharDialogText(UITestCase): def test_select_char(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.ui_test.execute_dialog_through_command(".uno:InsertSymbol") - xCharDialog = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:InsertSymbol") + xCharDialog = self.xUITest.getTopFocusWindow() - xCharSet = xCharDialog.getChild("showcharset") + xCharSet = xCharDialog.getChild("showcharset") - xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "2", "ROW": "2"})) + xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "2", "ROW": "2"})) - xCancelBtn = xCharDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + xCancelBtn = xCharDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/checkbox.py b/uitest/demo_ui/checkbox.py index fd2a649b4a28..114473d53851 100644 --- a/uitest/demo_ui/checkbox.py +++ b/uitest/demo_ui/checkbox.py @@ -13,14 +13,16 @@ class CheckBoxTest(UITestCase): def test_toggle_checkbox(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xCellsDlg = self.xUITest.getTopFocusWindow() - xNegativeNumRedCB = xCellsDlg.getChild("negnumred") - xNegativeNumRedCB.executeAction("CLICK",tuple()) + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() + xNegativeNumRedCB = xCellsDlg.getChild("negnumred") + xNegativeNumRedCB.executeAction("CLICK",tuple()) - okBtn = xCellsDlg.getChild("ok") - self.ui_test.close_dialog_through_button(okBtn) + okBtn = xCellsDlg.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/combobox.py b/uitest/demo_ui/combobox.py index f8c7ad9413cf..8b47f8338fb9 100644 --- a/uitest/demo_ui/combobox.py +++ b/uitest/demo_ui/combobox.py @@ -14,15 +14,17 @@ class ComboBoxTest(UITestCase): def test_select_entry_pos(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") - xAddNameDlg = self.xUITest.getTopFocusWindow() + self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") + xAddNameDlg = self.xUITest.getTopFocusWindow() - scopeCB = xAddNameDlg.getChild("scope") - select_pos(scopeCB, "1") + scopeCB = xAddNameDlg.getChild("scope") + select_pos(scopeCB, "1") - xCancelBtn = xAddNameDlg.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + xCancelBtn = xAddNameDlg.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/command_with_parameters.py b/uitest/demo_ui/command_with_parameters.py index 689415207e3b..c82d3359559a 100644 --- a/uitest/demo_ui/command_with_parameters.py +++ b/uitest/demo_ui/command_with_parameters.py @@ -12,11 +12,13 @@ class CommandWithParametersTest(UITestCase): def test_text_color_change(self): - with self.ui_test.create_doc_in_start_center("writer"): + self.ui_test.create_doc_in_start_center("writer") - self.xUITest.executeCommandWithParameters(".uno:Color", - mkPropertyValues({"Color": 16776960})) - xWriterEdit = self.xUITest.getTopFocusWindow().getChild("writer_edit") - type_text(xWriterEdit, "LibreOffice") + self.xUITest.executeCommandWithParameters(".uno:Color", + mkPropertyValues({"Color": 16776960})) + xWriterEdit = self.xUITest.getTopFocusWindow().getChild("writer_edit") + type_text(xWriterEdit, "LibreOffice") + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/edit.py b/uitest/demo_ui/edit.py index 0dcc82093fa0..48ada3b1d15e 100644 --- a/uitest/demo_ui/edit.py +++ b/uitest/demo_ui/edit.py @@ -16,36 +16,40 @@ class EditTest(UITestCase): def test_type_text(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") - xAddNameDlg = self.xUITest.getTopFocusWindow() + self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") + xAddNameDlg = self.xUITest.getTopFocusWindow() - xEdit = xAddNameDlg.getChild("edit") + xEdit = xAddNameDlg.getChild("edit") - type_text(xEdit, "simpleRangeName") + type_text(xEdit, "simpleRangeName") - xAddBtn = xAddNameDlg.getChild("cancel") - self.ui_test.close_dialog_through_button(xAddBtn) + xAddBtn = xAddNameDlg.getChild("cancel") + self.ui_test.close_dialog_through_button(xAddBtn) + + self.ui_test.close_doc() def test_select_text(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") + xAddNameDlg = self.xUITest.getTopFocusWindow() - self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") - xAddNameDlg = self.xUITest.getTopFocusWindow() + xEdit = xAddNameDlg.getChild("edit") - xEdit = xAddNameDlg.getChild("edit") + type_text(xEdit, "simpleRangeName") + xEdit.executeAction("SELECT", mkPropertyValues({"FROM": "2", "TO": "9"})) + type_text(xEdit, "otherChars") + self.assertEqual("siotherCharsgeName", get_state_as_dict(xEdit)["Text"]) - type_text(xEdit, "simpleRangeName") - xEdit.executeAction("SELECT", mkPropertyValues({"FROM": "2", "TO": "9"})) - type_text(xEdit, "otherChars") - self.assertEqual("siotherCharsgeName", get_state_as_dict(xEdit)["Text"]) + select_text(xEdit, from_pos="2", to="12") + self.assertEqual("otherChars", get_state_as_dict(xEdit)["SelectedText"]) - select_text(xEdit, from_pos="2", to="12") - self.assertEqual("otherChars", get_state_as_dict(xEdit)["SelectedText"]) + xAddBtn = xAddNameDlg.getChild("cancel") + self.ui_test.close_dialog_through_button(xAddBtn) - xAddBtn = xAddNameDlg.getChild("cancel") - self.ui_test.close_dialog_through_button(xAddBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/gridwin.py b/uitest/demo_ui/gridwin.py index 98d4c9c91fd0..ddfb13273bb8 100644 --- a/uitest/demo_ui/gridwin.py +++ b/uitest/demo_ui/gridwin.py @@ -13,33 +13,39 @@ class GridWinTest(UITestCase): def test_select_cell(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") - selectProps = mkPropertyValues({"CELL": "B10"}) - xGridWindow.executeAction("SELECT", selectProps) + selectProps = mkPropertyValues({"CELL": "B10"}) + xGridWindow.executeAction("SELECT", selectProps) + + self.ui_test.close_doc() def test_select_range(self): - with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + selectProps = mkPropertyValues({"RANGE": "B10:C20"}) + xGridWindow.executeAction("SELECT", selectProps) - selectProps = mkPropertyValues({"RANGE": "B10:C20"}) - xGridWindow.executeAction("SELECT", selectProps) + self.ui_test.close_doc() def test_extend_range(self): - with self.ui_test.create_doc_in_start_center("calc"): - xTopWindow = self.xUITest.getTopFocusWindow() + self.ui_test.create_doc_in_start_center("calc") + xTopWindow = self.xUITest.getTopFocusWindow() + + xGridWindow = xTopWindow.getChild("grid_window") - xGridWindow = xTopWindow.getChild("grid_window") + selectProps = mkPropertyValues({"RANGE": "B10:C20"}) + xGridWindow.executeAction("SELECT", selectProps) - selectProps = mkPropertyValues({"RANGE": "B10:C20"}) - xGridWindow.executeAction("SELECT", selectProps) + select2Props = mkPropertyValues({"RANGE": "D3:F5", "EXTEND": "true"}) + xGridWindow.executeAction("SELECT", select2Props) - select2Props = mkPropertyValues({"RANGE": "D3:F5", "EXTEND": "true"}) - xGridWindow.executeAction("SELECT", select2Props) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/hierarchy.py b/uitest/demo_ui/hierarchy.py index 31f123cef230..f5434366fda4 100644 --- a/uitest/demo_ui/hierarchy.py +++ b/uitest/demo_ui/hierarchy.py @@ -15,19 +15,21 @@ class CheckBoxTest(UITestCase): def test_get_json(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.ui_test.execute_dialog_through_command(".uno:About") + self.ui_test.execute_dialog_through_command(".uno:About") - xAboutDlg = self.xUITest.getTopFocusWindow() + xAboutDlg = self.xUITest.getTopFocusWindow() - json_string = xAboutDlg.getHierarchy() - print(json_string) - json_content = json.loads(json_string) - print(json_content) - print(json.dumps(json_content, indent=4)) + json_string = xAboutDlg.getHierarchy() + print(json_string) + json_content = json.loads(json_string) + print(json_content) + print(json.dumps(json_content, indent=4)) - closeBtn = xAboutDlg.getChild("btnClose") - self.ui_test.close_dialog_through_button(closeBtn) + closeBtn = xAboutDlg.getChild("btnClose") + self.ui_test.close_dialog_through_button(closeBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/listbox.py b/uitest/demo_ui/listbox.py index 4bce5c2ba258..7e9ae16e6543 100644 --- a/uitest/demo_ui/listbox.py +++ b/uitest/demo_ui/listbox.py @@ -14,22 +14,26 @@ class ListBoxTest(UITestCase): def test_select_entry_pos(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xCellsDlg = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() - xOkBtn = xCellsDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + xOkBtn = xCellsDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.close_doc() def test_select_entry_text(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xCellsDlg = self.xUITest.getTopFocusWindow() + xOkBtn = xCellsDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) - xOkBtn = xCellsDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/radiobutton.py b/uitest/demo_ui/radiobutton.py index f8d49587b0e0..bb2f5bd07440 100644 --- a/uitest/demo_ui/radiobutton.py +++ b/uitest/demo_ui/radiobutton.py @@ -25,14 +25,16 @@ class RadioButtonTest(UITestCase): def test_toggle_radiobutton(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xCellsDlg = self.xUITest.getTopFocusWindow() - xNegativeNumRedCB = xCellsDlg.getChild("negnumred") - xNegativeNumRedCB.executeAction("CLICK",tuple()) + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() + xNegativeNumRedCB = xCellsDlg.getChild("negnumred") + xNegativeNumRedCB.executeAction("CLICK",tuple()) - okBtn = xCellsDlg.getChild("ok") - self.ui_test.close_dialog_through_button(okBtn) + okBtn = xCellsDlg.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/spinfield.py b/uitest/demo_ui/spinfield.py index 9469bc9254d1..a74e47206274 100644 --- a/uitest/demo_ui/spinfield.py +++ b/uitest/demo_ui/spinfield.py @@ -14,56 +14,62 @@ class SpinFieldTest(UITestCase): def test_up(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xCellsDlg = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() - xDecimalPlaces = xCellsDlg.getChild("leadzerosed") - xDecimalPlaces.executeAction("UP", tuple()) + xDecimalPlaces = xCellsDlg.getChild("leadzerosed") + xDecimalPlaces.executeAction("UP", tuple()) - decimal_places_state = get_state_as_dict(xDecimalPlaces) - assert(decimal_places_state["Text"] == "2") + decimal_places_state = get_state_as_dict(xDecimalPlaces) + assert(decimal_places_state["Text"] == "2") - okBtn = xCellsDlg.getChild("ok") - self.ui_test.close_dialog_through_button(okBtn) + okBtn = xCellsDlg.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) + + self.ui_test.close_doc() def test_down(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xCellsDlg = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() - xDecimalPlaces = xCellsDlg.getChild("leadzerosed") - xDecimalPlaces.executeAction("UP", tuple()) - xDecimalPlaces.executeAction("UP", tuple()) + xDecimalPlaces = xCellsDlg.getChild("leadzerosed") + xDecimalPlaces.executeAction("UP", tuple()) + xDecimalPlaces.executeAction("UP", tuple()) - decimal_places_state = get_state_as_dict(xDecimalPlaces) - assert(decimal_places_state["Text"] == "3") + decimal_places_state = get_state_as_dict(xDecimalPlaces) + assert(decimal_places_state["Text"] == "3") - xDecimalPlaces.executeAction("DOWN", tuple()) + xDecimalPlaces.executeAction("DOWN", tuple()) + + decimal_places_state = get_state_as_dict(xDecimalPlaces) + assert(decimal_places_state["Text"] == "2") - decimal_places_state = get_state_as_dict(xDecimalPlaces) - assert(decimal_places_state["Text"] == "2") + okBtn = xCellsDlg.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) - okBtn = xCellsDlg.getChild("ok") - self.ui_test.close_dialog_through_button(okBtn) + self.ui_test.close_doc() def test_text(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xCellsDlg = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() - xDecimalPlaces = xCellsDlg.getChild("leadzerosed") - type_text(xDecimalPlaces, "4") + xDecimalPlaces = xCellsDlg.getChild("leadzerosed") + type_text(xDecimalPlaces, "4") + + decimal_places_state = get_state_as_dict(xDecimalPlaces) + assert(decimal_places_state["Text"] == "41") - decimal_places_state = get_state_as_dict(xDecimalPlaces) - assert(decimal_places_state["Text"] == "41") + okBtn = xCellsDlg.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) - okBtn = xCellsDlg.getChild("ok") - self.ui_test.close_dialog_through_button(okBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/tabcontrol.py b/uitest/demo_ui/tabcontrol.py index 4da9e8ee9782..47b3f33a3cf4 100644 --- a/uitest/demo_ui/tabcontrol.py +++ b/uitest/demo_ui/tabcontrol.py @@ -16,21 +16,23 @@ class TabControlTest(UITestCase): def test_select_pos(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") - enter_text_to_cell(xGridWindow, "B2", "=2+3+4") - xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + enter_text_to_cell(xGridWindow, "B2", "=2+3+4") + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") + self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") - xFunctionDlg = self.xUITest.getTopFocusWindow() + xFunctionDlg = self.xUITest.getTopFocusWindow() - xTabs = xFunctionDlg.getChild("tabcontrol") - select_pos(xTabs, "1") + xTabs = xFunctionDlg.getChild("tabcontrol") + select_pos(xTabs, "1") - xCancelBtn = xFunctionDlg.getChild("cancel") - xCancelBtn.executeAction("CLICK", tuple()) + xCancelBtn = xFunctionDlg.getChild("cancel") + xCancelBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/tabdialog.py b/uitest/demo_ui/tabdialog.py index 00e9c0e161b8..861b270989d9 100644 --- a/uitest/demo_ui/tabdialog.py +++ b/uitest/demo_ui/tabdialog.py @@ -14,22 +14,26 @@ class TabDialogTest(UITestCase): def test_select_tab_page_pos(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xCellsDlg = self.xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() - xOkBtn = xCellsDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + xOkBtn = xCellsDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.close_doc() def test_select_tab_page_name(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() - self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xCellsDlg = self.xUITest.getTopFocusWindow() + xOkBtn = xCellsDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) - xOkBtn = xCellsDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/demo_ui/treelist.py b/uitest/demo_ui/treelist.py index ad8246c5184a..265fa8b975b3 100644 --- a/uitest/demo_ui/treelist.py +++ b/uitest/demo_ui/treelist.py @@ -16,29 +16,31 @@ class TreeListTest(UITestCase): def test_expand(self): - with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.create_doc_in_start_center("calc") - xCalcDoc = self.xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") - enter_text_to_cell(xGridWindow, "B2", "=2+3+4") - xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + enter_text_to_cell(xGridWindow, "B2", "=2+3+4") + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") + self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") - xFunctionDlg = self.xUITest.getTopFocusWindow() + xFunctionDlg = self.xUITest.getTopFocusWindow() - xTabs = xFunctionDlg.getChild("tabcontrol") - select_pos(xTabs, "1") + xTabs = xFunctionDlg.getChild("tabcontrol") + select_pos(xTabs, "1") - xTreelist = xTabs.getChild("struct") + xTreelist = xTabs.getChild("struct") - xTreeEntry = xTreelist.getChild('0') + xTreeEntry = xTreelist.getChild('0') - xTreeEntry.executeAction("COLLAPSE", tuple()) + xTreeEntry.executeAction("COLLAPSE", tuple()) - xTreeEntry.executeAction("EXPAND", tuple()) + xTreeEntry.executeAction("EXPAND", tuple()) - xCancelBtn = xFunctionDlg.getChild("cancel") - xCancelBtn.executeAction("CLICK", tuple()) + xCancelBtn = xFunctionDlg.getChild("cancel") + xCancelBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/impress_tests/backgrounds.py b/uitest/impress_tests/backgrounds.py index a98e8a33f71c..123c7ef81021 100644 --- a/uitest/impress_tests/backgrounds.py +++ b/uitest/impress_tests/backgrounds.py @@ -105,42 +105,44 @@ class ImpressBackgrounds(UITestCase): def test_background_dialog(self): - with self.ui_test.create_doc_in_start_center("impress"): + self.ui_test.create_doc_in_start_center("impress") - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) - buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern'] - for index, button in enumerate(buttons): - self.ui_test.execute_dialog_through_command(".uno:PageSetup") + buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern'] + for index, button in enumerate(buttons): + self.ui_test.execute_dialog_through_command(".uno:PageSetup") - xPageSetupDlg = self.xUITest.getTopFocusWindow() - tabcontrol = xPageSetupDlg.getChild("tabcontrol") - select_pos(tabcontrol, "1") + xPageSetupDlg = self.xUITest.getTopFocusWindow() + tabcontrol = xPageSetupDlg.getChild("tabcontrol") + select_pos(tabcontrol, "1") - xBtn = xPageSetupDlg.getChild(button) - xBtn.executeAction("CLICK", tuple()) + xBtn = xPageSetupDlg.getChild(button) + xBtn.executeAction("CLICK", tuple()) - # tdf#100024: Without the fix in place, this test would have crashed here - # changing the background to bitmap - xOkBtn = xPageSetupDlg.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + # tdf#100024: Without the fix in place, this test would have crashed here + # changing the background to bitmap + xOkBtn = xPageSetupDlg.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - self.checkDefaultBackground(button) + self.checkDefaultBackground(button) - self.ui_test.execute_dialog_through_command(".uno:PageSetup") + self.ui_test.execute_dialog_through_command(".uno:PageSetup") - xPageSetupDlg = self.xUITest.getTopFocusWindow() - tabcontrol = xPageSetupDlg.getChild("tabcontrol") - select_pos(tabcontrol, "1") + xPageSetupDlg = self.xUITest.getTopFocusWindow() + tabcontrol = xPageSetupDlg.getChild("tabcontrol") + select_pos(tabcontrol, "1") - xBtn = xPageSetupDlg.getChild('btnnone') - xBtn.executeAction("CLICK", tuple()) + xBtn = xPageSetupDlg.getChild('btnnone') + xBtn.executeAction("CLICK", tuple()) - xOkBtn = xPageSetupDlg.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + xOkBtn = xPageSetupDlg.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - self.checkDefaultBackground('btnnone') + self.checkDefaultBackground('btnnone') + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/impress_tests/drawinglayer.py b/uitest/impress_tests/drawinglayer.py index 4e2f33d45604..7b33e369d2e6 100644 --- a/uitest/impress_tests/drawinglayer.py +++ b/uitest/impress_tests/drawinglayer.py @@ -13,146 +13,152 @@ from uitest.framework import UITestCase class ImpressDrawinglayerTest(UITestCase): def test_move_object(self): - with self.ui_test.create_doc_in_start_center("impress"): + self.ui_test.create_doc_in_start_center("impress") - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) - change_measurement_unit(self, 'Centimeter') + change_measurement_unit(self, 'Centimeter') - xImpressDoc = self.xUITest.getTopFocusWindow() + xImpressDoc = self.xUITest.getTopFocusWindow() - document = self.ui_test.get_component() - self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X) - self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y) - self.assertEqual(1400, document.DrawPages[0].getByIndex(1).Position.X) - self.assertEqual(3685, document.DrawPages[0].getByIndex(1).Position.Y) + document = self.ui_test.get_component() + self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X) + self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y) + self.assertEqual(1400, document.DrawPages[0].getByIndex(1).Position.X) + self.assertEqual(3685, document.DrawPages[0].getByIndex(1).Position.Y) - xEditWin = xImpressDoc.getChild("impress_win") - xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1") - xDrawinglayerObject.executeAction("MOVE", mkPropertyValues({"X": "1000", "Y":"1000"})) + xEditWin = xImpressDoc.getChild("impress_win") + xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1") + xDrawinglayerObject.executeAction("MOVE", mkPropertyValues({"X": "1000", "Y":"1000"})) - self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X) - self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y) - self.assertEqual(2400, document.DrawPages[0].getByIndex(1).Position.X) - self.assertEqual(4685, document.DrawPages[0].getByIndex(1).Position.Y) + self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X) + self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y) + self.assertEqual(2400, document.DrawPages[0].getByIndex(1).Position.X) + self.assertEqual(4685, document.DrawPages[0].getByIndex(1).Position.Y) - self.assertIsNone(document.CurrentSelection) + self.assertIsNone(document.CurrentSelection) - xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) - self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) - self.ui_test.execute_dialog_through_command(".uno:Size") + self.ui_test.execute_dialog_through_command(".uno:Size") - xDialog = self.xUITest.getTopFocusWindow() + xDialog = self.xUITest.getTopFocusWindow() - self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) - self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) - self.assertEqual('2.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) - self.assertEqual('4.69', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) - self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) + self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) + self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) + self.assertEqual('2.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) + self.assertEqual('4.69', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) + self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) - xEditWin.executeAction("DESELECT", tuple()) - self.assertIsNone(document.CurrentSelection) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + xEditWin.executeAction("DESELECT", tuple()) + self.assertIsNone(document.CurrentSelection) + + self.ui_test.close_doc() def test_resize_object(self): - with self.ui_test.create_doc_in_start_center("impress"): + self.ui_test.create_doc_in_start_center("impress") + + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) + change_measurement_unit(self, 'Centimeter') - change_measurement_unit(self, 'Centimeter') + xImpressDoc = self.xUITest.getTopFocusWindow() - xImpressDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width) + self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height) + self.assertEqual(25199, document.DrawPages[0].getByIndex(1).Size.Width) + self.assertEqual(9134, document.DrawPages[0].getByIndex(1).Size.Height) - document = self.ui_test.get_component() - self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width) - self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height) - self.assertEqual(25199, document.DrawPages[0].getByIndex(1).Size.Width) - self.assertEqual(9134, document.DrawPages[0].getByIndex(1).Size.Height) + xEditWin = xImpressDoc.getChild("impress_win") - xEditWin = xImpressDoc.getChild("impress_win") + xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1") + xDrawinglayerObject.executeAction("RESIZE", mkPropertyValues({"X": "500", "Y":"4000", "FRAC_X": "0.5", "FRAC_Y": "0.5"})) - xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1") - xDrawinglayerObject.executeAction("RESIZE", mkPropertyValues({"X": "500", "Y":"4000", "FRAC_X": "0.5", "FRAC_Y": "0.5"})) + self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width) + self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height) + self.assertEqual(12600, document.DrawPages[0].getByIndex(1).Size.Width) + self.assertEqual(4568, document.DrawPages[0].getByIndex(1).Size.Height) - self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width) - self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height) - self.assertEqual(12600, document.DrawPages[0].getByIndex(1).Size.Width) - self.assertEqual(4568, document.DrawPages[0].getByIndex(1).Size.Height) + self.assertIsNone(document.CurrentSelection) - self.assertIsNone(document.CurrentSelection) + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) - xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) - self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + self.ui_test.execute_dialog_through_command(".uno:Size") - self.ui_test.execute_dialog_through_command(".uno:Size") + xDialog = self.xUITest.getTopFocusWindow() - xDialog = self.xUITest.getTopFocusWindow() + self.assertEqual('12.6', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) + self.assertEqual('4.57', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) + self.assertEqual('0.95', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) + self.assertEqual('3.84', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) + self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) - self.assertEqual('12.6', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) - self.assertEqual('4.57', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) - self.assertEqual('0.95', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) - self.assertEqual('3.84', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) - self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + xEditWin.executeAction("DESELECT", tuple()) + self.assertIsNone(document.CurrentSelection) - self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) - xEditWin.executeAction("DESELECT", tuple()) - self.assertIsNone(document.CurrentSelection) + self.ui_test.close_doc() def test_rotate_object(self): - with self.ui_test.create_doc_in_start_center("impress"): + self.ui_test.create_doc_in_start_center("impress") + + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) + xImpressDoc = self.xUITest.getTopFocusWindow() - xImpressDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width) + self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height) + self.assertEqual(25199, document.DrawPages[0].getByIndex(1).Size.Width) + self.assertEqual(9134, document.DrawPages[0].getByIndex(1).Size.Height) + self.assertEqual(0, document.DrawPages[0].getByIndex(1).RotateAngle) - document = self.ui_test.get_component() - self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width) - self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height) - self.assertEqual(25199, document.DrawPages[0].getByIndex(1).Size.Width) - self.assertEqual(9134, document.DrawPages[0].getByIndex(1).Size.Height) - self.assertEqual(0, document.DrawPages[0].getByIndex(1).RotateAngle) + xEditWin = xImpressDoc.getChild("impress_win") - xEditWin = xImpressDoc.getChild("impress_win") + xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1") + xDrawinglayerObject.executeAction("ROTATE", mkPropertyValues({"X": "500", "Y":"4000", "ANGLE": "3000"})) - xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1") - xDrawinglayerObject.executeAction("ROTATE", mkPropertyValues({"X": "500", "Y":"4000", "ANGLE": "3000"})) + self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width) + self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height) + self.assertEqual(25199, document.DrawPages[0].getByIndex(1).Size.Width) + self.assertEqual(9134, document.DrawPages[0].getByIndex(1).Size.Height) + self.assertEqual(3000, document.DrawPages[0].getByIndex(1).RotateAngle) - self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width) - self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height) - self.assertEqual(25199, document.DrawPages[0].getByIndex(1).Size.Width) - self.assertEqual(9134, document.DrawPages[0].getByIndex(1).Size.Height) - self.assertEqual(3000, document.DrawPages[0].getByIndex(1).RotateAngle) + self.assertIsNone(document.CurrentSelection) - self.assertIsNone(document.CurrentSelection) + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) - xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) - self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + self.ui_test.execute_dialog_through_command(".uno:Size") - self.ui_test.execute_dialog_through_command(".uno:Size") + xDialog = self.xUITest.getTopFocusWindow() - xDialog = self.xUITest.getTopFocusWindow() + self.assertEqual('30', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) - self.assertEqual('30', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + xEditWin.executeAction("DESELECT", tuple()) + self.assertIsNone(document.CurrentSelection) - self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) - xEditWin.executeAction("DESELECT", tuple()) - self.assertIsNone(document.CurrentSelection) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/impress_tests/layouts.py b/uitest/impress_tests/layouts.py index f18321e4d076..ebbe8e2ec266 100644 --- a/uitest/impress_tests/layouts.py +++ b/uitest/impress_tests/layouts.py @@ -11,31 +11,33 @@ class ImpressLayouts(UITestCase): def test_impress_layouts(self): - with self.ui_test.create_doc_in_start_center("impress"): + self.ui_test.create_doc_in_start_center("impress") - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) - layouts= (".uno:AssignLayout?WhatLayout:long=20", ".uno:AssignLayout?WhatLayout:long=19", - ".uno:AssignLayout?WhatLayout:long=0", ".uno:AssignLayout?WhatLayout:long=1", - ".uno:AssignLayout?WhatLayout:long=32", ".uno:AssignLayout?WhatLayout:long=3", - ".uno:AssignLayout?WhatLayout:long=12", ".uno:AssignLayout?WhatLayout:long=15", - ".uno:AssignLayout?WhatLayout:long=14", ".uno:AssignLayout?WhatLayout:long=16", - ".uno:AssignLayout?WhatLayout:long=18", ".uno:AssignLayout?WhatLayout:long=34", - ".uno:AssignLayout?WhatLayout:long=28", ".uno:AssignLayout?WhatLayout:long=27", - ".uno:AssignLayout?WhatLayout:long=29", ".uno:AssignLayout?WhatLayout:long=30") + layouts= (".uno:AssignLayout?WhatLayout:long=20", ".uno:AssignLayout?WhatLayout:long=19", + ".uno:AssignLayout?WhatLayout:long=0", ".uno:AssignLayout?WhatLayout:long=1", + ".uno:AssignLayout?WhatLayout:long=32", ".uno:AssignLayout?WhatLayout:long=3", + ".uno:AssignLayout?WhatLayout:long=12", ".uno:AssignLayout?WhatLayout:long=15", + ".uno:AssignLayout?WhatLayout:long=14", ".uno:AssignLayout?WhatLayout:long=16", + ".uno:AssignLayout?WhatLayout:long=18", ".uno:AssignLayout?WhatLayout:long=34", + ".uno:AssignLayout?WhatLayout:long=28", ".uno:AssignLayout?WhatLayout:long=27", + ".uno:AssignLayout?WhatLayout:long=29", ".uno:AssignLayout?WhatLayout:long=30") - for i in layouts: - self.xUITest.executeCommand(i) + for i in layouts: + self.xUITest.executeCommand(i) - xImpressDoc = self.xUITest.getTopFocusWindow() + xImpressDoc = self.xUITest.getTopFocusWindow() - xEditWin = xImpressDoc.getChild("impress_win") + xEditWin = xImpressDoc.getChild("impress_win") - # There's a layout with 7 objects - for j in range(0,6): - xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object " + str(j)})) - xEditWin.executeAction("DESELECT", tuple()) + # There's a layout with 7 objects + for j in range(0,6): + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object " + str(j)})) + xEditWin.executeAction("DESELECT", tuple()) + + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/impress_tests/start.py b/uitest/impress_tests/start.py index 11e82d6a9f3d..b6f5cbc517c9 100644 --- a/uitest/impress_tests/start.py +++ b/uitest/impress_tests/start.py @@ -12,39 +12,43 @@ from uitest.framework import UITestCase class SimpleImpressTest(UITestCase): def test_start_impress(self): - with self.ui_test.create_doc_in_start_center("impress"): + self.ui_test.create_doc_in_start_center("impress") - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) - xImpressDoc = self.xUITest.getTopFocusWindow() + xImpressDoc = self.xUITest.getTopFocusWindow() - xEditWin = xImpressDoc.getChild("impress_win") - xEditWin.executeAction("SET", mkPropertyValues({"ZOOM": "200"})) + xEditWin = xImpressDoc.getChild("impress_win") + xEditWin.executeAction("SET", mkPropertyValues({"ZOOM": "200"})) - self.assertEqual(get_state_as_dict(xEditWin)["Zoom"], "200") + self.assertEqual(get_state_as_dict(xEditWin)["Zoom"], "200") + + self.ui_test.close_doc() def test_select_page(self): - with self.ui_test.create_doc_in_start_center("impress"): + self.ui_test.create_doc_in_start_center("impress") + + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) - xTemplateDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xTemplateDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCancelBtn) + xImpressDoc = self.xUITest.getTopFocusWindow() - xImpressDoc = self.xUITest.getTopFocusWindow() + xEditWin = xImpressDoc.getChild("impress_win") - xEditWin = xImpressDoc.getChild("impress_win") + self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "1") - self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "1") + self.xUITest.executeCommand(".uno:InsertPage") - self.xUITest.executeCommand(".uno:InsertPage") + self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "2") - self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "2") + xEditWin.executeAction("GOTO", mkPropertyValues({"PAGE": "1"})) - xEditWin.executeAction("GOTO", mkPropertyValues({"PAGE": "1"})) + self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "1") - self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "1") + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/math_tests/start.py b/uitest/math_tests/start.py index 9d1e51df69f7..2ad977f73917 100644 --- a/uitest/math_tests/start.py +++ b/uitest/math_tests/start.py @@ -18,64 +18,74 @@ class SimpleMathTest(UITestCase): def test_start_math(self): - with self.ui_test.create_doc_in_start_center("math"): + self.ui_test.create_doc_in_start_center("math") - xMathDoc = self.xUITest.getTopFocusWindow() + xMathDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.close_doc() def test_docking_window_listbox(self): - with self.ui_test.create_doc_in_start_center("math"): + self.ui_test.create_doc_in_start_center("math") + + xMathDoc = self.xUITest.getTopFocusWindow() - xMathDoc = self.xUITest.getTopFocusWindow() + xList = xMathDoc.getChild("listbox") + state = get_state_as_dict(xList) + self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators") + select_pos(xList, "1") + state = get_state_as_dict(xList) + self.assertEqual(state["SelectEntryText"], "Relations") - xList = xMathDoc.getChild("listbox") - state = get_state_as_dict(xList) - self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators") - select_pos(xList, "1") - state = get_state_as_dict(xList) - self.assertEqual(state["SelectEntryText"], "Relations") + self.ui_test.close_doc() def test_math_edit(self): - with self.ui_test.create_doc_in_start_center("math"): + self.ui_test.create_doc_in_start_center("math") + + xMathDoc = self.xUITest.getTopFocusWindow() - xMathDoc = self.xUITest.getTopFocusWindow() + xMathEdit = xMathDoc.getChild("math_edit") - xMathEdit = xMathDoc.getChild("math_edit") + type_text(xMathEdit, "E=mc^2") - type_text(xMathEdit, "E=mc^2") + self.ui_test.close_doc() def test_math_selector(self): - with self.ui_test.create_doc_in_start_center("math"): + self.ui_test.create_doc_in_start_center("math") - xMathDoc = self.xUITest.getTopFocusWindow() + xMathDoc = self.xUITest.getTopFocusWindow() - xMathSelector = xMathDoc.getChild("element_selector") + xMathSelector = xMathDoc.getChild("element_selector") - xElement = xMathSelector.getChild("1") - xElement.executeAction("SELECT", tuple()) + xElement = xMathSelector.getChild("1") + xElement.executeAction("SELECT", tuple()) + + self.ui_test.close_doc() @unittest.skip("on windows the f4 does not always work") def test_complete_math(self): - with self.ui_test.create_doc_in_start_center("math"): + self.ui_test.create_doc_in_start_center("math") + + xMathDoc = self.xUITest.getTopFocusWindow() - xMathDoc = self.xUITest.getTopFocusWindow() + xList = xMathDoc.getChild("listbox") + state = get_state_as_dict(xList) + self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators") + select_pos(xList, "1") - xList = xMathDoc.getChild("listbox") - state = get_state_as_dict(xList) - self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators") - select_pos(xList, "1") + xMathSelector = xMathDoc.getChild("element_selector") - xMathSelector = xMathDoc.getChild("element_selector") + xElement = xMathSelector.getChild("1") + xElement.executeAction("SELECT", tuple()) - xElement = xMathSelector.getChild("1") - xElement.executeAction("SELECT", tuple()) + xMathEdit = xMathDoc.getChild("math_edit") + type_text(xMathEdit, "1") + xMathEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F4"})) + type_text(xMathEdit, "2") - xMathEdit = xMathDoc.getChild("math_edit") - type_text(xMathEdit, "1") - xMathEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F4"})) - type_text(xMathEdit, "2") + edit_state = get_state_as_dict(xMathEdit) + self.assertEqual("1 <> 2 ", edit_state["Text"]) - edit_state = get_state_as_dict(xMathEdit) - self.assertEqual("1 <> 2 ", edit_state["Text"]) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py index 29af1e0899c2..c601116d2a6b 100644 --- a/uitest/uitest/test.py +++ b/uitest/uitest/test.py @@ -154,8 +154,6 @@ class UITest(object): self.close_dialog_through_button(xCancelBtn) return True - # Calls UITest.close_doc at exit - @contextmanager def create_doc_in_start_center(self, app): xStartCenter = self._xUITest.getTopFocusWindow() try: @@ -174,10 +172,6 @@ class UITest(object): if event.executed: frames = self.get_frames() self.get_desktop().setActiveFrame(frames[0]) - try: - yield - finally: - self.close_doc() return time_ += DEFAULT_SLEEP time.sleep(DEFAULT_SLEEP) diff --git a/uitest/uitest/uihelper/guarded.py b/uitest/uitest/uihelper/guarded.py index 1cc6d3cca7e6..5cfed2d49e1a 100644 --- a/uitest/uitest/uihelper/guarded.py +++ b/uitest/uitest/uihelper/guarded.py @@ -9,6 +9,16 @@ from contextlib import contextmanager +# Calls UITest.close_doc at exit +@contextmanager +def create_doc_in_start_center(testCase, app): + testCase.ui_test.create_doc_in_start_center(app) + component = testCase.ui_test.get_component() + try: + yield component + finally: + testCase.ui_test.close_doc() + # Calls UITest.close_dialog_through_button at exit @contextmanager def execute_dialog_through_action(testCase, ui_object, action, parameters = None, event_name = "DialogExecute", close_button = "ok"): diff --git a/uitest/uitest/uihelper/testDialog.py b/uitest/uitest/uihelper/testDialog.py index d1cf007fa0cb..43f0a5bc0794 100644 --- a/uitest/uitest/uihelper/testDialog.py +++ b/uitest/uitest/uihelper/testDialog.py @@ -12,27 +12,28 @@ from uitest.uihelper.common import get_state_as_dict # and if there is an "OK" button open the dialog again and close it by using the OK button # the test only checks if LibreOffice crashes by opening the dialog def testDialog(UITestCase, app, dialog): - with UITestCase.ui_test.create_doc_in_start_center(app): - UITestCase.ui_test.execute_dialog_through_command(dialog['command']) - xDialog = UITestCase.xUITest.getTopFocusWindow() + doc = UITestCase.ui_test.create_doc_in_start_center(app) + UITestCase.ui_test.execute_dialog_through_command(dialog['command']) + xDialog = UITestCase.xUITest.getTopFocusWindow() - xCloseBtn = xDialog.getChild(dialog['closeButton']) - if 'skipTestOK' in dialog and dialog['skipTestOK'] == True: - xOKBtn = None - else: - try: - xOKBtn = xDialog.getChild("ok") - if (get_state_as_dict(xOKBtn)["Enabled"] != "true"): - xOKBtn = None - except: + xCloseBtn = xDialog.getChild(dialog['closeButton']) + if 'skipTestOK' in dialog and dialog['skipTestOK'] == True: + xOKBtn = None + else: + try: + xOKBtn = xDialog.getChild("ok") + if (get_state_as_dict(xOKBtn)["Enabled"] != "true"): xOKBtn = None + except: + xOKBtn = None - UITestCase.ui_test.close_dialog_through_button(xCloseBtn) - if (xOKBtn != None): - print("check also OK button") - UITestCase.ui_test.execute_dialog_through_command(dialog['command']) - xDialog = UITestCase.xUITest.getTopFocusWindow() - xOKBtn = xDialog.getChild("ok") - UITestCase.ui_test.close_dialog_through_button(xOKBtn) + UITestCase.ui_test.close_dialog_through_button(xCloseBtn) + if (xOKBtn != None): + print("check also OK button") + UITestCase.ui_test.execute_dialog_through_command(dialog['command']) + xDialog = UITestCase.xUITest.getTopFocusWindow() + xOKBtn = xDialog.getChild("ok") + UITestCase.ui_test.close_dialog_through_button(xOKBtn) + UITestCase.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: |