diff options
author | Robert Loehning <robert.loehning@nokia.com> | 2011-11-24 15:25:20 +0100 |
---|---|---|
committer | Robert Löhning <robert.loehning@nokia.com> | 2011-11-24 17:52:26 +0100 |
commit | f107ec5ba6f85e017d479a931684d8fd8b3eec56 (patch) | |
tree | b0de845d465fcc20cd90f2420425a35cf54dac3f | |
parent | 3dc96ba1a84df371626f43c06759a6cc26d3f9a7 (diff) | |
download | qt-creator-f107ec5ba6f85e017d479a931684d8fd8b3eec56.tar.gz |
Squish: Made functions verifyEnabled and selectFromCombo more generic
Change-Id: I1f0d48712f5ec081fa323e929dabaeee1dbf9b63
Reviewed-by: Christian Stenger <christian.stenger@nokia.com>
-rw-r--r-- | tests/system/shared/project_explorer.py | 2 | ||||
-rw-r--r-- | tests/system/shared/utils.py | 30 |
2 files changed, 23 insertions, 9 deletions
diff --git a/tests/system/shared/project_explorer.py b/tests/system/shared/project_explorer.py index 79e6ec31f6..6ab2c54738 100644 --- a/tests/system/shared/project_explorer.py +++ b/tests/system/shared/project_explorer.py @@ -73,7 +73,7 @@ def prepareBuildSettings(targetCount, currentTarget, setReleaseBuild=True, disab wait = False try: if qtCombo.currentText != defaultQtVersion: - selectFromCombo(":scrollArea.qtVersionComboBox_QComboBox", defaultQtVersion.replace(".", "\\.")) + selectFromCombo(qtCombo, defaultQtVersion.replace(".", "\\.")) if setReleaseBuild: chooseThis = "%s Release" % defaultQtVersion else: diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index a3ca6f6bb4..9ed8b5f19e 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -32,14 +32,28 @@ def ensureChecked(objectName, shouldBeChecked = True): test.verify(object.checked == shouldBeChecked) return object -def verifyEnabled(objectName, expectedState = True): - waitFor("object.exists('" + objectName + "')", 20000) - object = findObject(objectName) - test.compare(object.enabled, expectedState) - return object - -def selectFromCombo(objectName, itemName): - object = verifyEnabled(objectName) +# verify that an object is in an expected enable state. Returns the object. +# param objectSpec specifies the object to check. It can either be a string determining an object +# or the object itself. If it is an object, it must exist already. +# param expectedState is the expected enable state of the object +def verifyEnabled(objectSpec, expectedState = True): + if isinstance(objectSpec, (str, unicode)): + waitFor("object.exists('" + objectSpec + "')", 20000) + foundObject = findObject(objectSpec) + else: + foundObject = objectSpec + if objectSpec == None: + test.warning("No valid object in function verifyEnabled.") + else: + test.compare(foundObject.enabled, expectedState) + return foundObject + +# select an item from a combo box +# param objectSpec specifies the combo box. It can either be a string determining an object +# or the object itself. If it is an object, it must exist already. +# param itemName is the item to be selected in the combo box +def selectFromCombo(objectSpec, itemName): + object = verifyEnabled(objectSpec) mouseClick(object, 5, 5, 0, Qt.LeftButton) mouseClick(waitForObjectItem(object, itemName), 5, 5, 0, Qt.LeftButton) |