aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/testlib/TestCase.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/testlib/TestCase.qml')
-rw-r--r--src/imports/testlib/TestCase.qml11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index 0bec4cddf2..6e2c8e73ab 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -290,14 +290,21 @@ Item {
return qtest_results.grabImage(item);
}
- function tryCompare(obj, prop, value, timeout) {
+ function tryCompare(obj, prop, value, timeout, msg) {
if (arguments.length == 2) {
qtest_results.fail("A value is required for tryCompare",
util.callerFile(), util.callerLine())
throw new Error("QtQuickTest::fail")
}
+ if (timeout !== undefined && typeof(timeout) != "number") {
+ qtest_results.fail("timeout should be a number",
+ util.callerFile(), util.callerLine())
+ throw new Error("QtQuickTest::fail")
+ }
if (!timeout)
timeout = 5000
+ if (msg === undefined)
+ msg = "property " + prop
if (!qtest_compareInternal(obj[prop], value))
wait(0)
var i = 0
@@ -309,7 +316,7 @@ Item {
var act = qtest_results.stringify(actual)
var exp = qtest_results.stringify(value)
var success = qtest_compareInternal(actual, value)
- if (!qtest_results.compare(success, "property " + prop, act, exp, util.callerFile(), util.callerLine()))
+ if (!qtest_results.compare(success, msg, act, exp, util.callerFile(), util.callerLine()))
throw new Error("QtQuickTest::fail")
}