summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-04-08 05:07:54 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-04-08 05:07:54 (GMT)
commit9fd2d52881356fb214213f139a2f25081fc848e4 (patch)
tree41902768ff80a3ba81df3fe75cf25a12bd241822 /tests
parent31ec693cd6ae4cf5a2533092f45ba9bb154ba152 (diff)
downloadQt-9fd2d52881356fb214213f139a2f25081fc848e4.zip
Qt-9fd2d52881356fb214213f139a2f25081fc848e4.tar.gz
Qt-9fd2d52881356fb214213f139a2f25081fc848e4.tar.bz2
Fix AnimatedImage for remote image test. Fix and test sourceSize property.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanerror1.qml6
-rw-r--r--tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanscaled.qml7
-rw-r--r--tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp24
3 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanerror1.qml b/tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanerror1.qml
new file mode 100644
index 0000000..5b0bdcb
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanerror1.qml
@@ -0,0 +1,6 @@
+import Qt 4.6
+
+AnimatedImage {
+ sourceSize: "240x180"
+ source: "stickman.gif"
+}
diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanscaled.qml b/tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanscaled.qml
new file mode 100644
index 0000000..f4d277a
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanscaled.qml
@@ -0,0 +1,7 @@
+import Qt 4.6
+
+AnimatedImage {
+ width: 240
+ height: 180
+ source: "stickman.gif"
+}
diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp
index 31efc64..39ce9eb 100644
--- a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp
+++ b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp
@@ -72,6 +72,8 @@ private slots:
void frameCount();
void remote();
void remote_data();
+ void sourceSize();
+ void sourceSizeReadOnly();
void invalidSource();
};
@@ -155,10 +157,32 @@ void tst_qdeclarativeanimatedimage::remote()
TRY_WAIT(anim->isPaused());
QCOMPARE(anim->currentFrame(), 2);
}
+ QVERIFY(anim->status() != QDeclarativeAnimatedImage::Error);
delete anim;
}
+void tst_qdeclarativeanimatedimage::sourceSize()
+{
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanscaled.qml"));
+ QDeclarativeAnimatedImage *anim = qobject_cast<QDeclarativeAnimatedImage *>(component.create());
+ QVERIFY(anim);
+ QCOMPARE(anim->width(),240.0);
+ QCOMPARE(anim->height(),180.0);
+ QCOMPARE(anim->sourceSize(),QSize(160,120));
+
+ delete anim;
+}
+
+void tst_qdeclarativeanimatedimage::sourceSizeReadOnly()
+{
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanerror1.qml"));
+ QVERIFY(component.isError());
+ QCOMPARE(component.errors().at(0).description(), QString("Invalid property assignment: \"sourceSize\" is a read-only property"));
+}
+
void tst_qdeclarativeanimatedimage::remote_data()
{
QTest::addColumn<QString>("fileName");