diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2011-07-25 14:11:42 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-26 06:29:54 +0200 |
commit | 4f6054407ab63dea424a0dd1242f5f025d7967db (patch) | |
tree | ad6738daadb59f58bfe974331ad3ac40caade742 /tests | |
parent | f79b7b7c87ad69b9e07057a92c6628315b540a0e (diff) |
Update polish even when animations aren't running
Task-number: QTBUG-20078
Change-Id: I095a872d72da61248794ec4a2a85f91ee618cdbc
Reviewed-on: http://codereview.qt.nokia.com/2063
Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qsgitem/tst_qsgitem.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/declarative/qsgitem/tst_qsgitem.cpp b/tests/auto/declarative/qsgitem/tst_qsgitem.cpp index edddbdc155..e591ab8c86 100644 --- a/tests/auto/declarative/qsgitem/tst_qsgitem.cpp +++ b/tests/auto/declarative/qsgitem/tst_qsgitem.cpp @@ -44,7 +44,9 @@ #include "qsgitem.h" #include "qsgcanvas.h" #include "private/qsgfocusscope_p.h" +#include "../../../shared/util.h" #include <QDebug> +#include <QTimer> class TestItem : public QSGItem { @@ -62,6 +64,28 @@ protected: virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { event->accept(); ++releaseCount; } }; +class TestPolishItem : public QSGItem +{ +Q_OBJECT +public: + TestPolishItem(QSGItem *parent) + : QSGItem(parent), wasPolished(false) { + QTimer::singleShot(50, this, SLOT(doPolish())); + } + + bool wasPolished; + +protected: + virtual void updatePolish() { + wasPolished = true; + } + +public slots: + void doPolish() { + polish(); + } +}; + class TestFocusScope : public QSGFocusScope { Q_OBJECT @@ -97,6 +121,7 @@ private slots: void enabled(); void mouseGrab(); + void polishOutsideAnimation(); private: void ensureFocus(QWidget *w) { @@ -806,6 +831,19 @@ void tst_qsgitem::mouseGrab() delete canvas; } +void tst_qsgitem::polishOutsideAnimation() +{ + QSGCanvas *canvas = new QSGCanvas; + canvas->resize(200, 200); + canvas->show(); + + TestPolishItem *item = new TestPolishItem(canvas->rootItem()); + + QTRY_VERIFY(item->wasPolished); + + delete item; + delete canvas; +} QTEST_MAIN(tst_qsgitem) |