diff options
Diffstat (limited to 'tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index 9e090d2..c5a3d14 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -91,6 +91,7 @@ private slots: void sourceSize_QTBUG_14303(); void sourceSize_QTBUG_16389(); void nullPixmapPaint(); + void resetSourceSize(); void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); @@ -693,6 +694,27 @@ void tst_qdeclarativeimage::nullPixmapPaint() delete image; } +void tst_qdeclarativeimage::resetSourceSize() +{ + QString src = QUrl::fromLocalFile(SRCDIR "/data/heart200.png").toString(); + QString componentStr = "import QtQuick 1.1\nImage { function reset() { sourceSize = undefined }\nsource: \"" + src + "\"; sourceSize: Qt.size(100,100) }"; + + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); + QVERIFY(obj != 0); + QCOMPARE(obj->pixmap().width(), 100); + QCOMPARE(obj->pixmap().height(), 100); + QCOMPARE(obj->sourceSize().height(), 100); + QCOMPARE(obj->sourceSize().width(), 100); + + QMetaObject::invokeMethod(obj, "reset"); + QCOMPARE(obj->pixmap().width(), 200); + QCOMPARE(obj->pixmap().height(), 200); + QCOMPARE(obj->sourceSize().height(), 200); + QCOMPARE(obj->sourceSize().width(), 200); +} + void tst_qdeclarativeimage::testQtQuick11Attributes() { QFETCH(QString, code); |