本文整理汇总了Python中uitest.uihelper.common.get_state_as_dict函数的典型用法代码示例。如果您正苦于以下问题:Python get_state_as_dict函数的具体用法?Python get_state_as_dict怎么用?Python get_state_as_dict使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_state_as_dict函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_tdf119462_find_format
def test_tdf119462_find_format(self):
writer_doc = self.ui_test.create_doc_in_start_center("writer")
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
#1. Choose Edit > Find & Replace
self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
xDialog = self.xUITest.getTopFocusWindow()
#2. Choose Format
format = xDialog.getChild("format")
def handle_format_dlg(dialog):
#3. Choose Bold
xTabs = dialog.getChild("tabcontrol")
select_pos(xTabs, "0")
xweststylelbcjk = dialog.getChild("weststylelb-cjk")
xweststylelbcjk.executeAction("TYPE", mkPropertyValues({"TEXT":"Bold"}))
xOkBtn = dialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOkBtn)
self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ()),
dialog_handler=handle_format_dlg)
#verify label searchdesc
searchdesc = xDialog.getChild("searchdesc")
self.assertEqual(get_state_as_dict(searchdesc)["Text"], "bold")
noformat = xDialog.getChild("noformat")
noformat.executeAction("CLICK", tuple()) #click No format button
self.assertEqual(get_state_as_dict(searchdesc)["Text"], "")
xcloseBtn = xDialog.getChild("close")
self.ui_test.close_dialog_through_button(xcloseBtn)
self.ui_test.close_doc()
示例2: test_master_elements
def test_master_elements(self):
self.ui_test.create_doc_in_start_center("impress")
xTemplateDlg = self.xUITest.getTopFocusWindow()
xCancelBtn = xTemplateDlg.getChild("cancel")
self.ui_test.close_dialog_through_button(xCancelBtn)
document = self.ui_test.get_component()
self.ui_test.execute_dialog_through_command(".uno:MasterLayouts")
xDialog = self.xUITest.getTopFocusWindow()
xpagenumber = xDialog.getChild("pagenumber")
xfooter = xDialog.getChild("footer")
datetime = xDialog.getChild("datetime")
xpagenumber.executeAction("CLICK", tuple())
xfooter.executeAction("CLICK", tuple())
datetime.executeAction("CLICK", tuple())
xOKButton = xDialog.getChild("ok")
xOKButton.executeAction("CLICK", tuple())
#verify
self.ui_test.execute_dialog_through_command(".uno:MasterLayouts")
xDialog = self.xUITest.getTopFocusWindow()
xfooter = xDialog.getChild("footer")
datetime = xDialog.getChild("datetime")
xpagenumber = xDialog.getChild("pagenumber")
self.assertEqual(get_state_as_dict(xfooter)["Selected"], "false")
self.assertEqual(get_state_as_dict(datetime)["Selected"], "false")
self.assertEqual(get_state_as_dict(xpagenumber)["Selected"], "false")
xOKButton = xDialog.getChild("ok")
xOKButton.executeAction("CLICK", tuple())
self.ui_test.close_doc()
示例3: testGetFormat
def testGetFormat(self):
# Copy a string in Impress.
self.ui_test.create_doc_in_start_center("impress")
template = self.xUITest.getTopFocusWindow()
self.ui_test.close_dialog_through_button(template.getChild("cancel"))
doc = self.xUITest.getTopFocusWindow()
editWin = doc.getChild("impress_win")
# Select the title shape.
editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"}))
self.xUITest.executeCommand(".uno:SelectAll")
self.xUITest.executeCommand(".uno:Copy")
# Now use paste special to see what formats are offered.
self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
pasteSpecial = self.xUITest.getTopFocusWindow()
formats = pasteSpecial.getChild("list")
entryCount = int(get_state_as_dict(formats)["EntryCount"])
items = []
for index in range(entryCount):
formats.executeAction("SELECT", mkPropertyValues({"POS": str(index)}))
items.append(get_state_as_dict(formats)["SelectEntryText"])
# Make sure there is no RTF vs Richtext duplication.
self.assertTrue("Rich text formatting (RTF)" in items)
self.assertFalse("Rich text formatting (Richtext)" in items)
# Close the dialog and the document.
self.ui_test.close_dialog_through_button(pasteSpecial.getChild("cancel"))
self.ui_test.close_doc()
示例4: test_track_headings_outline
def test_track_headings_outline(self):
writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf114724.odt"))
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
self.xUITest.executeCommand(".uno:Sidebar")
xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"}))
xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel")
xNavigatorPanel.executeAction("ROOT", tuple())
xWriterEdit.executeAction("FOCUS", tuple())
time.sleep(2)
self.assertEqual(get_state_as_dict(xNavigatorPanel)["selectioncount"], "1")
for _ in range(0,3):
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
time.sleep(2)
self.assertEqual(get_state_as_dict(xNavigatorPanel)["selectioncount"], "1")
for _ in range(0,3):
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
time.sleep(2)
self.assertEqual(get_state_as_dict(xNavigatorPanel)["selectioncount"], "1")
self.xUITest.executeCommand(".uno:Sidebar")
self.ui_test.close_doc()
示例5: test_insert_horizontal_line
def test_insert_horizontal_line(self):
self.ui_test.create_doc_in_start_center("writer")
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
type_text(xWriterEdit, "Test horizontal line") #write the text
self.xUITest.executeCommand(".uno:StyleApply?Style:string=Horizontal%20Line&FamilyName:string=ParagraphStyles") #insert horizontal line
self.ui_test.execute_dialog_through_command(".uno:EditStyle") #open style dialog
xDialog = self.xUITest.getTopFocusWindow()
xStyleNametxt = xDialog.getChild("namerw")
self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name
xCancBtn = xDialog.getChild("cancel")
self.ui_test.close_dialog_through_button(xCancBtn)
self.xUITest.executeCommand(".uno:Undo")
self.xUITest.executeCommand(".uno:Redo")
self.ui_test.execute_dialog_through_command(".uno:EditStyle") #open style dialog
xDialog = self.xUITest.getTopFocusWindow()
xStyleNametxt = xDialog.getChild("namerw")
self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name
xCancBtn = xDialog.getChild("cancel")
self.ui_test.close_dialog_through_button(xCancBtn)
self.ui_test.close_doc()
示例6: test_tdf122449_crash_edit_index_entry
def test_tdf122449_crash_edit_index_entry(self):
writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf122449.odt"))
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
#search word Autocorrect (second find) .uno:SearchDialog
self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
xDialog = self.xUITest.getTopFocusWindow()
searchterm = xDialog.getChild("searchterm")
searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Autocorrection"}))
xsearch = xDialog.getChild("search")
xsearch.executeAction("CLICK", tuple()) #first search
xsearch.executeAction("CLICK", tuple()) #2nd search
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "6")
xcloseBtn = xDialog.getChild("close")
self.ui_test.close_dialog_through_button(xcloseBtn)
xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"}))
# invoke Index dialog Index entry .uno:IndexEntryDialog
self.ui_test.execute_dialog_through_command(".uno:IndexEntryDialog")
xDialog = self.xUITest.getTopFocusWindow()
xcloseBtn = xDialog.getChild("close")
self.ui_test.close_dialog_through_button(xcloseBtn)
# close
# Go to page 2
self.ui_test.execute_dialog_through_command(".uno:GotoPage")
xDialog = self.xUITest.getTopFocusWindow()
xPageText = xDialog.getChild("page")
xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
xOkBtn = xDialog.getChild("ok")
xOkBtn.executeAction("CLICK", tuple())
# verify
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
self.ui_test.close_doc()
示例7: test_row_hide_show
def test_row_hide_show(self):
calc_doc = self.ui_test.create_doc_in_start_center("calc")
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
#select A3
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"}))
self.xUITest.executeCommand(".uno:HideRow") #uno command moves focus one cell down
#verify A4
gridWinState = get_state_as_dict(gridwin)
self.assertEqual(gridWinState["CurrentRow"], "3")
gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"UP"}))
#verify A2 (row 3 is hidden)
gridWinState = get_state_as_dict(gridwin)
self.assertEqual(gridWinState["CurrentRow"], "1")
#Show hidden row: select A2:A4
gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A4"}))
self.xUITest.executeCommand(".uno:ShowRow")
#verify
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A4"}))
gridWinState = get_state_as_dict(gridwin)
self.assertEqual(gridWinState["CurrentRow"], "3")
gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"UP"}))
#verify A3 (row 3 is not hidden)
gridWinState = get_state_as_dict(gridwin)
self.assertEqual(gridWinState["CurrentRow"], "2")
self.ui_test.close_doc()
示例8: test_down
def test_down(self):
self.ui_test.create_doc_in_start_center("calc")
self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
xCellsDlg = self.xUITest.getTopFocusWindow()
# select the numbers tab page
select_pos(xCellsDlg, "0")
xDecimalPlaces = xCellsDlg.getChild("leadzerosed")
xDecimalPlaces.executeAction("UP", tuple())
xDecimalPlaces.executeAction("UP", tuple())
decimal_places_state = get_state_as_dict(xDecimalPlaces)
assert(decimal_places_state["Text"] == "3")
xDecimalPlaces.executeAction("DOWN", tuple())
decimal_places_state = get_state_as_dict(xDecimalPlaces)
assert(decimal_places_state["Text"] == "2")
okBtn = xCellsDlg.getChild("ok")
self.ui_test.close_dialog_through_button(okBtn)
self.ui_test.close_doc()
示例9: test_column_hide_show
def test_column_hide_show(self):
calc_doc = self.ui_test.create_doc_in_start_center("calc")
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
#select A3
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"}))
self.xUITest.executeCommand(".uno:HideColumn") #uno command moves focus one cell down
#verify D1
gridWinState = get_state_as_dict(gridwin)
self.assertEqual(gridWinState["CurrentColumn"], "3")
gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"LEFT"}))
#verify B (column C is hidden)
gridWinState = get_state_as_dict(gridwin)
self.assertEqual(gridWinState["CurrentColumn"], "1")
#Show hidden column: select B1:D1
gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:D1"}))
self.xUITest.executeCommand(".uno:ShowColumn")
#verify
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
gridWinState = get_state_as_dict(gridwin)
self.assertEqual(gridWinState["CurrentColumn"], "3")
gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"LEFT"}))
#verify C1 (COlumn C is not hidden)
gridWinState = get_state_as_dict(gridwin)
self.assertEqual(gridWinState["CurrentColumn"], "2")
self.ui_test.close_doc()
示例10: test_search_filter
def test_search_filter(self):
self.ui_test.create_doc_in_start_center("writer")
self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog")
xDialog = self.xUITest.getTopFocusWindow()
xfunc = xDialog.getChild("functions")
xSearch = xDialog.getChild("searchEntry")
initialEntryCount = get_state_as_dict(xfunc)["Children"]
self.assertTrue(initialEntryCount is not 0)
xSearch.executeAction("SET", mkPropertyValues({"TEXT":"format"}))
# Wait for the search/filter op to be completed
time.sleep(1)
filteredEntryCount = get_state_as_dict(xfunc)["Children"]
self.assertTrue(filteredEntryCount < initialEntryCount)
xSearch.executeAction("CLEAR", tuple())
# Wait for the search/filter op to be completed
time.sleep(1)
finalEntryCount = get_state_as_dict(xfunc)["Children"]
self.assertEqual(initialEntryCount, finalEntryCount)
xcancBtn = xDialog.getChild("cancel") #button Cancel
xcancBtn.executeAction("CLICK", tuple()) #click the button
self.ui_test.close_doc()
示例11: test_exchange_database2
def test_exchange_database2(self):
self.ui_test.create_doc_in_start_center("writer")
self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField")
xExDBDlg = self.xUITest.getTopFocusWindow()
xTreelist = xExDBDlg.getChild("availablelb")
xLabeldb = xExDBDlg.getChild("dbnameft")
self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "[None]")
xTreeEntry = xTreelist.getChild('0') #Available Databases
xTreeEntry.executeAction("EXPAND", tuple()) #Click on the Bibliography
xTreeEntry.executeAction("COLLAPSE", tuple())
xTreeEntry.executeAction("EXPAND", tuple())
xTreeEntry2 = xTreeEntry.getChild('0') #Available Databases
xTreeEntry2.executeAction("SELECT", tuple()) #Click on the biblio
xDefineBtn = xExDBDlg.getChild("ok")
xDefineBtn.executeAction("CLICK", tuple())
self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField")
xExDBDlg = self.xUITest.getTopFocusWindow()
xLabeldb = xExDBDlg.getChild("dbnameft")
self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "Bibliography.biblio")
xCloseBtn = xExDBDlg.getChild("close")
self.ui_test.close_dialog_through_button(xCloseBtn)
self.ui_test.close_doc()
示例12: test_tdf62267
def test_tdf62267(self):
calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf62267.ods"))
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
#* Copy A1, then paste special to C1;
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
self.xUITest.executeCommand(".uno:Copy")
gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"}))
self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
xDialog = self.xUITest.getTopFocusWindow()
#it's the default - text, numbers and dates
xOkBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOkBtn)
#--> Cell formatting should stay as before
self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog")
xCondFormatMgr = self.xUITest.getTopFocusWindow()
# check that we have exactly 1 conditional format
xList = xCondFormatMgr.getChild("CONTAINER")
list_state = get_state_as_dict(xList)
self.assertEqual(list_state['Children'], '1')
xTreeEntry = xList.getChild('0')
self.assertEqual(get_state_as_dict(xTreeEntry)["Text"], "A1\tCell value is = 1")
xCancelBtn = xCondFormatMgr.getChild("cancel")
self.ui_test.close_dialog_through_button(xCancelBtn)
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
示例13: test_tdf98417_find_previous_writer
def test_tdf98417_find_previous_writer(self):
writer_doc = self.ui_test.load_file(get_url_for_data_file("findReplace.odt"))
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
xDialog = self.xUITest.getTopFocusWindow()
searchterm = xDialog.getChild("searchterm")
searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"third"}))
xsearch = xDialog.getChild("search")
xsearch.executeAction("CLICK", tuple())
#verify
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
xsearch.executeAction("CLICK", tuple())
#verify
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "4") #page 4
backsearch = xDialog.getChild("backsearch")
backsearch.executeAction("CLICK", tuple())
#verify
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
xcloseBtn = xDialog.getChild("close")
self.ui_test.close_dialog_through_button(xcloseBtn)
self.ui_test.close_doc()
示例14: test_tdf55712
def test_tdf55712(self):
calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf55712.ods"))
document = self.ui_test.get_component()
calcDoc = self.xUITest.getTopFocusWindow()
xGridWindow = calcDoc.getChild("grid_window")
xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
xFloatWindow = self.xUITest.getFloatWindow()
xTreeList = xFloatWindow.getChild("check_list_box")
x1Entry = xTreeList.getChild("0")
x2Entry = xTreeList.getChild("1")
x3Entry = xTreeList.getChild("2")
x4Entry = xTreeList.getChild("3")
x5Entry = xTreeList.getChild("4")
x6Entry = xTreeList.getChild("5")
x7Entry = xTreeList.getChild("6")
x8Entry = xTreeList.getChild("7")
x9Entry = xTreeList.getChild("8")
self.assertEqual(get_state_as_dict(x1Entry)["Text"], "0")
self.assertEqual(get_state_as_dict(x2Entry)["Text"], "0.1")
self.assertEqual(get_state_as_dict(x3Entry)["Text"], "0.2")
self.assertEqual(get_state_as_dict(x4Entry)["Text"], "0.3")
self.assertEqual(get_state_as_dict(x5Entry)["Text"], "0.5")
self.assertEqual(get_state_as_dict(x6Entry)["Text"], "0.8")
self.assertEqual(get_state_as_dict(x7Entry)["Text"], "0.9")
self.assertEqual(get_state_as_dict(x8Entry)["Text"], "1")
self.assertEqual(get_state_as_dict(x9Entry)["Text"], "(empty)")
self.assertEqual(get_state_as_dict(xTreeList)["Children"], "9")
xCancel = xFloatWindow.getChild("cancel")
xCancel.executeAction("CLICK", tuple())
self.ui_test.close_doc()
示例15: test_tdf123479_Crash_ScFormulaResult_GetMatrixFormulaCellToken
def test_tdf123479_Crash_ScFormulaResult_GetMatrixFormulaCellToken(self):
#numberingformatpage.ui
calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf123479.ods"))
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
#Select D14:D16
gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D14:D16"}))
#Open Formula Wizard (Ctrl+F2)
self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog")
xDialog = self.xUITest.getTopFocusWindow()
edArg1 = xDialog.getChild("ED_ARG1")
edArg2 = xDialog.getChild("ED_ARG2")
formulaRes = xDialog.getChild("formula_result")
#check formula wizard data
self.assertEqual(get_state_as_dict(edArg1)["Text"], "CHAR(10)")
self.assertEqual(get_state_as_dict(edArg2)["Text"], "OFFSET($Data.$A$2:$Data.$A$4,0,COLUMN()-3)")
self.assertEqual(get_state_as_dict(formulaRes)["Text"], "{4;4;4}")
xOk = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOk)
#verify; no crashes
self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Pass/Fail")
self.ui_test.close_doc()