Exemple #1
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:
Exemple #2
0
   def test_tdf55712(self):
        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf55712.ods"))
        document = self.ui_test.get_component()
        calcDoc = self.xUITest.getTopFocusWindow()
        xGridWindow = calcDoc.getChild("grid_window")

        xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
        xFloatWindow = self.xUITest.getFloatWindow()
        xTreeList = xFloatWindow.getChild("check_list_box")
        x1Entry = xTreeList.getChild("0")
        x2Entry = xTreeList.getChild("1")
        x3Entry = xTreeList.getChild("2")
        x4Entry = xTreeList.getChild("3")
        x5Entry = xTreeList.getChild("4")
        x6Entry = xTreeList.getChild("5")
        x7Entry = xTreeList.getChild("6")
        x8Entry = xTreeList.getChild("7")
        x9Entry = xTreeList.getChild("8")

        self.assertEqual(get_state_as_dict(x1Entry)["Text"], "0")
        self.assertEqual(get_state_as_dict(x2Entry)["Text"], "0.1")
        self.assertEqual(get_state_as_dict(x3Entry)["Text"], "0.2")
        self.assertEqual(get_state_as_dict(x4Entry)["Text"], "0.3")
        self.assertEqual(get_state_as_dict(x5Entry)["Text"], "0.5")
        self.assertEqual(get_state_as_dict(x6Entry)["Text"], "0.8")
        self.assertEqual(get_state_as_dict(x7Entry)["Text"], "0.9")
        self.assertEqual(get_state_as_dict(x8Entry)["Text"], "1")
        self.assertEqual(get_state_as_dict(x9Entry)["Text"], "(empty)")
        self.assertEqual(get_state_as_dict(xTreeList)["Children"], "9")

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

        self.ui_test.close_doc()
    def testGetFormat(self):
        # Copy a string in Impress.
        self.ui_test.create_doc_in_start_center("impress")
        template = self.xUITest.getTopFocusWindow()
        self.ui_test.close_dialog_through_button(template.getChild("cancel"))
        doc = self.xUITest.getTopFocusWindow()
        editWin = doc.getChild("impress_win")
        # Select the title shape.
        editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
        editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"}))
        self.xUITest.executeCommand(".uno:SelectAll")
        self.xUITest.executeCommand(".uno:Copy")

        # Now use paste special to see what formats are offered.
        self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
        pasteSpecial = self.xUITest.getTopFocusWindow()
        formats = pasteSpecial.getChild("list")
        entryCount = int(get_state_as_dict(formats)["EntryCount"])
        items = []
        for index in range(entryCount):
            formats.executeAction("SELECT", mkPropertyValues({"POS": str(index)}))
            items.append(get_state_as_dict(formats)["SelectEntryText"])

        # Make sure there is no RTF vs Richtext duplication.
        self.assertTrue("Rich text formatting (RTF)" in items)
        self.assertFalse("Rich text formatting (Richtext)" in items)

        # Close the dialog and the document.
        self.ui_test.close_dialog_through_button(pasteSpecial.getChild("cancel"))
        self.ui_test.close_doc()
Exemple #4
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()
Exemple #5
0
    def test_tdf123479_Crash_ScFormulaResult_GetMatrixFormulaCellToken(self):
        #numberingformatpage.ui
        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf123479.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        #Select D14:D16
        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D14:D16"}))
        #Open Formula Wizard (Ctrl+F2)
        self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        edArg1 = xDialog.getChild("ED_ARG1")
        edArg2 = xDialog.getChild("ED_ARG2")
        formulaRes = xDialog.getChild("formula_result")

        #check formula wizard data
        self.assertEqual(get_state_as_dict(edArg1)["Text"], "CHAR(10)")
        self.assertEqual(get_state_as_dict(edArg2)["Text"], "OFFSET($Data.$A$2:$Data.$A$4,0,COLUMN()-3)")
        self.assertEqual(get_state_as_dict(formulaRes)["Text"], "{4;4;4}")

        xOk = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOk)
        #verify; no crashes
        self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Pass/Fail")

        self.ui_test.close_doc()
Exemple #6
0
    def test_exchange_database2(self):

        self.ui_test.create_doc_in_start_center("writer")

        self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField")
        xExDBDlg = self.xUITest.getTopFocusWindow()
        xTreelist = xExDBDlg.getChild("availablelb")

        xLabeldb = xExDBDlg.getChild("dbnameft")
        self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "[None]")

        xTreeEntry = xTreelist.getChild('0')                 #Available Databases
        xTreeEntry.executeAction("EXPAND", tuple())          #Click on the Bibliography
        xTreeEntry.executeAction("COLLAPSE", tuple())
        xTreeEntry.executeAction("EXPAND", tuple())
        xTreeEntry2 = xTreeEntry.getChild('0')                 #Available Databases
        xTreeEntry2.executeAction("SELECT", tuple())          #Click on the biblio

        xDefineBtn = xExDBDlg.getChild("ok")
        xDefineBtn.executeAction("CLICK", tuple())

        self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField")
        xExDBDlg = self.xUITest.getTopFocusWindow()
        xLabeldb = xExDBDlg.getChild("dbnameft")
        self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "Bibliography.biblio")

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

        self.ui_test.close_doc()
Exemple #7
0
    def test_down(self):

        self.ui_test.create_doc_in_start_center("calc")

        self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
        xCellsDlg = self.xUITest.getTopFocusWindow()

        # select the numbers tab page
        select_pos(xCellsDlg, "0")
        
        xDecimalPlaces = xCellsDlg.getChild("leadzerosed")
        xDecimalPlaces.executeAction("UP", tuple())
        xDecimalPlaces.executeAction("UP", tuple())

        decimal_places_state = get_state_as_dict(xDecimalPlaces)
        assert(decimal_places_state["Text"] == "3")
        
        xDecimalPlaces.executeAction("DOWN", tuple())

        decimal_places_state = get_state_as_dict(xDecimalPlaces)
        assert(decimal_places_state["Text"] == "2")

        okBtn = xCellsDlg.getChild("ok")
        self.ui_test.close_dialog_through_button(okBtn)

        self.ui_test.close_doc()
    def test_insert_horizontal_line(self):
        self.ui_test.create_doc_in_start_center("writer")
        xWriterDoc = self.xUITest.getTopFocusWindow()
        xWriterEdit = xWriterDoc.getChild("writer_edit")

        type_text(xWriterEdit, "Test horizontal line")     #write the text

        self.xUITest.executeCommand(".uno:StyleApply?Style:string=Horizontal%20Line&FamilyName:string=ParagraphStyles") #insert horizontal line

        self.ui_test.execute_dialog_through_command(".uno:EditStyle")  #open style dialog
        xDialog = self.xUITest.getTopFocusWindow()
        xStyleNametxt = xDialog.getChild("namerw")
        self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name
        xCancBtn = xDialog.getChild("cancel")
        self.ui_test.close_dialog_through_button(xCancBtn)

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

        self.ui_test.execute_dialog_through_command(".uno:EditStyle")  #open style dialog
        xDialog = self.xUITest.getTopFocusWindow()
        xStyleNametxt = xDialog.getChild("namerw")
        self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line")  #check style name
        xCancBtn = xDialog.getChild("cancel")
        self.ui_test.close_dialog_through_button(xCancBtn)

        self.ui_test.close_doc()
Exemple #9
0
    def test_track_headings_outline(self):
        writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf114724.odt"))
        xWriterDoc = self.xUITest.getTopFocusWindow()
        xWriterEdit = xWriterDoc.getChild("writer_edit")

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

        xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel")
        xNavigatorPanel.executeAction("ROOT", tuple())

        xWriterEdit.executeAction("FOCUS", tuple())
        time.sleep(2)
        self.assertEqual(get_state_as_dict(xNavigatorPanel)["selectioncount"], "1")
        for _ in range(0,3):
            xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
            time.sleep(2)
            self.assertEqual(get_state_as_dict(xNavigatorPanel)["selectioncount"], "1")
        for _ in range(0,3):
            xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
            time.sleep(2)
            self.assertEqual(get_state_as_dict(xNavigatorPanel)["selectioncount"], "1")

        self.xUITest.executeCommand(".uno:Sidebar")
        self.ui_test.close_doc()
Exemple #10
0
   def test_master_elements(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:MasterLayouts")
        xDialog = self.xUITest.getTopFocusWindow()

        xpagenumber = xDialog.getChild("pagenumber")
        xfooter = xDialog.getChild("footer")
        datetime = xDialog.getChild("datetime")
        xpagenumber.executeAction("CLICK", tuple())
        xfooter.executeAction("CLICK", tuple())
        datetime.executeAction("CLICK", tuple())

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

        #verify
        self.ui_test.execute_dialog_through_command(".uno:MasterLayouts")
        xDialog = self.xUITest.getTopFocusWindow()
        xfooter = xDialog.getChild("footer")
        datetime = xDialog.getChild("datetime")
        xpagenumber = xDialog.getChild("pagenumber")

        self.assertEqual(get_state_as_dict(xfooter)["Selected"], "false")
        self.assertEqual(get_state_as_dict(datetime)["Selected"], "false")
        self.assertEqual(get_state_as_dict(xpagenumber)["Selected"], "false")

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

        self.ui_test.close_doc()
Exemple #11
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()
Exemple #12
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()
Exemple #13
0
    def test_tdf119462_find_format(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")
        #1. Choose Edit > Find & Replace
        self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        #2. Choose Format
        format = xDialog.getChild("format")
        def handle_format_dlg(dialog):

            #3. Choose Bold
            xTabs = dialog.getChild("tabcontrol")
            select_pos(xTabs, "0")
            xweststylelbcjk = dialog.getChild("weststylelb-cjk")
            xweststylelbcjk.executeAction("TYPE", mkPropertyValues({"TEXT":"Bold"}))
            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 label searchdesc
        searchdesc = xDialog.getChild("searchdesc")
        self.assertEqual(get_state_as_dict(searchdesc)["Text"], "bold")
        noformat = xDialog.getChild("noformat")
        noformat.executeAction("CLICK", tuple())   #click No format button
        self.assertEqual(get_state_as_dict(searchdesc)["Text"], "")
        xcloseBtn = xDialog.getChild("close")
        self.ui_test.close_dialog_through_button(xcloseBtn)

        self.ui_test.close_doc()
Exemple #14
0
    def test_search_filter(self):
        self.ui_test.create_doc_in_start_center("writer")
        self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog")
        xDialog = self.xUITest.getTopFocusWindow()

        xfunc = xDialog.getChild("functions")
        xSearch = xDialog.getChild("searchEntry")

        initialEntryCount = get_state_as_dict(xfunc)["Children"]
        self.assertTrue(initialEntryCount is not 0)

        xSearch.executeAction("SET", mkPropertyValues({"TEXT":"format"}))

        # Wait for the search/filter op to be completed
        time.sleep(1)

        filteredEntryCount = get_state_as_dict(xfunc)["Children"]
        self.assertTrue(filteredEntryCount < initialEntryCount)

        xSearch.executeAction("CLEAR", tuple())

        # Wait for the search/filter op to be completed
        time.sleep(1)

        finalEntryCount = get_state_as_dict(xfunc)["Children"]
        self.assertEqual(initialEntryCount, finalEntryCount)


        xcancBtn = xDialog.getChild("cancel")  #button Cancel
        xcancBtn.executeAction("CLICK", tuple())  #click the button

        self.ui_test.close_doc()
Exemple #15
0
    def test_tdf98417_find_previous_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":"third"}))
        xsearch = xDialog.getChild("search")
        xsearch.executeAction("CLICK", tuple())
        #verify
        self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
        xsearch.executeAction("CLICK", tuple())
        #verify
        self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "4")   #page 4
        backsearch = xDialog.getChild("backsearch")
        backsearch.executeAction("CLICK", tuple())
        #verify
        self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")

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

        self.ui_test.close_doc()
Exemple #16
0
    def test_tdf92423_text_to_columns(self):
        calc_doc = self.ui_test.create_doc_in_start_center("calc")
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()

        #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
        self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")  #optionsdialog
        xDialogOpt = self.xUITest.getTopFocusWindow()

        xPages = xDialogOpt.getChild("pages")
        xWriterEntry = xPages.getChild('3')                 # Calc
        xWriterEntry.executeAction("EXPAND", tuple())
        xWriterGeneralEntry = xWriterEntry.getChild('0')
        xWriterGeneralEntry.executeAction("SELECT", tuple())          #General / replwarncb
        xreplwarncb = xDialogOpt.getChild("replwarncb")
        if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
            xreplwarncb.executeAction("CLICK", tuple())
        xOKBtn = xDialogOpt.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #enter data
        enter_text_to_cell(gridwin, "A1", "1;2")
        enter_text_to_cell(gridwin, "A2", "2;3")
        enter_text_to_cell(gridwin, "A3", "3;4")
        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"}))
        #copy data
        self.xUITest.executeCommand(".uno:Copy")
        #move down
        self.xUITest.executeCommand(".uno:GoDown")
        self.xUITest.executeCommand(".uno:GoDown")
        self.xUITest.executeCommand(".uno:GoDown")
        self.xUITest.executeCommand(".uno:GoDown")
        self.xUITest.executeCommand(".uno:GoDown")
        self.xUITest.executeCommand(".uno:GoDown")
        #paste data, should be selected
        self.xUITest.executeCommand(".uno:Paste") #A7:A9
        gridWinState = get_state_as_dict(gridwin)
        self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A7:Sheet1.A9")
        # Data - Text to Columns
        self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
        xDialog = self.xUITest.getTopFocusWindow()
        xSemicolon = xDialog.getChild("semicolon")  #check semicolon checkbox
        if (get_state_as_dict(xSemicolon)["Selected"]) == "false":
            xSemicolon.executeAction("CLICK", tuple())
        # Click Ok
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)

        #Verify
        self.assertEqual(get_cell_by_position(document, 0, 0, 6).getValue(), 1)
        self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 2)
        self.assertEqual(get_cell_by_position(document, 0, 0, 8).getValue(), 3)
        self.assertEqual(get_cell_by_position(document, 0, 1, 6).getValue(), 2)
        self.assertEqual(get_cell_by_position(document, 0, 1, 7).getValue(), 3)
        self.assertEqual(get_cell_by_position(document, 0, 1, 8).getValue(), 4)

        self.ui_test.close_doc()

# vim: set shiftwidth=4 softtabstop=4 expandtab:
Exemple #17
0
    def test_clear_cells_formats(self):
        calc_doc = self.ui_test.create_doc_in_start_center("calc")
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        enter_text_to_cell(gridwin, "A1", "aa")
        enter_text_to_cell(gridwin, "A2", "1")

        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"}))
        self.xUITest.executeCommand(".uno:Bold")
        self.ui_test.execute_dialog_through_command(".uno:Delete")
        xDialog = self.xUITest.getTopFocusWindow()
        xdeleteall = xDialog.getChild("deleteall")
        xtext = xDialog.getChild("text")
        xdatetime = xDialog.getChild("datetime")
        xcomments = xDialog.getChild("comments")
        xobjects = xDialog.getChild("objects")
        xnumbers = xDialog.getChild("numbers")
        xformulas = xDialog.getChild("formulas")
        xformats = xDialog.getChild("formats")

        if (get_state_as_dict(xdeleteall)["Selected"]) == "true":
            xdeleteall.executeAction("CLICK", tuple())
        if (get_state_as_dict(xtext)["Selected"]) == "true":
            xtext.executeAction("CLICK", tuple())
        if (get_state_as_dict(xdatetime)["Selected"]) == "true":
            xdatetime.executeAction("CLICK", tuple())
        if (get_state_as_dict(xcomments)["Selected"]) == "true":
            xcomments.executeAction("CLICK", tuple())
        if (get_state_as_dict(xobjects)["Selected"]) == "true":
            xobjects.executeAction("CLICK", tuple())
        if (get_state_as_dict(xnumbers)["Selected"]) == "true":
            xnumbers.executeAction("CLICK", tuple())
        if (get_state_as_dict(xformulas)["Selected"]) == "true":
            xformulas.executeAction("CLICK", tuple())
        if (get_state_as_dict(xformats)["Selected"]) == "false":
            xformats.executeAction("CLICK", tuple())

        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #Verify
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "1")  #tab Font

        xstylelb = xDialog.getChild("weststylelb-cjk")
        print(get_state_as_dict(xstylelb))


        self.assertEqual(get_state_as_dict(xstylelb)["Text"], "Regular")

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

        self.ui_test.close_doc()
Exemple #18
0
    def test_row_height_insert_below(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()

        #Make sure that tools-options-StarOffice Calc-General
        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 /cm
        xunitlb = xDialogOpt.getChild("unitlb")
        props = {"TEXT": "Centimeter"}
        actionProps = mkPropertyValues(props)
        xunitlb.executeAction("SELECT", actionProps)
        xOKBtn = xDialogOpt.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #select A3
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"}))
        #row height
        self.ui_test.execute_dialog_through_command(".uno:RowHeight")
        xDialog = self.xUITest.getTopFocusWindow()
        xvalue = xDialog.getChild("value")
        xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
        xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
        xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"}))
        # Click Ok
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)
        #select row 3
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"}))
        self.xUITest.executeCommand(".uno:SelectRow")
        #insert rows below
        self.xUITest.executeCommand(".uno:InsertRowsAfter")

        #verify
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"}))
        self.ui_test.execute_dialog_through_command(".uno:RowHeight")
        xDialog = self.xUITest.getTopFocusWindow()
        xvalue = xDialog.getChild("value")
        self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm")
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)

        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A4"}))
        self.ui_test.execute_dialog_through_command(".uno:RowHeight")
        xDialog = self.xUITest.getTopFocusWindow()
        xvalue = xDialog.getChild("value")
        self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm")
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)

        self.ui_test.close_doc()
   def test_bullets_and_numbering_dialog_tab_position(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:OptionsTreeDialog")  #optionsdialog
        xDialog = self.xUITest.getTopFocusWindow()
        xPages = xDialog.getChild("pages")
        xWriterEntry = xPages.getChild('3')                 # Writer
        xWriterEntry.executeAction("EXPAND", tuple())
        xWriterGeneralEntry = xWriterEntry.getChild('0')
        xWriterGeneralEntry.executeAction("SELECT", tuple())          #General - set millimeters
        xMetric = xDialog.getChild("metric")
        props = {"TEXT": "Millimeter"}
        actionProps = mkPropertyValues(props)
        xMetric.executeAction("SELECT", actionProps)
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

        self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "4")
        xalignedatmf = xDialog.getChild("alignedatmf")
        xnum2alignlb = xDialog.getChild("num2alignlb")
        xatmf = xDialog.getChild("atmf")
        xindentatmf = xDialog.getChild("indentatmf")
        xokbtn = xDialog.getChild("ok")

        xalignedatmf.executeAction("UP", tuple())
        props = {"TEXT": "Centered"}
        actionProps = mkPropertyValues(props)
        xnum2alignlb.executeAction("SELECT", actionProps)
        xatmf.executeAction("UP", tuple())
        xindentatmf.executeAction("UP", tuple())

        self.ui_test.close_dialog_through_button(xokbtn)

        self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "4")
        xalignedatmf = xDialog.getChild("alignedatmf")
        xnum2alignlb = xDialog.getChild("num2alignlb")
        xatmf = xDialog.getChild("atmf")
        xindentatmf = xDialog.getChild("indentatmf")

        self.assertEqual(get_state_as_dict(xalignedatmf)["Text"], "6.5 mm")
        self.assertEqual(get_state_as_dict(xnum2alignlb)["SelectEntryText"], "Centered")
        self.assertEqual(get_state_as_dict(xatmf)["Text"], "12.8 mm")
        self.assertEqual(get_state_as_dict(xindentatmf)["Text"], "12.8 mm")

        xcancbtn = xDialog.getChild("cancel")
        self.ui_test.close_dialog_through_button(xcancbtn)

        self.ui_test.close_doc()
Exemple #20
0
   def test_tdf124111_chart_x_negative_cross(self):
    calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf124111.ods"))
    xCalcDoc = self.xUITest.getTopFocusWindow()
    gridwin = xCalcDoc.getChild("grid_window")
    document = self.ui_test.get_component()

    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": "DiagramAxisX"}))  # X Axis...
    xDialog = self.xUITest.getTopFocusWindow()
    #Click on tab "positioning".
    tabcontrol = xDialog.getChild("tabcontrol")
    select_pos(tabcontrol, "1")

    crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
    crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
    placeLabels = xDialog.getChild("LB_PLACE_LABELS")
    innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
    outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
    innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
    outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
    placeMarks = xDialog.getChild("LB_PLACE_TICKS")
    crossAxisValue.executeAction("DOWN", tuple())  #-1

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

    #reopen and verify tab "positioning".
    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": "DiagramAxisX"}))
    xDialog = self.xUITest.getTopFocusWindow()

    tabcontrol = xDialog.getChild("tabcontrol")
    select_pos(tabcontrol, "1")

    crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
    crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
    placeLabels = xDialog.getChild("LB_PLACE_LABELS")
    innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
    outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
    innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
    outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
    placeMarks = xDialog.getChild("LB_PLACE_TICKS")

    self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value")
    self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "-1")

    xOKBtn = xDialog.getChild("ok")
    self.ui_test.close_dialog_through_button(xOKBtn)
    self.ui_test.close_doc()
Exemple #21
0
        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)
Exemple #22
0
    def test_standard_filter_condition_contains(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", "first")
        enter_text_to_cell(gridwin, "B1", "second")
        enter_text_to_cell(gridwin, "A2", "aa")
        enter_text_to_cell(gridwin, "A3", "aaa")
        enter_text_to_cell(gridwin, "A4", "abbb")
        enter_text_to_cell(gridwin, "A5", "accc")
        enter_text_to_cell(gridwin, "A6", "a*")
        enter_text_to_cell(gridwin, "B2", "1")
        enter_text_to_cell(gridwin, "B3", "2")
        enter_text_to_cell(gridwin, "B4", "3")
        enter_text_to_cell(gridwin, "B5", "4")
        enter_text_to_cell(gridwin, "B6", "5")
        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B6"}))
        self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter")
        xDialog = self.xUITest.getTopFocusWindow()
        xfield1 = xDialog.getChild("field1")
        xval1 = xDialog.getChild("val1")
        xregexp = xDialog.getChild("regexp")

        props = {"TEXT": "first"}
        actionProps = mkPropertyValues(props)
        xfield1.executeAction("SELECT", actionProps)
        xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a*"}))
        xregexp.executeAction("CLICK", tuple())
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #3x down - should be on row 7
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
        gridWinState = get_state_as_dict(gridwin)
        self.assertEqual(gridWinState["CurrentRow"], "6")
        #reopen filter and verify
        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
        self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter")
        xDialog = self.xUITest.getTopFocusWindow()
        xfield1 = xDialog.getChild("field1")
        xval1 = xDialog.getChild("val1")
        xregexp = xDialog.getChild("regexp")

        self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first")
        self.assertEqual(get_state_as_dict(xval1)["Text"], "a*")
        self.assertEqual(get_state_as_dict(xregexp)["Selected"], "true")
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        self.ui_test.close_doc()
Exemple #23
0
    def test_column_width_two_columns(self):
        calc_doc = self.ui_test.create_doc_in_start_center("calc")
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()

        #Make sure that tools-options-StarOffice Calc-General
        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 /cm
        xunitlb = xDialogOpt.getChild("unitlb")
        props = {"TEXT": "Centimeter"}
        actionProps = mkPropertyValues(props)
        xunitlb.executeAction("SELECT", actionProps)
        xOKBtn = xDialogOpt.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1", "EXTEND":"1"}))

        self.ui_test.execute_dialog_through_command(".uno:ColumnWidth")
        xDialog = self.xUITest.getTopFocusWindow()
        xvalue = xDialog.getChild("value")
        xdefault = xDialog.getChild("default")
        #write your own value
        xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
        xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
        xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"}))
        # Click Ok
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)
        #verify
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        self.ui_test.execute_dialog_through_command(".uno:ColumnWidth")
        xDialog = self.xUITest.getTopFocusWindow()
        xvalue = xDialog.getChild("value")
        self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm")
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)

        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"}))
        self.ui_test.execute_dialog_through_command(".uno:ColumnWidth")
        xDialog = self.xUITest.getTopFocusWindow()
        xvalue = xDialog.getChild("value")
        self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm")
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)

        self.ui_test.close_doc()
Exemple #24
0
    def test_columns(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")

        #set cm
        self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")  #optionsdialog
        xDialog = self.xUITest.getTopFocusWindow()

        xPages = xDialog.getChild("pages")
        xWriterEntry = xPages.getChild('3')                 # Writer
        xWriterEntry.executeAction("EXPAND", tuple())
        xWriterGeneralEntry = xWriterEntry.getChild('0')
        xWriterGeneralEntry.executeAction("SELECT", tuple())          #General
        xMetric = xDialog.getChild("metric")
        props = {"TEXT": "Centimeter"}
        actionProps = mkPropertyValues(props)
        xMetric.executeAction("SELECT", actionProps)
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

        #dialog Columns
        self.ui_test.execute_dialog_through_command(".uno:FormatColumns")
        xDialog = self.xUITest.getTopFocusWindow()

        colsnf = xDialog.getChild("colsnf")
        colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
        colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
        colsnf.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
        colsnf.executeAction("UP", tuple())
        colsnf.executeAction("DOWN", tuple())
        spacing1mf = xDialog.getChild("spacing1mf")
        spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
        spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
        spacing1mf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
        autowidth = xDialog.getChild("autowidth")
        autowidth.executeAction("CLICK", tuple())
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #verify
        self.ui_test.execute_dialog_through_command(".uno:FormatColumns")
        xDialog = self.xUITest.getTopFocusWindow()
        colsnf = xDialog.getChild("colsnf")
        spacing1mf = xDialog.getChild("spacing1mf")
        autowidth = xDialog.getChild("autowidth")

        self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
        self.assertEqual(get_state_as_dict(spacing1mf)["Text"], "1.00 cm")
        self.assertEqual(get_state_as_dict(autowidth)["Selected"], "false")
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

        self.ui_test.close_doc()
Exemple #25
0
    def test_tdf96453(self):

        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf96453.ods"))

        sheet = get_sheet_from_doc(calc_doc, 0)
        conditional_format_list = get_conditional_format_from_sheet(sheet)
        self.assertEqual(conditional_format_list.getLength(), 2)

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

        xCondFormatMgr = self.xUITest.getTopFocusWindow()

        # check that we have exactly two conditional formats in the beginning
        xList = xCondFormatMgr.getChild("CONTAINER")
        list_state = get_state_as_dict(xList)
        self.assertEqual(list_state['Children'], '2')

        # remove one conditional format
        xRemoveBtn = xCondFormatMgr.getChild("remove")
        xRemoveBtn.executeAction("CLICK", tuple())

        # check that the table only shows one
        # but the document still contains two
        list_state = get_state_as_dict(xList)
        self.assertEqual(list_state['Children'], '1')

        self.assertEqual(conditional_format_list.getLength(), 2)

        # add a new conditional format through the add button
        xAddBtn = xCondFormatMgr.getChild("add")
        self.ui_test.execute_dialog_through_action(xAddBtn, "CLICK", event_name = "ModelessDialogVisible")

        xCondFormatDlg = self.xUITest.getTopFocusWindow()
        xCondFormatOkBtn = xCondFormatDlg.getChild("ok")
        self.ui_test.close_dialog_through_button(xCondFormatOkBtn)

        # we need to get a pointer again as the old window has been deleted
        xCondFormatMgr = self.xUITest.getTopFocusWindow()

        # check again that we now have 2 and not 3 entries in the list
        # and still only 2 conditional formats in the document
        xList = xCondFormatMgr.getChild("CONTAINER")
        list_state = get_state_as_dict(xList)
        self.assertEqual(list_state['Children'], '2')

        self.assertEqual(conditional_format_list.getLength(), 2)

        # close the conditional format manager
        xCancelBtn = xCondFormatMgr.getChild("cancel")
        self.ui_test.close_dialog_through_button(xCancelBtn)

        self.ui_test.close_doc()
Exemple #26
0
    def test_tdf123122_format_cell_datetime(self):
        #numberingformatpage.ui
        calc_doc = self.ui_test.create_doc_in_start_center("calc")
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        #select cell A1
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        #format - cell
        self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "0")  #tab Numbers
        xliststore1 = xDialog.getChild("categorylb")  #1st list / Category
        xliststore2 = xDialog.getChild("formatlb")  #2nd list / Format
        xdecimalsed = xDialog.getChild("decimalsed")
        xleadzerosed = xDialog.getChild("leadzerosed")
        xnegnumred = xDialog.getChild("negnumred")
        xthousands = xDialog.getChild("thousands")
        xlanguagelb = xDialog.getChild("languagelb")
        xformatted = xDialog.getChild("formatted")

        #Format cells and enter NN MMM DD YYYY HH:MM as format code
        xformatted.executeAction("CLEAR", tuple())  #clear textbox
        xformatted.executeAction("TYPE", mkPropertyValues({"TEXT":"NN MMM DD YYYY HH:MM"}))
        #save - OK
        xOk = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOk)

        #verify
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        #format - cell
        self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "0")  #tab Numbers
        xliststore1 = xDialog.getChild("categorylb")  #1st list / Category
        xliststore2 = xDialog.getChild("formatlb")  #2nd list / Format
        xdecimalsed = xDialog.getChild("decimalsed")
        xleadzerosed = xDialog.getChild("leadzerosed")
        xnegnumred = xDialog.getChild("negnumred")
        xthousands = xDialog.getChild("thousands")
        xlanguagelb = xDialog.getChild("languagelb")
        xformatted = xDialog.getChild("formatted")


        self.assertEqual(get_state_as_dict(xliststore1)["SelectEntryText"], "Date")
        self.assertEqual(get_state_as_dict(xformatted)["Text"], "NN MMM DD YYYY HH:MM")
        xOk = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOk)

        self.ui_test.close_doc()
Exemple #27
0
    def test_td89958_standard_filter(self):
        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf89958.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        #select A1-> Column .uno:SelectColumn
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        self.xUITest.executeCommand(".uno:SelectColumn")

        #Menu: Data->Filter->Standard Filter ...
        #Field Name "Column A", Condition "Does not end with", Value: "CTORS"
        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": "Column 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":"CTORS"}))
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

        #Expected behaviours: A2 is not filtered as it does not end with "CTORS".
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
        gridWinState = get_state_as_dict(gridwin)
        self.assertEqual(gridWinState["CurrentRow"], "1")
        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
        gridWinState = get_state_as_dict(gridwin)
        self.assertEqual(gridWinState["CurrentRow"], "3")
#        #reopen filter and verify - doesn't works
#        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"], "Column A")
#        self.assertEqual(get_state_as_dict(xval1)["Text"], "CTORS")
#        self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not end with")
#        xCancelBtn = xDialog.getChild("cancel")
#        self.ui_test.close_dialog_through_button(xCancelBtn)

        self.ui_test.close_doc()

# vim: set shiftwidth=4 softtabstop=4 expandtab:
Exemple #28
0
   def test_format_character_tab_hyperlink(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, "4")

        xURL = xDialog.getChild("urled")
        xURL.executeAction("TYPE", mkPropertyValues({"TEXT":"libreoffice.org"}))
        xTexted = xDialog.getChild("texted")
        xTexted.executeAction("TYPE", mkPropertyValues({"TEXT":"LibreOffice"}))
        xName = xDialog.getChild("nameed")
        xName.executeAction("TYPE", mkPropertyValues({"TEXT":"hyperlink"}))

        xVisited = xDialog.getChild("visitedlb")
        props = {"TEXT": "Bullets"}
        actionProps = mkPropertyValues(props)
        xVisited.executeAction("SELECT", actionProps)
        xUnVisited = xDialog.getChild("unvisitedlb")
        props = {"TEXT": "Bullets"}
        actionProps = mkPropertyValues(props)
        xUnVisited.executeAction("SELECT", actionProps)

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

        self.xUITest.executeCommand(".uno:GoLeft")
        self.assertEqual(document.Text.String[0:11], "LibreOffice")

        self.ui_test.execute_dialog_through_command(".uno:FontDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "4")
        xURL = xDialog.getChild("urled")
        xTexted = xDialog.getChild("texted")
        xName = xDialog.getChild("nameed")
        xVisited = xDialog.getChild("visitedlb")
        xUnVisited = xDialog.getChild("unvisitedlb")

        self.assertEqual(get_state_as_dict(xURL)["Text"], "http://libreoffice.org/")
        self.assertEqual(get_state_as_dict(xTexted)["Text"], "LibreOffice")
        self.assertEqual(get_state_as_dict(xName)["Text"], "hyperlink")
        self.assertEqual(get_state_as_dict(xVisited)["SelectEntryText"], "Bullets")
        self.assertEqual(get_state_as_dict(xUnVisited)["SelectEntryText"], "Bullets")

        xCanc = xDialog.getChild("cancel")
        self.ui_test.close_dialog_through_button(xCanc)
        self.ui_test.close_doc()
Exemple #29
0
    def test_word_count_dialog(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()

        type_text(xWriterEdit, "Test for word count dialog") #type text
        xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "8"})) #select two words

        self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
        xDialog = self.xUITest.getTopFocusWindow()

        xselectwords = xDialog.getChild("selectwords")
        xdocwords = xDialog.getChild("docwords")
        xselectchars = xDialog.getChild("selectchars")
        xdocchars = xDialog.getChild("docchars")
        xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
        xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
        xselectcjkchars = xDialog.getChild("selectcjkchars")
        xdoccjkchars = xDialog.getChild("doccjkchars")

        self.assertEqual(get_state_as_dict(xselectwords)["Text"], "2")
        self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5")
        self.assertEqual(get_state_as_dict(xselectchars)["Text"], "8")
        self.assertEqual(get_state_as_dict(xdocchars)["Text"], "26")
        self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "7")
        self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "22")
        self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
        self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
        xCloseBtn = xDialog.getChild("close")
        self.ui_test.close_dialog_through_button(xCloseBtn)

        self.ui_test.close_doc()
Exemple #30
0
    def test_word_count_interpunction_counted_tdf56975(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, enter "Testing one two! Test?"
        type_text(xWriterEdit, "Testing one two! Test?")
        #-> LO says: 4 words. SUCCESS! :)
        self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
        xDialog = self.xUITest.getTopFocusWindow()

        xselectwords = xDialog.getChild("selectwords")
        xdocwords = xDialog.getChild("docwords")
        xselectchars = xDialog.getChild("selectchars")
        xdocchars = xDialog.getChild("docchars")
        xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
        xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
        xselectcjkchars = xDialog.getChild("selectcjkchars")
        xdoccjkchars = xDialog.getChild("doccjkchars")

        self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0")
        self.assertEqual(get_state_as_dict(xdocwords)["Text"], "4")
        self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0")
        self.assertEqual(get_state_as_dict(xdocchars)["Text"], "22")
        self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0")
        self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "19")
        self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
        self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
        xCloseBtn = xDialog.getChild("close")
        self.ui_test.close_dialog_through_button(xCloseBtn)

        self.ui_test.close_doc()
Exemple #31
0
    def test_pageBreak_and_tableAutoFormat(self):
        self.ui_test.create_doc_in_start_center("writer")
        xWriterDoc = self.xUITest.getTopFocusWindow()
        xWriterEdit = xWriterDoc.getChild("writer_edit")

        self.xUITest.executeCommand(".uno:InsertPagebreak")
        self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")

        self.ui_test.execute_dialog_through_command(".uno:InsertTable")
        xDialog = self.xUITest.getTopFocusWindow()

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

        self.ui_test.execute_dialog_through_command(".uno:AutoFormat")
        xDialog = self.xUITest.getTopFocusWindow()

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

        self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")

        self.ui_test.close_doc()
Exemple #32
0
    def test_down(self):

        self.ui_test.create_doc_in_start_center("calc")

        self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
        xCellsDlg = self.xUITest.getTopFocusWindow()

        xDecimalPlaces = xCellsDlg.getChild("leadzerosed")
        xDecimalPlaces.executeAction("UP", tuple())
        xDecimalPlaces.executeAction("UP", tuple())

        decimal_places_state = get_state_as_dict(xDecimalPlaces)
        assert (decimal_places_state["Text"] == "3")

        xDecimalPlaces.executeAction("DOWN", tuple())

        decimal_places_state = get_state_as_dict(xDecimalPlaces)
        assert (decimal_places_state["Text"] == "2")

        okBtn = xCellsDlg.getChild("ok")
        self.ui_test.close_dialog_through_button(okBtn)

        self.ui_test.close_doc()
Exemple #33
0
    def test_tdf131936_saveas_docx_version(self):
        self.ui_test.load_file(get_url_for_data_file("tdf131936.docx"))

        self.ui_test.execute_dialog_through_command(".uno:SaveAs")
        time.sleep(DEFAULT_SLEEP)
        xDialog = self.xUITest.getTopFocusWindow()
        xFileTypeCombo = xDialog.getChild("file_type")
        state = get_state_as_dict(xFileTypeCombo)
        self.assertEqual(state["SelectEntryText"], "Office Open XML Text (Transitional) (.docx)")

        xCancel = xDialog.getChild("cancel")
        self.ui_test.close_dialog_through_button(xCancel)

        self.ui_test.close_doc()
Exemple #34
0
    def test_tdf51700_text_to_columns(self):
        calc_doc = self.ui_test.create_doc_in_start_center("calc")
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()

        #Add data
        enter_text_to_cell(gridwin, "A2", "3242,43242,3242,2342")
        enter_text_to_cell(gridwin, "A3", "fdsfa,afsdfa,adfdas,fsad")
        enter_text_to_cell(gridwin, "A4", "21312,1111,1111,111")
        #select column A
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        self.xUITest.executeCommand(".uno:SelectColumn")
        # Data - Text to Columns
        self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
        xDialog = self.xUITest.getTopFocusWindow()
        xcomma = xDialog.getChild("comma")
        if (get_state_as_dict(xcomma)["Selected"]) == "false":
            xcomma.executeAction("CLICK", tuple())
        # Click Ok
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)

        #Verify
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 1).getValue(), 3242)
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 2).getString(), "fdsfa")
        self.assertEqual(
            get_cell_by_position(document, 0, 0, 3).getValue(), 21312)
        self.assertEqual(
            get_cell_by_position(document, 0, 1, 1).getValue(), 43242)
        self.assertEqual(
            get_cell_by_position(document, 0, 1, 2).getString(), "afsdfa")
        self.assertEqual(
            get_cell_by_position(document, 0, 1, 3).getValue(), 1111)
        self.assertEqual(
            get_cell_by_position(document, 0, 2, 1).getValue(), 3242)
        self.assertEqual(
            get_cell_by_position(document, 0, 2, 2).getString(), "adfdas")
        self.assertEqual(
            get_cell_by_position(document, 0, 2, 3).getValue(), 1111)
        self.assertEqual(
            get_cell_by_position(document, 0, 3, 1).getValue(), 2342)
        self.assertEqual(
            get_cell_by_position(document, 0, 3, 2).getString(), "fsad")
        self.assertEqual(
            get_cell_by_position(document, 0, 3, 3).getValue(), 111)

        self.ui_test.close_doc()
Exemple #35
0
   def test_tdf81124(self):
        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81124.ods"))
        document = self.ui_test.get_component()
        calcDoc = self.xUITest.getTopFocusWindow()
        xGridWindow = calcDoc.getChild("grid_window")

        xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
        xFloatWindow = self.xUITest.getFloatWindow()

        xUnselect = xFloatWindow.getChild("unselect_current")
        xUnselect.executeAction("CLICK", tuple())
        xokBtn = xFloatWindow.getChild("ok")
        self.assertEqual(get_state_as_dict(xokBtn)["Enabled"], "false")

        xSelect = xFloatWindow.getChild("select_current")
        xSelect.executeAction("CLICK", tuple())
        xokBtn = xFloatWindow.getChild("ok")
        self.assertEqual(get_state_as_dict(xokBtn)["Enabled"], "true")

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

        self.ui_test.close_doc()
Exemple #36
0
    def test_category_listbox(self):
        self.ui_test.create_doc_in_start_center("writer")
        self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog")
        xDialog = self.xUITest.getTopFocusWindow()

        xFunc = xDialog.getChild("functions")
        xCategory = xDialog.getChild("commandcategorylist")

        initialEntryCount = get_state_as_dict(xFunc)["Children"]
        self.assertTrue(initialEntryCount != 0)

        select_pos(xCategory, "1")
        filteredEntryCount = get_state_as_dict(xFunc)["Children"]
        self.assertTrue(filteredEntryCount < initialEntryCount)

        select_pos(xCategory, "0")
        finalEntryCount = get_state_as_dict(xFunc)["Children"]
        self.assertEqual(initialEntryCount, finalEntryCount)

        xcancBtn = xDialog.getChild("cancel")  #button Cancel
        xcancBtn.executeAction("CLICK", tuple())  #click the button

        self.ui_test.close_doc()
    def test_date_field_with_custom_format(self):
        # open a file with a date form field
        writer_doc = self.ui_test.load_file(
            get_url_for_data_file("date_form_field_custom_format.odt"))
        document = self.ui_test.get_component()
        xWriterDoc = self.xUITest.getTopFocusWindow()

        # open the dialog (cursor is at the field)
        self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
        xDialog = self.xUITest.getTopFocusWindow()

        itemsList = xDialog.getChild("date_formats_treeview")

        # check whether we have the right format selected
        self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
        self.assertEqual(
            get_state_as_dict(itemsList)["SelectEntryText"],
            "1999. december 31., péntek")

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

        self.ui_test.close_doc()
Exemple #38
0
    def test_tdf74857(self):
        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("tdf74857.ods"))
        document = self.ui_test.get_component()
        calcDoc = self.xUITest.getTopFocusWindow()
        xGridWindow = calcDoc.getChild("grid_window")

        xGridWindow.executeAction(
            "TYPE", mkPropertyValues({"KEYCODE": "SHIFT+CTRL+DOWN"}))
        # Assert that the correct range has been selected
        gridWinState = get_state_as_dict(xGridWindow)
        self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A1:Sheet1.A25")

        self.ui_test.close_doc()
Exemple #39
0
    def test_tdf130762(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 cell A1
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        #format - cell
        self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "3")  #tab Alignment
        xspinDegrees = xDialog.getChild("spinDegrees")
        self.assertEqual(get_state_as_dict(xspinDegrees)["Text"].replace('°', ''), "0")
        xspinDegrees.executeAction("DOWN", tuple())
        self.assertEqual(get_state_as_dict(xspinDegrees)["Text"].replace('°', ''), "355")
        xspinDegrees.executeAction("UP", tuple())
        self.assertEqual(get_state_as_dict(xspinDegrees)["Text"].replace('°', ''), "0")

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

        self.ui_test.close_doc()
Exemple #40
0
    def changeLocalSetting(self, language):
        self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")
        xDialog = self.xUITest.getTopFocusWindow()

        xPages = xDialog.getChild("pages")
        xLanguageEntry = xPages.getChild('2')
        xLanguageEntry.executeAction("EXPAND", tuple())
        xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0')
        xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple())

        # Check asian support is enabled
        asianlanguage = xDialog.getChild("asiansupport")
        self.assertEqual("true", get_state_as_dict(asianlanguage)['Selected'])

        localeSetting = xDialog.getChild("localesetting")
        localeSetting.executeAction("SELECT",
                                    mkPropertyValues({"TEXT": language}))

        self.assertEqual(language,
                         get_state_as_dict(localeSetting)['SelectEntryText'])

        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
Exemple #41
0
    def test_format_paragraph_tab_borders(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, "7")

        xStyle = xDialog.getChild("linestylelb")
        xwidth = xDialog.getChild("linewidthmf")
        xSync = xDialog.getChild("sync")
        xLeft = xDialog.getChild("leftmf")
        xRight = xDialog.getChild("rightmf")
        xTop = xDialog.getChild("topmf")
        xBottom = xDialog.getChild("bottommf")
        xMerge = xDialog.getChild("mergewithnext")

        xwidth.executeAction("UP", tuple())
        xSync.executeAction("CLICK", tuple())
        xLeft.executeAction("UP", tuple())
        xLeft.executeAction("UP", tuple())
        xRight.executeAction("UP", tuple())
        xTop.executeAction("UP", tuple())
        xBottom.executeAction("UP", tuple())
        xMerge.executeAction("CLICK", tuple())

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

        self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "7")

        xStyle = xDialog.getChild("linestylelb")
        xwidth = xDialog.getChild("linewidthmf")
        xSync = xDialog.getChild("sync")
        xLeft = xDialog.getChild("leftmf")
        xRight = xDialog.getChild("rightmf")
        xTop = xDialog.getChild("topmf")
        xBottom = xDialog.getChild("bottommf")
        xMerge = xDialog.getChild("mergewithnext")

        self.assertEqual(get_state_as_dict(xSync)["Selected"], "false")
        self.assertEqual(get_state_as_dict(xMerge)["Selected"], "false")
        self.assertEqual(get_state_as_dict(xLeft)["Text"], "0.20 cm")
        self.assertEqual(get_state_as_dict(xRight)["Text"], "0.10 cm")
        self.assertEqual(get_state_as_dict(xTop)["Text"], "0.10 cm")
        self.assertEqual(get_state_as_dict(xBottom)["Text"], "0.10 cm")

        xCanc = xDialog.getChild("cancel")
        self.ui_test.close_dialog_through_button(xCanc)
        self.ui_test.close_doc()
Exemple #42
0
    def test_tdf89244(self):
        calc_doc = self.ui_test.create_doc_in_start_center("calc")
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()

        enter_text_to_cell(gridwin, "A1", "AAA")
        enter_text_to_cell(gridwin, "A3", "BBB")
        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"}))

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

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

        gridwin.executeAction(
            "LAUNCH",
            mkPropertyValues({
                "AUTOFILTER": "",
                "COL": "0",
                "ROW": "0"
            }))

        xFloatWindow = self.xUITest.getFloatWindow()

        xCheckListMenu = xFloatWindow.getChild("check_list_menu")

        xList = xCheckListMenu.getChild("check_list_box")

        self.assertEqual(2, len(xList.getChildren()))
        self.assertEqual("(empty)",
                         get_state_as_dict(xList.getChild('0'))['Text'])
        self.assertEqual("BBB", get_state_as_dict(xList.getChild('1'))['Text'])

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

        self.ui_test.close_doc()
Exemple #43
0
    def test_tdf106099_find_format_underline(self):
        writer_doc = self.ui_test.create_doc_in_start_center("writer")
        document = self.ui_test.get_component()
        xWriterDoc = self.xUITest.getTopFocusWindow()
        #Find and replace
        self.ui_test.execute_modeless_dialog_through_command(
            ".uno:SearchDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        #2. Choose Format
        format = xDialog.getChild("format")

        def handle_format_dlg(dialog):
            #Font effects - Underline Single. OK.
            xTabs = dialog.getChild("tabcontrol")
            select_pos(xTabs, "1")  #tab font effects
            underlinelb = dialog.getChild("underlinelb")
            props = {"TEXT": "Single"}
            actionProps = mkPropertyValues(props)
            underlinelb.executeAction("SELECT", actionProps)
            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 label searchdesc
        searchdesc = xDialog.getChild("searchdesc")
        print(get_state_as_dict(searchdesc))
        self.assertEqual(
            get_state_as_dict(searchdesc)["Text"], "Single underline")
        noformat = xDialog.getChild("noformat")
        noformat.executeAction("CLICK", tuple())  #click No format button
        self.assertEqual(get_state_as_dict(searchdesc)["Text"], "")
        xcloseBtn = xDialog.getChild("close")
        self.ui_test.close_dialog_through_button(xcloseBtn)

        self.ui_test.close_doc()
Exemple #44
0
    def test_DefineLabelRange(self):
        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf131170.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")

        self.ui_test.execute_dialog_through_command(".uno:DefineLabelRange")
        xDialog = self.xUITest.getTopFocusWindow()

        xRange = xDialog.getChild("range")
        self.assertEqual(4, len(xRange.getChildren()))
        self.assertEqual(get_state_as_dict(xRange.getChild('0'))["Text"].strip(), "--- Column ---")
        self.assertEqual(get_state_as_dict(xRange.getChild('1'))["Text"].strip(), "$Sheet1.$I$6:$K$6 [AA, BB, CC]")
        self.assertEqual(get_state_as_dict(xRange.getChild('2'))["Text"].strip(), "--- Row ---")
        self.assertEqual(get_state_as_dict(xRange.getChild('3'))["Text"].strip(), "$Sheet1.$H$7:$H$9 [X, Y, Z]")

        def handle_confirmation_dlg(dialog2):
            xOKBtn2 = dialog2.getChild("yes")
            self.ui_test.close_dialog_through_button(xOKBtn2)

        xDeleteBtn = xDialog.getChild("delete")

        xRange.getChild('1').executeAction("SELECT", tuple())
        self.ui_test.execute_blocking_action(xDeleteBtn.executeAction, args=('CLICK', ()),
                dialog_handler=handle_confirmation_dlg)

        self.assertEqual(3, len(xRange.getChildren()))
        self.assertEqual(get_state_as_dict(xRange.getChild('0'))["Text"].strip(), "--- Column ---")
        self.assertEqual(get_state_as_dict(xRange.getChild('1'))["Text"].strip(), "--- Row ---")
        self.assertEqual(get_state_as_dict(xRange.getChild('2'))["Text"].strip(), "$Sheet1.$H$7:$H$9 [X, Y, Z]")

        xRange.getChild('2').executeAction("SELECT", tuple())
        self.ui_test.execute_blocking_action(xDeleteBtn.executeAction, args=('CLICK', ()),
                dialog_handler=handle_confirmation_dlg)

        self.assertEqual(2, len(xRange.getChildren()))
        self.assertEqual(get_state_as_dict(xRange.getChild('0'))["Text"].strip(), "--- Column ---")
        self.assertEqual(get_state_as_dict(xRange.getChild('1'))["Text"].strip(), "--- Row ---")

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

        self.ui_test.close_doc()
Exemple #45
0
    def test_tdf123052_shit_tab(self):
        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("tdf123052.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        #Holding the Shift key and repeated pressing the Tab key does not correctly cycle though the unprotected cells
        #I'm at 7, hold TAB for cycling
        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
        # Assert that the correct cell has been selected
        gridWinState = get_state_as_dict(gridwin)
        self.assertEqual(gridWinState["CurrentRow"], "2")
        self.assertEqual(gridWinState["CurrentColumn"], "5")

        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
        # Assert that the correct cell has been selected
        gridWinState = get_state_as_dict(gridwin)
        self.assertEqual(gridWinState["CurrentRow"], "4")
        self.assertEqual(gridWinState["CurrentColumn"], "3")

        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
        # Assert that the correct cell has been selected
        gridWinState = get_state_as_dict(gridwin)
        self.assertEqual(gridWinState["CurrentRow"], "4")
        self.assertEqual(gridWinState["CurrentColumn"], "4")

        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
        # Assert that the correct cell has been selected
        gridWinState = get_state_as_dict(gridwin)
        self.assertEqual(gridWinState["CurrentRow"], "5")
        self.assertEqual(gridWinState["CurrentColumn"], "5")

        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
        # Assert that the correct cell has been selected
        gridWinState = get_state_as_dict(gridwin)
        self.assertEqual(gridWinState["CurrentRow"], "7")
        self.assertEqual(gridWinState["CurrentColumn"], "0")

        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
        # Assert that the correct cell has been selected
        gridWinState = get_state_as_dict(gridwin)
        self.assertEqual(gridWinState["CurrentRow"], "8")
        self.assertEqual(gridWinState["CurrentColumn"], "4")
        #now shift + tab
        gridwin.executeAction("TYPE",
                              mkPropertyValues({"KEYCODE": "SHIFT+TAB"}))
        # Assert that the correct cell has been selected
        gridWinState = get_state_as_dict(gridwin)
        self.assertEqual(gridWinState["CurrentRow"], "7")
        self.assertEqual(gridWinState["CurrentColumn"], "0")

        self.ui_test.close_doc()
Exemple #46
0
    def test_format_cell_font_tab(self):
        #numberingformatpage.ui
        calc_doc = self.ui_test.create_doc_in_start_center("calc")
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        #select cell A1
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        #format - cell
        self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "1")  #tab Font
        xSizeFont = xDialog.getChild("westsizelb-cjk")
        xSizeFontEast = xDialog.getChild("eastsizelb")
        xSizeFontCTL = xDialog.getChild("ctlsizelb")
        xLangFont = xDialog.getChild("westlanglb-cjk")
        xLangFontEast = xDialog.getChild("eastlanglb")
        xLangFontCTL = xDialog.getChild("ctllanglb")

        xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
        xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"18"}))    #set font size 18
        xSizeFontEast.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
        xSizeFontEast.executeAction("TYPE", mkPropertyValues({"TEXT":"18"}))    #set font size 18
        xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
        xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"TEXT":"18"}))    #set font size 18
        select_pos(xLangFont, "0")
        select_pos(xLangFontEast, "0")
        select_pos(xLangFontCTL, "0")
        xOK = xDialog.getChild("ok")
        xOK.executeAction("CLICK", tuple())

        #Verify - select cell A1
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        #format - cell
        self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "1")  #tab Font
        xSizeFont = xDialog.getChild("westsizelb-cjk")
        xSizeFontEast = xDialog.getChild("eastsizelb")
        xSizeFontCTL = xDialog.getChild("ctlsizelb")
        xLangFont = xDialog.getChild("westlanglb-cjk")
        xLangFontEast = xDialog.getChild("eastlanglb")
        xLangFontCTL = xDialog.getChild("ctllanglb")

        self.assertEqual(get_state_as_dict(xSizeFont)["Text"], "18 pt")
        self.assertEqual(get_state_as_dict(xSizeFontEast)["Text"], "18 pt")
        self.assertEqual(get_state_as_dict(xSizeFontCTL)["Text"], "18 pt") #check font size
        self.assertEqual(get_state_as_dict(xLangFont)["Text"], "[None]")
        self.assertEqual(get_state_as_dict(xLangFontEast)["SelectEntryText"], "[None]")
        self.assertEqual(get_state_as_dict(xLangFontCTL)["SelectEntryText"], "[None]")

        xCanc = xDialog.getChild("cancel")
        self.ui_test.close_dialog_through_button(xCanc)

        self.ui_test.close_doc()
Exemple #47
0
    def test_tdf99711(self):

        writer_doc = self.ui_test.load_file(get_url_for_data_file("shape.odt"))

        #set measurement to millimeters
        self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")
        xDialogOpt = self.xUITest.getTopFocusWindow()
        xPages = xDialogOpt.getChild("pages")
        xWriterEntry = xPages.getChild('3')
        xWriterEntry.executeAction("EXPAND", tuple())
        xWriterGeneralEntry = xWriterEntry.getChild('0')
        xWriterGeneralEntry.executeAction("SELECT", tuple())
        xMetric = xDialogOpt.getChild("metric")
        props = {"TEXT": "Millimeter"}
        actionProps = mkPropertyValues(props)
        xMetric.executeAction("SELECT", actionProps)
        xOKBtn = xDialogOpt.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

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

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

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

        #wait until the sidebar is available
        self.ui_test.wait_until_child_is_available(xWriterEdit, 'selectwidth')
        self.assertEqual(get_state_as_dict(xWriterEdit.getChild('selectwidth'))['Text'], '10.00 mm')

        self.ui_test.wait_until_child_is_available(xWriterEdit, 'selectheight')
        self.assertEqual(get_state_as_dict(xWriterEdit.getChild('selectheight'))['Text'], '10.00 mm')

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

        self.ui_test.close_doc()
Exemple #48
0
    def test_run(self):
        self.ui_test.create_doc_in_start_center("writer")
        document = self.ui_test.get_component()

        self.ui_test.execute_dialog_through_command(".uno:PageDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        tabcontrol = xDialog.getChild("tabcontrol")
        select_pos(tabcontrol, 4)  #header

        xHeaderOn = xDialog.getChild("checkHeaderOn")
        xMoreBtn = xDialog.getChild("buttonMore")

        self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "false")
        self.assertEqual(get_state_as_dict(xMoreBtn)["Enabled"], "false")

        xHeaderOn.executeAction("CLICK", tuple())

        self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "true")
        self.assertEqual(get_state_as_dict(xMoreBtn)["Enabled"], "true")

        self.ui_test.execute_dialog_through_action(xMoreBtn, "CLICK")

        xBorderDlg = self.xUITest.getTopFocusWindow()

        #modify any property
        bottomft = xBorderDlg.getChild("bottommf")
        bottomft.executeAction("UP", tuple())

        #it would crash here
        okBtn = xBorderDlg.getChild("ok")
        self.ui_test.close_dialog_through_button(okBtn)

        xDialog = self.xUITest.getTopFocusWindow()
        okBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(okBtn)

        self.ui_test.close_doc()
Exemple #49
0
    def test_setting_date_format(self):
        # open a file with a date form field
        writer_doc = self.ui_test.load_file(
            get_url_for_data_file("date_form_field.odt"))
        document = self.ui_test.get_component()
        xWriterDoc = self.xUITest.getTopFocusWindow()

        # open the dialog (cursor is at the field)
        self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
        xDialog = self.xUITest.getTopFocusWindow()

        itemsList = xDialog.getChild("date_formats_treeview")

        # check whether we have the right format selected
        self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
        self.assertEqual(
            get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")

        # select a new format
        itemsList.getChild("11").executeAction("SELECT", tuple())
        self.assertEqual(
            get_state_as_dict(itemsList)["SelectEntryText"], "12-31")

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

        # open the dialog again
        self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
        xDialog = self.xUITest.getTopFocusWindow()
        itemsList = xDialog.getChild("date_formats_treeview")
        self.assertEqual(
            get_state_as_dict(itemsList)["SelectEntryText"], "12-31")

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

        self.ui_test.close_doc()
Exemple #50
0
    def test_validity_tab_inputHelp(self):
        #validationhelptabpage.ui
        calc_doc = self.ui_test.create_doc_in_start_center("calc")
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))

        self.ui_test.execute_dialog_through_command(".uno:Validation")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "1")
        xtsbhelp = xDialog.getChild("tsbhelp")
        xtitle = xDialog.getChild("title")
        xinputhelp = xDialog.getChild("inputhelp")

        xtsbhelp.executeAction("CLICK", tuple())
        xtitle.executeAction("TYPE", mkPropertyValues({"TEXT": "A"}))
        xinputhelp.executeAction("TYPE", mkPropertyValues({"TEXT": "B"}))
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #reopen and verify
        self.ui_test.execute_dialog_through_command(".uno:Validation")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        xtsbhelp = xDialog.getChild("tsbhelp")
        xtitle = xDialog.getChild("title")
        xinputhelp = xDialog.getChild("inputhelp")
        # print(get_state_as_dict(xtsbhelp))
        select_pos(xTabs, "1")
        self.assertEqual(get_state_as_dict(xtsbhelp)["Selected"], "true")
        self.assertEqual(get_state_as_dict(xtitle)["Text"], "A")
        self.assertEqual(get_state_as_dict(xinputhelp)["Text"], "B")
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

        self.ui_test.close_doc()
Exemple #51
0
    def test_tdf88999_scientific_format_decimal_value(self):
        #numberingformatpage.ui
        calc_doc = self.ui_test.create_doc_in_start_center("calc")
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        enter_text_to_cell(gridwin, "A1", "1e-2")
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
        #select cell A1
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        #format - cell
        self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "0")  #tab Numbers
        xliststore1 = xDialog.getChild("categorylb")  #1st list / Category
        xliststore2 = xDialog.getChild("formatlb")  #2nd list / Format
        xdecimalsed = xDialog.getChild("decimalsed")
        xleadzerosed = xDialog.getChild("leadzerosed")
        xnegnumred = xDialog.getChild("negnumred")
        xthousands = xDialog.getChild("thousands")
        xlanguagelb = xDialog.getChild("languagelb")
        xformatted = xDialog.getChild("formatted")

        self.assertEqual(
            get_state_as_dict(xliststore1)["SelectEntryText"], "Scientific")
        self.assertEqual(get_state_as_dict(xdecimalsed)["Text"], "2")
        self.assertEqual(get_state_as_dict(xdecimalsed)["Enabled"], "true")
        self.assertEqual(get_state_as_dict(xleadzerosed)["Text"], "1")
        self.assertEqual(get_state_as_dict(xformatted)["Text"], "0.00E+00")
        xOk = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOk)

        self.ui_test.close_doc()


# vim: set shiftwidth=4 softtabstop=4 expandtab:
Exemple #52
0
    def test_copy_move_sheet(self):
        writer_doc = self.ui_test.create_doc_in_start_center("calc")
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        #default - 1 sheet; select the sheet (is selected), dialog move/copy sheet
        self.ui_test.execute_dialog_through_command(".uno:Move")
        xDialog = self.xUITest.getTopFocusWindow()
        #new name = newName
        newName = xDialog.getChild("newName")
        newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
        newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
        newName.executeAction("TYPE", mkPropertyValues({"TEXT":"newName"}))
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #verify, the file has 2 sheets; first one "newName" is selected
        self.assertEqual(document.Sheets.getCount(), 2)
        # dialog move/copy sheet ; Move is selected; select -move to end position - ; New Name = moveName
        self.ui_test.execute_dialog_through_command(".uno:Move")
        xDialog = self.xUITest.getTopFocusWindow()
        insertBefore = xDialog.getChild("insertBefore")

        xTreeEntry = insertBefore.getChild('2')
        xTreeEntry.executeAction("SELECT", tuple())

        newName = xDialog.getChild("newName")
        self.assertEqual(get_state_as_dict(newName)["Text"], "newName")
        newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
        newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
        newName.executeAction("TYPE", mkPropertyValues({"TEXT":"moveName"}))
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #verify, the file has 2 sheets; first one is "Sheet1" ; second one is "moveName"
        self.assertEqual(document.Sheets.getCount(), 2)

        self.assertEqual(document.Sheets.getByIndex(0).Name, "Sheet1")
        self.assertEqual(document.Sheets.getByIndex(1).Name, "moveName")

        #verify that the cancel button does not do anything
        self.ui_test.execute_dialog_through_command(".uno:Move")
        xDialog = self.xUITest.getTopFocusWindow()
        xCancelBtn = xDialog.getChild("cancel")
        self.ui_test.close_dialog_through_button(xCancelBtn)

        self.assertEqual(document.Sheets.getCount(), 2)
        self.assertEqual(document.Sheets.getByIndex(0).Name, "Sheet1")
        self.assertEqual(document.Sheets.getByIndex(1).Name, "moveName")

        self.ui_test.close_doc()
Exemple #53
0
    def test_tdf89907_text_to_columns(self):
        calc_doc = self.ui_test.create_doc_in_start_center("calc")
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()

        #Add data
        enter_text_to_cell(gridwin, "A1", "afasdfs.fdfasd.fsadf.fasd")
        enter_text_to_cell(gridwin, "A2", "3242.43242.3242.2342")
        enter_text_to_cell(gridwin, "A3", "fdsfa.afsdfa.adfdas.fsad")
        enter_text_to_cell(gridwin, "A4", "21312.1111.1111.111")
        #select column A
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        self.xUITest.executeCommand(".uno:SelectColumn")
        #Optimal Width
        self.xUITest.executeCommand(".uno:SetOptimalColumnWidthDirect")
        # Data - Text to Columns
        self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
        xDialog = self.xUITest.getTopFocusWindow()
        xother = xDialog.getChild("other")
        xinputother = xDialog.getChild("inputother")
        if (get_state_as_dict(xother)["Selected"]) == "false":
            xother.executeAction("CLICK", tuple())
        xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"."}))
        # Click Ok
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)

        #Verify
        self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "afasdfs")
        self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 3242)
        self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "fdsfa")
        self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 21312)
        self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "fdfasd")
        self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 43242)
        self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "afsdfa")
        self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 1111)
        self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "fsadf")
        self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3242)
        self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "adfdas")
        self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 1111)
        self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "fasd")
        self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 2342)
        self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "fsad")
        self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 111)

        self.ui_test.close_doc()

# vim: set shiftwidth=4 softtabstop=4 expandtab:
Exemple #54
0
    def test_tdf96432_chart_trendline_name(self):
        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("tdf123013.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        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": "FormatTrendline"}))
        xDialog = self.xUITest.getTopFocusWindow()
        #Click on tab "Type".
        tabcontrol = xDialog.getChild("tabcontrol")
        select_pos(tabcontrol, "0")
        #add name
        xentryname = xDialog.getChild("entry_name")
        xentryname.executeAction("TYPE", mkPropertyValues({"TEXT": "Tline"}))
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

        #reopen and try again
        gridwin.executeAction("SELECT",
                              mkPropertyValues({"OBJECT": "Object 1"}))
        gridwin.executeAction("ACTIVATE", tuple())
        xChartMainTop = self.xUITest.getTopFocusWindow()
        xChartMain = xChartMainTop.getChild("chart_window")

        #Right-click on the chart; from the pop-up menu select "Format Y bars
        # The program presents dialog "Format Y bars", tab "Line".
        xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
        self.ui_test.execute_dialog_through_action(
            xSeriesObj, "COMMAND",
            mkPropertyValues({"COMMAND": "FormatTrendline"}))
        xDialog = self.xUITest.getTopFocusWindow()
        #Click on tab "Type".
        tabcontrol = xDialog.getChild("tabcontrol")
        select_pos(tabcontrol, "0")
        #add name
        xentryname = xDialog.getChild("entry_name")
        self.assertEqual(get_state_as_dict(xentryname)["Text"], "Tline")
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

        self.ui_test.close_doc()
Exemple #55
0
    def execute_sort_dialog(self, gridwin, bIncludeNotes):
        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B3"}))

        self.ui_test.execute_dialog_through_command(".uno:DataSort")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "1")

        xIncludeNotes = xDialog.getChild("includenotes")

        if (get_state_as_dict(xIncludeNotes)["Selected"]) != bIncludeNotes:
            xIncludeNotes.executeAction("CLICK", tuple())

        xOk = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOk)
Exemple #56
0
    def test_tdf135636(self):

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

        document = self.ui_test.get_component()

        self.assertEqual(document.CurrentController.PageCount, 2)

        xWriterDoc = self.xUITest.getTopFocusWindow()
        xWriterEdit = xWriterDoc.getChild("writer_edit")
        self.ui_test.wait_until_child_is_available(xWriterEdit, 'PageBreak')
        xPageBreak = xWriterEdit.getChild('PageBreak')

        self.ui_test.execute_dialog_through_action(xPageBreak, "EDIT")

        xDialog = self.xUITest.getTopFocusWindow()

        xBreak = xDialog.getChild("break")
        self.assertEqual("true", get_state_as_dict(xBreak)["Selected"])

        xBreak.executeAction("CLICK", tuple())

        self.assertEqual("false", get_state_as_dict(xBreak)["Selected"])

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

        # Without the fix in place, this test would have failed with
        # AssertionError: 2 != 1
        self.assertEqual(document.CurrentController.PageCount, 1)

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

        self.assertEqual(document.CurrentController.PageCount, 2)

        self.ui_test.close_doc()
Exemple #57
0
    def test_complete_math(self):
        self.ui_test.create_doc_in_start_center("math")

        xMathDoc = self.xUITest.getTopFocusWindow()

        xList = xMathDoc.getChild("listbox")
        state = get_state_as_dict(xList)
        self.assertEqual(state["SelectEntryText"], "Unary/Binary Operators")
        select_pos(xList, "1")

        xMathSelector = xMathDoc.getChild("element_selector")

        xElement = xMathSelector.getChild("1")
        xElement.executeAction("SELECT", tuple())

        xMathEdit = xMathDoc.getChild("math_edit")
        type_text(xMathEdit, "1")
        xMathEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F4"}))
        type_text(xMathEdit, "2")

        edit_state = get_state_as_dict(xMathEdit)
        self.assertEqual("1 <> 2 ", edit_state["Text"])

        self.ui_test.close_doc()
Exemple #58
0
   def test_tdf104795(self):
        writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf104795.odt"))
        self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")
        xDialog = self.xUITest.getTopFocusWindow()

        sShowSignedText = get_state_as_dict(xDialog.getChild('showsigned'))['Text']

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

        # Without the fix in place, this test would have failed with
        # AssertionError: '12/19/2016, 23:06:31, timur.davletshin' != '12/19/2016, 00:00:00, !!br0ken!!'
        self.assertEqual("12/19/2016, 23:06:31, timur.davletshin", sShowSignedText.split('@')[0])

        self.ui_test.close_doc()
Exemple #59
0
    def test_tdf122509_format_cell_negative_numbers(self):
        #numberingformatpage.ui
        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf122509.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        #select cell A1
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        #format - cell
        self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "0")  #tab Numbers
        xliststore1 = xDialog.getChild("categorylb")  #1st list / Category
        xliststore2 = xDialog.getChild("formatlb")  #2nd list / Format
        xdecimalsed = xDialog.getChild("decimalsed")
        xleadzerosed = xDialog.getChild("leadzerosed")
        xnegnumred = xDialog.getChild("negnumred")
        xthousands = xDialog.getChild("thousands")
        xlanguagelb = xDialog.getChild("languagelb")
        xformatted = xDialog.getChild("formatted")

        self.assertEqual(get_state_as_dict(xformatted)["Text"], "#,##0.00 [$USD];[RED]-#,##0.00 [$USD]")
        #click negative
        xnegnumred.executeAction("CLICK", tuple())
        #format check; https://bugs.documentfoundation.org/show_bug.cgi?id=122509#c7
        self.assertEqual(get_state_as_dict(xformatted)["Text"], "#,##0.00 [$USD];-#,##0.00 [$USD]")
        # click negative
        xnegnumred.executeAction("CLICK", tuple())
        #OK
        xOk = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOk)
        #verify; no crashes
        self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 2)

        self.ui_test.close_doc()
Exemple #60
0
    def test_insert_hyperlink(self):

        self.ui_test.create_doc_in_start_center("writer")
        xMainWindow = self.xUITest.getTopFocusWindow()

        self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog")
        xDialog = self.xUITest.getTopFocusWindow()

        # insert link
        xtab = xDialog.getChild("tabcontrol")
        xtab.executeAction("SELECT", mkPropertyValues({"POS": "0"}))

        xtarget = xDialog.getChild("target")
        xtarget.executeAction(
            "TYPE", mkPropertyValues({"TEXT": "http://www.libreoffice.org/"}))
        self.assertEqual(
            get_state_as_dict(xtarget)["Text"], "http://www.libreoffice.org/")

        xindication = xDialog.getChild("indication")
        xindication.executeAction("TYPE", mkPropertyValues({"TEXT": "link"}))
        self.assertEqual(get_state_as_dict(xindication)["Text"], "link")

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

        # Check that the link is added
        xMainWindow = self.xUITest.getTopFocusWindow()
        xedit = xMainWindow.getChild("writer_edit")
        xedit.executeAction(
            "SELECT", mkPropertyValues({
                "START_POS": "0",
                "END_POS": "4"
            }))
        self.assertEqual(get_state_as_dict(xedit)["SelectedText"], "link")

        self.ui_test.close_doc()