Beispiel #1
0
    def test_tdf132169(self):

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

        #set measurement to points
        change_measurement_unit(self, "Point")

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

        #wait until the toolbar is available
        xLineMetric = self.ui_test.wait_until_child_is_available('metricfield')
        self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "0.0 pt")

        #Check changing value from dialog also works
        self.ui_test.execute_dialog_through_command(".uno:FormatLine")
        xFormatLineDlg = self.xUITest.getTopFocusWindow()
        xWidth = xFormatLineDlg.getChild('MTR_FLD_LINE_WIDTH')
        type_text(xWidth, "4.0")
        xOKBtn = xFormatLineDlg.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

        self.ui_test.wait_until_property_is_updated(xLineMetric, "Text",
                                                    "4.0 pt")
        self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "4.0 pt")

        xLineMetric.executeAction("UP", tuple())

        document = self.ui_test.get_component()
        drawPage = document.getDrawPages().getByIndex(0)
        shape = drawPage.getByIndex(0)

        #Without the fix in place, it would have been 310
        self.assertEqual(shape.LineWidth, 176)

        self.ui_test.close_doc()
Beispiel #2
0
    def test_tdf99711(self):

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

        #set measurement to millimeters
        change_measurement_unit(self, "Millimeter")

        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()
Beispiel #3
0
    def test_tdf138546(self):
        self.ui_test.load_file(get_url_for_data_file("tdf138546.odt"))
        xWriterDoc = self.xUITest.getTopFocusWindow()

        change_measurement_unit(self, "Centimeter")

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

        colsnf = xDialog.getChild("colsnf")
        width1mf = xDialog.getChild("width1mf")
        self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
        self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3],
                         "2.0")  #2.00 cm
        xOKBtn = xDialog.getChild("cancel")
        self.ui_test.close_dialog_through_button(xOKBtn)

        self.ui_test.execute_dialog_through_command(".uno:PageDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        tabcontrol = xDialog.getChild("tabcontrol")
        select_pos(tabcontrol, "7")  #Columns
        colsnf = xDialog.getChild("colsnf")
        width1mf = xDialog.getChild("width1mf")
        self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
        self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3],
                         "2.0")  #2.00 cm
        xOKBtn = xDialog.getChild("cancel")
        self.ui_test.close_dialog_through_button(xOKBtn)

        self.ui_test.close_doc()
Beispiel #4
0
    def test_tdf126673_auto_fit_row_height(self):
        calc_doc = self.ui_test.load_file(
            get_url_for_data_file("tdf126673.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()

        change_measurement_unit(self, "Centimeter")

        #select A2
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
        #optimal row height
        self.ui_test.execute_dialog_through_command(".uno:SetOptimalRowHeight")
        xDialog = self.xUITest.getTopFocusWindow()
        # Click Ok
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)
        #select A2
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
        #row height
        self.ui_test.execute_dialog_through_command(".uno:RowHeight")
        xDialog = self.xUITest.getTopFocusWindow()
        xvalue = xDialog.getChild("value")
        heightStrOrig = get_state_as_dict(xvalue)["Text"]
        heightVal = heightStrOrig[:4]  #default 0.45 cm,
        self.assertEqual(heightVal > '0.45',
                         True)  #new value is bigger then default
        # Click Ok
        xcancel = xDialog.getChild("cancel")
        self.ui_test.close_dialog_through_button(xcancel)

        self.ui_test.close_doc()
Beispiel #5
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()
Beispiel #6
0
    def test_tdf137397(self):

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

        change_measurement_unit(self, 'Centimeter')

        xCalcDoc = self.xUITest.getTopFocusWindow()
        xGridWin = xCalcDoc.getChild("grid_window")

        xGridWin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Shape"}))

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

        xCalcDoc = self.xUITest.getTopFocusWindow()

        self.ui_test.wait_until_child_is_available(xCalcDoc, 'selectwidth')
        self.assertEqual(
            get_state_as_dict(xCalcDoc.getChild('selectwidth'))['Text'],
            '6.00 cm')

        # Without the fix in place, this test would have failed with
        # AssertionError: '-14,585,309.84 cm' != '2.00 cm'
        self.ui_test.wait_until_child_is_available(xCalcDoc, 'selectheight')
        self.assertEqual(
            get_state_as_dict(xCalcDoc.getChild('selectheight'))['Text'],
            '2.00 cm')

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

        self.ui_test.close_doc()
Beispiel #7
0
    def test_tdf128431_pageFormat_sync_padding(self):
        self.ui_test.create_doc_in_start_center("writer")
        document = self.ui_test.get_component()

        change_measurement_unit(self, "Centimeter")

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

        sync = xDialog.getChild("sync")
        bottomft = xDialog.getChild("bottommf")
        topft = xDialog.getChild("topmf")
        rightft = xDialog.getChild("rightmf")
        leftft = xDialog.getChild("leftmf")

        self.assertEqual(get_state_as_dict(sync)["Selected"], "true")
        bottomft.executeAction("UP", tuple())
        self.assertEqual(get_state_as_dict(bottomft)["Text"], "0.10 cm")
        self.assertEqual(get_state_as_dict(topft)["Text"], "0.10 cm")
        self.assertEqual(get_state_as_dict(rightft)["Text"], "0.10 cm")
        self.assertEqual(get_state_as_dict(leftft)["Text"], "0.10 cm")

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

        self.ui_test.close_doc()
Beispiel #8
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")

        select_pos(xStyle, "1")
        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()
Beispiel #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()
Beispiel #10
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()
Beispiel #11
0
    def test_minimal_border_width(self):
        #borderpage.ui, tdf#137790
        calc_doc = self.ui_test.create_doc_in_start_center("calc")
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()

        #set points pt measurement
        change_measurement_unit(self, "Point")

        #select cell A1
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        #format - cell
        self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "5")  #tab Borders

        linewidthmf = xDialog.getChild("linewidthmf")
        xLineSet = xDialog.getChild('lineset')

        # check line-width for default solid line
        self.assertEqual('0', get_state_as_dict(xLineSet)['SelectedItemPos'])
        widthVal = get_state_as_dict(linewidthmf)["Text"]
        self.assertEqual(widthVal, '0.75 pt')

        # set line style to "double" (minimal width is taken)
        xLineSet.executeAction("CHOOSE", mkPropertyValues({"POS": '16'}))
        widthVal = get_state_as_dict(linewidthmf)["Text"]
        self.assertEqual(widthVal, '1.10 pt')

        # set line style to "solid"
        xLineSet.executeAction("CHOOSE", mkPropertyValues({"POS": "1"}))
        widthVal = get_state_as_dict(linewidthmf)["Text"]
        self.assertEqual(widthVal, '0.75 pt')

        # make custom line width
        linewidthmf.executeAction("UP", tuple())
        linewidthmf.executeAction("UP", tuple())
        linewidthmf.executeAction("UP", tuple())
        widthVal = get_state_as_dict(linewidthmf)["Text"]
        self.assertEqual(widthVal, '1.50 pt')

        # set line style to "double" (minimal width is not taken)
        xLineSet.executeAction("CHOOSE", mkPropertyValues({"POS": "8"}))
        widthVal = get_state_as_dict(linewidthmf)["Text"]
        self.assertEqual(widthVal, '1.50 pt')

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

        self.ui_test.close_doc()
Beispiel #12
0
    def test_tdf139486(self):

        # Reuse file from another test
        self.ui_test.load_file(get_url_for_data_file("tdf140198.odt"))

        change_measurement_unit(self, "Centimeter")

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

        document = self.ui_test.get_component()
        drawPage = document.getDrawPages().getByIndex(0)
        shape = drawPage.getByIndex(0)
        self.assertEqual(13996, shape.getSize().Width)
        self.assertEqual(2408, shape.getSize().Height)

        self.ui_test.execute_modeless_dialog_through_command(
            ".uno:ControlProperties")
        xWidth = self.ui_test.wait_until_child_is_available(
            'numericfield-Width')
        xHeight = self.ui_test.wait_until_child_is_available(
            'numericfield-Height')

        self.assertEqual("14.00 cm", get_state_as_dict(xWidth)['Text'])
        self.assertEqual("2.41 cm", get_state_as_dict(xHeight)['Text'])

        xWidth.executeAction("FOCUS", tuple())
        xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE":
                                                       "BACKSPACE"}))
        xWidth.executeAction("TYPE", mkPropertyValues({"TEXT": "20 cm"}))

        self.assertEqual("20 cm", get_state_as_dict(xWidth)['Text'])

        xHeight.executeAction("FOCUS", tuple())
        xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xHeight.executeAction("TYPE",
                              mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        xHeight.executeAction("TYPE", mkPropertyValues({"TEXT": "5 cm"}))

        self.assertEqual("5 cm", get_state_as_dict(xHeight)['Text'])

        # Move the focus to another element so the changes done before take effect on the document
        xDialog = self.xUITest.getTopFocusWindow()
        xDialog.getChild('numericfield-PositionY').executeAction(
            "FOCUS", tuple())

        # Without the fix in place, the size of the form wouldn't have changed
        self.assertEqual(20001, shape.getSize().Width)
        self.assertEqual(5001, shape.getSize().Height)

        self.ui_test.close_doc()
Beispiel #13
0
    def test_tdf82616(self):
        self.ui_test.create_doc_in_start_center("impress")

        xTemplateDlg = self.xUITest.getTopFocusWindow()
        xCancelBtn = xTemplateDlg.getChild("close")
        self.ui_test.close_dialog_through_button(xCancelBtn)

        change_measurement_unit(self, 'Centimeter')

        xImpressDoc = self.xUITest.getTopFocusWindow()

        document = self.ui_test.get_component()
        self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X)
        self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y)
        self.assertEqual(1400, document.DrawPages[0].getByIndex(1).Position.X)
        self.assertEqual(3685, document.DrawPages[0].getByIndex(1).Position.Y)

        self.assertIsNone(document.CurrentSelection)

        xEditWin = xImpressDoc.getChild("impress_win")
        xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"}))
        self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())

        xEditWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PosSizePropertyPanel"}))

        xHorizontalPos = xImpressDoc.getChild("horizontalpos")
        self.ui_test.wait_until_property_is_updated(xHorizontalPos, "Value", "1.4")
        self.assertEqual("1.4", get_state_as_dict(xHorizontalPos)['Value'])

        xVerticalPos = xImpressDoc.getChild("verticalpos")
        self.ui_test.wait_until_property_is_updated(xVerticalPos, "Value", "3.69")
        self.assertEqual("3.69", get_state_as_dict(xVerticalPos)['Value'])

        xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1")
        xDrawinglayerObject.executeAction("MOVE", mkPropertyValues({"X": "-5000", "Y":"-10000"}))

        self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X)
        self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y)
        self.assertEqual(-3600, document.DrawPages[0].getByIndex(1).Position.X)
        self.assertEqual(-6315, document.DrawPages[0].getByIndex(1).Position.Y)

        # Without the fix in place, this test would have failed with
        # AssertionError: '-3.6' != '0'
        self.ui_test.wait_until_property_is_updated(xHorizontalPos, "Value", "-3.6")
        self.assertEqual("-3.6", get_state_as_dict(xHorizontalPos)['Value'])

        self.ui_test.wait_until_property_is_updated(xVerticalPos, "Value", "-6.32")
        self.assertEqual("-6.32", get_state_as_dict(xVerticalPos)['Value'])

        self.ui_test.close_doc()
Beispiel #14
0
    def test_bullets_and_numbering_tab_move(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")

        change_measurement_unit(self, "Millimeter")

        self.ui_test.execute_dialog_through_command(
            ".uno:BulletsAndNumberingDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "4")
        xindentatmf = xDialog.getChild("indentatmf")
        indentValue = get_state_as_dict(xindentatmf)["Text"][
            0:len(get_state_as_dict(xindentatmf)["Text"]) - 3]

        xokbtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xokbtn)  #create bullets

        xWriterEdit.executeAction("TYPE", mkPropertyValues(
            {"KEYCODE": "TAB"}))  #TAB to move indent right
        self.ui_test.execute_dialog_through_command(
            ".uno:BulletsAndNumberingDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "4")
        xindentatmf = xDialog.getChild("indentatmf")
        indentValue2 = get_state_as_dict(xindentatmf)["Text"][
            0:len(get_state_as_dict(xindentatmf)["Text"]) - 3]
        self.assertEqual(indentValue < indentValue2, True)
        xcancbtn = xDialog.getChild("cancel")
        self.ui_test.close_dialog_through_button(xcancbtn)

        xWriterEdit.executeAction("TYPE",
                                  mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        self.ui_test.execute_dialog_through_command(
            ".uno:BulletsAndNumberingDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "4")
        xindentatmf = xDialog.getChild("indentatmf")
        indentValue3 = get_state_as_dict(xindentatmf)["Text"][
            0:len(get_state_as_dict(xindentatmf)["Text"]) - 3]
        self.assertEqual(indentValue == indentValue3, True)
        xcancbtn = xDialog.getChild("cancel")
        self.ui_test.close_dialog_through_button(xcancbtn)

        self.ui_test.close_doc()
Beispiel #15
0
    def test_tdf139511(self):
        self.ui_test.create_doc_in_start_center("impress")
        xTemplateDlg = self.xUITest.getTopFocusWindow()
        xCancelBtn = xTemplateDlg.getChild("close")
        self.ui_test.close_dialog_through_button(xCancelBtn)

        change_measurement_unit(self, "Centimeter")

        self.xUITest.executeCommand(
            ".uno:InsertTable?Columns:short=4&Rows:short=4")

        document = self.ui_test.get_component()
        self.assertEqual(8004,
                         document.DrawPages[0].getByIndex(2).BoundRect.Height)
        self.assertEqual(14104,
                         document.DrawPages[0].getByIndex(2).BoundRect.Width)

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

        xDialog = self.xUITest.getTopFocusWindow()

        xWidth = xDialog.getChild('MTR_FLD_WIDTH')
        xHeight = xDialog.getChild('MTR_FLD_HEIGHT')

        xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE":
                                                       "BACKSPACE"}))
        xWidth.executeAction("TYPE", mkPropertyValues({"TEXT": "10"}))

        xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xHeight.executeAction("TYPE",
                              mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        xHeight.executeAction("TYPE", mkPropertyValues({"TEXT": "5"}))

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

        document = self.ui_test.get_component()

        # Without the fix in place, this test would have failed with
        # AssertionError: 5005 != 8004
        self.assertEqual(5005,
                         document.DrawPages[0].getByIndex(2).BoundRect.Height)
        self.assertEqual(10005,
                         document.DrawPages[0].getByIndex(2).BoundRect.Width)

        self.ui_test.close_doc()
Beispiel #16
0
    def test_column_width(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()

        change_measurement_unit(self, "Centimeter")

        #select A1
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        #column width
        self.ui_test.execute_dialog_through_command(".uno:ColumnWidth")
        xDialog = self.xUITest.getTopFocusWindow()
        xvalue = xDialog.getChild("value")
        xdefault = xDialog.getChild("default")
        self.assertEqual(get_state_as_dict(xdefault)["Selected"],
                         "true")  #default selected
        heightStrOrig = get_state_as_dict(xvalue)["Text"]
        heightVal = heightStrOrig[:4]  #default 2.26 cm
        xvalue.executeAction("UP", tuple())  #2.36 cm
        heightStr = get_state_as_dict(xvalue)["Text"]
        heightValNew = heightStr[:4]
        self.assertEqual(get_state_as_dict(xdefault)["Selected"],
                         "false")  #default not selected
        self.assertEqual(heightValNew > heightVal, True)  #new value is bigger
        xdefault.executeAction("CLICK", tuple())  #click default
        self.assertEqual(
            get_state_as_dict(xvalue)["Text"] == heightStrOrig,
            True)  #default value set
        #write your own value
        xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":
                                                       "BACKSPACE"}))
        xvalue.executeAction("TYPE", mkPropertyValues({"TEXT": "1 cm"}))
        # Click Ok
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)
        #verify
        self.ui_test.execute_dialog_through_command(".uno:ColumnWidth")
        xDialog = self.xUITest.getTopFocusWindow()
        xvalue = xDialog.getChild("value")
        self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm")
        xCancel = xDialog.getChild("cancel")
        self.ui_test.close_dialog_through_button(xCancel)

        self.ui_test.close_doc()
Beispiel #17
0
    def test_bullets_and_numbering_button_move(self):
        self.ui_test.create_doc_in_start_center("writer")
        document = self.ui_test.get_component()
        xWriterDoc = self.xUITest.getTopFocusWindow()

        change_measurement_unit(self, "Millimeter")

        self.ui_test.execute_dialog_through_command(
            ".uno:BulletsAndNumberingDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "4")
        xindentatmf = xDialog.getChild("indentatmf")
        indentValue = get_state_as_dict(xindentatmf)["Text"][
            0:len(get_state_as_dict(xindentatmf)["Text"]) - 3]

        xokbtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xokbtn)  #create bullets

        self.xUITest.executeCommand(".uno:DecrementSubLevels")
        self.ui_test.execute_dialog_through_command(
            ".uno:BulletsAndNumberingDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "4")
        xindentatmf = xDialog.getChild("indentatmf")
        indentValue2 = get_state_as_dict(xindentatmf)["Text"][
            0:len(get_state_as_dict(xindentatmf)["Text"]) - 3]
        self.assertEqual(indentValue < indentValue2, True)
        xcancbtn = xDialog.getChild("cancel")
        self.ui_test.close_dialog_through_button(xcancbtn)

        self.xUITest.executeCommand(".uno:IncrementLevel")
        self.ui_test.execute_dialog_through_command(
            ".uno:BulletsAndNumberingDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "4")
        xindentatmf = xDialog.getChild("indentatmf")
        indentValue3 = get_state_as_dict(xindentatmf)["Text"][
            0:len(get_state_as_dict(xindentatmf)["Text"]) - 3]
        self.assertEqual(indentValue == indentValue3, True)
        xcancbtn = xDialog.getChild("cancel")
        self.ui_test.close_dialog_through_button(xcancbtn)

        self.ui_test.close_doc()
Beispiel #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()

        change_measurement_unit(self, "Centimeter")

        #select A3
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"}))
        #row height
        self.ui_test.execute_dialog_through_command(".uno:RowHeight")
        xDialog = self.xUITest.getTopFocusWindow()
        xvalue = xDialog.getChild("value")
        xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":
                                                       "BACKSPACE"}))
        xvalue.executeAction("TYPE", mkPropertyValues({"TEXT": "1 cm"}))
        # Click Ok
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)
        #select row 3
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"}))
        self.xUITest.executeCommand(".uno:SelectRow")
        #insert rows below
        self.xUITest.executeCommand(".uno:InsertRowsAfter")

        #verify
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"}))
        self.ui_test.execute_dialog_through_command(".uno:RowHeight")
        xDialog = self.xUITest.getTopFocusWindow()
        xvalue = xDialog.getChild("value")
        self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.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()
Beispiel #19
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()

        change_measurement_unit(self, "Centimeter")

        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()
Beispiel #20
0
    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()

        change_measurement_unit(self, "Millimeter")

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

        xalignedatmf.executeAction("UP", tuple())
        select_by_text(xnum2alignlb, "Centered")
        xatmf.executeAction("UP", tuple())
        xindentatmf.executeAction("UP", tuple())

        self.ui_test.close_dialog_through_button(xokbtn)

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

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

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

        self.ui_test.close_doc()
Beispiel #21
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()

        change_measurement_unit(self, "Centimeter")

        #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("cancel")
        self.ui_test.close_dialog_through_button(xOKBtn)

        self.ui_test.close_doc()
    def test_tdf134881(self):
        writer_doc = self.ui_test.load_file(
            get_url_for_data_file("tdf134881_colProportionalAdjust.odt"))
        document = self.ui_test.get_component()
        xWriterDoc = self.xUITest.getTopFocusWindow()

        change_measurement_unit(self, "Centimeter")

        #dialog Table Properties
        self.ui_test.execute_dialog_through_command(".uno:TableDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        tabcontrol = xDialog.getChild("tabcontrol")
        select_pos(tabcontrol, "2")  #columns

        adaptcolumns = xDialog.getChild("adaptcolumns")
        width1 = xDialog.getChild("width1")
        width2 = xDialog.getChild("width2")
        # Get the baseline. The first column is much shorter than the second.
        self.assertEqual((get_state_as_dict(width1)["Text"])[0:3], "3.0")
        self.assertEqual((get_state_as_dict(width2)["Text"])[0:4], "14.0")
        # Set proportional adjust - so all columns are affected.
        adaptcolumns.executeAction("CLICK", tuple())
        # Cut the second column in half.
        width2.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"}))
        width2.executeAction("TYPE", mkPropertyValues({"KEYCODE":
                                                       "BACKSPACE"}))
        width2.executeAction("TYPE", mkPropertyValues({"TEXT": "7"}))
        width2.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))

        # The first column should now be half it's original value, not zero (not 3 - 7)
        self.assertEqual((get_state_as_dict(width1)["Text"])[0:2], "1.")  #1.5

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

        self.ui_test.close_doc()
Beispiel #23
0
   def test_chart_x_axis_dialog(self):
    calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf122398.ods"))
    xCalcDoc = self.xUITest.getTopFocusWindow()
    gridwin = xCalcDoc.getChild("grid_window")
    document = self.ui_test.get_component()

    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")
    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 "Scale".
    tabcontrol = xDialog.getChild("tabcontrol")
    select_pos(tabcontrol, "0")

    reverseDirection = xDialog.getChild("CBX_REVERSE")
    logarithmicScale = xDialog.getChild("CBX_LOGARITHM")
    autoMinimum = xDialog.getChild("CBX_AUTO_MIN")
    autoMaximum = xDialog.getChild("CBX_AUTO_MAX")
    majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN")
    minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP")
    minimum = xDialog.getChild("EDT_MIN")
    maximum = xDialog.getChild("EDT_MAX")
    major = xDialog.getChild("EDT_STEP_MAIN")
    minor = xDialog.getChild("MT_STEPHELP")

    reverseDirection.executeAction("CLICK", tuple())
    logarithmicScale.executeAction("CLICK", tuple())
    autoMinimum.executeAction("CLICK", tuple())
    autoMaximum.executeAction("CLICK", tuple())
    majorInterval.executeAction("CLICK", tuple())
    minorInterval.executeAction("CLICK", tuple())

    minimum.executeAction("DOWN", tuple()) #10.12.2017
    maximum.executeAction("DOWN", tuple()) #29.04.2018
    major.executeAction("DOWN", tuple())   #19
    minor.executeAction("UP", tuple())  #3
    xOKBtn = xDialog.getChild("ok")
    self.ui_test.close_dialog_through_button(xOKBtn)

    #reopen and verify
    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()
    #Click on tab "Scale".
    tabcontrol = xDialog.getChild("tabcontrol")
    select_pos(tabcontrol, "0")

    reverseDirection = xDialog.getChild("CBX_REVERSE")
    logarithmicScale = xDialog.getChild("CBX_LOGARITHM")
    autoMinimum = xDialog.getChild("CBX_AUTO_MIN")
    autoMaximum = xDialog.getChild("CBX_AUTO_MAX")
    majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN")
    minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP")
    minimum = xDialog.getChild("EDT_MIN")
    maximum = xDialog.getChild("EDT_MAX")
    major = xDialog.getChild("EDT_STEP_MAIN")
    minor = xDialog.getChild("MT_STEPHELP")

    self.assertEqual(get_state_as_dict(reverseDirection)["Selected"], "true")
    self.assertEqual(get_state_as_dict(logarithmicScale)["Selected"], "true")
    self.assertEqual(get_state_as_dict(autoMinimum)["Selected"], "false")
    self.assertEqual(get_state_as_dict(autoMaximum)["Selected"], "false")
    self.assertEqual(get_state_as_dict(majorInterval)["Selected"], "false")
    self.assertEqual(get_state_as_dict(minorInterval)["Selected"], "false")
    self.assertEqual(get_state_as_dict(minimum)["Text"], "10.12.2017")
    self.assertEqual(get_state_as_dict(maximum)["Text"], "29.04.2018")
    self.assertEqual(get_state_as_dict(major)["Text"], "19")
    self.assertEqual(get_state_as_dict(minor)["Text"], "3")

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

    props = {"TEXT": "Start"}
    actionProps = mkPropertyValues(props)
    crossAxis.executeAction("SELECT", actionProps)
    props2 = {"TEXT": "Outside end"}
    actionProps2 = mkPropertyValues(props2)
    placeLabels.executeAction("SELECT", actionProps2)
    innerMajorTick.executeAction("CLICK", tuple())
    outerMajorTick.executeAction("CLICK", tuple())
    innerMinorTick.executeAction("CLICK", tuple())
    outerMinorTick.executeAction("CLICK", tuple())
    props3 = {"TEXT": "At axis"}
    actionProps3 = mkPropertyValues(props3)
    placeMarks.executeAction("SELECT", actionProps3)

    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"], "Start")
    self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end")
    self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true")
    self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false")
    self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true")
    self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true")
    self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis")
    #change tab "positioning".
    props = {"TEXT": "Value"}
    actionProps = mkPropertyValues(props)
    crossAxis.executeAction("SELECT", actionProps)
    crossAxisValue.executeAction("UP", 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")
    self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end")
    self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true")
    self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false")
    self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true")
    self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true")
    self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis")
    #change tab "Line".
    select_pos(tabcontrol, "2")

    xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
    transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")

    xWidth.executeAction("UP", tuple())
    transparency.executeAction("UP", tuple())

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

    #reopen and verify tab "Line".
    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, "2")

    xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
    transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")

    self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
    self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")

    #change tab "Label"
    tabcontrol = xDialog.getChild("tabcontrol")
    select_pos(tabcontrol, "3")

    tile = xDialog.getChild("tile")
    overlapCB = xDialog.getChild("overlapCB")
    breakCB = xDialog.getChild("breakCB")
    stackedCB = xDialog.getChild("stackedCB")
    textdirLB = xDialog.getChild("textdirLB")

    tile.executeAction("CLICK", tuple())
    overlapCB.executeAction("CLICK", tuple())
    breakCB.executeAction("CLICK", tuple())
    stackedCB.executeAction("CLICK", tuple())
    props = {"TEXT": "Right-to-left"}
    actionProps = mkPropertyValues(props)
    textdirLB.executeAction("SELECT", actionProps)

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

    #reopen and verify tab "Label".
    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, "3")

    tile = xDialog.getChild("tile")
    overlapCB = xDialog.getChild("overlapCB")
    breakCB = xDialog.getChild("breakCB")
    stackedCB = xDialog.getChild("stackedCB")
    textdirLB = xDialog.getChild("textdirLB")

    self.assertEqual(get_state_as_dict(tile)["Checked"], "true")
    self.assertEqual(get_state_as_dict(overlapCB)["Selected"], "true")
    self.assertEqual(get_state_as_dict(breakCB)["Selected"], "true")
    self.assertEqual(get_state_as_dict(stackedCB)["Selected"], "true")
    self.assertEqual(get_state_as_dict(textdirLB)["SelectEntryText"], "Right-to-left")

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

    self.ui_test.close_doc()
Beispiel #24
0
    def test_tdf117522_column_width_insert_left(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()

        change_measurement_unit(self, "Centimeter")

        #select C1
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"}))
        #column width
        self.ui_test.execute_dialog_through_command(".uno:ColumnWidth")
        xDialog = self.xUITest.getTopFocusWindow()
        xvalue = xDialog.getChild("value")
        xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":
                                                       "BACKSPACE"}))
        xvalue.executeAction("TYPE", mkPropertyValues({"TEXT": "1 cm"}))
        # Click Ok
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)
        #select D1
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
        #column width
        self.ui_test.execute_dialog_through_command(".uno:ColumnWidth")
        xDialog = self.xUITest.getTopFocusWindow()
        xvalue = xDialog.getChild("value")
        xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":
                                                       "BACKSPACE"}))
        xvalue.executeAction("TYPE", mkPropertyValues({"TEXT": "2 cm"}))
        # Click Ok
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)
        #select E1
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"}))
        #column width
        self.ui_test.execute_dialog_through_command(".uno:ColumnWidth")
        xDialog = self.xUITest.getTopFocusWindow()
        xvalue = xDialog.getChild("value")
        xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":
                                                       "BACKSPACE"}))
        xvalue.executeAction("TYPE", mkPropertyValues({"TEXT": "3 cm"}))
        # Click Ok
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)
        #select columns C-E
        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:E1"}))
        self.xUITest.executeCommand(".uno:SelectColumn")
        #Insert Columns Left
        self.xUITest.executeCommand(".uno:InsertColumnsBefore")
        #verify
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"}))
        self.ui_test.execute_dialog_through_command(".uno:ColumnWidth")
        xDialog = self.xUITest.getTopFocusWindow()
        xvalue = xDialog.getChild("value")
        self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm")
        xOK = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOK)

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

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

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

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

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

        self.ui_test.close_doc()
Beispiel #25
0
    def test_format_cell_borders_tab(self):
        #borderpage.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()

        #set points pt measurement
        change_measurement_unit(self, "Point")

        #select cell A1
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        #format - cell
        self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "5")  #tab Borders
        xsync = xDialog.getChild("sync")
        xleftmf = xDialog.getChild("leftmf")
        xrightmf = xDialog.getChild("rightmf")
        xtopmf = xDialog.getChild("topmf")
        xbottommf = xDialog.getChild("bottommf")

        xsync.executeAction("CLICK", tuple())  #uncheck Synchronize
        xleftmf.executeAction("UP", tuple())
        xrightmf.executeAction("UP", tuple())
        xrightmf.executeAction("UP", tuple())
        xtopmf.executeAction("UP", tuple())
        xtopmf.executeAction("UP", tuple())
        xtopmf.executeAction("UP", tuple())
        xbottommf.executeAction("UP", tuple())
        xbottommf.executeAction("UP", tuple())
        xbottommf.executeAction("UP", tuple())
        xbottommf.executeAction("UP", tuple())

        leftVal = get_state_as_dict(xleftmf)["Text"]
        rightVal = get_state_as_dict(xrightmf)["Text"]
        topVal = get_state_as_dict(xtopmf)["Text"]
        bottomVal = get_state_as_dict(xbottommf)["Text"]

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

        # Verify select cell A1
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        #format - cell
        self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xTabs = xDialog.getChild("tabcontrol")
        select_pos(xTabs, "5")  #tab Borders
        xsync = xDialog.getChild("sync")
        xleftmf = xDialog.getChild("leftmf")
        xrightmf = xDialog.getChild("rightmf")
        xtopmf = xDialog.getChild("topmf")
        xbottommf = xDialog.getChild("bottommf")

        self.assertEqual(get_state_as_dict(xsync)["Selected"], "false")
        self.assertEqual(get_state_as_dict(xleftmf)["Text"] == leftVal, True)
        self.assertEqual(get_state_as_dict(xrightmf)["Text"] == rightVal, True)
        self.assertEqual(get_state_as_dict(xtopmf)["Text"] == topVal, True)
        self.assertEqual(
            get_state_as_dict(xbottommf)["Text"] == bottomVal, True)

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

        self.ui_test.close_doc()
Beispiel #26
0
    def test_tdf137446(self):

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

        change_measurement_unit(self, "Centimeter")

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

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

        xDialog = self.xUITest.getTopFocusWindow()

        self.assertEqual(
            '10',
            get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
        self.assertEqual(
            '0',
            get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
        self.assertEqual(
            '5.51',
            get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
        self.assertEqual(
            '2.55',
            get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
        self.assertEqual(
            '0',
            get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])

        xDialog.getChild('MTR_FLD_WIDTH').executeAction("UP", tuple())

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

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

        xDialog = self.xUITest.getTopFocusWindow()

        self.assertEqual(
            '10.1',
            get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
        self.assertEqual(
            '0',
            get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
        self.assertEqual(
            '5.51',
            get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
        self.assertEqual(
            '2.55',
            get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])

        # Without the fix in place, this test would have failed with AssertionError: '0' != '180'
        self.assertEqual(
            '0',
            get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])

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

        self.ui_test.close_doc()
Beispiel #27
0
    def test_tdf135590(self):
        writer_doc = self.ui_test.create_doc_in_start_center("writer")

        #change measurement to Centimeter
        change_measurement_unit(self, 'Centimeter')

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

        xDialog = self.xUITest.getTopFocusWindow()

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

        xWidth = xDialog.getChild('width')
        xHeight = xDialog.getChild('height')
        xFormat = xDialog.getChild("format")

        select_by_text(xFormat, "C6 Envelope")

        self.assertEqual("16.2", get_state_as_dict(xWidth)['Value'])
        self.assertEqual("11.4", get_state_as_dict(xHeight)['Value'])

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

        # A new document is created
        xWriterDoc = self.xUITest.getTopFocusWindow()
        xWriterEdit = xWriterDoc.getChild("writer_edit")

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

        xWidth = xDialog.getChild('spinWidth')
        xHeight = xDialog.getChild('spinHeight')
        xFormatList = xDialog.getChild("comboPageFormat")

        # Without the fix in place, this test would have failed with
        # AssertionError: '16.2' != '11.4'
        self.assertEqual("16.2", get_state_as_dict(xWidth)['Value'])
        self.assertEqual("11.4", get_state_as_dict(xHeight)['Value'])
        self.assertEqual("User",
                         get_state_as_dict(xFormatList)['SelectEntryText'])

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

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

        xPaperSize = xWriterEdit.getChild('papersize')
        self.ui_test.wait_until_property_is_updated(xPaperSize,
                                                    "SelectEntryText", "User")
        self.assertEqual(
            get_state_as_dict(xPaperSize)['SelectEntryText'], "User")

        xPaperHeight = xWriterEdit.getChild('paperheight')
        self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text",
                                                    "11.40 cm")
        self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "11.40 cm")

        xPaperWidth = xWriterEdit.getChild('paperwidth')
        self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text",
                                                    "16.20 cm")
        self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "16.20 cm")

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

        self.ui_test.close_doc()
    def test_chapter_numbering_dialog(self):
        self.ui_test.create_doc_in_start_center("writer")
        document = self.ui_test.get_component()

        change_measurement_unit(self, "Millimeter")

        self.ui_test.execute_dialog_through_command(
            ".uno:ChapterNumberingDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xstyle = xDialog.getChild("style")
        xnumbering = xDialog.getChild("numbering")
        xcharstyle = xDialog.getChild("charstyle")
        xprefix = xDialog.getChild("prefix")
        xsuffix = xDialog.getChild("suffix")
        xstartat = xDialog.getChild("startat")
        xtab = xDialog.getChild("tabcontrol")
        #second tab
        xalignedatmf = xDialog.getChild("alignedatmf")
        xnum2alignlb = xDialog.getChild("num2alignlb")
        xnumfollowedbylb = xDialog.getChild("numfollowedbylb")
        xatmf = xDialog.getChild("atmf")
        xindentatmf = xDialog.getChild("indentatmf")
        select_pos(xtab, "0")  #first tab
        props = {"TEXT": "Heading"}
        actionProps = mkPropertyValues(props)
        xstyle.executeAction("SELECT", actionProps)
        props2 = {"TEXT": "1, 2, 3, ..."}
        actionProps2 = mkPropertyValues(props2)
        xnumbering.executeAction("SELECT", actionProps2)
        props3 = {"TEXT": "Bullets"}
        actionProps3 = mkPropertyValues(props3)
        xcharstyle.executeAction("SELECT", actionProps3)
        xprefix.executeAction("TYPE", mkPropertyValues({"TEXT": "A"}))
        xsuffix.executeAction("TYPE", mkPropertyValues({"TEXT": "B"}))
        xstartat.executeAction("UP", tuple())

        select_pos(xtab, "1")  #second tab Position
        xalignedatmf.executeAction("UP", tuple())
        props4 = {"TEXT": "Centered"}
        actionProps4 = mkPropertyValues(props4)
        xnum2alignlb.executeAction("SELECT", actionProps4)
        props5 = {"TEXT": "Tab stop"}
        actionProps5 = mkPropertyValues(props5)
        xnumfollowedbylb.executeAction("SELECT", actionProps5)
        xatmf.executeAction("UP", tuple())
        xindentatmf.executeAction("UP", tuple())

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

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

        xstyle = xDialog.getChild("style")
        xnumbering = xDialog.getChild("numbering")
        xcharstyle = xDialog.getChild("charstyle")
        xprefix = xDialog.getChild("prefix")
        xsuffix = xDialog.getChild("suffix")
        xstartat = xDialog.getChild("startat")
        xtab = xDialog.getChild("tabcontrol")
        #second tab
        xalignedatmf = xDialog.getChild("alignedatmf")
        xnum2alignlb = xDialog.getChild("num2alignlb")
        xnumfollowedbylb = xDialog.getChild("numfollowedbylb")
        xatmf = xDialog.getChild("atmf")
        xindentatmf = xDialog.getChild("indentatmf")
        select_pos(xtab, "0")
        self.assertEqual(
            get_state_as_dict(xstyle)["SelectEntryText"], "Heading")
        self.assertEqual(
            get_state_as_dict(xnumbering)["SelectEntryText"], "1, 2, 3, ...")
        self.assertEqual(
            get_state_as_dict(xcharstyle)["SelectEntryText"], "Bullets")
        self.assertEqual(get_state_as_dict(xprefix)["Text"], "A")
        self.assertEqual(get_state_as_dict(xsuffix)["Text"], "B")
        self.assertEqual(get_state_as_dict(xstartat)["Text"], "2")
        select_pos(xtab, "1")  #second tab Position
        self.assertEqual(get_state_as_dict(xalignedatmf)["Text"], "0.1 mm")
        self.assertEqual(
            get_state_as_dict(xnum2alignlb)["SelectEntryText"], "Centered")
        self.assertEqual(
            get_state_as_dict(xnumfollowedbylb)["SelectEntryText"], "Tab stop")
        self.assertEqual(get_state_as_dict(xatmf)["Text"], "0.1 mm")
        self.assertEqual(get_state_as_dict(xindentatmf)["Text"], "0.1 mm")
        xCancelBtn = xDialog.getChild("cancel")
        self.ui_test.close_dialog_through_button(xCancelBtn)

        self.ui_test.close_doc()
Beispiel #29
0
    def test_resize_object(self):
        self.ui_test.create_doc_in_start_center("impress")

        xTemplateDlg = self.xUITest.getTopFocusWindow()
        xCancelBtn = xTemplateDlg.getChild("close")
        self.ui_test.close_dialog_through_button(xCancelBtn)

        change_measurement_unit(self, 'Centimeter')

        xImpressDoc = self.xUITest.getTopFocusWindow()

        document = self.ui_test.get_component()
        self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width)
        self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height)
        self.assertEqual(25199, document.DrawPages[0].getByIndex(1).Size.Width)
        self.assertEqual(9134, document.DrawPages[0].getByIndex(1).Size.Height)

        xEditWin = xImpressDoc.getChild("impress_win")

        xDrawinglayerObject = xEditWin.getChild(
            "Unnamed Drawinglayer object 1")
        xDrawinglayerObject.executeAction(
            "RESIZE",
            mkPropertyValues({
                "X": "500",
                "Y": "4000",
                "FRAC_X": "0.5",
                "FRAC_Y": "0.5"
            }))

        self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width)
        self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height)
        self.assertEqual(12600, document.DrawPages[0].getByIndex(1).Size.Width)
        self.assertEqual(4568, document.DrawPages[0].getByIndex(1).Size.Height)

        self.assertIsNone(document.CurrentSelection)

        xEditWin.executeAction(
            "SELECT",
            mkPropertyValues({"OBJECT": "Unnamed Drawinglayer object 1"}))
        self.assertEqual("com.sun.star.drawing.SvxShapeCollection",
                         document.CurrentSelection.getImplementationName())

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

        xDialog = self.xUITest.getTopFocusWindow()

        self.assertEqual(
            '12.6',
            get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
        self.assertEqual(
            '4.57',
            get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
        self.assertEqual(
            '0.95',
            get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
        self.assertEqual(
            '3.84',
            get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
        self.assertEqual(
            '0',
            get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])

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

        self.assertEqual("com.sun.star.drawing.SvxShapeCollection",
                         document.CurrentSelection.getImplementationName())
        xEditWin.executeAction("DESELECT", tuple())
        self.assertIsNone(document.CurrentSelection)

        self.ui_test.close_doc()
Beispiel #30
0
    def test_move_object(self):
        self.ui_test.create_doc_in_start_center("impress")

        xTemplateDlg = self.xUITest.getTopFocusWindow()
        xCancelBtn = xTemplateDlg.getChild("close")
        self.ui_test.close_dialog_through_button(xCancelBtn)

        change_measurement_unit(self, 'Centimeter')

        xImpressDoc = self.xUITest.getTopFocusWindow()

        document = self.ui_test.get_component()
        self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X)
        self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y)
        self.assertEqual(1400, document.DrawPages[0].getByIndex(1).Position.X)
        self.assertEqual(3685, document.DrawPages[0].getByIndex(1).Position.Y)

        xEditWin = xImpressDoc.getChild("impress_win")
        xDrawinglayerObject = xEditWin.getChild(
            "Unnamed Drawinglayer object 1")
        xDrawinglayerObject.executeAction(
            "MOVE", mkPropertyValues({
                "X": "1000",
                "Y": "1000"
            }))

        self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X)
        self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y)
        self.assertEqual(2400, document.DrawPages[0].getByIndex(1).Position.X)
        self.assertEqual(4685, document.DrawPages[0].getByIndex(1).Position.Y)

        self.assertIsNone(document.CurrentSelection)

        xEditWin.executeAction(
            "SELECT",
            mkPropertyValues({"OBJECT": "Unnamed Drawinglayer object 1"}))
        self.assertEqual("com.sun.star.drawing.SvxShapeCollection",
                         document.CurrentSelection.getImplementationName())

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

        xDialog = self.xUITest.getTopFocusWindow()

        self.assertEqual(
            '25.2',
            get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
        self.assertEqual(
            '9.13',
            get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
        self.assertEqual(
            '2.4',
            get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
        self.assertEqual(
            '4.69',
            get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
        self.assertEqual(
            '0',
            get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])

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

        self.assertEqual("com.sun.star.drawing.SvxShapeCollection",
                         document.CurrentSelection.getImplementationName())
        xEditWin.executeAction("DESELECT", tuple())
        self.assertIsNone(document.CurrentSelection)

        self.ui_test.close_doc()