def test_asian_phonetic_guide(self):
        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.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.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
        xRight1ED.executeAction("TYPE", mkPropertyValues({"TEXT":"w"}))
        props = {"TEXT": "Right"}
        actionProps = mkPropertyValues(props)
        xadjustlb.executeAction("SELECT", actionProps)
        props2 = {"TEXT": "Right"}
        actionProps2 = mkPropertyValues(props2)
        xpositionlb.executeAction("SELECT", actionProps2)
        props3 = {"TEXT": "Quotation"}
        actionProps3 = mkPropertyValues(props3)
        xstylelb.executeAction("SELECT", actionProps3)

        xApplyBtn = xDialog.getChild("apply")
        xApplyBtn.executeAction("CLICK", tuple())

        xCloseBtn = xDialog.getChild("close")
        self.ui_test.close_dialog_through_button(xCloseBtn)

        self.assertEqual(document.Text.String[0:1], "a")
        self.ui_test.close_doc()
Ejemplo n.º 2
0
    def test_Sorting_default_to_selected_TAB_B_column(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: 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()
Ejemplo n.º 3
0
    def test_text_to_table_header(self):
        writer_doc = self.ui_test.load_file(get_url_for_data_file("textToTable.odt"))
        document = self.ui_test.get_component()
        xWriterDoc = self.xUITest.getTopFocusWindow()
        xWriterEdit = xWriterDoc.getChild("writer_edit")
        #open file; select all text ; dialog Text to table - other ":"; verify
        self.xUITest.executeCommand(".uno:SelectAll")
        self.ui_test.execute_dialog_through_command(".uno:ConvertTextToTable")
        xDialog = self.xUITest.getTopFocusWindow()
        other = xDialog.getChild("other")
        other.executeAction("CLICK", tuple())
        othered = xDialog.getChild("othered")
        othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
        othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
        othered.executeAction("TYPE", mkPropertyValues({"TEXT":":"}))
        headingcb = xDialog.getChild("headingcb")
        headingcb.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()), 4)
        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()
Ejemplo n.º 4
0
    def test_tdf31805_delete_column_merged(self):
        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf31805.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        #1. open "sample.ods"
        #2. click 'G1'
        #3. Menu 'edit -> Celete Cell - Delete entire Column'
        #expected: Column with cell containing "g" will be deleted,
        #     a merged cell range will remainlect row 1

        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "G1"}))
        self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True)
        self.xUITest.executeCommand(".uno:DeleteColumns")
        #verify. C5:F11 should be merged
        #isMerged   returns true if this cell is merged with another cell.
        self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True)      #C5
        self.assertEqual(get_cell_by_position(document, 0, 6, 4).getIsMerged(), False)      #G5
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A11"}))
        self.xUITest.executeCommand(".uno:DeleteRows")
        self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True)      #C5
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
        self.xUITest.executeCommand(".uno:DeleteColumns")
        self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True)      #C5
        self.ui_test.close_doc()
    def test_autosum_test1(self):
        #Sum on range and Sum on Sum's
        calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        #Place the cell cursor on the gray cells located under Point 1.
        #(Multiselection is not possible at this place) and press the Sum Icon in the formula bar.
        #Now hit the enter key and the result should be shown. Do so for each gray cell in this part of the document.
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B10"}))
        self.xUITest.executeCommand(".uno:AutoSum")
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B13"}))
        self.xUITest.executeCommand(".uno:AutoSum")
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B14"}))
        self.xUITest.executeCommand(".uno:AutoSum")
        self.assertEqual(get_cell_by_position(document, 0, 1, 9).getValue(), 2)
        self.assertEqual(get_cell_by_position(document, 0, 1, 9).getFormula(), "=SUM(B8:B9)")
        self.assertEqual(get_cell_by_position(document, 0, 1, 12).getValue(), 2)
        self.assertEqual(get_cell_by_position(document, 0, 1, 12).getFormula(), "=SUM(B11:B12)")
        self.assertEqual(get_cell_by_position(document, 0, 1, 13).getValue(), 4)
        self.assertEqual(get_cell_by_position(document, 0, 1, 13).getFormula(), "=SUM(B13:B13;B10:B10)")

        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "F8:F14"}))
        self.xUITest.executeCommand(".uno:AutoSum")
        self.assertEqual(get_cell_by_position(document, 0, 5, 13).getValue(), 4)
        self.assertEqual(get_cell_by_position(document, 0, 5, 13).getFormula(), "=SUM(F13:F13;F10:F10)")

        self.ui_test.close_doc()
Ejemplo n.º 6
0
   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()
Ejemplo n.º 7
0
    def test_tdf122449_crash_edit_index_entry(self):
        writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf122449.odt"))
        document = self.ui_test.get_component()
        xWriterDoc = self.xUITest.getTopFocusWindow()
        xWriterEdit = xWriterDoc.getChild("writer_edit")
        #search word Autocorrect (second find)   .uno:SearchDialog
        self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
        xDialog = self.xUITest.getTopFocusWindow()

        searchterm = xDialog.getChild("searchterm")
        searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Autocorrection"}))
        xsearch = xDialog.getChild("search")
        xsearch.executeAction("CLICK", tuple())  #first search
        xsearch.executeAction("CLICK", tuple())  #2nd search
        self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "6")
        xcloseBtn = xDialog.getChild("close")
        self.ui_test.close_dialog_through_button(xcloseBtn)
        xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"}))
        # invoke Index dialog Index entry   .uno:IndexEntryDialog
        self.ui_test.execute_dialog_through_command(".uno:IndexEntryDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xcloseBtn = xDialog.getChild("close")
        self.ui_test.close_dialog_through_button(xcloseBtn)
        # close
        # Go to page 2
        self.ui_test.execute_dialog_through_command(".uno:GotoPage")
        xDialog = self.xUITest.getTopFocusWindow()
        xPageText = xDialog.getChild("page")
        xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
        xOkBtn = xDialog.getChild("ok")
        xOkBtn.executeAction("CLICK", tuple())
        # verify
        self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")

        self.ui_test.close_doc()
Ejemplo n.º 8
0
    def test_protect_spreadsheet(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
        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"}))

        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"}))

        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

        self.ui_test.close_doc()
Ejemplo n.º 9
0
    def test_bookmark_dialog_goto(self):
        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


        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()
        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()
Ejemplo n.º 10
0
    def test_row_hide_show(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()
        #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()
Ejemplo n.º 11
0
    def test_paragraph_classification_dialog_text(self):
        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")
        #+ 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())
        props = {"TEXT": "Internal Only"}
        actionProps = mkPropertyValues(props)
        classificationCB.executeAction("SELECT", actionProps)
        #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)
        # verify the text on characters 0-6 : "(AAIO)"
        self.assertEqual(document.Text.String[0:6], "(AAIO)")

        self.ui_test.close_doc()
Ejemplo n.º 12
0
 def handle_protect_dlg(dialog):
     xOkBtn = dialog.getChild("ok")
     xPasswordText = dialog.getChild("pass1ed")
     xPasswordText.executeAction("TYPE", mkPropertyValues({"TEXT":"password"}))
     xConfirmText = dialog.getChild("confirm1ed")
     xConfirmText.executeAction("TYPE", mkPropertyValues({"TEXT":"password"}))
     self.ui_test.close_dialog_through_button(xOkBtn)
Ejemplo n.º 13
0
   def test_tdf94055(self):
        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()
Ejemplo n.º 14
0
 def handleDialog(dialog):
     dialog.getChild("identifier").executeAction("TYPE", mkPropertyValues({"TEXT": "baddcafe-e394-4cd6-9b83-7172794612e5"}))
     dialog.getChild("title").executeAction("TYPE", mkPropertyValues({"TEXT": "unknown title from ui"}))
     dialog.getChild("author").executeAction("TYPE", mkPropertyValues({"TEXT": "unknown author from ui"}))
     dialog.getChild("language").executeAction("TYPE", mkPropertyValues({"TEXT": "sk"}))
     dialog.getChild("date").executeAction("TYPE", mkPropertyValues({"TEXT": "2013-11-20T17:16:07Z"}))
     dialog.getChild("ok").executeAction("CLICK", tuple())
Ejemplo n.º 15
0
    def test_tdf88792(self):
        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf88792.ods"))
        XcalcDoc = self.xUITest.getTopFocusWindow()
        document = self.ui_test.get_component()
        gridwin = XcalcDoc.getChild("grid_window")

        # go to cell A1
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        # Select from the menu bar Data
        # Select option subtotal
        # Subtotal dialog displays
        self.ui_test.execute_dialog_through_command(".uno:DataSubTotals")
        xDialog = self.xUITest.getTopFocusWindow()
        # Select group by: Category
        xGroupBy = xDialog.getChild("group_by")
        props = {"TEXT": "Category"}
        actionProps = mkPropertyValues(props)
        xGroupBy.executeAction("SELECT", actionProps)
        # Select calculate subtotals for the months -  selected by default
        # Select tab options
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "3")
        # select option include formats
        xformats = xDialog.getChild("formats")
        xformats.executeAction("CLICK", tuple())
        # apply with OK
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

        self.assertEqual(get_cell_by_position(document, 0, 3, 5).getValue(), 28000)
        self.ui_test.close_doc()
Ejemplo n.º 16
0
    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()
Ejemplo n.º 17
0
    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()
Ejemplo n.º 18
0
    def test_tdf118206(self):
        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf118206.xlsx"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        self.xUITest.executeCommand(".uno:SelectColumn")
        self.xUITest.executeCommand(".uno:Copy")
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
        self.xUITest.executeCommand(".uno:SelectColumn")
        self.xUITest.executeCommand(".uno:Paste")

        #verify
        self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "On Back Order")
        self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 0)
        self.assertEqual(get_cell_by_position(document, 0, 1, 7).getValue(), 1)

        #Undo
        self.xUITest.executeCommand(".uno:Undo")
        self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "On Back Order")
        self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 0)
        self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 1)
        self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "")
        self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "")
        self.assertEqual(get_cell_by_position(document, 0, 1, 7).getString(), "")
        self.ui_test.close_doc()
Ejemplo n.º 19
0
    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()
Ejemplo n.º 20
0
   def test_insert_foot_endnote(self):
        self.ui_test.create_doc_in_start_center("writer")
        document = self.ui_test.get_component()
        xWriterDoc = self.xUITest.getTopFocusWindow()
        xWriterEdit = xWriterDoc.getChild("writer_edit")

#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())

        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"}))

        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()

        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())

        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)

        self.ui_test.close_doc()
Ejemplo n.º 21
0
    def test_tdf53482_Range_contains_column_headings_file(self):
        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf53482.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        #1. Highlight cells to be sorted A8:J124
        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A8:J124"}))
        #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())
        xSortKey1 = xDialog.getChild("sortlb")
        props = {"TEXT": "Occupation"}
        actionProps = mkPropertyValues(props)
        xSortKey1.executeAction("SELECT", actionProps)
        #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, 6, 7).getString(), "Occupation")
        self.assertEqual(get_cell_by_position(document, 0, 6, 8).getString(), "Travel Industry")
        self.assertEqual(get_cell_by_position(document, 0, 6, 123).getString(), "13")

        self.ui_test.close_doc()
Ejemplo n.º 22
0
   def test_tdf39959_find_replace_all_sheets(self):
        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf39959.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()

        # 1. Open a new document
        # 2. Enter "asdf" in A1
        # 3. Activate Sheet2
        # 4. Try Find-and-replace (Ctrl+Alt+F) to search for "asdf"
        # Whether the checkbox "in allen Tabellen suchen" is activated or not: LibO Calc never seems to find the 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":"asdf"}))
        replaceterm = xDialog.getChild("replaceterm")
        replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"bbb"})) #replace textbox
        allsheets = xDialog.getChild("allsheets")
        allsheets.executeAction("CLICK", tuple())
        replaceall = xDialog.getChild("replaceall")
        replaceall.executeAction("CLICK", tuple())
        # print(xDialog.getChildren())
        xcloseBtn = xDialog.getChild("close")
        self.ui_test.close_dialog_through_button(xcloseBtn)

        #verify Sheet2.A1 = "bbb"
        self.assertEqual(get_cell_by_position(document, 1, 0, 0).getString(), "bbb ")
        self.assertEqual(get_cell_by_position(document, 1, 0, 2).getString(), "abc")
        #Undo
        self.xUITest.executeCommand(".uno:Undo")
        self.assertEqual(get_cell_by_position(document, 1, 0, 0).getString(), "asdf ")
        self.ui_test.close_doc()
Ejemplo n.º 23
0
    def test_tdf37341_goalSeek(self):
        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf37341.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "F111"}))
        self.ui_test.execute_modeless_dialog_through_command(".uno:GoalSeekDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xformulaedit = xDialog.getChild("formulaedit")
        xtarget = xDialog.getChild("target")
        xvaredit = xDialog.getChild("varedit")
        xtarget.executeAction("TYPE", mkPropertyValues({"TEXT":"0"}))
        xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"E7"}))
        xOKBtn = xDialog.getChild("ok")
        def handle_OK_dlg(dialog):
            xYesButn = dialog.getChild("yes")
            self.ui_test.close_dialog_through_button(xYesButn)

        self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()),
                dialog_handler=handle_OK_dlg)
        #verify
        self.assertEqual(get_cell_by_position(document, 0, 4, 6).getValue() > 0, True)
        self.ui_test.close_doc()

# vim: set shiftwidth=4 softtabstop=4 expandtab:
Ejemplo n.º 24
0
    def test_column_hide_show(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()
        #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()
Ejemplo n.º 25
0
   def test_multiple_operations_several_formulas(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()

        #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)

        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()
Ejemplo n.º 26
0
    def test_tdf117601_merge_middle_column(self):

        self.ui_test.create_doc_in_start_center("writer")
        xWriterDoc = self.xUITest.getTopFocusWindow()
        xWriterEdit = xWriterDoc.getChild("writer_edit")
        document = self.ui_test.get_component()
        #* open Writer
        #* create table 3x5
        #* merge the middle row
        #--> crash
        self.ui_test.execute_dialog_through_command(".uno:InsertTable")
        xDialog = self.xUITest.getTopFocusWindow()

        column = xDialog.getChild("colspin")
        column.executeAction("UP", tuple())
        row = xDialog.getChild("rowspin")
        row.executeAction("UP", tuple())
        row.executeAction("UP", tuple())
        row.executeAction("UP", tuple())
        xOkBtn = xDialog.getChild("ok")
        xOkBtn.executeAction("CLICK", tuple())

        self.assertEqual(document.TextTables.getCount(), 1)
        #go to middle row
        xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
        xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
        #Table - Select Column .uno:EntireColumn
        self.xUITest.executeCommand(".uno:EntireColumn")
        #merge
        self.xUITest.executeCommand(".uno:MergeCells")
        self.assertEqual(document.TextTables.getCount(), 1)

        self.ui_test.close_doc()
Ejemplo n.º 27
0
    def test_tdf118189(self):
        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf118189.xlsx"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        #1. Open attached document
        #2. Copy Column A
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        self.xUITest.executeCommand(".uno:SelectColumn")
        self.xUITest.executeCommand(".uno:Copy")
        #3. New Spreadsheet
        calc_doc2 = self.ui_test.load_file(get_url_for_data_file("emptyFile.ods"))
        gridwin2 = xCalcDoc.getChild("grid_window")
        document2 = self.ui_test.get_component()

        frames = self.ui_test.get_frames()
        frames[1].activate()
        #4. Paste it
        gridwin2.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        self.xUITest.executeCommand(".uno:Paste")
        #5. Cut it
        self.xUITest.executeCommand(".uno:Cut")
        #6. Undo
        self.xUITest.executeCommand(".uno:Undo")

        #-> CRASH
        self.assertEqual(get_cell_by_position(document2, 0, 0, 0).getString(), "")

        self.ui_test.close_doc()

# vim: set shiftwidth=4 softtabstop=4 expandtab:
    def test_tdf57274_tdf116385_row_only(self):
        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf57274.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()

        #* Source Cells, range B6..E6
        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B6:E6"}))
        self.xUITest.executeCommand(".uno:Copy")
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B11"}))
        self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
        xDialog = self.xUITest.getTopFocusWindow()
        #We paste here using Paste Special with 'Link' Checkbox activated
        xLink = xDialog.getChild("link")
        xLink.executeAction("CLICK", tuple())
        xOkBtn = xDialog.getChild("ok")
        # self.ui_test.close_dialog_through_button(xOkBtn)
        def handle_confirm_dlg(dialog):
            xOKBtn = dialog.getChild("yes")
            self.ui_test.close_dialog_through_button(xOKBtn)

        self.ui_test.execute_blocking_action(xOkBtn.executeAction, args=('CLICK', ()),
                dialog_handler=handle_confirm_dlg)
        #we would expect a reference to cell E6 here and a zero being displayed, but the cell is also simply blank.
        self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 0)
        self.assertEqual(get_cell_by_position(document, 0, 4, 10).getFormula(), "=$Sheet1.$E$6")
        self.ui_test.close_doc()

# vim: set shiftwidth=4 softtabstop=4 expandtab:
Ejemplo n.º 29
0
    def test_tdf62267(self):
        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf62267.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()

        #* Copy A1, then paste special to C1;
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        self.xUITest.executeCommand(".uno:Copy")
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"}))
        self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
        xDialog = self.xUITest.getTopFocusWindow()
        #it's the default - text, numbers and dates
        xOkBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOkBtn)

        #--> Cell formatting should stay as before
        self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog")

        xCondFormatMgr = self.xUITest.getTopFocusWindow()

        # check that we have exactly 1 conditional format
        xList = xCondFormatMgr.getChild("CONTAINER")
        list_state = get_state_as_dict(xList)
        self.assertEqual(list_state['Children'], '1')

        xTreeEntry = xList.getChild('0')
        self.assertEqual(get_state_as_dict(xTreeEntry)["Text"], "A1\tCell value is = 1")

        xCancelBtn = xCondFormatMgr.getChild("cancel")
        self.ui_test.close_dialog_through_button(xCancelBtn)

        self.ui_test.close_doc()

# vim: set shiftwidth=4 softtabstop=4 expandtab:
Ejemplo n.º 30
0
   def test_sort_numerical(self):
        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")

        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())
        props = {"TEXT": "Numerical"}
        actionProps = mkPropertyValues(props)
        xtypelb1.executeAction("SELECT", actionProps)
        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:
Ejemplo n.º 31
0
    def test_find_impress(self):
        impress_doc = self.ui_test.load_file(
            get_url_for_data_file("findReplace.odp"))
        document = self.ui_test.get_component()
        # print(dir(document))
        # xPages= document.CurrentController.getCurrentPage().Number
        # print(xPages)
        self.assertEqual(document.CurrentController.getCurrentPage().Number, 1)
        self.ui_test.execute_modeless_dialog_through_command(
            ".uno:SearchDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        searchterm = xDialog.getChild("searchterm")
        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"TEXT":
                                                   "second"}))  #2nd slide
        xsearch = xDialog.getChild("search")
        xsearch.executeAction("CLICK", tuple())
        #verify
        self.assertEqual(document.CurrentController.getCurrentPage().Number, 2)

        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "CTRL+A"}))
        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        searchterm.executeAction("TYPE", mkPropertyValues({"TEXT": "third"}))
        xsearch.executeAction("CLICK", tuple())
        #verify
        self.assertEqual(document.CurrentController.getCurrentPage().Number,
                         3)  #3rd slide

        xcloseBtn = xDialog.getChild("close")
        self.ui_test.close_dialog_through_button(xcloseBtn)

        #now open dialog and verify find="third" (remember last value); replace value with "First" ( click match case) with word "Replace" - click twice Replace button, check "Replace first first"
        self.ui_test.execute_modeless_dialog_through_command(
            ".uno:SearchDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        searchterm = xDialog.getChild("searchterm")
        self.assertEqual(get_state_as_dict(searchterm)["Text"], "third")
        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "CTRL+A"}))
        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        searchterm.executeAction("TYPE", mkPropertyValues({"TEXT": "First"}))
        matchcase = xDialog.getChild("matchcase")
        matchcase.executeAction("CLICK", tuple())  #click match case
        replaceterm = xDialog.getChild("replaceterm")
        replaceterm.executeAction("TYPE",
                                  mkPropertyValues({"TEXT": "Replace"
                                                    }))  #replace textbox
        replace = xDialog.getChild("replace")
        replace.executeAction("CLICK", tuple())
        replace.executeAction("CLICK", tuple())  #click twice Replace button
        #close and reopen the dialog, because of bug  122788
        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()
        replaceterm = xDialog.getChild("replaceterm")
        matchcase = xDialog.getChild("matchcase")
        #now replace first (uncheck match case) with word "aaa" - click once Replace All button, check "Replace aaa aaa"
        replaceterm.executeAction("TYPE",
                                  mkPropertyValues({"KEYCODE": "CTRL+A"}))
        replaceterm.executeAction("TYPE",
                                  mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT": "aaa"}))
        matchcase.executeAction("CLICK", tuple())  #uncheck match case
        replaceall = xDialog.getChild("replaceall")
        replaceall.executeAction("CLICK", tuple())
        xcloseBtn = xDialog.getChild("close")
        self.ui_test.close_dialog_through_button(xcloseBtn)

        #go to second page
        self.ui_test.execute_modeless_dialog_through_command(
            ".uno:SearchDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        searchterm = xDialog.getChild("searchterm")
        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"TEXT":
                                                   "second"}))  #2nd slide
        xsearch = xDialog.getChild("search")
        xsearch.executeAction("CLICK", tuple())
        xcloseBtn = xDialog.getChild("close")
        self.ui_test.close_dialog_through_button(xcloseBtn)
        self.assertEqual(document.CurrentController.getCurrentPage().Number, 2)
        #now check if text "Replace aaa aaa" is on first slide
        self.ui_test.execute_modeless_dialog_through_command(
            ".uno:SearchDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        searchterm = xDialog.getChild("searchterm")
        backsearch = xDialog.getChild("backsearch")
        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "CTRL+A"}))
        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"TEXT": "Replace aaa aaa"}))
        backsearch.executeAction("CLICK", tuple())
        #verify
        self.assertEqual(document.CurrentController.getCurrentPage().Number,
                         1)  #1st slide

        xcloseBtn = xDialog.getChild("close")
        self.ui_test.close_dialog_through_button(xcloseBtn)

        self.ui_test.close_doc()
Ejemplo n.º 32
0
    def test_autofill(self):
        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("autofill.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        #Select cell A12 and drag the fill handle in the bottom right corner of the cell down to A18
        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A12:A18"}))
        self.ui_test.execute_dialog_through_command(".uno:FillSeries")
        xDialog = self.xUITest.getTopFocusWindow()
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)
        #Compare with the content in the right next column
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 11).getValue(), 18.34)
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 12).getValue(), 19.34)
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 13).getValue(), 20.34)
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 14).getValue(), 21.34)
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 15).getValue(), 22.34)
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 16).getValue(), 23.34)
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 17).getValue(), 24.34)
        #Select cell A12 and drag the fill handle in the bottom right corner of the cell up to A6
        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A6:A12"}))
        self.ui_test.execute_dialog_through_command(".uno:FillSeries")
        xDialog = self.xUITest.getTopFocusWindow()
        xup = xDialog.getChild("up")
        xincrement = xDialog.getChild("increment")
        xup.executeAction("CLICK", tuple())
        xincrement.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xincrement.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        xincrement.executeAction("TYPE", mkPropertyValues({"TEXT": "-1"}))
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)
        #Compare with the content in the right next column
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 5).getValue(), 12.34)
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 6).getValue(), 13.34)
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 7).getValue(), 14.34)
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 8).getValue(), 15.34)
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 9).getValue(), 16.34)
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 10).getValue(), 17.34)
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 11).getValue(), 18.34)

        #Continue with the next cells with grey background
        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "M12:M18"}))
        self.ui_test.execute_dialog_through_command(".uno:FillSeries")
        xDialog = self.xUITest.getTopFocusWindow()
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)
        #Compare with the content in the right next column
        self.assertEqual(
            get_cell_by_position(document, 0, 12, 11).getString(), "12abc40")
        self.assertEqual(
            get_cell_by_position(document, 0, 12, 12).getString(), "12abc41")
        self.assertEqual(
            get_cell_by_position(document, 0, 12, 13).getString(), "12abc42")
        self.assertEqual(
            get_cell_by_position(document, 0, 12, 14).getString(), "12abc43")
        self.assertEqual(
            get_cell_by_position(document, 0, 12, 15).getString(), "12abc44")
        self.assertEqual(
            get_cell_by_position(document, 0, 12, 16).getString(), "12abc45")
        self.assertEqual(
            get_cell_by_position(document, 0, 12, 17).getString(), "12abc46")

        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "M6:M12"}))
        self.ui_test.execute_dialog_through_command(".uno:FillSeries")
        xDialog = self.xUITest.getTopFocusWindow()
        xup = xDialog.getChild("up")
        xincrement = xDialog.getChild("increment")
        xup.executeAction("CLICK", tuple())
        xincrement.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xincrement.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        xincrement.executeAction("TYPE", mkPropertyValues({"TEXT": "-1"}))
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)
        #Compare with the content in the right next column
        self.assertEqual(
            get_cell_by_position(document, 0, 12, 5).getString(), "12abc34")
        self.assertEqual(
            get_cell_by_position(document, 0, 12, 6).getString(), "12abc35")
        self.assertEqual(
            get_cell_by_position(document, 0, 12, 7).getString(), "12abc36")
        self.assertEqual(
            get_cell_by_position(document, 0, 12, 8).getString(), "12abc37")
        self.assertEqual(
            get_cell_by_position(document, 0, 12, 9).getString(), "12abc38")
        self.assertEqual(
            get_cell_by_position(document, 0, 12, 10).getString(), "12abc39")
        self.assertEqual(
            get_cell_by_position(document, 0, 12, 11).getString(), "12abc40")

        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "P12:P18"}))
        self.ui_test.execute_dialog_through_command(".uno:FillSeries")
        xDialog = self.xUITest.getTopFocusWindow()
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)
        #Compare with the content in the right next column
        self.assertEqual(
            get_cell_by_position(document, 0, 15, 11).getString(),
            "10.64.127.7")
        self.assertEqual(
            get_cell_by_position(document, 0, 15, 12).getString(),
            "10.64.127.8")
        self.assertEqual(
            get_cell_by_position(document, 0, 15, 13).getString(),
            "10.64.127.9")
        self.assertEqual(
            get_cell_by_position(document, 0, 15, 14).getString(),
            "10.64.127.10")
        self.assertEqual(
            get_cell_by_position(document, 0, 15, 15).getString(),
            "10.64.127.11")
        self.assertEqual(
            get_cell_by_position(document, 0, 15, 16).getString(),
            "10.64.127.12")
        self.assertEqual(
            get_cell_by_position(document, 0, 15, 17).getString(),
            "10.64.127.13")

        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "P6:P12"}))
        self.ui_test.execute_dialog_through_command(".uno:FillSeries")
        xDialog = self.xUITest.getTopFocusWindow()
        xup = xDialog.getChild("up")
        xincrement = xDialog.getChild("increment")
        xup.executeAction("CLICK", tuple())
        xincrement.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xincrement.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        xincrement.executeAction("TYPE", mkPropertyValues({"TEXT": "-1"}))
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)
        #Compare with the content in the right next column
        self.assertEqual(
            get_cell_by_position(document, 0, 15, 5).getString(),
            "10.64.127.1")
        self.assertEqual(
            get_cell_by_position(document, 0, 15, 6).getString(),
            "10.64.127.2")
        self.assertEqual(
            get_cell_by_position(document, 0, 15, 7).getString(),
            "10.64.127.3")
        self.assertEqual(
            get_cell_by_position(document, 0, 15, 8).getString(),
            "10.64.127.4")
        self.assertEqual(
            get_cell_by_position(document, 0, 15, 9).getString(),
            "10.64.127.5")
        self.assertEqual(
            get_cell_by_position(document, 0, 15, 10).getString(),
            "10.64.127.6")
        self.assertEqual(
            get_cell_by_position(document, 0, 15, 11).getString(),
            "10.64.127.7")

        self.ui_test.close_doc()
Ejemplo n.º 33
0
    def test_statistic_covariance_column(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()
        #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()
Ejemplo n.º 34
0
    def test_statistic_covariance_row(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()
        #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()
Ejemplo n.º 35
0
    def test_copy_paste_chart_with_dot_in_sheet_name(self):
        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("chartWithDotInSheetName.ods"))
        document = self.ui_test.get_component()

        xChart = document.Sheets[0].Charts[0]
        xDataSeries = xChart.getEmbeddedObject().getFirstDiagram(
        ).CoordinateSystems[0].ChartTypes[0].DataSeries

        self.assertEqual(4, len(xDataSeries))

        xOldSheetRanges = []
        for i in range(4):
            xRow = []
            xDS = xDataSeries[i].DataSequences

            self.assertEqual(1, len(xDS))
            xRow.append(xDS[0].Values.SourceRangeRepresentation)
            xOldSheetRanges.append(xRow)

        self.xUITest.executeCommand(".uno:SelectAll")

        self.xUITest.executeCommand(".uno:Copy")

        self.xUITest.executeCommand(".uno:CloseDoc")

        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
        self.ui_test.execute_dialog_through_command(".uno:RenameTable")
        xDialog = self.xUITest.getTopFocusWindow()
        xname_entry = xDialog.getChild("name_entry")

        xname_entry.executeAction("TYPE",
                                  mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xname_entry.executeAction("TYPE",
                                  mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT":
                                                            "Sheet.1"}))
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

        self.xUITest.executeCommand(".uno:Paste")

        xChart = document.Sheets[0].Charts[0]
        xDataSeries = xChart.getEmbeddedObject().getFirstDiagram(
        ).CoordinateSystems[0].ChartTypes[0].DataSeries

        self.assertEqual(4, len(xDataSeries))

        xNewSheetRanges = []
        for i in range(4):
            xRow = []
            xDS = xDataSeries[i].DataSequences

            self.assertEqual(1, len(xDS))
            xRow.append(xDS[0].Values.SourceRangeRepresentation)
            xNewSheetRanges.append(xRow)

        # Without the fix in place, this test would have failed with
        # ["$'Sheet.1'.$B$12:$B$18"]
        # ["'file:///home/<user>/Documents/Sheet.1'#$Sheet1.$B$12:$B$18"]
        self.assertEqual(xOldSheetRanges, xNewSheetRanges)

        self.ui_test.close_doc()
Ejemplo n.º 36
0
   def test_chart_display_titles_dialog(self):
    calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf98390.ods"))
    xCalcDoc = self.xUITest.getTopFocusWindow()
    gridwin = xCalcDoc.getChild("grid_window")
    document = self.ui_test.get_component()

    xCS = document.Sheets[0].Charts[0].getEmbeddedObject().FirstDiagram.CoordinateSystems[0]

    self.assertFalse(document.Sheets[0].Charts[0].getEmbeddedObject().HasMainTitle)
    self.assertFalse(document.Sheets[0].Charts[0].getEmbeddedObject().HasSubTitle)
    self.assertIsNone(xCS.getAxisByDimension(0, 0).TitleObject)
    self.assertIsNone(xCS.getAxisByDimension(1, 0).TitleObject)

    gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
    gridwin.executeAction("ACTIVATE", tuple())
    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": "InsertMenuTitles"}))
    xDialog = self.xUITest.getTopFocusWindow()

    maintitle = xDialog.getChild("maintitle")
    subtitle = xDialog.getChild("subtitle")
    primaryXaxis = xDialog.getChild("primaryXaxis")
    primaryYaxis = xDialog.getChild("primaryYaxis")
    secondaryXaxis = xDialog.getChild("secondaryXaxis")
    secondaryYaxis = xDialog.getChild("secondaryYaxis")

    maintitle.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
    subtitle.executeAction("TYPE", mkPropertyValues({"TEXT":"B"}))
    primaryXaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"C"}))
    primaryYaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"D"}))
    secondaryXaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"E"}))
    secondaryYaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"F"}))

    xOKBtn = xDialog.getChild("ok")
    self.ui_test.close_dialog_through_button(xOKBtn)

    self.assertTrue(document.Sheets[0].Charts[0].getEmbeddedObject().HasMainTitle)
    self.assertTrue(document.Sheets[0].Charts[0].getEmbeddedObject().HasSubTitle)
    self.assertEqual("A", document.Sheets[0].Charts[0].getEmbeddedObject().Title.String)
    self.assertEqual("B", document.Sheets[0].Charts[0].getEmbeddedObject().SubTitle.String)
    self.assertEqual("C", xCS.getAxisByDimension(0, 0).TitleObject.Text[0].String)
    self.assertEqual("D", xCS.getAxisByDimension(1, 0).TitleObject.Text[0].String)
    self.assertEqual("E", xCS.getAxisByDimension(0, 1).TitleObject.Text[0].String)
    self.assertEqual("F", xCS.getAxisByDimension(1, 1).TitleObject.Text[0].String)

    #reopen and verify InsertMenuTitles dialog
    gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
    gridwin.executeAction("ACTIVATE", tuple())
    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": "InsertMenuTitles"}))
    xDialog = self.xUITest.getTopFocusWindow()

    maintitle = xDialog.getChild("maintitle")
    subtitle = xDialog.getChild("subtitle")
    primaryXaxis = xDialog.getChild("primaryXaxis")
    primaryYaxis = xDialog.getChild("primaryYaxis")
    secondaryXaxis = xDialog.getChild("secondaryXaxis")
    secondaryYaxis = xDialog.getChild("secondaryYaxis")

    self.assertEqual(get_state_as_dict(maintitle)["Text"], "A")
    self.assertEqual(get_state_as_dict(subtitle)["Text"], "B")
    self.assertEqual(get_state_as_dict(primaryXaxis)["Text"], "C")
    self.assertEqual(get_state_as_dict(primaryYaxis)["Text"], "D")
    self.assertEqual(get_state_as_dict(secondaryXaxis)["Text"], "E")
    self.assertEqual(get_state_as_dict(secondaryYaxis)["Text"], "F")

    xOKBtn = xDialog.getChild("ok")
    self.ui_test.close_dialog_through_button(xOKBtn)

    self.ui_test.close_doc()
Ejemplo n.º 37
0
    def test_find_similarities(self):
        writer_doc = self.ui_test.load_file(
            get_url_for_data_file("findReplace.odt"))
        document = self.ui_test.get_component()
        xWriterDoc = self.xUITest.getTopFocusWindow()
        xWriterEdit = xWriterDoc.getChild("writer_edit")
        #verify: we are on page 1
        self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
        # search and replace dialog
        #find = seco
        self.ui_test.execute_modeless_dialog_through_command(
            ".uno:SearchDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        searchterm = xDialog.getChild("searchterm")
        searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":
                                                           "seco"}))  #seco
        # check similarities, button similarities, set values = 1; close dialog with OK
        similarity = xDialog.getChild("similarity")
        similaritybtn = xDialog.getChild("similaritybtn")
        similarity.executeAction("CLICK", tuple())

        def handle_similarity_dlg(dialog):
            otherfld = dialog.getChild("otherfld")
            longerfld = dialog.getChild("longerfld")
            shorterfld = dialog.getChild("shorterfld")
            otherfld.executeAction("DOWN", tuple())
            longerfld.executeAction("DOWN", tuple())
            shorterfld.executeAction("DOWN", tuple())
            xOKBtn = dialog.getChild("ok")
            self.ui_test.close_dialog_through_button(xOKBtn)

        self.ui_test.execute_blocking_action(
            similaritybtn.executeAction,
            args=('CLICK', ()),
            dialog_handler=handle_similarity_dlg)

        #open dialog again, verify values = 1; close dialog with cancel
        def handle_similarity_dlg2(dialog):
            otherfld = dialog.getChild("otherfld")
            longerfld = dialog.getChild("longerfld")
            shorterfld = dialog.getChild("shorterfld")
            self.assertEqual(get_state_as_dict(otherfld)["Text"], "1")
            self.assertEqual(get_state_as_dict(longerfld)["Text"], "1")
            self.assertEqual(get_state_as_dict(shorterfld)["Text"], "1")

            xCancelBtn = dialog.getChild("cancel")
            self.ui_test.close_dialog_through_button(xCancelBtn)

        self.ui_test.execute_blocking_action(
            similaritybtn.executeAction,
            args=('CLICK', ()),
            dialog_handler=handle_similarity_dlg2)

        xsearch = xDialog.getChild("search")
        xsearch.executeAction("CLICK", tuple())
        # Find next - not found
        self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
        #find = secon
        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "CTRL+A"}))
        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        searchterm.executeAction("TYPE", mkPropertyValues({"TEXT": "secon"}))
        # Find next - verify: we are on page 2
        xsearch = xDialog.getChild("search")
        xsearch.executeAction("CLICK", tuple())
        self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
        xWriterEdit.executeAction("TYPE", mkPropertyValues(
            {"KEYCODE": "LEFT"}))  #word "second" is selected
        #find = irst
        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "CTRL+A"}))
        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        searchterm.executeAction("TYPE", mkPropertyValues({"TEXT": "irst"}))
        # Find next - verify: we are on page 1
        xsearch.executeAction("CLICK", tuple())
        self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")

        self.ui_test.close_doc()
Ejemplo n.º 38
0
    def test_tdf137802(self):

        self.ui_test.load_file(get_url_for_data_file("tdf137802.odt"))

        xWriterDoc = self.xUITest.getTopFocusWindow()
        xWriterEdit = xWriterDoc.getChild("writer_edit")
        document = self.ui_test.get_component()

        self.assertEqual(document.DrawPage.getCount(), 2)
        self.assertEqual(AT_PARAGRAPH,
                         document.DrawPage.getByIndex(0).AnchorType)

        self.xUITest.executeCommand(".uno:JumpToNextFrame")

        self.ui_test.wait_until_child_is_available(xWriterEdit, 'metricfield')

        self.ui_test.execute_dialog_through_command(".uno:TransformDialog")

        xDialog = self.xUITest.getTopFocusWindow()

        xDialog.getChild('topage').executeAction("CLICK", tuple())

        xOkBtn = xDialog.getChild("ok")
        xOkBtn.executeAction("CLICK", tuple())

        self.assertEqual(AT_PAGE, document.DrawPage.getByIndex(0).AnchorType)

        self.assertEqual(document.DrawPage.getCount(), 2)

        xWriterDoc = self.xUITest.getTopFocusWindow()
        xWriterEdit = xWriterDoc.getChild("writer_edit")

        # When shape 1 is selected, esc key doesn't put the focus back to the document
        # because the shape has a textbox. Move the focus to another shape with tab key
        # and then use escape
        xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
        xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ESC"}))

        # Wait until the shape is deselected and the cursor is on the document
        self.ui_test.wait_until_child_is_available(xWriterEdit, 'FontNameBox')

        # Delete the second paragraph. Shape 2 is anchored to this paragraph
        # so it should be deleted
        xWriterEdit.executeAction("TYPE",
                                  mkPropertyValues({"KEYCODE": "BACKSPACE"}))

        self.assertEqual(document.DrawPage.getCount(), 1)

        self.xUITest.executeCommand(".uno:JumpToNextFrame")
        self.xUITest.executeCommand(".uno:Delete")

        self.assertEqual(document.DrawPage.getCount(), 0)

        self.xUITest.executeCommand(".uno:Undo")

        self.assertEqual(document.DrawPage.getCount(), 1)

        self.xUITest.executeCommand(".uno:Undo")

        self.assertEqual(document.DrawPage.getCount(), 2)

        self.xUITest.executeCommand(".uno:Undo")

        self.assertEqual(AT_PARAGRAPH,
                         document.DrawPage.getByIndex(0).AnchorType)

        self.ui_test.close_doc()
Ejemplo n.º 39
0
    def test_autocorrect_options_impress(self):
        self.ui_test.create_doc_in_start_center("impress")
        xTemplateDlg = self.xUITest.getTopFocusWindow()
        xCancelBtn = xTemplateDlg.getChild("cancel")
        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"]

        #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)["EntryCount"]
        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)["EntryCount"]
        nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb)
        self.assertEqual(nrRowsAbbDiff, 1)  #we have +1 rule
        delabbrev.executeAction("CLICK", tuple())
        self.assertEqual(
            get_state_as_dict(abbrevlist)["EntryCount"],
            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)["EntryCount"]
        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)["EntryCount"]
        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)["EntryCount"],
            nrRowsDouble)  #we have default nr of rules

        xCancelButton = xDialog.getChild("cancel")
        xCancelButton.executeAction("CLICK", tuple())

        self.ui_test.close_doc()
Ejemplo n.º 40
0
    def test_find_writer(self):
        writer_doc = self.ui_test.load_file(
            get_url_for_data_file("findReplace.odt"))
        document = self.ui_test.get_component()
        xWriterDoc = self.xUITest.getTopFocusWindow()
        xWriterEdit = xWriterDoc.getChild("writer_edit")
        self.ui_test.execute_modeless_dialog_through_command(
            ".uno:SearchDialog")
        xDialog = self.xUITest.getTopFocusWindow()

        searchterm = xDialog.getChild("searchterm")
        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"TEXT":
                                                   "second"}))  #2nd page
        xsearch = xDialog.getChild("search")
        xsearch.executeAction("CLICK", tuple())
        #verify
        self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")

        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "CTRL+A"}))
        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        searchterm.executeAction("TYPE", mkPropertyValues({"TEXT": "third"}))
        xsearch.executeAction("CLICK", tuple())
        #verify
        self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"],
                         "3")  #3rd page

        xcloseBtn = xDialog.getChild("close")
        self.ui_test.close_dialog_through_button(xcloseBtn)

        #now open dialog and verify find="third" (remember last value); replace value with "First" ( click match case) with word "Replace" - click twice Replace button, check "Replace first first"
        self.ui_test.execute_modeless_dialog_through_command(
            ".uno:SearchDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        searchterm = xDialog.getChild("searchterm")
        self.assertEqual(get_state_as_dict(searchterm)["Text"], "third")
        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "CTRL+A"}))
        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        searchterm.executeAction("TYPE", mkPropertyValues({"TEXT": "First"}))
        matchcase = xDialog.getChild("matchcase")
        matchcase.executeAction("CLICK", tuple())  #click match case
        replaceterm = xDialog.getChild("replaceterm")
        replaceterm.executeAction("TYPE",
                                  mkPropertyValues({"TEXT": "Replace"
                                                    }))  #replace textbox
        replace = xDialog.getChild("replace")
        replace.executeAction("CLICK", tuple())
        replace.executeAction("CLICK", tuple())  #click twice Replace button
        #verify
        self.assertEqual(document.Text.String[0:19], "Replace first first")

        #now replace first (uncheck match case) with word "aaa" - click once Replace All button, check "Replace aaa aaa"
        replaceterm.executeAction("TYPE",
                                  mkPropertyValues({"KEYCODE": "CTRL+A"}))
        replaceterm.executeAction("TYPE",
                                  mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT": "aaa"}))
        matchcase.executeAction("CLICK", tuple())  #uncheck match case
        replaceall = xDialog.getChild("replaceall")
        replaceall.executeAction("CLICK", tuple())
        #verify
        self.assertEqual(document.Text.String[0:15], "Replace aaa aaa")

        #now delete strings in textbox Find and textbox Replace, click button Format, select  Size=16 pt, Close OK, Find Next; verify Page=2;
        #click No format button; close dialog
        replaceterm.executeAction("TYPE",
                                  mkPropertyValues({"KEYCODE": "CTRL+A"}))
        replaceterm.executeAction("TYPE",
                                  mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "CTRL+A"}))
        searchterm.executeAction("TYPE",
                                 mkPropertyValues({"KEYCODE": "BACKSPACE"}))

        format = xDialog.getChild("format")

        def handle_format_dlg(dialog):
            #print(dialog.getChildren())
            xTabs = dialog.getChild("tabcontrol")
            select_pos(xTabs, "0")
            xSizeFont = dialog.getChild("westsizelb-cjk")
            xSizeFont.executeAction("TYPE",
                                    mkPropertyValues({"KEYCODE": "CTRL+A"}))
            xSizeFont.executeAction("TYPE",
                                    mkPropertyValues({"TEXT": "16"
                                                      }))  #set font size 16
            xOkBtn = dialog.getChild("ok")
            self.ui_test.close_dialog_through_button(xOkBtn)

        self.ui_test.execute_blocking_action(format.executeAction,
                                             args=('CLICK', ()),
                                             dialog_handler=handle_format_dlg)

        # Verify these didn't get set again through SvxSearchController::StateChanged, timer-
        # triggered from SfxBindings::NextJob while executing the Format dialog above:
        self.assertEqual(get_state_as_dict(searchterm)["Text"], "")
        self.assertEqual(get_state_as_dict(replaceterm)["Text"], "")

        xsearch = xDialog.getChild("search")
        xsearch.executeAction("CLICK", tuple())
        #verify
        self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
        noformat = xDialog.getChild("noformat")
        noformat.executeAction("CLICK", tuple())  #click No format button

        xcloseBtn = xDialog.getChild("close")
        self.ui_test.close_dialog_through_button(xcloseBtn)

        self.ui_test.close_doc()
Ejemplo n.º 41
0
   def test_insert_foot_endnote(self):
        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()

        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()

        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)

#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"}))

        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)

#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()
Ejemplo n.º 42
0
    def test_text_case_switch(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", "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()
Ejemplo n.º 43
0
    def test_fTest_column(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()
        #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")

        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")

        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, 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.ui_test.close_doc()

# vim: set shiftwidth=4 softtabstop=4 expandtab:
Ejemplo n.º 44
0
    def test_format_character_tab_font(self):
        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.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("BACKSPACE", tuple())
        xSizeFont.executeAction("TYPE",
                                mkPropertyValues({"TEXT":
                                                  "18"}))  #set font size 18
        xSizeFontEast.executeAction("TYPE",
                                    mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xSizeFontEast.executeAction("BACKSPACE", tuple())
        xSizeFontEast.executeAction("TYPE",
                                    mkPropertyValues({"TEXT": "18"
                                                      }))  #set font size 18
        xSizeFontCTL.executeAction("TYPE",
                                   mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xSizeFontCTL.executeAction("BACKSPACE", tuple())
        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()
Ejemplo n.º 45
0
    def test_standard_filter(self):
        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("standardFilter.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C8"}))

        self.ui_test.execute_modeless_dialog_through_command(
            ".uno:DataFilterStandardFilter")
        xDialog = self.xUITest.getTopFocusWindow()
        xfield1 = xDialog.getChild("field1")
        xval1 = xDialog.getChild("val1")
        xconnect2 = xDialog.getChild("connect2")
        xfield2 = xDialog.getChild("field2")
        xval2 = xDialog.getChild("val2")

        props = {"TEXT": "a"}
        actionProps = mkPropertyValues(props)
        xfield1.executeAction("SELECT", actionProps)
        xval1.executeAction("TYPE", mkPropertyValues({"TEXT": "1"}))
        propsA = {"TEXT": "OR"}
        actionPropsA = mkPropertyValues(propsA)
        xconnect2.executeAction("SELECT", actionPropsA)
        props2 = {"TEXT": "b"}
        actionProps2 = mkPropertyValues(props2)
        xfield2.executeAction("SELECT", actionProps2)
        xval2.executeAction("TYPE", mkPropertyValues({"TEXT": "3"}))
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #3x down - should be on row 9
        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"], "8")
        #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")
        xconnect2 = xDialog.getChild("connect2")
        xfield2 = xDialog.getChild("field2")
        xval2 = xDialog.getChild("val2")

        self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "a")
        self.assertEqual(get_state_as_dict(xfield2)["SelectEntryText"], "b")
        self.assertEqual(get_state_as_dict(xconnect2)["SelectEntryText"], "OR")
        self.assertEqual(get_state_as_dict(xval1)["Text"], "1")
        self.assertEqual(get_state_as_dict(xval2)["Text"], "3")
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        self.ui_test.close_doc()
Ejemplo n.º 46
0
    def test_consolidate(self):
        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("consolidate.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()

        self.ui_test.execute_modeless_dialog_through_command(
            ".uno:DataConsolidate")
        xDialog = self.xUITest.getTopFocusWindow()
        xfunc = xDialog.getChild("func")
        xlbdataarea = xDialog.getChild("lbdataarea")
        xadd = xDialog.getChild("add")
        xbyrow = xDialog.getChild("byrow")
        xbycol = xDialog.getChild("bycol")
        xeddestarea = xDialog.getChild("eddestarea")

        props = {"TEXT": "Sum"}
        actionProps = mkPropertyValues(props)
        xfunc.executeAction("SELECT", actionProps)

        propsA = {"TEXT": "range1"}
        actionPropsA = mkPropertyValues(propsA)
        xlbdataarea.executeAction("SELECT", actionPropsA)
        xadd.executeAction("CLICK", tuple())
        propsB = {"TEXT": "range2"}
        actionPropsB = mkPropertyValues(propsB)
        xlbdataarea.executeAction("SELECT", actionPropsB)
        xadd.executeAction("CLICK", tuple())
        propsC = {"TEXT": "range3"}
        actionPropsC = mkPropertyValues(propsC)
        xlbdataarea.executeAction("SELECT", actionPropsC)
        xadd.executeAction("CLICK", tuple())
        xbyrow.executeAction("CLICK", tuple())
        xbycol.executeAction("CLICK", tuple())
        xeddestarea.executeAction("TYPE",
                                  mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xeddestarea.executeAction("TYPE",
                                  mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        xeddestarea.executeAction("TYPE",
                                  mkPropertyValues({"TEXT": "$Total.$A$2"}))
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #verify
        self.assertEqual(
            get_cell_by_position(document, 0, 1, 2).getValue(), 300)
        self.assertEqual(
            get_cell_by_position(document, 0, 1, 3).getValue(), 303)
        self.assertEqual(
            get_cell_by_position(document, 0, 1, 4).getValue(), 306)
        self.assertEqual(
            get_cell_by_position(document, 0, 1, 5).getValue(), 309)

        self.assertEqual(
            get_cell_by_position(document, 0, 2, 2).getValue(), 303)
        self.assertEqual(
            get_cell_by_position(document, 0, 2, 3).getValue(), 306)
        self.assertEqual(
            get_cell_by_position(document, 0, 2, 4).getValue(), 309)
        self.assertEqual(
            get_cell_by_position(document, 0, 2, 5).getValue(), 312)

        self.assertEqual(
            get_cell_by_position(document, 0, 3, 2).getValue(), 306)
        self.assertEqual(
            get_cell_by_position(document, 0, 3, 3).getValue(), 309)
        self.assertEqual(
            get_cell_by_position(document, 0, 3, 4).getValue(), 312)
        self.assertEqual(
            get_cell_by_position(document, 0, 3, 5).getValue(), 315)

        self.assertEqual(
            get_cell_by_position(document, 0, 4, 2).getValue(), 309)
        self.assertEqual(
            get_cell_by_position(document, 0, 4, 3).getValue(), 312)
        self.assertEqual(
            get_cell_by_position(document, 0, 4, 4).getValue(), 315)
        self.assertEqual(
            get_cell_by_position(document, 0, 4, 5).getValue(), 318)
        #verify dialog
        self.ui_test.execute_modeless_dialog_through_command(
            ".uno:DataConsolidate")
        xDialog = self.xUITest.getTopFocusWindow()
        xfunc = xDialog.getChild("func")
        xlbdataarea = xDialog.getChild("lbdataarea")
        xdelete = xDialog.getChild("delete")
        xbyrow = xDialog.getChild("byrow")
        xbycol = xDialog.getChild("bycol")
        xeddestarea = xDialog.getChild("eddestarea")
        xconsareas = xDialog.getChild("consareas")
        self.assertEqual(get_state_as_dict(xfunc)["SelectEntryText"], "Sum")
        self.assertEqual(get_state_as_dict(xconsareas)["EntryCount"], "3")
        self.assertEqual(get_state_as_dict(xeddestarea)["Text"], "$Total.$A$2")
        self.assertEqual(get_state_as_dict(xbyrow)["Selected"], "true")
        self.assertEqual(get_state_as_dict(xbycol)["Selected"], "true")
        #delete first range
        select_pos(xconsareas, "0")
        xdelete.executeAction("CLICK", tuple())
        self.assertEqual(get_state_as_dict(xconsareas)["EntryCount"], "2")
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

        self.assertEqual(
            get_cell_by_position(document, 0, 1, 2).getValue(), 200)
        self.assertEqual(
            get_cell_by_position(document, 0, 1, 3).getValue(), 202)
        self.assertEqual(
            get_cell_by_position(document, 0, 1, 4).getValue(), 204)
        self.assertEqual(
            get_cell_by_position(document, 0, 1, 5).getValue(), 206)

        self.assertEqual(
            get_cell_by_position(document, 0, 2, 2).getValue(), 202)
        self.assertEqual(
            get_cell_by_position(document, 0, 2, 3).getValue(), 204)
        self.assertEqual(
            get_cell_by_position(document, 0, 2, 4).getValue(), 206)
        self.assertEqual(
            get_cell_by_position(document, 0, 2, 5).getValue(), 208)

        self.assertEqual(
            get_cell_by_position(document, 0, 3, 2).getValue(), 204)
        self.assertEqual(
            get_cell_by_position(document, 0, 3, 3).getValue(), 206)
        self.assertEqual(
            get_cell_by_position(document, 0, 3, 4).getValue(), 208)
        self.assertEqual(
            get_cell_by_position(document, 0, 3, 5).getValue(), 210)

        self.assertEqual(
            get_cell_by_position(document, 0, 4, 2).getValue(), 206)
        self.assertEqual(
            get_cell_by_position(document, 0, 4, 3).getValue(), 208)
        self.assertEqual(
            get_cell_by_position(document, 0, 4, 4).getValue(), 210)
        self.assertEqual(
            get_cell_by_position(document, 0, 4, 5).getValue(), 212)

        self.ui_test.close_doc()


# vim: set shiftwidth=4 softtabstop=4 expandtab:
Ejemplo n.º 47
0
    def test_format_paragraph_tab_tabs(self):
        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()
Ejemplo n.º 48
0
    def test_standard_filter_condition_Does_not_end_with(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")
        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")

        props = {"TEXT": "A"}
        actionProps = mkPropertyValues(props)
        xfield1.executeAction("SELECT", actionProps)
        props2 = {"TEXT": "Does not end with"}
        actionProps2 = mkPropertyValues(props2)
        xcond1.executeAction("SELECT", actionProps2)
        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()
Ejemplo n.º 49
0
    def test_format_paragraph_tab_text_flow(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: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())
        props = {"TEXT": "Column"}
        actionProps = mkPropertyValues(props)
        xType.executeAction("SELECT", actionProps)
        props2 = {"TEXT": "After"}
        actionProps2 = mkPropertyValues(props2)
        xPosition.executeAction("SELECT", actionProps2)
        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()
Ejemplo n.º 50
0
    def test_format_paragraph_transparency(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: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())
        props = {"TEXT": "Axial"}
        actionProps = mkPropertyValues(props)
        xType.executeAction("SELECT", actionProps)
        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()
Ejemplo n.º 51
0
    def test_table_to_text(self):
        writer_doc = self.ui_test.load_file(
            get_url_for_data_file("tableToText.odt"))
        document = self.ui_test.get_component()
        xWriterDoc = self.xUITest.getTopFocusWindow()
        #dialog Table to text - Tabs; verify
        self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
        xDialog = self.xUITest.getTopFocusWindow()
        tabs = xDialog.getChild("tabs")
        tabs.executeAction("CLICK", tuple())
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #verify
        self.assertEqual(document.Text.String[0:3], "a\ta")
        self.assertEqual(document.TextTables.getCount(), 0)
        #undo
        self.xUITest.executeCommand(".uno:Undo")
        self.assertEqual(document.TextTables.getCount(), 1)

        #dialog Table to text - Paragraph; verify
        self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
        xDialog = self.xUITest.getTopFocusWindow()
        paragraph = xDialog.getChild("paragraph")
        paragraph.executeAction("CLICK", tuple())
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #verify
        self.assertEqual(
            document.Text.String.replace('\r\n', '\n')[0:4], "a\na\n")
        self.assertEqual(document.TextTables.getCount(), 0)
        #undo
        self.xUITest.executeCommand(".uno:Undo")
        self.assertEqual(document.TextTables.getCount(), 1)

        #dialog Table to text - Semicolons; verify
        self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
        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.Text.String.replace('\r\n', '\n')[0:6], "a;a\n;\n")
        self.assertEqual(document.TextTables.getCount(), 0)
        #undo
        self.xUITest.executeCommand(".uno:Undo")
        self.assertEqual(document.TextTables.getCount(), 1)

        #dialog Table to text - other; verify
        self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
        xDialog = self.xUITest.getTopFocusWindow()
        other = xDialog.getChild("other")
        other.executeAction("CLICK", tuple())
        othered = xDialog.getChild("othered")
        othered.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"}))
        othered.executeAction("TYPE",
                              mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        othered.executeAction("TYPE", mkPropertyValues({"TEXT": ":"}))
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #verify
        self.assertEqual(
            document.Text.String.replace('\r\n', '\n')[0:6], "a:a\n:\n")
        self.assertEqual(document.TextTables.getCount(), 0)
        #undo
        self.xUITest.executeCommand(".uno:Undo")
        self.assertEqual(document.TextTables.getCount(), 1)

        self.ui_test.close_doc()
Ejemplo n.º 52
0
    def test_format_paragraph_tab_indents_spacing(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: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())
        props = {"TEXT": "Double"}
        actionProps = mkPropertyValues(props)
        xLineSpacing.executeAction("SELECT", actionProps)
        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()
Ejemplo n.º 53
0
    def test_tdf133160(self):
        doc = self.ui_test.load_file(get_url_for_data_file("tdf133160.ods"))

        xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
        xGridWin.executeAction(
            "LAUNCH",
            mkPropertyValues({
                "AUTOFILTER": "",
                "COL": "1",
                "ROW": "3"
            }))
        xFloatWindow = self.xUITest.getFloatWindow()
        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
        xTreeList = xCheckListMenu.getChild("check_list_box")
        size1 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
        xOkBtn = xFloatWindow.getChild("cancel")
        xOkBtn.executeAction("CLICK", tuple())

        xGridWin.executeAction(
            "LAUNCH",
            mkPropertyValues({
                "AUTOFILTER": "",
                "COL": "2",
                "ROW": "3"
            }))
        xFloatWindow = self.xUITest.getFloatWindow()
        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
        xTreeList = xCheckListMenu.getChild("check_list_box")
        size2 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
        xOkBtn = xFloatWindow.getChild("cancel")
        xOkBtn.executeAction("CLICK", tuple())

        xGridWin.executeAction(
            "LAUNCH",
            mkPropertyValues({
                "AUTOFILTER": "",
                "COL": "3",
                "ROW": "3"
            }))
        xFloatWindow = self.xUITest.getFloatWindow()
        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
        xTreeList = xCheckListMenu.getChild("check_list_box")
        size3 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
        xOkBtn = xFloatWindow.getChild("cancel")
        xOkBtn.executeAction("CLICK", tuple())

        xGridWin.executeAction(
            "LAUNCH",
            mkPropertyValues({
                "AUTOFILTER": "",
                "COL": "4",
                "ROW": "3"
            }))
        xFloatWindow = self.xUITest.getFloatWindow()
        xCheckListMenu = xFloatWindow.getChild("check_list_menu")
        xTreeList = xCheckListMenu.getChild("check_list_box")
        size4 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])

        xOkBtn = xFloatWindow.getChild("cancel")
        xOkBtn.executeAction("CLICK", tuple())

        self.assertTrue(
            size1 <
            size2)  # for me they were size1=176 size2=212 size3=459 size4=1012
        self.assertTrue(
            size2 < size3
        )  # size1 is the minimum window width,  size2 based on its column width
        self.assertTrue(size3 < size4)  # size3 is a long text width
        self.assertTrue(
            size4 <
            1500)  # size4 is the maximum window width with a really long text

        self.ui_test.close_doc()
Ejemplo n.º 54
0
    def test_zoom_writer(self):
        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)

        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()
        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()
        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()
Ejemplo n.º 55
0
    def test_load_styles_from_template(self):
        self.ui_test.create_doc_in_start_center("writer")

        self.ui_test.execute_dialog_through_command(".uno:LoadStyles")

        xDialog = self.xUITest.getTopFocusWindow()

        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'])

        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'])

        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")}))

        xOpenBtn = xOpenDialog.getChild("open")
        xOpenBtn.executeAction("CLICK", tuple())

        xWriterDoc = self.xUITest.getTopFocusWindow()
        xWriterEdit = xWriterDoc.getChild("writer_edit")

        self.xUITest.executeCommand(".uno:Sidebar")
        xWriterEdit.executeAction(
            "SIDEBAR", mkPropertyValues({"PANEL": "StyleListPanel"}))

        xFilter = xWriterEdit.getChild('filter')
        xFilter.executeAction("SELECT",
                              mkPropertyValues({"TEXT": "Custom Styles"}))

        expectedResults = [
            "customParagraphStyle", "customCharacterStyle", "customFrameStyle",
            "customPageStyle", "customNumberingStyle"
        ]

        for i in range(5):
            xLeft = xWriterEdit.getChild('left')

            #change to another style type
            xLeft.executeAction("CLICK", mkPropertyValues({"POS": str(i)}))

            xFlatView = xWriterEdit.getChild("flatview")

            self.assertEqual(1, len(xFlatView.getChildren()))

            xFlatView.getChild('0').executeAction("SELECT", tuple())
            self.assertEqual(expectedResults[i],
                             get_state_as_dict(xFlatView)['SelectEntryText'])

        self.xUITest.executeCommand(".uno:Sidebar")

        self.ui_test.close_doc()
Ejemplo n.º 56
0
    def test_tdf69981_text_to_columns(self):

        # FIXME flaky test, passed once, but broke multiple times.
        return
        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("tdf69981.ods"))
        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()

        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)

        #Select A2:A7
        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A7"}))
        #Data - Text to Columns
        self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
        xDialog = self.xUITest.getTopFocusWindow()
        xtab = xDialog.getChild("tab")
        xcomma = xDialog.getChild("comma")
        xtab.executeAction("CLICK", tuple())
        xcomma.executeAction("CLICK", tuple())
        #Click Ok
        #overwrite warning come up
        #press Ok.
        xOK = xDialog.getChild("ok")

        def handle_warn_dlg(dialog):
            xyesBtn = dialog.getChild("yes")
            self.ui_test.close_dialog_through_button(xyesBtn)

        self.ui_test.execute_blocking_action(xOK.executeAction,
                                             args=('CLICK', ()),
                                             dialog_handler=handle_warn_dlg)
        #Verify
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 0).getString(), "Original")
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 1).getString(), "a")
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 2).getString(), "")
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 3).getString(), "")
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 4).getString(), "a")
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 5).getString(), "a")
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 6).getString(), "a")

        self.assertEqual(
            get_cell_by_position(document, 0, 1, 0).getString(), "Copy")
        self.assertEqual(
            get_cell_by_position(document, 0, 1, 1).getString(), "b")
        self.assertEqual(
            get_cell_by_position(document, 0, 1, 2).getString(), "b")
        self.assertEqual(
            get_cell_by_position(document, 0, 1, 3).getString(), "")
        self.assertEqual(
            get_cell_by_position(document, 0, 1, 4).getString(), "")
        self.assertEqual(
            get_cell_by_position(document, 0, 1, 5).getString(), "b")
        self.assertEqual(
            get_cell_by_position(document, 0, 1, 6).getString(), "")

        self.assertEqual(
            get_cell_by_position(document, 0, 2, 0).getString(), "")
        self.assertEqual(
            get_cell_by_position(document, 0, 2, 1).getString(), "c")
        self.assertEqual(
            get_cell_by_position(document, 0, 2, 2).getString(), "c")
        self.assertEqual(
            get_cell_by_position(document, 0, 2, 3).getString(), "c")
        self.assertEqual(
            get_cell_by_position(document, 0, 2, 4).getString(), "")
        self.assertEqual(
            get_cell_by_position(document, 0, 2, 5).getString(), "")
        self.assertEqual(
            get_cell_by_position(document, 0, 2, 6).getString(), "c")

        self.ui_test.close_doc()
Ejemplo n.º 57
0
    def test_text_to_columns_dot(self):
        #_Dot_as_Separator
        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("text_to_columns_dot.ods"))
        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()

        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")
        print(get_state_as_dict(xreplwarncb)["Selected"])
        if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
            xreplwarncb.executeAction("CLICK", tuple())
        print(get_state_as_dict(xreplwarncb)["Selected"])
        xOKBtn = xDialogOpt.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

        #Select A1:A5 on Sheet 'Dot_as_Separator'
        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
        #Data - Text to Columns
        self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
        xDialog = self.xUITest.getTopFocusWindow()
        #Untag Tab as separator and tag other. Put a dot into the input field next to the other checkbox
        xtab = xDialog.getChild("tab")
        xcomma = xDialog.getChild("comma")
        xsemicolon = xDialog.getChild("semicolon")
        xspace = xDialog.getChild("space")
        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
        #Does an overwrite warning come up? If not file an Issue.
        #Tag the 'Do not show warning again' checkbox and press Ok.
        xOK = xDialog.getChild("ok")

        def handle_warn_dlg(dialog):
            xyesBtn = dialog.getChild("yes")
            xask = dialog.getChild("ask")
            xask.executeAction("CLICK", tuple())
            self.ui_test.close_dialog_through_button(xyesBtn)

        self.ui_test.execute_blocking_action(xOK.executeAction,
                                             args=('CLICK', ()),
                                             dialog_handler=handle_warn_dlg)
        #Verify
        self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
        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(), 5)
        self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
        self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
        self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
        self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
        self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
        self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
        self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
        self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
        self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
        self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
        self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
        self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
        self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
        self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
        self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
        self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
        self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
        self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
        self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
        self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
        self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
        self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
        self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
        self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
        self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
        self.assertEqual(
            get_cell_by_position(document, 0, 6, 0).getString(),
            "random content")
        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, 4).getString(),
            "random content")
        #verify setting in options
        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")
        self.assertEqual(get_state_as_dict(xreplwarncb)["Selected"], "false")
        xOKBtn = xDialogOpt.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

        self.ui_test.close_doc()
Ejemplo n.º 58
0
    def test_differentSearches(self):
        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"}))

        self.xUITest.executeCommand(".uno:DataFilterAutoFilter")

        xGridWindow.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("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"}))

        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())

        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"
            }))

        xFloatWindow = self.xUITest.getFloatWindow()

        xCheckListMenu = xFloatWindow.getChild("check_list_menu")

        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'])

        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'])

        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.ui_test.close_doc()
Ejemplo n.º 59
0
def enter_text_to_cell(gridwin, cell, text):
    gridwin.executeAction("SELECT", mkPropertyValues({"CELL": cell}))
    gridwin.executeAction("TYPE", mkPropertyValues({"TEXT": text}))
    gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
Ejemplo n.º 60
0
    def test_text_to_columns_pipespace(self):
        #Space as Separator
        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("text_to_columns_pipe_space.ods"))
        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()

        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)

        # Select A1:A5 on Sheet
        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
        # Data - Text to Columns
        self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
        xDialog = self.xUITest.getTopFocusWindow()
        #
        xtab = xDialog.getChild("tab")
        xcomma = xDialog.getChild("comma")
        xsemicolon = xDialog.getChild("semicolon")
        xspace = xDialog.getChild("space")
        xother = xDialog.getChild("other")
        xinputother = xDialog.getChild("inputother")
        if (get_state_as_dict(xspace)["Selected"]) == "false":
            xspace.executeAction("CLICK", tuple())
        if (get_state_as_dict(xother)["Selected"]) == "false":
            xother.executeAction("CLICK", tuple())
        xinputother.executeAction("TYPE", mkPropertyValues({"TEXT": "|"}))
        # Click Ok
        xOK = xDialog.getChild("ok")

        def handle_warn_dlg(dialog):
            xyesBtn = dialog.getChild("yes")
            self.ui_test.close_dialog_through_button(xyesBtn)

        self.ui_test.execute_blocking_action(xOK.executeAction,
                                             args=('CLICK', ()),
                                             dialog_handler=handle_warn_dlg)
        #Verify
        self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
        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(), 5)
        self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
        self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
        self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
        self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
        self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
        self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
        self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
        self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
        self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
        self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
        self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
        self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
        self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
        self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
        self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
        self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
        self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
        self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
        self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
        self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
        self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
        self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
        self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
        self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
        self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
        self.assertEqual(
            get_cell_by_position(document, 0, 6, 0).getString(),
            "random content")
        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, 4).getString(),
            "random content")
        self.ui_test.close_doc()


# vim: set shiftwidth=4 softtabstop=4 expandtab: