diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-01-27 06:52:54 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-01-27 06:52:54 (GMT) |
commit | ab71df83ba4eb9d749efc0f3a2d4a0fe5486023f (patch) | |
tree | 4605ab304db27aeec693a154418f2fbffbdebfc2 /tests/auto/declarative/qdeclarativeimage | |
parent | 5d2817cd668a705729df1727de49adf00713ac97 (diff) | |
download | Qt-ab71df83ba4eb9d749efc0f3a2d4a0fe5486023f.zip Qt-ab71df83ba4eb9d749efc0f3a2d4a0fe5486023f.tar.gz Qt-ab71df83ba4eb9d749efc0f3a2d4a0fe5486023f.tar.bz2 |
Add missing revisions for QtQuick 1.1 additions
Task-number: QTBUG-15279
Reviewed-by: Michael Brasser
Diffstat (limited to 'tests/auto/declarative/qdeclarativeimage')
-rw-r--r-- | tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index c277eb7..f1fe2bd 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -90,6 +90,8 @@ private slots: void paintedWidthHeight(); void sourceSize_QTBUG_14303(); void nullPixmapPaint(); + void testQtQuick11Attributes(); + void testQtQuick11Attributes_data(); private: template<typename T> @@ -164,7 +166,7 @@ void tst_qdeclarativeimage::imageSource() if (!error.isEmpty()) QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); - QString componentStr = "import QtQuick 1.0\nImage { source: \"" + source + "\"; asynchronous: " + QString componentStr = "import QtQuick 1.1\nImage { source: \"" + source + "\"; asynchronous: " + (async ? QLatin1String("true") : QLatin1String("false")) + "; cache: " + (cache ? QLatin1String("true") : QLatin1String("false")) + " }"; QDeclarativeComponent component(&engine); @@ -280,7 +282,7 @@ void tst_qdeclarativeimage::mirror() qreal height = 250; QString src = QUrl::fromLocalFile(SRCDIR "/data/heart200.png").toString(); - QString componentStr = "import QtQuick 1.0\nImage { source: \"" + src + "\"; }"; + QString componentStr = "import QtQuick 1.1\nImage { source: \"" + src + "\"; }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -667,6 +669,45 @@ void tst_qdeclarativeimage::nullPixmapPaint() delete image; } +void tst_qdeclarativeimage::testQtQuick11Attributes() +{ + QFETCH(QString, code); + QFETCH(QString, warning); + QFETCH(QString, error); + + QDeclarativeEngine engine; + QObject *obj; + + QDeclarativeComponent valid(&engine); + valid.setData("import QtQuick 1.1; Image { " + code.toUtf8() + " }", QUrl("")); + obj = valid.create(); + QVERIFY(obj); + QVERIFY(valid.errorString().isEmpty()); + delete obj; + + QDeclarativeComponent invalid(&engine); + invalid.setData("import QtQuick 1.0; Image { " + code.toUtf8() + " }", QUrl("")); + QTest::ignoreMessage(QtWarningMsg, warning.toUtf8()); + obj = invalid.create(); + QCOMPARE(invalid.errorString(), error); + delete obj; +} + +void tst_qdeclarativeimage::testQtQuick11Attributes_data() +{ + QTest::addColumn<QString>("code"); + QTest::addColumn<QString>("warning"); + QTest::addColumn<QString>("error"); + + QTest::newRow("mirror") << "mirror: true" + << "QDeclarativeComponent: Component is not ready" + << ":1 \"Image.mirror\" is not available in QtQuick 1.0.\n"; + + QTest::newRow("cache") << "cache: true" + << "QDeclarativeComponent: Component is not ready" + << ":1 \"Image.cache\" is not available in QtQuick 1.0.\n"; +} + /* Find an item with the specified objectName. If index is supplied then the item must also evaluate the {index} expression equal to index |