aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@theqtcompany.com>2015-04-16 14:31:01 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-04-21 10:41:35 +0000
commit1883fd4e59128ce114f5a2bb492cc29d541f4f15 (patch)
treeb134912b423e076cf51189e2bf486a57d0ccb6e7 /src/imports
parentb607f610ed80532d83ddcc14c3f44292e526dabf (diff)
TestCase: add equals() function to QuickTestImageObject.
This allows for comparison of image objects returned from TestCase's grabImage() function using QImage's operator== function. Doing pixel by pixel image comparisons in QML is extremely slow. This functionality is useful for checking that an item was redrawn after a property change, for example. [ChangeLog][QuickTest][TestCase] Added equals() function to image object returned from TestCase's grabImage() function. Change-Id: I0ece9df6effe2b1b9d8e1ee8ac011115d9367ef2 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com> Reviewed-by: Liang Qi <liang.qi@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/testlib/TestCase.qml7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index 039ee63f07..4c48611e79 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -613,12 +613,19 @@ Item {
\li blue(x, y) Returns the blue channel value of the pixel at \a x, \a y position
\li alpha(x, y) Returns the alpha channel value of the pixel at \a x, \a y position
\li pixel(x, y) Returns the color value of the pixel at \a x, \a y position
+ \li equals(image) Returns \c true if this image is identical to \a image -
+ see \l QImage::operator== (since 5.6)
+
For example:
\code
var image = grabImage(rect);
compare(image.red(10, 10), 255);
compare(image.pixel(20, 20), Qt.rgba(255, 0, 0, 255));
+
+ rect.width += 10;
+ var newImage = grabImage(rect);
+ verify(!newImage.equals(image));
\endcode
\endlist