diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2016-07-03 13:54:30 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2016-07-04 14:27:43 +0000 |
commit | 672716db6e17b79c86075e4d79afe76bc0c5a23e (patch) | |
tree | fd175380448416ff0ee7a3a258387683b93a83bd /src/imports/testlib | |
parent | f1216b9c4a6cc239c6ed730fcf14e6fd4b3cecdb (diff) |
Improve error handling in TestCase::tryCompare
Change-Id: I27a6962e404be0b92a9702f9deff8775edb782b1
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/testlib')
-rw-r--r-- | src/imports/testlib/TestCase.qml | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml index 046ce507d4..cff265869d 100644 --- a/src/imports/testlib/TestCase.qml +++ b/src/imports/testlib/TestCase.qml @@ -711,6 +711,11 @@ Item { \sa compare(), SignalSpy::wait() */ function tryCompare(obj, prop, value, timeout, msg) { + if (arguments.length == 1 || typeof(prop) != "string") { + qtest_results.fail("A property name as string is required for tryCompare", + util.callerFile(), util.callerLine()) + throw new Error("QtQuickTest::fail") + } if (arguments.length == 2) { qtest_results.fail("A value is required for tryCompare", util.callerFile(), util.callerLine()) |