diff options
author | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2015-04-16 14:31:01 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-04-21 10:41:35 +0000 |
commit | 1883fd4e59128ce114f5a2bb492cc29d541f4f15 (patch) | |
tree | b134912b423e076cf51189e2bf486a57d0ccb6e7 /src/qmltest | |
parent | b607f610ed80532d83ddcc14c3f44292e526dabf (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/qmltest')
-rw-r--r-- | src/qmltest/quicktestresult.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp index 9a8e2c938d..2ead2b8c6f 100644 --- a/src/qmltest/quicktestresult.cpp +++ b/src/qmltest/quicktestresult.cpp @@ -108,6 +108,14 @@ public Q_SLOTS: pixel += x; return QColor::fromRgba(*pixel); } + + bool equals(QuickTestImageObject *other) const + { + if (!other) + return m_image.isNull(); + + return m_image == other->m_image; + } private: QImage m_image; }; |