Kaydet (Commit) 7903848d authored tarafından Zdeněk Crhonek's avatar Zdeněk Crhonek Kaydeden (comit) Zdenek Crhonek

uitest for Calc- AutoFormat and move/copy sheet dialogs

Change-Id: Ic13f33d37d9f8e472bde5a2708a8a7cbdc6d26f4
Reviewed-on: https://gerrit.libreoffice.org/63583
Tested-by: Jenkins
Reviewed-by: 's avatarZdenek Crhonek <zcrhonek@gmail.com>
üst 37455f8f
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict
from uitest.uihelper.common import select_pos
from uitest.uihelper.calc import enter_text_to_cell
from libreoffice.calc.document import get_cell_by_position
from libreoffice.uno.propertyvalue import mkPropertyValues
#uitest sc / AutoFormat Styles
class autoFormat(UITestCase):
def test_autoformat_styles(self):
writer_doc = self.ui_test.create_doc_in_start_center("calc")
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
#select A1:C5
gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C5"}))
#AutoFormat Styles
self.ui_test.execute_dialog_through_command(".uno:AutoFormat")
xDialog = self.xUITest.getTopFocusWindow()
formatlb = xDialog.getChild("formatlb")
numformatcb = xDialog.getChild("numformatcb")
bordercb = xDialog.getChild("bordercb")
fontcb = xDialog.getChild("fontcb")
patterncb = xDialog.getChild("patterncb")
alignmentcb = xDialog.getChild("alignmentcb")
autofitcb = xDialog.getChild("autofitcb")
props = {"TEXT": "Financial"}
actionProps = mkPropertyValues(props)
formatlb.executeAction("SELECT", actionProps)
numformatcb.executeAction("CLICK", tuple())
bordercb.executeAction("CLICK", tuple())
fontcb.executeAction("CLICK", tuple())
patterncb.executeAction("CLICK", tuple())
alignmentcb.executeAction("CLICK", tuple())
autofitcb.executeAction("CLICK", tuple())
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
#verify
self.ui_test.execute_dialog_through_command(".uno:AutoFormat")
xDialog = self.xUITest.getTopFocusWindow()
formatlb = xDialog.getChild("formatlb")
numformatcb = xDialog.getChild("numformatcb")
bordercb = xDialog.getChild("bordercb")
fontcb = xDialog.getChild("fontcb")
patterncb = xDialog.getChild("patterncb")
alignmentcb = xDialog.getChild("alignmentcb")
autofitcb = xDialog.getChild("autofitcb")
props = {"TEXT": "Financial"}
actionProps = mkPropertyValues(props)
formatlb.executeAction("SELECT", actionProps)
self.assertEqual(get_state_as_dict(numformatcb)["Selected"], "false")
self.assertEqual(get_state_as_dict(bordercb)["Selected"], "false")
self.assertEqual(get_state_as_dict(fontcb)["Selected"], "false")
self.assertEqual(get_state_as_dict(patterncb)["Selected"], "false")
self.assertEqual(get_state_as_dict(alignmentcb)["Selected"], "false")
self.assertEqual(get_state_as_dict(autofitcb)["Selected"], "false")
numformatcb.executeAction("CLICK", tuple())
bordercb.executeAction("CLICK", tuple())
fontcb.executeAction("CLICK", tuple())
patterncb.executeAction("CLICK", tuple())
alignmentcb.executeAction("CLICK", tuple())
autofitcb.executeAction("CLICK", tuple())
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict
from uitest.uihelper.common import select_pos
from uitest.debug import sleep
from uitest.uihelper.calc import enter_text_to_cell
from libreoffice.calc.document import get_cell_by_position
from libreoffice.uno.propertyvalue import mkPropertyValues
#uitest sc - move/copy sheet dialog
class moveCopySheet(UITestCase):
def test_copy_move_sheet(self):
writer_doc = self.ui_test.create_doc_in_start_center("calc")
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
#default - 1 sheet; select the sheet (is selected), dialog move/copy sheet
self.ui_test.execute_dialog_through_command(".uno:Move")
xDialog = self.xUITest.getTopFocusWindow()
#new name = newName
newName = xDialog.getChild("newName")
newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
newName.executeAction("TYPE", mkPropertyValues({"TEXT":"newName"}))
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
#verify, the file has 2 sheets; first one "newName" is selected
self.assertEqual(document.Sheets.getCount(), 2)
# dialog move/copy sheet ; Move is selected; select -move to end position - ; New Name = moveName
self.ui_test.execute_dialog_through_command(".uno:Move")
xDialog = self.xUITest.getTopFocusWindow()
insertBefore = xDialog.getChild("insertBefore")
xTreeEntry = insertBefore.getChild('2')
xTreeEntry.executeAction("SELECT", tuple())
newName = xDialog.getChild("newName")
self.assertEqual(get_state_as_dict(newName)["Text"], "newName")
newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
newName.executeAction("TYPE", mkPropertyValues({"TEXT":"moveName"}))
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
#verify, the file has 2 sheets; first one is "Sheet1" ; second one is "moveName"
self.assertEqual(document.Sheets.getCount(), 2)
self.assertEqual(document.Sheets.getByIndex(0).Name, "Sheet1")
self.assertEqual(document.Sheets.getByIndex(1).Name, "moveName")
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment