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

    sleep(2)  #we need this sleep,because without this is pagecount counted without index. Load index takes time probably.
    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)

    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()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
Beispiel #2
0
    def test_tdf51816(self):
        writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf51816.odt"))
        xWriterDoc = self.xUITest.getTopFocusWindow()
        xWriterEdit = xWriterDoc.getChild("writer_edit")
        document = self.ui_test.get_component()
        #1. Open attached document
        #2. Tools> Word count
        self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xselectwords = xDialog.getChild("selectwords")
        xdocwords = xDialog.getChild("docwords")
        xselectchars = xDialog.getChild("selectchars")
        xdocchars = xDialog.getChild("docchars")
        xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
        xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
        xselectcjkchars = xDialog.getChild("selectcjkchars")
        xdoccjkchars = xDialog.getChild("doccjkchars")

        #3. Click after "At nunc" then <Ctrl><Shift><Left>
        self.xUITest.executeCommand(".uno:GoRight")
        self.xUITest.executeCommand(".uno:GoRight")
        self.xUITest.executeCommand(".uno:GoRight")
        self.xUITest.executeCommand(".uno:GoRight")
        self.xUITest.executeCommand(".uno:GoRight")
        self.xUITest.executeCommand(".uno:GoRight")
        self.xUITest.executeCommand(".uno:GoRight")
        self.xUITest.executeCommand(".uno:WordLeftSel")

        #need to wait, because Word count dialog is already open and it takes time to refresh the counter
        timeout = time.time() + 3
        while get_state_as_dict(xselectwords)["Text"] != "1" and time.time() < timeout:
            sleep(0.1)

        #Expected result : Words 1 & Characters 4 #Actual result : Words 0 & Characters 0
        self.assertEqual(get_state_as_dict(xselectwords)["Text"], "1")
        self.assertEqual(get_state_as_dict(xselectchars)["Text"], "4")

        #4. Click after "At nunc" then <Shift><Home>
        self.xUITest.executeCommand(".uno:StartOfParaSel")

        #need to wait, because Word count dialog is already open and it takes time to refresh the counter
        timeout = time.time() + 3
        while get_state_as_dict(xselectwords)["Text"] != "2" and time.time() < timeout:
            sleep(0.1)

        #Expected result : Words 2 & Characters 7 & excluding space 6  #Actual result : Words 0 & Characters 0
        self.assertEqual(get_state_as_dict(xselectwords)["Text"], "2")
        self.assertEqual(get_state_as_dict(xselectchars)["Text"], "7")

        self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "6")

        xCloseBtn = xDialog.getChild("close")
        self.ui_test.close_dialog_through_button(xCloseBtn)
        self.ui_test.close_doc()
Beispiel #3
0
    def test_select_char(self):
        self.ui_test.create_doc_in_start_center("calc")

        self.ui_test.execute_dialog_through_command(".uno:InsertSymbol")
        xCharDialog = self.xUITest.getTopFocusWindow()
        print(xCharDialog.getChildren())

        sleep(5)

        xCharSet = xCharDialog.getChild("showcharset")

        xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "2", "ROW": "2"}))

        sleep(5)

        xCancelBtn = xCharDialog.getChild("cancel")
        xCancelBtn.executeAction("CLICK", tuple())

        self.ui_test.close_doc()
Beispiel #4
0
    def test_select_char(self):
        self.ui_test.create_doc_in_start_center("calc")

        self.ui_test.execute_dialog_through_command(".uno:InsertSymbol")
        xCharDialog = self.xUITest.getTopFocusWindow()
        print(xCharDialog.getChildren())

        sleep(5)

        xCharSet = xCharDialog.getChild("showcharset")

        xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "2", "ROW": "2"}))

        sleep(5)

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

        self.ui_test.close_doc()
Beispiel #5
0
 def handle_format_dlg(dialog):
     sleep(3)
     xOkBtn = dialog.getChild("ok")
     self.ui_test.close_dialog_through_button(xOkBtn)
Beispiel #6
0
    def test_tdf118208_search_dialog_format_crash(self):
        writer_doc = self.ui_test.load_file(
            get_url_for_data_file("tdf118208.odt"))
        document = self.ui_test.get_component()
        xWriterDoc = self.xUITest.getTopFocusWindow()
        xWriterEdit = xWriterDoc.getChild("writer_edit")
        # 1. Open the attached file.
        # 2. Press ctrl-H to show the search and replace dialog.
        # 3. Press the "Format..."  button.
        #Libreoffice immediately crashed.
        self.ui_test.execute_dialog_through_command(
            ".uno:OptionsTreeDialog")  #optionsdialog
        xDialog = self.xUITest.getTopFocusWindow()

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

        asianlanguage = xDialog.getChild("asiansupport")
        complexlanguage = xDialog.getChild("ctlsupport")
        if (get_state_as_dict(asianlanguage)["Selected"]) == "true":
            asianlanguage.executeAction("CLICK", tuple())
        if (get_state_as_dict(complexlanguage)["Selected"]) == "true":
            complexlanguage.executeAction("CLICK", tuple())
        sleep(5)
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

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

        format = xDialog.getChild("format")

        def handle_format_dlg(dialog):
            sleep(3)
            xOkBtn = dialog.getChild("ok")
            self.ui_test.close_dialog_through_button(xOkBtn)

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

        #verify
        self.assertEqual(document.Text.String[0:14], "Aaaaaaaaaaaaaa")
        xcloseBtn = xDialog.getChild("close")
        self.ui_test.close_dialog_through_button(xcloseBtn)
        sleep(1)
        #enable lang support again
        self.ui_test.execute_dialog_through_command(
            ".uno:OptionsTreeDialog")  #optionsdialog
        xDialog = self.xUITest.getTopFocusWindow()

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

        asianlanguage = xDialog.getChild("asiansupport")
        complexlanguage = xDialog.getChild("ctlsupport")
        if (get_state_as_dict(asianlanguage)["Selected"]) == "false":
            asianlanguage.executeAction("CLICK", tuple())
        if (get_state_as_dict(complexlanguage)["Selected"]) == "false":
            complexlanguage.executeAction("CLICK", tuple())
        sleep(5)
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

        self.ui_test.close_doc()
Beispiel #7
0
    def test_tdf118208_search_dialog_format_crash(self):
        writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf118208.odt"))
        document = self.ui_test.get_component()
        xWriterDoc = self.xUITest.getTopFocusWindow()
        xWriterEdit = xWriterDoc.getChild("writer_edit")
        # 1. Open the attached file.
        # 2. Press ctrl-H to show the search and replace dialog.
        # 3. Press the "Format..."  button.
        #Libreoffice immediately crashed.
        self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")  #optionsdialog
        xDialog = self.xUITest.getTopFocusWindow()

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

        asianlanguage = xDialog.getChild("asiansupport")
        complexlanguage = xDialog.getChild("ctlsupport")
        if (get_state_as_dict(asianlanguage)["Selected"]) == "true":
            asianlanguage.executeAction("CLICK", tuple())
        if (get_state_as_dict(complexlanguage)["Selected"]) == "true":
            complexlanguage.executeAction("CLICK", tuple())

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

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

        format = xDialog.getChild("format")
        def handle_format_dlg(dialog):
            xOkBtn = dialog.getChild("ok")
            self.ui_test.close_dialog_through_button(xOkBtn)

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

        #verify
        self.assertEqual(document.Text.String[0:14], "Aaaaaaaaaaaaaa")
        xcloseBtn = xDialog.getChild("close")
        self.ui_test.close_dialog_through_button(xcloseBtn)
        sleep(1)
        #enable lang support again
        self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")  #optionsdialog
        xDialog = self.xUITest.getTopFocusWindow()

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

        asianlanguage = xDialog.getChild("asiansupport")
        complexlanguage = xDialog.getChild("ctlsupport")
        if (get_state_as_dict(asianlanguage)["Selected"]) == "false":
            asianlanguage.executeAction("CLICK", tuple())
        if (get_state_as_dict(complexlanguage)["Selected"]) == "false":
            complexlanguage.executeAction("CLICK", tuple())
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)

        self.ui_test.close_doc()
Beispiel #8
0
    def test_exponential_smoothing_column(self):
        calc_doc = self.ui_test.create_doc_in_start_center("calc")
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        #fill data
        sleep(30)
        enter_text_to_cell(gridwin, "A1", "1")
        enter_text_to_cell(gridwin, "A2", "0")
        enter_text_to_cell(gridwin, "A3", "0")
        enter_text_to_cell(gridwin, "A4", "0")
        enter_text_to_cell(gridwin, "A5", "0")
        enter_text_to_cell(gridwin, "A7", "0")
        enter_text_to_cell(gridwin, "A8", "0")
        enter_text_to_cell(gridwin, "A9", "0")
        enter_text_to_cell(gridwin, "A10", "0")
        enter_text_to_cell(gridwin, "A11", "0")
        enter_text_to_cell(gridwin, "A12", "0")
        enter_text_to_cell(gridwin, "A13", "0")

        enter_text_to_cell(gridwin, "B1", "0")
        enter_text_to_cell(gridwin, "B2", "0")
        enter_text_to_cell(gridwin, "B3", "1")
        enter_text_to_cell(gridwin, "B4", "0")
        enter_text_to_cell(gridwin, "B5", "0")
        enter_text_to_cell(gridwin, "B6", "0")
        enter_text_to_cell(gridwin, "B7", "0")
        enter_text_to_cell(gridwin, "B8", "0")
        enter_text_to_cell(gridwin, "B9", "0")
        enter_text_to_cell(gridwin, "B10", "0")
        enter_text_to_cell(gridwin, "B11", "0")
        enter_text_to_cell(gridwin, "B12", "0")
        enter_text_to_cell(gridwin, "B13", "0")

        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"}))
        self.ui_test.execute_modeless_dialog_through_command(
            ".uno:ExponentialSmoothingDialog")
        xDialog = self.xUITest.getTopFocusWindow()
        xinputrangeedit = xDialog.getChild("input-range-edit")
        xoutputrangeedit = xDialog.getChild("output-range-edit")
        xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio")
        xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio")
        xmoothingfactorspin = xDialog.getChild("smoothing-factor-spin")

        xinputrangeedit.executeAction("TYPE",
                                      mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xinputrangeedit.executeAction(
            "TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        xinputrangeedit.executeAction(
            "TYPE", mkPropertyValues({"TEXT": "$Sheet1.$A$1:$B$13"}))
        xoutputrangeedit.executeAction("TYPE",
                                       mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xoutputrangeedit.executeAction(
            "TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        xoutputrangeedit.executeAction("TYPE",
                                       mkPropertyValues({"TEXT": "$F$1"}))
        xmoothingfactorspin.executeAction(
            "TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"}))
        xmoothingfactorspin.executeAction(
            "TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
        xmoothingfactorspin.executeAction("TYPE",
                                          mkPropertyValues({"TEXT": "0.5"}))
        xOKBtn = xDialog.getChild("ok")
        self.ui_test.close_dialog_through_button(xOKBtn)
        #Verify
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 0).getString(), "Alpha")
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 1).getValue(), 0.5)
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 2).getString(), "Column 1")
        self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 1)
        self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 1)
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 5).getValue(), 0.5)
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 6).getValue(), 0.25)
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 7).getValue(), 0.125)
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 8).getValue(), 0.0625)
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 9).getValue(), 0.03125)
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 10).getValue(), 0.015625)
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 11).getValue(), 0.0078125)
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 12).getValue(), 0.00390625)
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 13).getValue(), 0.001953125)
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 14).getValue(), 0.0009765625)
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 15).getValue(), 0.00048828125)
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 16).getValue(),
            0.000244140625)

        self.assertEqual(
            get_cell_by_position(document, 0, 6, 2).getString(), "Column 2")
        self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
        self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue(), 0)
        self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 0)
        self.assertEqual(
            get_cell_by_position(document, 0, 6, 6).getValue(), 0.5)
        self.assertEqual(
            get_cell_by_position(document, 0, 6, 7).getValue(), 0.25)
        self.assertEqual(
            get_cell_by_position(document, 0, 6, 8).getValue(), 0.125)
        self.assertEqual(
            get_cell_by_position(document, 0, 6, 9).getValue(), 0.0625)
        self.assertEqual(
            get_cell_by_position(document, 0, 6, 10).getValue(), 0.03125)
        self.assertEqual(
            get_cell_by_position(document, 0, 6, 11).getValue(), 0.015625)
        self.assertEqual(
            get_cell_by_position(document, 0, 6, 12).getValue(), 0.0078125)
        self.assertEqual(
            get_cell_by_position(document, 0, 6, 13).getValue(), 0.00390625)
        self.assertEqual(
            get_cell_by_position(document, 0, 6, 14).getValue(), 0.001953125)
        self.assertEqual(
            get_cell_by_position(document, 0, 6, 15).getValue(), 0.0009765625)
        self.assertEqual(
            get_cell_by_position(document, 0, 6, 16).getValue(), 0.00048828125)

        #undo
        self.xUITest.executeCommand(".uno:Undo")
        self.assertEqual(
            get_cell_by_position(document, 0, 5, 0).getString(), "")

        self.ui_test.close_doc()