diff options
Diffstat (limited to 'Tests/system/suite_configuration/shared/scripts/config_utils.py')
-rw-r--r-- | Tests/system/suite_configuration/shared/scripts/config_utils.py | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Tests/system/suite_configuration/shared/scripts/config_utils.py b/Tests/system/suite_configuration/shared/scripts/config_utils.py index 52cdd3b3..ca98f6ee 100644 --- a/Tests/system/suite_configuration/shared/scripts/config_utils.py +++ b/Tests/system/suite_configuration/shared/scripts/config_utils.py @@ -7,6 +7,8 @@ import os +import names + def readQtDirs(): dirString = os.getenv("SQUISH_VSTOOLS_QTDIRS") @@ -22,3 +24,55 @@ def readQtDirs(): qtDirs.append({"path": current, "name": current.rsplit(":")[-1].strip("\\").replace("\\", "_")}) return qtDirs + + +def typeToEdit(editId, text): + edit = waitForObject(editId) + mouseClick(edit) + type(edit, text) + waitFor("waitForObject(editId).text == text") + + +def tableCell(col, row): + return {"column": col, "container": names.dataGrid_Table, "row": row, "type": "TableCell"} + + +def tableCellEdit(col, row): + return {"container": tableCell(col, row), "type": "Edit"} + + +def configureQtVersions(msvsVersion, qtDirs, withTests=False): + openVsToolsMenu(msvsVersion) + mouseClick(waitForObject(names.pART_Popup_Qt_Versions_MenuItem)) + tableRows = waitForObjectExists(names.dataGrid_Table).rowCount + if withTests: + test.compare(tableRows, 1, + "The table should have exactly one line before adding Qt versions.") + if tableRows != 1: + test.fatal("Unexpected table shown. Probably there is either an unexpected configuration " + "or the UI changed.") + clickButton(waitForObject(names.options_Cancel_Button)) + return False + for i, qtDir in enumerate(qtDirs): + mouseClick(waitForObject(tableCell(1, i))) + typeToEdit(tableCellEdit(3, i), qtDir["path"]) + typeToEdit(tableCellEdit(1, i), qtDir["name"]) + if withTests: + test.compare(waitForObjectExists(names.dataGrid_Table).rowCount, i + 2, + "The table should have %d lines after adding %d Qt versions." + % (i + 2, i + 1)) + clickButton(waitForObject(names.options_OK_Button)) + waitFor("not object.exists(names.options_Dialog)") + return True + + +def clearQtVersions(msvsVersion): + openVsToolsMenu(msvsVersion) + mouseClick(waitForObject(names.pART_Popup_Qt_Versions_MenuItem)) + qtVersionCount = waitForObjectExists(names.dataGrid_Table).rowCount - 1 + for i in range(qtVersionCount): + clickButton(waitForObject({"container": tableCell(1, i), + "text": "", "type": "Button"})) + snooze(1) + clickButton(waitForObject(names.options_OK_Button)) + waitFor("not object.exists(names.options_Dialog)") |