diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2010-04-14 13:21:38 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2010-04-14 13:21:38 (GMT) |
commit | 8a7199be73aea42eacf07c56a63d2b526204c8fb (patch) | |
tree | 5e2a58f65075ad9b1ba80f34156bc52c576ea3c0 /tests | |
parent | 90e3b63122ef0807c4c8a7e5c7772ea54c1874a4 (diff) | |
parent | 9ae50ce40c1bc571c867bc698f2c53839c2c6932 (diff) | |
download | Qt-8a7199be73aea42eacf07c56a63d2b526204c8fb.zip Qt-8a7199be73aea42eacf07c56a63d2b526204c8fb.tar.gz Qt-8a7199be73aea42eacf07c56a63d2b526204c8fb.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests')
5 files changed, 63 insertions, 1 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/SpuriousWarning.qml b/tests/auto/declarative/qdeclarativeecmascript/data/SpuriousWarning.qml new file mode 100644 index 0000000..86c312c --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/SpuriousWarning.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +Item { + property int children: root.children.length +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.2.qml new file mode 100644 index 0000000..a762d6d --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.2.qml @@ -0,0 +1,10 @@ +import Qt 4.6 + +Item { + id: root + + Item {} + + SpuriousWarning {} +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 12a065e..35b4d99 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -2242,6 +2242,7 @@ void tst_qdeclarativeecmascript::qtbug_9792() // Test that we shut down without stupid warnings void tst_qdeclarativeecmascript::noSpuriousWarningsAtShutdown() { + { QDeclarativeComponent component(&engine, TEST_FILE("noSpuriousWarningsAtShutdown.qml")); QObject *o = component.create(); @@ -2254,6 +2255,23 @@ void tst_qdeclarativeecmascript::noSpuriousWarningsAtShutdown() qInstallMsgHandler(old); QCOMPARE(transientErrorsMsgCount, 0); + } + + + { + QDeclarativeComponent component(&engine, TEST_FILE("noSpuriousWarningsAtShutdown.2.qml")); + + QObject *o = component.create(); + + transientErrorsMsgCount = 0; + QtMsgHandler old = qInstallMsgHandler(transientErrorsMsgHandler); + + delete o; + + qInstallMsgHandler(old); + + QCOMPARE(transientErrorsMsgCount, 0); + } } QTEST_MAIN(tst_qdeclarativeecmascript) diff --git a/tests/auto/declarative/qdeclarativeimage/data/aspectratio.qml b/tests/auto/declarative/qdeclarativeimage/data/aspectratio.qml new file mode 100644 index 0000000..402d33e --- /dev/null +++ b/tests/auto/declarative/qdeclarativeimage/data/aspectratio.qml @@ -0,0 +1,6 @@ +import Qt 4.7 + +Image { + source: "heart.png" + fillMode: Image.PreserveAspectFit; +} diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index 52d7c16..53c208e 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -46,6 +46,7 @@ #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativecomponent.h> +#include <QtDeclarative/qdeclarativeview.h> #include <private/qdeclarativeimage_p.h> #include <private/qdeclarativeimagebase_p.h> #include <private/qdeclarativeloader_p.h> @@ -80,6 +81,7 @@ private slots: void imageSource_data(); void clearSource(); void resized(); + void preserveAspectRatio(); void smooth(); void pixmap(); void svg(); @@ -209,10 +211,31 @@ void tst_qdeclarativeimage::resized() QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); QCOMPARE(obj->fillMode(), QDeclarativeImage::Stretch); - delete obj; } + +void tst_qdeclarativeimage::preserveAspectRatio() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->show(); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/aspectratio.qml")); + QDeclarativeImage *image = qobject_cast<QDeclarativeImage*>(canvas->rootObject()); + QVERIFY(image != 0); + image->setWidth(80.0); + QCOMPARE(image->width(), 80.); + QCOMPARE(image->height(), 80.); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/aspectratio.qml")); + image = qobject_cast<QDeclarativeImage*>(canvas->rootObject()); + image->setHeight(60.0); + QVERIFY(image != 0); + QCOMPARE(image->height(), 60.); + QCOMPARE(image->width(), 60.); + delete canvas; +} + void tst_qdeclarativeimage::smooth() { QString componentStr = "import Qt 4.7\nImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; |