Пример #1
0
    def test_tdf124586_crash_switch_outline_numbering(self):
        writer_doc = self.ui_test.load_file(
            get_url_for_data_file("tdf124586.odt"))
        document = self.ui_test.get_component()
        xWriterDoc = self.xUITest.getTopFocusWindow()

        #Goto Tools > Chapter Numbering.
        self.ui_test.execute_dialog_through_command(
            ".uno:ChapterNumberingDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xstyle = xDialog.getChild("style")
        select_by_text(xstyle, "MyHeading")
        xOK = xDialog.getChild("ok")
        xOK.executeAction("CLICK", tuple())

        self.assertEqual(document.Text.String[0:8], "Schritte")

        self.ui_test.execute_dialog_through_command(
            ".uno:ChapterNumberingDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xstyle = xDialog.getChild("style")
        self.assertEqual(
            get_state_as_dict(xstyle)["SelectEntryText"], "MyHeading")
        xOK = xDialog.getChild("ok")
        xOK.executeAction("CLICK", tuple())
        self.ui_test.close_doc()
Пример #2
0
    def test_tdf133630(self):

        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("chartArea.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()

        change_measurement_unit(self, "Centimeter")

        xCS = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram(
        ).CoordinateSystems[0]
        self.assertEqual(0, xCS.getAxisByDimension(0, 0).LineWidth)
        self.assertEqual(80, xCS.ChartTypes[0].DataSeries[0].LineWidth)

        # First change the line width of one element
        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:Axis=0,0")
        self.ui_test.execute_dialog_through_action(
            xSeriesObj, "COMMAND",
            mkPropertyValues({"COMMAND": "DiagramAxisX"}))

        xDialog = self.xUITest.getTopFocusWindow()
        tabcontrol = xDialog.getChild("tabcontrol")
        select_pos(tabcontrol, "2")

        xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
        xWidth.executeAction("UP", tuple())

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

        self.assertEqual(100, xCS.getAxisByDimension(0, 0).LineWidth)
        self.assertEqual(80, xCS.ChartTypes[0].DataSeries[0].LineWidth)

        # Now change the line width of another element
        xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
        self.ui_test.execute_dialog_through_action(
            xSeriesObj, "COMMAND",
            mkPropertyValues({"COMMAND": "FormatDataSeries"}))

        xDialog = self.xUITest.getTopFocusWindow()
        tabcontrol = xDialog.getChild("tabcontrol")
        select_pos(tabcontrol, "1")

        xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
        xWidth.executeAction("UP", tuple())

        # Without the fix in place, this test would have crashed here
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

        self.assertEqual(100, xCS.getAxisByDimension(0, 0).LineWidth)
        self.assertEqual(100, xCS.ChartTypes[0].DataSeries[0].LineWidth)

        self.ui_test.close_doc()
Пример #3
0
   def test_tdf113284(self):
    writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf113284.odt"))
    document = self.ui_test.get_component()
    xWriterDoc = self.xUITest.getTopFocusWindow()
    xWriterEdit = xWriterDoc.getChild("writer_edit")

    xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
    xToolkit.processEventsToIdle()

    xPageCount = document.CurrentController.PageCount
    self.ui_test.execute_dialog_through_command(".uno:GotoPage")
    xDialog = self.xUITest.getTopFocusWindow()
    xPageText = xDialog.getChild("page")
    xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":str(xPageCount)})) # goto last page
    xOkBtn = xDialog.getChild("ok")
    self.ui_test.close_dialog_through_button(xOkBtn)

    xToolkit.processEventsToIdle()

    self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], str(xPageCount))
    self.ui_test.execute_dialog_through_command(".uno:EditCurIndex")  #open index dialog
    xDiagIndex = self.xUITest.getTopFocusWindow()
    xCancBtn = xDiagIndex.getChild("cancel")
    self.ui_test.close_dialog_through_button(xCancBtn)   # close dialog

    #page count  is not constant
    #self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "66")    #page 66 start of the Index
    #pagecount unchanged
    self.assertEqual(document.CurrentController.PageCount, xPageCount)

    self.ui_test.close_doc()
Пример #4
0
    def test_tdf62349_crash_copy_chart_clipboard(self):
        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("tdf62349.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        #3: select all data cells C5:H9
        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C5:H9"}))
        # 4: create a chart with insert/chart menu
        self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart")
        xChartDlg = self.xUITest.getTopFocusWindow()

        xOkBtn = xChartDlg.getChild("finish")
        self.ui_test.close_dialog_through_button(xOkBtn)

        # 5: (single) click to an empty cell to finalize the chart
        gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))
        # 6: (single) click back inside the chart to select it
        gridwin.executeAction("SELECT",
                              mkPropertyValues({"OBJECT": "Object 1"}))
        # 7: press CTRL-C
        self.xUITest.executeCommand(".uno:Copy")
        self.xUITest.executeCommand(".uno:Paste")
        #check we didn't crash
        self.assertEqual(
            get_cell_by_position(document, 0, 2, 5).getString(), "group1")

        self.ui_test.close_doc()
Пример #5
0
    def test_tdf31805_delete_column_merged(self):
        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf31805.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        #1. open "sample.ods"
        #2. click 'G1'
        #3. Menu 'edit -> Delete Cell - Delete entire Column'
        #expected: Column with cell containing "g" will be deleted,
        #     a merged cell range will remain left row 1

        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "G1"}))
        self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True)
        self.xUITest.executeCommand(".uno:DeleteColumns")
        #verify. C5:F11 should be merged
        #isMerged   returns true if this cell is merged with another cell.
        self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True)      #C5
        self.assertEqual(get_cell_by_position(document, 0, 6, 4).getIsMerged(), False)      #G5
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A11"}))
        self.xUITest.executeCommand(".uno:DeleteRows")
        self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True)      #C5
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
        self.xUITest.executeCommand(".uno:DeleteColumns")
        self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True)      #C5
        self.ui_test.close_doc()
Пример #6
0
 def test_tdf56958(self):
     calc_doc = self.ui_test.load_file(
         get_url_for_data_file("tdf56958.ods"))
     XcalcDoc = self.xUITest.getTopFocusWindow()
     document = self.ui_test.get_component()
     gridwin = XcalcDoc.getChild("grid_window")
     # 1. Open the test file
     # 2. Data->Subtotals
     self.ui_test.execute_dialog_through_command(".uno:DataSubTotals")
     xDialog = self.xUITest.getTopFocusWindow()
     # 3. Group by->Trans date
     xGroupBy = xDialog.getChild("group_by")
     props = {"TEXT": "Trans Date"}
     actionProps = mkPropertyValues(props)
     xGroupBy.executeAction("SELECT", actionProps)
     # 4. Tick 'Calculate subtotals for' -> Amount  (grid1)
     xCheckListMenu = xDialog.getChild("grid1")
     xTreeList = xCheckListMenu.getChild("columns")
     xFirstEntry = xTreeList.getChild("2")
     xFirstEntry.executeAction("CLICK", tuple())
     # 5. Click OK
     xOKBtn = xDialog.getChild("ok")
     self.ui_test.close_dialog_through_button(xOKBtn)
     # 6. Data->Subtotals
     self.ui_test.execute_dialog_through_command(".uno:DataSubTotals")
     xDialog = self.xUITest.getTopFocusWindow()
     # 7. Group by->-none-
     xGroupBy = xDialog.getChild("group_by")
     props = {"TEXT": "- none -"}
     actionProps = mkPropertyValues(props)
     xGroupBy.executeAction("SELECT", actionProps)
     # 8. Untick 'Calculate subtotals for' -> Amount
     xCheckListMenu = xDialog.getChild("grid1")
     xTreeList = xCheckListMenu.getChild("columns")
     xFirstEntry = xTreeList.getChild("2")
     xFirstEntry.executeAction("CLICK", tuple())
     # 9. Click OK
     xOKBtn = xDialog.getChild("ok")
     self.ui_test.close_dialog_through_button(xOKBtn)
     # 10. Data->Sort
     self.ui_test.execute_dialog_through_command(".uno:DataSort")
     xDialog = self.xUITest.getTopFocusWindow()
     # 11. Sort key 1->Post Date.
     sortkey1 = xDialog.getChild("sortlb")
     props = {"TEXT": "Post Date"}
     actionProps = mkPropertyValues(props)
     sortkey1.executeAction("SELECT", actionProps)
     # 12. Sort key 2->-undefined-
     sortkey2 = xDialog.getChild("sortuserlb")
     props = {"TEXT": "- undefined -"}
     actionProps = mkPropertyValues(props)
     sortkey2.executeAction("SELECT", actionProps)
     # 13. Click OK
     xOKBtn = xDialog.getChild("ok")
     self.ui_test.close_dialog_through_button(xOKBtn)
     self.assertEqual(
         get_cell_by_position(document, 0, 2, 1).getValue(), -0.25)
     self.ui_test.close_doc()
Пример #7
0
    def test_tdf134439(self):

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

        document = self.ui_test.get_component()

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

        xCursor = document.CurrentController.ViewCursor
        self.assertEqual("Chap 1", xCursor.PageStyleName)

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

        self.assertEqual(
            "Page",
            get_state_as_dict(
                xDialog.getChild("comboBreakType"))["SelectEntryText"])
        self.assertEqual(
            "Before",
            get_state_as_dict(
                xDialog.getChild("comboBreakPosition"))["SelectEntryText"])

        xPageStyle = xDialog.getChild("comboPageStyle")
        self.assertEqual("Chap 2",
                         get_state_as_dict(xPageStyle)["SelectEntryText"])

        xPageStyle.executeAction("SELECT", mkPropertyValues({"TEXT":
                                                             "Chap 3"}))

        self.assertEqual("Chap 3",
                         get_state_as_dict(xPageStyle)["SelectEntryText"])

        # tdf#116070: Without the fix in place, this test would have crashed here
        okBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(okBtn)

        # Without the fix in place, this test would have failed with
        # AssertionError: 'Chap 1' != 'Chap 3'
        self.assertEqual("Chap 1", xCursor.PageStyleName)

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

        xCursor.jumpToNextPage()
        self.assertEqual("Chap 3", xCursor.PageStyleName)

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

        self.assertEqual("Chap 2", xCursor.PageStyleName)

        self.ui_test.close_doc()
Пример #8
0
    def test_tdf130960(self):

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

        document = self.ui_test.get_component()
        xWriterDoc = self.xUITest.getTopFocusWindow()

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

        xOpenDialog = self.xUITest.getTopFocusWindow()
        xFileName = xOpenDialog.getChild("file_name")
        xFileName.executeAction(
            "TYPE",
            mkPropertyValues(
                {"TEXT": get_url_for_data_file("tdf130960_2.odt")}))

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

        # Close the dialog and open it again so the list of changes is updated
        xTrackDlg = self.xUITest.getTopFocusWindow()
        xcloseBtn = xTrackDlg.getChild("close")
        xcloseBtn.executeAction("CLICK", tuple())

        self.ui_test.execute_modeless_dialog_through_command(
            ".uno:AcceptTrackedChanges")
        xTrackDlg = self.xUITest.getTopFocusWindow()
        changesList = xTrackDlg.getChild("writerchanges")

        text = "Unknown Author\t" + datetime.datetime.now().strftime(
            "%m/%d/%Y")
        self.assertEqual(2, len(changesList.getChildren()))
        self.assertTrue(
            get_state_as_dict(
                changesList.getChild('0'))["Text"].startswith(text))
        self.assertTrue(
            get_state_as_dict(
                changesList.getChild('1'))["Text"].startswith(text))

        xcloseBtn = xTrackDlg.getChild("close")
        xcloseBtn.executeAction("CLICK", tuple())

        self.ui_test.close_doc()
Пример #9
0
    def test_tdf136573(self):
        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("dataLabels.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")

        change_measurement_unit(self, "Centimeter")

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

        # Select the first label
        xDataLabel = xChartMain.getChild(
            "CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=0"
        )
        xDataLabel.executeAction("SELECT", tuple())

        self.ui_test.execute_dialog_through_action(
            xDataLabel, "COMMAND",
            mkPropertyValues({"COMMAND": "TransformDialog"}))

        xDialog = self.xUITest.getTopFocusWindow()
        self.assertEqual(
            "0.5",
            get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value'])
        self.assertEqual(
            "2.89",
            get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value'])

        # Use OK button in order to test tdf#137165
        xOkBtn = xDialog.getChild("ok")
        xOkBtn.executeAction("CLICK", tuple())

        xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
        xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))

        self.ui_test.execute_dialog_through_action(
            xDataLabel, "COMMAND",
            mkPropertyValues({"COMMAND": "TransformDialog"}))

        # Check the position has changed after moving the label using the arrows keys
        xDialog = self.xUITest.getTopFocusWindow()
        self.assertEqual(
            "0.4",
            get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value'])
        self.assertEqual(
            "2.79",
            get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value'])

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

        self.ui_test.close_doc()
Пример #10
0
    def test_tdf137855(self):

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

        document = self.ui_test.get_component()
        xWriterDoc = self.xUITest.getTopFocusWindow()

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

        xOpenDialog = self.xUITest.getTopFocusWindow()
        xFileName = xOpenDialog.getChild("file_name")
        xFileName.executeAction(
            "TYPE",
            mkPropertyValues(
                {"TEXT": get_url_for_data_file("tdf137855_2.odt")}))

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

        # Close the dialog and open it again so the list of changes is updated
        xTrackDlg = self.xUITest.getTopFocusWindow()
        xcloseBtn = xTrackDlg.getChild("close")
        xcloseBtn.executeAction("CLICK", tuple())

        self.ui_test.execute_modeless_dialog_through_command(
            ".uno:AcceptTrackedChanges")
        xTrackDlg = self.xUITest.getTopFocusWindow()
        changesList = xTrackDlg.getChild("writerchanges")

        # Check the number of changes
        self.assertEqual(263, len(changesList.getChildren()))

        # Without the fix in place, this test would have crashed here
        xAccBtn = xTrackDlg.getChild("acceptall")
        xAccBtn.executeAction("CLICK", tuple())

        self.assertEqual(0, len(changesList.getChildren()))

        xcloseBtn = xTrackDlg.getChild("close")
        xcloseBtn.executeAction("CLICK", tuple())

        self.ui_test.close_doc()
Пример #11
0
    def test_standard_filter(self):
        calc_doc = self.ui_test.load_file(get_url_for_data_file("standardFilter.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C8"}))

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

        props = {"TEXT": "a"}
        actionProps = mkPropertyValues(props)
        xfield1.executeAction("SELECT", actionProps)
        xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
        propsA = {"TEXT": "OR"}
        actionPropsA = mkPropertyValues(propsA)
        xconnect2.executeAction("SELECT", actionPropsA)
        props2 = {"TEXT": "b"}
        actionProps2 = mkPropertyValues(props2)
        xfield2.executeAction("SELECT", actionProps2)
        xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"}))
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #3x down - should be on row 9
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
        gridWinState = get_state_as_dict(gridwin)
        self.assertEqual(gridWinState["CurrentRow"], "8")
        #reopen filter and verify
        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
        self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter")
        xDialog = self.xUITest.getTopFocusWindow()
        xfield1 = xDialog.getChild("field1")
        xval1 = xDialog.getChild("val1")
        xconnect2 = xDialog.getChild("connect2")
        xfield2 = xDialog.getChild("field2")
        xval2 = xDialog.getChild("val2")

        self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "a")
        self.assertEqual(get_state_as_dict(xfield2)["SelectEntryText"], "b")
        self.assertEqual(get_state_as_dict(xconnect2)["SelectEntryText"], "OR")
        self.assertEqual(get_state_as_dict(xval1)["Text"], "1")
        self.assertEqual(get_state_as_dict(xval2)["Text"], "3")
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        self.ui_test.close_doc()
Пример #12
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:
Пример #13
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()
Пример #14
0
    def test_tdf107097(self):
        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("tdf107097.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")

        document = self.ui_test.get_component()

        xFirstMatrix = []
        for row in range(6, 18):
            xRow = []
            for column in range(3, 7):
                xRow.append(
                    get_cell_by_position(document, 1, column, row).getValue())
            xFirstMatrix.append(xRow)

        gridwin.executeAction("SELECT",
                              mkPropertyValues({"OBJECT": "Object 1"}))

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

        self.ui_test.close_doc()

        self.ui_test.load_empty_file("calc")
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()

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

        xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data

        xSecondMatrix = []
        for row in xData.Data:
            xRow = []
            for value in row:
                xRow.append(value)
            xSecondMatrix.append(xRow)

        self.assertEqual(xFirstMatrix, xSecondMatrix)

        aExpectedColumnDescriptions = ('Sum - Sales T1', 'Sum - Sales T2',
                                       'Sum - Sales T3', 'Sum - Sales T4')
        aExpectedRowDescriptions = ('DE Berlin A', 'DE Berlin B',
                                    'DE Munich A', 'DE Munich B',
                                    'EN Glasgow A', 'EN Liverpool B',
                                    'EN London A', 'EN London B',
                                    'FR Nantes A', 'FR Nantes B', 'FR Paris A',
                                    'FR Paris B')

        self.assertEqual(aExpectedColumnDescriptions, xData.ColumnDescriptions)
        self.assertEqual(aExpectedRowDescriptions, xData.RowDescriptions)

        self.ui_test.close_doc()
Пример #15
0
    def test_merge_merged_cells_tdf63766(self):
        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf105412.ods"))
        xTopWindow = self.xUITest.getTopFocusWindow()
        gridwin = xTopWindow.getChild("grid_window")

        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C19:F22"}))
        self.xUITest.executeCommand(".uno:ToggleMergeCells")
        self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 18).getString(), "L6")
        self.xUITest.executeCommand(".uno:Undo")

        self.ui_test.close_doc()
Пример #16
0
    def test_title_move_with_arrows_keys(self):

        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("chartArea.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")

        change_measurement_unit(self, "Centimeter")

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

        # Select the title
        xTitle = xChartMain.getChild("CID/Title=")
        xTitle.executeAction("SELECT", tuple())

        self.ui_test.execute_dialog_through_action(
            xTitle, "COMMAND", mkPropertyValues({"COMMAND":
                                                 "TransformDialog"}))

        xDialog = self.xUITest.getTopFocusWindow()
        self.assertEqual(
            "3.52",
            get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value'])
        self.assertEqual(
            "0.3",
            get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value'])

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

        xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
        xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))

        self.ui_test.execute_dialog_through_action(
            xTitle, "COMMAND", mkPropertyValues({"COMMAND":
                                                 "TransformDialog"}))

        # Check the position has changed after moving the title using the arrows keys
        xDialog = self.xUITest.getTopFocusWindow()
        self.assertEqual(
            "3.42",
            get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value'])
        self.assertEqual(
            "0.2",
            get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value'])

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

        self.ui_test.close_doc()
Пример #17
0
   def test_tdf122780(self):
        writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf122780.docx"))
        self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")

        # Without the fix in place, this test would have hung here
        xDialog = self.xUITest.getTopFocusWindow()
        self.assertEqual("Normal_x005F", get_state_as_dict(xDialog.getChild('showtemplate'))['Text'][:12])
        self.assertEqual(32767, len(get_state_as_dict(xDialog.getChild('showtemplate'))['Text']))
        xOkBtn = xDialog.getChild("ok")
        xOkBtn.executeAction("CLICK", tuple())

        self.ui_test.close_doc()
Пример #18
0
   def test_open_documentProperties_tdf81457(self):
        writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf81457.odt"))
        self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "2")     #tab Custom properties
        xOkBtn = xDialog.getChild("ok")
        xOkBtn.executeAction("CLICK", tuple())

        self.ui_test.close_doc()

# vim: set shiftwidth=4 softtabstop=4 expandtab:
Пример #19
0
    def test_tdf117039_preview_signed_document(self):
        writer_doc = self.ui_test.load_file(
            get_url_for_data_file("tdf117039.odt"))
        document = self.ui_test.get_component()
        self.xUITest.executeCommand(".uno:PrintPreview")  #open print preview
        self.xUITest.executeCommand(".uno:ClosePreview")  # close print preview

        self.xUITest.getTopFocusWindow()  #Get focus after closing preview

        #verify
        self.assertEqual(document.Text.String[0:22], "Test digital signature")
        self.ui_test.close_doc()
Пример #20
0
   def test_tdf99069_chart_cancel_data_ranges_dialog(self):
    calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf99069.ods"))
    xCalcDoc = self.xUITest.getTopFocusWindow()
    gridwin = xCalcDoc.getChild("grid_window")
    document = self.ui_test.get_component()
    #(1) Download and open example.ods attached to tdf#97266  with cell B1 active.
    #(2) In tool bar, click the chart icon.  Program presents Chart Wizard.
    self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart")
    xDialog = self.xUITest.getTopFocusWindow()
    #(3) In Chart Wizard, click <Finish>.  The program closes the wizard;
    # the chart shows a border with handles on each side and at each corner.
    xFinishBtn = xDialog.getChild("finish")
    self.ui_test.close_dialog_through_button(xFinishBtn)
    for _ in range(0,5):
        #(4) Click outside the chart, for example in cell C23.  The borders
        #disappear from the chart and the program restores the menubar to
        #the window.  (Yes, this step is necessary to the crash.)
        gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C23"}))
        #(5) Double-click on the chart.  The program shows a border around the
        # chart.  (It may be necessary to do this a second time before the
        # pop-up menu will offer "Data Ranges...".
        gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
        gridwin.executeAction("ACTIVATE", tuple())
        xChartMainTop = self.xUITest.getTopFocusWindow()
        xChartMain = xChartMainTop.getChild("chart_window")

        #(6) Right-click on the chart; from the pop-up menu select "Data
        # Ranges...".  The program presents dialog "Data Ranges", tab "Data Range".
        xSeriesObj =  xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
        self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"}))
        xDialog = self.xUITest.getTopFocusWindow()

        #(7) Click on tab "Data Series".  (Actually, tab "Data Range" crashes,
        # too.  This step is just a remnant of what I was doing when I
        # stumbled over the bug.)
        notebook = xDialog.getChild("tabcontrol")
        select_pos(notebook, "0")
        select_pos(notebook, "1")

        #(8) Click <Cancel>.  In the versions that I deemed bad while
        # bibisecting, the program crashed here five times out of seven.
        # The other two attempts, both on daily bibisect version 2016-02-18,
        # crashed after I closed the Data Ranges dialog an additional three
        # times, one of those times using by typing <Esc>.
        xCancelBtn = xDialog.getChild("cancel")
        self.ui_test.close_dialog_through_button(xCancelBtn)

        #verify - we didn't crash
    gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))
    self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 0.529084)

    self.ui_test.close_doc()
Пример #21
0
    def test_tdf77509_consolidate(self):
        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("tdf77509.xls"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        #1. Open attachment: Consolidate-test.xls
        #2. Select any empty cell, eg. cell D1
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
        #3. Tab: Data > Consolidate
        self.ui_test.execute_modeless_dialog_through_command(
            ".uno:DataConsolidate")
        xDialog = self.xUITest.getTopFocusWindow()
        xfunc = xDialog.getChild("func")
        xeddataarea = xDialog.getChild("eddataarea")
        xadd = xDialog.getChild("add")
        xbyrow = xDialog.getChild("byrow")
        xbycol = xDialog.getChild("bycol")
        xeddestarea = xDialog.getChild("eddestarea")

        props = {"TEXT": "Sum"}
        actionProps = mkPropertyValues(props)
        xfunc.executeAction("SELECT", actionProps)
        #4. Source data ranges: $Sheet1.$A$1:$B$7
        #5. Click 'Add' so that ranges appear in "Consolidation ranges"
        xeddataarea.executeAction(
            "TYPE", mkPropertyValues({"TEXT": "$Sheet1.$A$1:$B$7"}))
        xadd.executeAction("CLICK", tuple())
        #6. Click 'Options' > check 'Row labels' > click OK
        xbyrow.executeAction("CLICK", tuple())
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #verify
        self.assertEqual(
            get_cell_by_position(document, 0, 3, 0).getString(), "A 1")
        self.assertEqual(
            get_cell_by_position(document, 0, 3, 1).getString(), "AB 1")
        self.assertEqual(
            get_cell_by_position(document, 0, 3, 2).getString(), "AB 12")
        self.assertEqual(
            get_cell_by_position(document, 0, 3, 3).getString(), "AB 123")
        self.assertEqual(
            get_cell_by_position(document, 0, 3, 4).getString(), "ABC 1")

        self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 1)
        self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 2)
        self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 2)
        self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 1)
        self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 1)
        self.ui_test.close_doc()


# vim: set shiftwidth=4 softtabstop=4 expandtab:
Пример #22
0
    def test_load_file(self):

        calc_file = self.ui_test.load_file(get_url_for_data_file("test.ods"))

        calc_file2 = self.ui_test.load_file(get_url_for_data_file("test2.ods"))

        frames = self.ui_test.get_frames()
        self.assertEqual(len(frames), 2)

        self.ui_test.close_doc()

        frames = self.ui_test.get_frames()
        self.assertEqual(len(frames), 1)

        # this is currently still necessary as otherwise
        # the command is not forwarded to the correct frame
        # TODO: provide an additional event that we can use
        #       and get rid of the sleep
        time.sleep(1)

        self.ui_test.close_doc()
Пример #23
0
    def test_tdf130770_autofilter(self):
        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("tdf130770.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()

        # 1. open attached file and check initial state
        self.assertFalse(is_row_hidden(calc_doc, 0))
        self.assertFalse(is_row_hidden(calc_doc, 1))
        self.assertTrue(is_row_hidden(calc_doc, 2))
        self.assertFalse(is_row_hidden(calc_doc, 3))
        self.assertFalse(is_row_hidden(calc_doc, 4))

        # 2. open filter of column A  and cancel
        gridwin.executeAction(
            "LAUNCH",
            mkPropertyValues({
                "AUTOFILTER": "",
                "COL": "0",
                "ROW": "0"
            }))
        xFloatWindow = self.xUITest.getFloatWindow()

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

        self.assertFalse(is_row_hidden(calc_doc, 0))
        self.assertFalse(is_row_hidden(calc_doc, 1))
        self.assertTrue(is_row_hidden(calc_doc, 2))
        self.assertFalse(is_row_hidden(calc_doc, 3))
        self.assertFalse(is_row_hidden(calc_doc, 4))

        # 3. open filter of column A  and just click OK
        gridwin.executeAction(
            "LAUNCH",
            mkPropertyValues({
                "AUTOFILTER": "",
                "COL": "0",
                "ROW": "0"
            }))
        xFloatWindow = self.xUITest.getFloatWindow()

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

        self.assertFalse(is_row_hidden(calc_doc, 0))
        self.assertFalse(is_row_hidden(calc_doc, 1))
        self.assertTrue(is_row_hidden(calc_doc, 2))
        self.assertFalse(is_row_hidden(calc_doc, 3))
        self.assertTrue(is_row_hidden(calc_doc, 4))  # filtered out

        self.ui_test.close_doc()
Пример #24
0
    def test_tdf133855(self):

        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("tdf133855.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        document = self.ui_test.get_component()

        results = ['A', 'B', 'C', 'D', 'E', 'F']

        # Conditional formatted dropdown list
        for i in range(len(results)):
            gridwin = xCalcDoc.getChild("grid_window")
            gridwin.executeAction(
                "LAUNCH",
                mkPropertyValues({
                    "SELECTMENU": "",
                    "COL": "6",
                    "ROW": "5"
                }))

            #Select the TreeList UI Object
            xWin = self.xUITest.getTopFocusWindow()
            xlist = xWin.getChild("list")

            xListItem = xlist.getChild(str(i))
            xListItem.executeAction("DOUBLECLICK", mkPropertyValues({}))
            self.assertEqual(
                get_cell_by_position(document, 0, 6, 5).getString(),
                results[i])

        # normal dropdown list
        for i in range(len(results)):
            gridwin = xCalcDoc.getChild("grid_window")
            gridwin.executeAction(
                "LAUNCH",
                mkPropertyValues({
                    "SELECTMENU": "",
                    "COL": "6",
                    "ROW": "6"
                }))

            #Select the TreeList UI Object
            xWin = self.xUITest.getTopFocusWindow()
            xlist = xWin.getChild("list")

            xListItem = xlist.getChild(str(i))
            xListItem.executeAction("DOUBLECLICK", mkPropertyValues({}))
            self.assertEqual(
                get_cell_by_position(document, 0, 6, 6).getString(),
                results[i])

        self.ui_test.close_doc()
Пример #25
0
    def test_td85979_text_to_columns(self):
        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("tdf85979.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()

        #(I selected C1 to C5, then Text to Columns, unselected "Tab" and selected "Space")
        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:C5"}))
        # Data - Text to Columns
        self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
        xDialog = self.xUITest.getTopFocusWindow()
        xspace = xDialog.getChild("space")
        if (get_state_as_dict(xspace)["Selected"]) == "false":
            xspace.executeAction("CLICK", tuple())
        # Click Ok
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)

        #Verify
        self.assertEqual(
            get_cell_by_position(document, 0, 2, 0).getValue(), 99)
        self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 4)
        self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 9)
        self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 9)
        self.assertEqual(
            get_cell_by_position(document, 0, 3, 0).getValue(), 260)
        self.assertEqual(
            get_cell_by_position(document, 0, 3, 1).getValue(), 10)
        self.assertEqual(
            get_cell_by_position(document, 0, 3, 2).getValue(), 23)
        self.assertEqual(
            get_cell_by_position(document, 0, 3, 3).getValue(), 23)
        self.assertEqual(
            get_cell_by_position(document, 0, 4, 0).getValue(), 149)
        self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 6)
        self.assertEqual(
            get_cell_by_position(document, 0, 4, 2).getValue(), 14)
        self.assertEqual(
            get_cell_by_position(document, 0, 4, 3).getValue(), 14)
        self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 0)
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 1).getValue(), 16)
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 2).getValue(), 35)
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 3).getValue(), 35)

        self.ui_test.close_doc()


# vim: set shiftwidth=4 softtabstop=4 expandtab:
Пример #26
0
    def test_tdf120348(self):

        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("tdf120348.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()

        xFirstMatrix = []
        for row in range(1, 159):
            xRow = []
            for column in range(5, 9):
                xRow.append(
                    round(
                        get_cell_by_position(document, 0, column,
                                             row).getValue(), 5))
            xFirstMatrix.append(xRow)

        gridwin.executeAction("SELECT",
                              mkPropertyValues({"OBJECT": "Object 2"}))

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

        self.ui_test.close_doc()

        self.ui_test.load_empty_file("calc")
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()

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

        xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data

        columnNames = ('Finland', 'Sweden', 'Poland', '')
        self.assertEqual(columnNames, xData.ColumnDescriptions)

        xSecondMatrix = []
        for row in xData.Data:
            xRow = []
            for value in row:
                xRow.append(round(value, 5))
            xSecondMatrix.append(xRow)

        # Without the fix in place, this test would have failed with
        # First differing element 51:
        # [3.31618, 3.65089, 3.33626, 0.0]
        # [3.31618, 3.65089, 0.0, 0.0]

        self.assertEqual(xFirstMatrix, xSecondMatrix)

        self.ui_test.close_doc()
Пример #27
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")
        xToolBar = xNavigatorPanel.getChild("content5")
        xToolBar.executeAction("CLICK",
                               mkPropertyValues({"POS": "0"}))  # 'root' button

        xWriterEdit.executeAction("FOCUS", tuple())

        xContentTree = xNavigatorPanel.getChild("contenttree")

        self.ui_test.wait_until_property_is_updated(xContentTree,
                                                    "SelectEntryText",
                                                    "HEADING 1")
        self.assertEqual(
            get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 1")
        self.assertEqual(
            get_state_as_dict(xContentTree)["SelectionCount"], "1")
        for _ in range(0, 3):
            xWriterEdit.executeAction("TYPE",
                                      mkPropertyValues({"KEYCODE": "DOWN"}))

        self.ui_test.wait_until_property_is_updated(xContentTree,
                                                    "SelectEntryText",
                                                    "HEADING 4")
        self.assertEqual(
            get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 4")
        self.assertEqual(
            get_state_as_dict(xContentTree)["SelectionCount"], "1")

        for _ in range(0, 3):
            xWriterEdit.executeAction("TYPE",
                                      mkPropertyValues({"KEYCODE": "UP"}))

        self.ui_test.wait_until_property_is_updated(xContentTree,
                                                    "SelectEntryText",
                                                    "HEADING 1")
        self.assertEqual(
            get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 1")
        self.assertEqual(
            get_state_as_dict(xContentTree)["SelectionCount"], "1")

        self.xUITest.executeCommand(".uno:Sidebar")
        self.ui_test.close_doc()
Пример #28
0
    def testPdfSigning(self):
        # Start Impress.
        impress_doc = self.ui_test.load_file(get_url_for_data_file("pdf-sign.pdf"))
        doc = self.xUITest.getTopFocusWindow()

        # Now use File -> Digital signatures -> Digital signatures.
        self.ui_test.execute_dialog_through_command(".uno:Signature")
        xDialog = self.xUITest.getTopFocusWindow()
        # Without the accompanying fix in place, this test would have failed with:
        # uno.com.sun.star.uno.RuntimeException: Could not find child with id: close vcl/source/uitest/uiobject.cxx:452
        self.ui_test.close_dialog_through_button(xDialog.getChild("close"))

        self.ui_test.close_doc()
Пример #29
0
    def test_tdf120731_crash_open_char_dialog(self):
        writer_doc = self.ui_test.load_file(
            get_url_for_data_file("tdf120731.odt"))
        document = self.ui_test.get_component()
        xWriterDoc = self.xUITest.getTopFocusWindow()

        self.xUITest.executeCommand(".uno:SelectAll")
        self.ui_test.execute_dialog_through_command(".uno:FontDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xOK = xDialog.getChild("ok")
        xOK.executeAction("CLICK", tuple())
        self.assertEqual(document.Text.String[0:5], "Lorem")
        self.ui_test.close_doc()
Пример #30
0
    def test_tdf134243(self):
        writer_doc = self.ui_test.load_file(
            get_url_for_data_file("tdf134243.odt"))

        # Without the fix in place, it would hung launching the mailmerge wizard
        self.ui_test.execute_dialog_through_command(".uno:MailMergeWizard")

        xDialog = self.xUITest.getTopFocusWindow()

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

        self.ui_test.close_doc()