diff options
Diffstat (limited to 'src/imports/testlib/TestCase.qml')
-rw-r--r-- | src/imports/testlib/TestCase.qml | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml index 8c1744a2b2..7ff51bb6d6 100644 --- a/src/imports/testlib/TestCase.qml +++ b/src/imports/testlib/TestCase.qml @@ -757,6 +757,10 @@ Item { bProperties.push(i); // collect exp's properties } + if (aProperties.length == 0 && bProperties.length == 0) { // at least a special case for QUrl + return eq && (JSON.stringify(act) == JSON.stringify(exp)); + } + // Ensures identical properties name return eq && qtest_compareInternal(aProperties.sort(), bProperties.sort()); @@ -837,7 +841,14 @@ Item { Returns a snapshot image object of the given \a item. - The returned image object has the following methods: + The returned image object has the following properties: + \list + \li width Returns the width of the underlying image (since 5.10) + \li height Returns the height of the underlying image (since 5.10) + \li size Returns the size of the underlying image (since 5.10) + \endlist + + Additionally, the returned image object has the following methods: \list \li red(x, y) Returns the red channel value of the pixel at \a x, \a y position \li green(x, y) Returns the green channel value of the pixel at \a x, \a y position @@ -858,6 +869,21 @@ Item { var newImage = grabImage(rect); verify(!newImage.equals(image)); \endcode + \li save(path) Saves the image to the given \a path. If the image cannot + be saved, an exception will be thrown. (since 5.10) + + This can be useful to perform postmortem analysis on failing tests, for + example: + + \code + var image = grabImage(rect); + try { + compare(image.width, 100); + } catch (ex) { + image.save("debug.png"); + throw ex; + } + \endcode \endlist |