summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmlgraphicsitem
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2010-02-16 06:16:38 (GMT)
committerJoona Petrell <joona.t.petrell@nokia.com>2010-02-17 05:11:40 (GMT)
commit060d833d3e0fd5a99876e0717fb26ef93fae30e1 (patch)
tree75dff625d18ca442088c8b8b07b9979e5cb55544 /tests/auto/declarative/qmlgraphicsitem
parent7f6317c25e6c1ec457971ab70c850d4d2bbe4cd2 (diff)
downloadQt-060d833d3e0fd5a99876e0717fb26ef93fae30e1.zip
Qt-060d833d3e0fd5a99876e0717fb26ef93fae30e1.tar.gz
Qt-060d833d3e0fd5a99876e0717fb26ef93fae30e1.tar.bz2
Add missing NOTIFY signals to various QML item class properties
Reviewed-by: Aaron Kennedy
Diffstat (limited to 'tests/auto/declarative/qmlgraphicsitem')
-rw-r--r--tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp52
1 files changed, 51 insertions, 1 deletions
diff --git a/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp b/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp
index c671dae..639f64c 100644
--- a/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp
+++ b/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp
@@ -39,11 +39,12 @@
**
****************************************************************************/
#include <qtest.h>
+#include <QtTest/QSignalSpy>
#include <QtDeclarative/qmlengine.h>
#include <QtDeclarative/qmlcomponent.h>
#include <QtDeclarative/qmlcontext.h>
#include <QtDeclarative/qmlview.h>
-#include <qmlgraphicsitem.h>
+#include <QtDeclarative/qmlgraphicsitem.h>
class tst_QmlGraphicsItem : public QObject
@@ -55,10 +56,13 @@ public:
private slots:
void keys();
void keyNavigation();
+ void smooth();
+ void clip();
private:
template<typename T>
T *findItem(QmlGraphicsItem *parent, const QString &objectName);
+ QmlEngine engine;
};
class KeysTestObject : public QObject
@@ -241,6 +245,52 @@ void tst_QmlGraphicsItem::keyNavigation()
QVERIFY(item->hasFocus());
}
+void tst_QmlGraphicsItem::smooth()
+{
+ QmlComponent component(&engine);
+ component.setData("import Qt 4.6; Item { smooth: false; }", QUrl::fromLocalFile(""));
+ QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(component.create());
+ QSignalSpy spy(item, SIGNAL(smoothChanged()));
+
+ QVERIFY(item);
+ QVERIFY(!item->smooth());
+
+ item->setSmooth(true);
+ QVERIFY(item->smooth());
+ QCOMPARE(spy.count(),1);
+ item->setSmooth(true);
+ QCOMPARE(spy.count(),1);
+
+ item->setSmooth(false);
+ QVERIFY(!item->smooth());
+ QCOMPARE(spy.count(),2);
+ item->setSmooth(false);
+ QCOMPARE(spy.count(),2);
+}
+
+void tst_QmlGraphicsItem::clip()
+{
+ QmlComponent component(&engine);
+ component.setData("import Qt 4.6\nItem { clip: false\n }", QUrl::fromLocalFile(""));
+ QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(component.create());
+ QSignalSpy spy(item, SIGNAL(clipChanged()));
+
+ QVERIFY(item);
+ QVERIFY(!item->clip());
+
+ item->setClip(true);
+ QVERIFY(item->clip());
+ QCOMPARE(spy.count(),1);
+ item->setClip(true);
+ QCOMPARE(spy.count(),1);
+
+ item->setClip(false);
+ QVERIFY(!item->clip());
+ QCOMPARE(spy.count(),2);
+ item->setClip(false);
+ QCOMPARE(spy.count(),2);
+}
+
template<typename T>
T *tst_QmlGraphicsItem::findItem(QmlGraphicsItem *parent, const QString &objectName)
{