def test_clear_cells_all(self): 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_paste_only(self): 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()
def test_tdf125051_crash_spelling_dialog(self): 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") def handle_options_dlg(dialog): #print(dialog.getChildren()) xCancelBtn = dialog.getChild("cancel") self.ui_test.close_dialog_through_button(xCancelBtn) self.ui_test.execute_blocking_action(optionsBtn.executeAction, args=('CLICK', ()), dialog_handler=handle_options_dlg) 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()
def test_tdf88999_scientific_format_decimal_value(self): #numberingformatpage.ui 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.ui_test.close_doc()
def test_validation(self): self.ui_test.create_doc_in_start_center("calc") 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() xAllowList = xValidationDlg.getChild("allow") xAllowList.executeAction("SELECT", mkPropertyValues({"POS": "1"})) xData = xValidationDlg.getChild("data") xData.executeAction("SELECT", mkPropertyValues({"POS": "5"})) xVal = xValidationDlg.getChild("max") xVal.executeAction("TYPE", mkPropertyValues({"TEXT": "0"})) xOkBtn = xValidationDlg.getChild("ok") self.ui_test.close_dialog_through_button(xOkBtn) def enter_text(cell, text): enter_text_to_cell(xGridWin, cell, text) self.ui_test.execute_blocking_action(enter_text, "ok", args=("A1", "abc")) self.ui_test.execute_blocking_action(enter_text, "ok", args=("B6", "2.18")) enter_text_to_cell(xGridWin, "C2", "24") self.ui_test.close_doc()
def test_expand(self): 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"})) self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") xFunctionDlg = self.xUITest.getTopFocusWindow() xTabs = xFunctionDlg.getChild("tabs") select_pos(xTabs, "1") xTreelist = xTabs.getChild("struct") xTreeEntry = xTreelist.getChild('0') xTreeEntry.executeAction("COLLAPSE", tuple()) xTreeEntry.executeAction("EXPAND", tuple()) xCancelBtn = xFunctionDlg.getChild("cancel") xCancelBtn.executeAction("CLICK", tuple()) self.ui_test.close_doc()
def test_tdf89244(self): 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"})) self.xUITest.executeCommand(".uno:MergeCells") 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") 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()) self.ui_test.close_doc()
def test_paste_special(self): # EN-8:Paste special with options # This test is to check that paste special combined with some options and link is ok. # Refers to tdf#84810 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()
def test_tdf73006_text_to_columns(self): 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) #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:
def test_paste_only(self): 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()
def test_validation(self): self.ui_test.create_doc_in_start_center("calc") 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() xAllowList = xValidationDlg.getChild("allow") xAllowList.executeAction("SELECT", mkPropertyValues({"POS": "1"})) xData = xValidationDlg.getChild("data") xData.executeAction("SELECT", mkPropertyValues({"POS": "5"})) xVal = xValidationDlg.getChild("max") xVal.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) xOkBtn = xValidationDlg.getChild("ok") self.ui_test.close_dialog_through_button(xOkBtn) def enter_text(cell, text): enter_text_to_cell(xGridWin, cell, text) self.ui_test.execute_blocking_action(enter_text, "ok", args=("A1", "abc")) self.ui_test.execute_blocking_action(enter_text, "ok", args=("B6", "2.18")) enter_text_to_cell(xGridWin, "C2", "24") self.ui_test.close_doc()
def test_protect_sheet(self): 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") self.ui_test.close_doc()
def test_tracked_changes_rejectall(self): # FIXME flaky test, passed once, but broke multiple times. return 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() #track changes; enter text to cell self.xUITest.executeCommand(".uno:TraceChangeMode") enter_text_to_cell(gridwin, "A1", "Test LibreOffice") #accept tracked changes self.ui_test.execute_modeless_dialog_through_command( ".uno:AcceptChanges") xTrackDlg = self.xUITest.getTopFocusWindow() xAccBtn = xTrackDlg.getChild("rejectall") xAccBtn.executeAction("CLICK", tuple()) xCancBtn = xTrackDlg.getChild("close") xCancBtn.executeAction("CLICK", tuple()) self.assertEqual( get_cell_by_position(document, 0, 0, 0).getString(), "") self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab:
def test_tdf73006_text_to_columns(self): 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) #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:
def test_tdf43078_insert_and_delete_sheet_insert_text(self): self.ui_test.create_doc_in_start_center("calc") document = self.ui_test.get_component() 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.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.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_tdf67346_undo_paste_text_input_line(self): 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()
def test_expand(self): 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"})) self.ui_test.execute_modeless_dialog_through_command( ".uno:FunctionDialog") xFunctionDlg = self.xUITest.getTopFocusWindow() xTabs = xFunctionDlg.getChild("tabs") select_pos(xTabs, "1") xTreelist = xTabs.getChild("struct") xTreeEntry = xTreelist.getChild('0') xTreeEntry.executeAction("COLLAPSE", tuple()) xTreeEntry.executeAction("EXPAND", tuple()) xCancelBtn = xFunctionDlg.getChild("cancel") xCancelBtn.executeAction("CLICK", tuple()) self.ui_test.close_doc()
def test_tdf44398_find_replace_regexp(self): 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 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") self.ui_test.close_doc()
def test_paste_special(self): # EN-8:Paste special with options # This test is to check that paste special combined with some options and link is ok. # Refers to tdf#84810 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()
def test_clear_cells_formats(self): 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_tdf119954_second_db_range(self): calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf119954.ods")) xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") document = self.ui_test.get_component() #* new document #* in A1 enter 1 #* in C3 enter 2 #* on A1 define a database range 'aaa' with $Sheet1.$A$1 #* on C3 define a database range 'bbb' with $Sheet2.$C$3 #* in any cell enter formula =bbb # => result is 1 instead of 2 #* place cell cursor on that formula cell again # => see that the formula is =aaa instead of =bbb gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") xDefineNameDlg = self.xUITest.getTopFocusWindow() xEntryBox = xDefineNameDlg.getChild("entry") type_text(xEntryBox, "aaa") add = xDefineNameDlg.getChild("add") assign = xDefineNameDlg.getChild("assign") add.executeAction("CLICK", tuple()) xOkBtn = xDefineNameDlg.getChild("ok") self.ui_test.close_dialog_through_button(xOkBtn) gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") xDefineNameDlg = self.xUITest.getTopFocusWindow() xEntryBox = xDefineNameDlg.getChild("entry") assign = xDefineNameDlg.getChild("assign") select_all(xEntryBox) type_text(xEntryBox, "bbb") select_all(assign) type_text(assign, "$Sheet2.$C$3") add.executeAction("CLICK", tuple()) xOkBtn = xDefineNameDlg.getChild("ok") self.ui_test.close_dialog_through_button(xOkBtn) enter_text_to_cell(gridwin, "B2", "=bbb") gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2) enter_text_to_cell(gridwin, "C2", "=aaa") gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 1) self.xUITest.executeCommand(".uno:Undo") self.xUITest.executeCommand(".uno:Undo") self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 0) self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 0) self.assertEqual(get_cell_by_position(document, 0, 1, 2).getFormula(), "") self.assertEqual(get_cell_by_position(document, 0, 1, 1).getFormula(), "") self.ui_test.close_doc()
def test_tdf79983_sort_list_case_sensitive(self): 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"})) #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()) 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"})) 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:
def test_input(self): self.ui_test.create_doc_in_start_center("calc") xTopWindow = self.xUITest.getTopFocusWindow() xGridWindow = xTopWindow.getChild("grid_window") enter_text_to_cell(xGridWindow, "C3", "=A1") enter_text_to_cell(xGridWindow, "A1", "2") self.ui_test.close_doc()
def test_tdf105351_cond_format_data_bar(self): 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 props = {"TEXT": "Value"} actionProps = mkPropertyValues(props) xcolscalemin.executeAction("SELECT", actionProps) xedcolscalemin.executeAction("TYPE", mkPropertyValues({"TEXT": "0"})) props2 = {"TEXT": "Value"} actionProps2 = mkPropertyValues(props2) xcolscalemax.executeAction("SELECT", actionProps2) 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") 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) self.ui_test.close_doc()
def test_tdf129083(self): 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", "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"})) self.xUITest.executeCommand(".uno:Copy") self.ui_test.close_doc() writer_doc = self.ui_test.load_file( get_url_for_data_file("tdf129083.odt")) document = self.ui_test.get_component() xWriterDoc = self.xUITest.getTopFocusWindow() self.xUITest.executeCommand(".uno:Paste") self.assertEqual(document.TextTables.getCount(), 1) table = document.getTextTables()[0] self.assertEqual(len(table.getRows()), 4) self.assertEqual(table.getCellByName("A1").getString(), "Test 1") self.assertEqual(table.getCellByName("A2").getString(), "Test 2") self.assertEqual(table.getCellByName("A3").getString(), "Test 3") self.assertEqual(table.getCellByName("A4").getString(), "Test 4") self.ui_test.close_doc()
def test_tdf91305_sort_text_cells_1st_row_digit(self): 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") self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab:
def test_scenarios(self): 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()
def test_transpose(self): 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.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C10"})) self.xUITest.executeCommand(".uno:Cut") xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") xPasteSpecialDlg = self.xUITest.getTopFocusWindow() xAllChkBox = xPasteSpecialDlg.getChild("paste_all") xAllChkBox.executeAction("CLICK", tuple()) xTransposeChkBox = xPasteSpecialDlg.getChild("transpose") xTransposeChkBox.executeAction("CLICK", tuple()) 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) self.ui_test.close_doc()
def test_natural_sorting_columns(self): 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"})) #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") self.ui_test.close_doc()
def test_tdf105351_cond_format_data_bar(self): 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 props = {"TEXT": "Value"} actionProps = mkPropertyValues(props) xcolscalemin.executeAction("SELECT", actionProps) xedcolscalemin.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) props2 = {"TEXT": "Value"} actionProps2 = mkPropertyValues(props2) xcolscalemax.executeAction("SELECT", actionProps2) 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") 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) self.ui_test.close_doc()
def test_create_range_name_from_ui(self): self.ui_test.create_doc_in_start_center("calc") 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") 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"})) self.assertEqual('RANGE1', get_state_as_dict(xPosWindow)['Text']) 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()) # 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.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()) # 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.assertEqual("=SUM(RANGE1)", get_cell_by_position(document, 0, 0, 1).getFormula()) self.ui_test.close_doc()
def test_tdf36383_row_height(self): 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() 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()) 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"})) xOk = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOk) self.assertFalse(row.getPropertyValue("IsVisible")) #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) self.assertFalse(row.getPropertyValue("IsVisible")) self.ui_test.close_doc()
def test_tdf120174(self): 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()
def test_tdf71339_autosum_on_selected_range(self): 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, "A2", "1") enter_text_to_cell(gridwin, "A3", "1") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"})) self.xUITest.executeCommand(".uno:AutoSum") self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 2) self.assertEqual(get_cell_by_position(document, 0, 0, 3).getFormula(), "=SUM(A1:A3)") self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab:
def test_tdf142350(self): 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") xEntry = xList.getChild("2") 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('true', get_state_as_dict(xList.getChild('0'))['IsChecked']) self.assertEqual('true', get_state_as_dict(xList.getChild('1'))['IsChecked']) self.assertEqual('false', get_state_as_dict(xList.getChild('2'))['IsChecked']) xCloseButton = xFloatWindow.getChild("cancel") xCloseButton.executeAction("CLICK", tuple()) self.ui_test.close_doc()
def test_tdf69450(self): 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()
def test_tdf44398_find_replace_regexp_string(self): 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 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()) 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") self.ui_test.close_doc()
def test_tdf53482_Range_contains_column_headings(self): 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()) #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:
def test_tdf54197_CTRL_D_input_line_change(self): 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()
def test_tdf118308(self): 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") 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) 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: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") 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) self.assertEqual("A", get_cell_by_position(document, 0, 0, 0).getString()) self.ui_test.close_doc()
def test_tdf117367_merge_cells_radio_buttons(self): 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()
def test_tdf46885_crash_chart_no_cell_selected_nextButton(self): 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") self.ui_test.close_doc()
def test_tdf83901_row_insert_after(self): #Bug 83901 - ROW() value is not updated if row is inserted after 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() #- A2 = ROW(A3) enter_text_to_cell(gridwin, "A2", "=ROW(A3)") #- Insert a row between rows 2 and 3 by right-clicking on row 3 and choosing "insert rows above". gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) self.xUITest.executeCommand(".uno:SelectRow") self.xUITest.executeCommand(".uno:InsertRowsBefore") #- Result: cell A2 still shows "3" as its value, although it should show "4". self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 4) self.ui_test.close_doc()
def test_tdf125030_repeat_crash(self): 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()
def test_autofill_with_suffix(self): 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()
def test_tdf69450(self): 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()
def test_tdf46885_crash_chart_multiple_empty_cells_selected(self): 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") self.ui_test.close_doc()
def test_tracked_changes_accept(self): 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() #track changes; enter text to cell self.xUITest.executeCommand(".uno:TraceChangeMode") enter_text_to_cell(gridwin, "A1", "Test LibreOffice") #accept tracked changes self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges") xTrackDlg = self.xUITest.getTopFocusWindow() xAccBtn = xTrackDlg.getChild("accept") xAccBtn.executeAction("CLICK", tuple()) 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_tdf83901_row_insert_after(self): #Bug 83901 - ROW() value is not updated if row is inserted after 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() #- A2 = ROW(A3) enter_text_to_cell(gridwin, "A2", "=ROW(A3)") #- Insert a row between rows 2 and 3 by right-clicking on row 3 and choosing "insert rows above". gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) self.xUITest.executeCommand(".uno:SelectRow") self.xUITest.executeCommand(".uno:InsertRowsBefore") #- Result: cell A2 still shows "3" as its value, although it should show "4". self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 4) self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab:
def test_tdf105268(self): 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", "001-001-001") 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(), "001-001-001") self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "001-001-002") self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "001-001-003") self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab:
def test_tdf44398_find_replace_regexp_string(self): 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 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()) 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") self.ui_test.close_doc()