diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2010-05-18 04:09:47 (GMT) |
---|---|---|
committer | Andrew den Exter <andrew.den-exter@nokia.com> | 2010-05-18 04:09:47 (GMT) |
commit | 183afaf48fdaeeacde009cd3f497152f89d8e0af (patch) | |
tree | e6fcc88a20e8af694c7c5020b2050c76add26de7 /tests/auto | |
parent | cb03c8cad2a40272c9cc8d0998246fb74a49e671 (diff) | |
parent | 379b4dc81177b95c15de30c5925efca1136e4041 (diff) | |
download | Qt-183afaf48fdaeeacde009cd3f497152f89d8e0af.zip Qt-183afaf48fdaeeacde009cd3f497152f89d8e0af.tar.gz Qt-183afaf48fdaeeacde009cd3f497152f89d8e0af.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt into 4.7
Conflicts:
configure.exe
src/imports/multimedia/qdeclarativeaudio.cpp
src/imports/multimedia/qdeclarativeaudio_p.h
src/multimedia/mediaservices/mediaservices.pro
src/plugins/mediaservices/mediaservices.pro
src/plugins/mediaservices/symbian/mediaplayer/s60audioplayersession.h
src/plugins/mediaservices/symbian/mediaplayer/s60videoplayersession.h
src/s60installs/s60installs.pro
src/src.pro
Diffstat (limited to 'tests/auto')
259 files changed, 5271 insertions, 1543 deletions
diff --git a/tests/auto/bic/tst_bic.cpp b/tests/auto/bic/tst_bic.cpp index 010965c..400fcc1 100644 --- a/tests/auto/bic/tst_bic.cpp +++ b/tests/auto/bic/tst_bic.cpp @@ -191,7 +191,7 @@ void tst_Bic::sizesAndVTables_data() #elif defined Q_OS_MAC && defined(__i386__) # define FILESUFFIX "macx-gcc-ia32" #elif defined Q_OS_MAC && defined(__amd64__) -# define FILESUFFIX "macx-gcc-amd64"; +# define FILESUFFIX "macx-gcc-amd64" #elif defined Q_OS_WIN && defined Q_CC_GNU # define FILESUFFIX "win32-gcc-ia32" #else diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 9b3b3d0..4bb3518 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -1,77 +1,80 @@ TEMPLATE = subdirs +!symbian: { SUBDIRS += \ examples \ - graphicswidgets \ # Cover - parserstress \ # Cover - qmetaobjectbuilder \ # Cover - qdeclarativeanimations \ # Cover - qdeclarativebehaviors \ # Cover - qdeclarativebinding \ # Cover - qdeclarativecomponent \ # Cover - qdeclarativeconnection \ # Cover - qdeclarativecontext \ # Cover - qdeclarativedebug \ # Cover - qdeclarativedebugclient \ # Cover - qdeclarativedebugservice \ # Cover - qdeclarativedom \ # Cover - qdeclarativeecmascript \ # Cover - qdeclarativeengine \ # Cover - qdeclarativeerror \ # Cover - qdeclarativefontloader \ # Cover - qdeclarativeanchors \ # Cover - qdeclarativeanimatedimage \ # Cover - qdeclarativeimage \ # Cover - qdeclarativeborderimage \ # Cover - qdeclarativeflickable \ # Cover - qdeclarativeflipable \ # Cover - qdeclarativefocusscope \ # Cover - qdeclarativegridview \ # Cover - qdeclarativeitem \ # Cover - qdeclarativelistview \ # Cover - qdeclarativeloader \ # Cover - qdeclarativelayouts \ # Cover - qdeclarativemousearea \ # Cover - qdeclarativeparticles \ # Cover - qdeclarativepathview \ # Cover - qdeclarativepositioners \ # Cover - qdeclarativetext \ # Cover - qdeclarativetextedit \ # Cover - qdeclarativetextinput \ # Cover - qdeclarativeinfo \ # Cover - qdeclarativeinstruction \ # Cover - qdeclarativelanguage \ # Cover - qdeclarativelistreference \ # Cover - qdeclarativelistmodel \ # Cover - qdeclarativeproperty \ # Cover - qdeclarativemetatype \ # Cover - qdeclarativemoduleplugin \ # Cover - qdeclarativepixmapcache \ # Cover - qdeclarativepropertymap \ # Cover - qdeclarativeqt \ # Cover - qdeclarativesmoothedanimation \ # Cover - qdeclarativesmoothedfollow\ # Cover - qdeclarativespringfollow \ # Cover - qdeclarativestates \ # Cover - qdeclarativesystempalette \ # Cover - qdeclarativetimer \ # Cover - qdeclarativexmllistmodel \ # Cover - qpacketprotocol \ # Cover - qdeclarativerepeater \ # Cover - qdeclarativeworkerscript \ # Cover - qdeclarativevaluetypes \ # Cover - qdeclarativeview \ # Cover - qdeclarativexmlhttprequest \ # Cover - qdeclarativeimageprovider \ # Cover - qdeclarativestyledtext \ # Cover - qdeclarativesqldatabase \ # Cover - qdeclarativevisualdatamodel \ # Cover - qmlvisual # Cover + qdeclarativemetatype \ + qmetaobjectbuilder +} + +SUBDIRS += \ + parserstress \ + qdeclarativeanchors \ + qdeclarativeanimatedimage \ + qdeclarativeanimations \ + qdeclarativebehaviors \ + qdeclarativebinding \ + qdeclarativeborderimage \ + qdeclarativecomponent \ + qdeclarativeconnection \ + qdeclarativecontext \ + qdeclarativedebug \ + qdeclarativedebugclient \ + qdeclarativedebugservice \ + qdeclarativedom \ + qdeclarativeecmascript \ + qdeclarativeengine \ + qdeclarativeerror \ + qdeclarativefontloader \ + qdeclarativeflickable \ + qdeclarativeflipable \ + qdeclarativefocusscope \ + qdeclarativegridview \ + qdeclarativeimage \ + qdeclarativeimageprovider \ + qdeclarativeinfo \ + qdeclarativeinstruction \ + qdeclarativeitem \ + qdeclarativelanguage \ + qdeclarativelayoutitem \ + qdeclarativelistmodel \ + qdeclarativelistreference \ + qdeclarativelistview \ + qdeclarativeloader \ + qdeclarativemoduleplugin \ + qdeclarativemousearea \ + qdeclarativeparticles \ + qdeclarativepathview \ + qdeclarativepixmapcache \ + qdeclarativepositioners \ + qdeclarativeproperty \ + qdeclarativepropertymap \ + qdeclarativeqt \ + qdeclarativerepeater \ + qdeclarativesmoothedanimation \ + qdeclarativesmoothedfollow\ + qdeclarativespringfollow \ + qdeclarativesqldatabase \ + qdeclarativestates \ + qdeclarativestyledtext \ + qdeclarativesystempalette \ + qdeclarativetext \ + qdeclarativetextedit \ + qdeclarativetextinput \ + qdeclarativetimer \ + qdeclarativevaluetypes \ + qdeclarativeview \ + qdeclarativeviewer \ + qdeclarativevisualdatamodel \ + qdeclarativeworkerscript \ + qdeclarativexmlhttprequest \ + qdeclarativexmllistmodel \ + qmlvisual \ + qpacketprotocol contains(QT_CONFIG, webkit) { SUBDIRS += \ - qdeclarativewebview # Cover + qdeclarativewebview } # Tests which should run in Pulse PULSE_TESTS = $$SUBDIRS - diff --git a/tests/auto/declarative/examples/examples.pro b/tests/auto/declarative/examples/examples.pro index 4c32524..92a16f1 100644 --- a/tests/auto/declarative/examples/examples.pro +++ b/tests/auto/declarative/examples/examples.pro @@ -6,7 +6,14 @@ SOURCES += tst_examples.cpp include(../../../../tools/qml/qml.pri) -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index 16b0cbe..605345e 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -80,22 +80,14 @@ tst_examples::tst_examples() // Add directories you want excluded here - excludedDirs << "examples/declarative/extending"; - excludedDirs << "examples/declarative/tutorials/extending"; - excludedDirs << "examples/declarative/plugins"; - excludedDirs << "examples/declarative/proxywidgets"; - excludedDirs << "examples/declarative/gestures"; - - excludedDirs << "examples/declarative/imageprovider"; - excludedDirs << "demos/declarative/minehunt"; #ifdef QT_NO_WEBKIT - excludedDirs << "examples/declarative/webview"; + excludedDirs << "examples/declarative/modelviews/webview"; excludedDirs << "demos/declarative/webbrowser"; #endif #ifdef QT_NO_XMLPATTERNS - excludedDirs << "examples/declarative/xmldata"; + excludedDirs << "examples/declarative/xml/xmldata"; excludedDirs << "demos/declarative/twitter"; excludedDirs << "demos/declarative/flickr"; excludedDirs << "demos/declarative/photoviewer"; @@ -157,11 +149,14 @@ QStringList tst_examples::findQmlFiles(const QDir &d) QStringList rv; - QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"), - QDir::Files); - foreach (const QString &file, files) { - if (file.at(0).isLower()) { - rv << d.absoluteFilePath(file); + QStringList cppfiles = d.entryList(QStringList() << QLatin1String("*.cpp"), QDir::Files); + if (cppfiles.isEmpty()) { + QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"), + QDir::Files); + foreach (const QString &file, files) { + if (file.at(0).isLower()) { + rv << d.absoluteFilePath(file); + } } } diff --git a/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml b/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml deleted file mode 100644 index d6cf4de..0000000 --- a/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml +++ /dev/null @@ -1,52 +0,0 @@ -import Qt 4.7 -import Qt.widgets 4.7 - -QGraphicsWidget { - geometry: "20,0,600x400" - layout: QGraphicsLinearLayout { - orientation: Qt.Horizontal - QGraphicsWidget { - layout: QGraphicsLinearLayout { - spacing: 10; orientation: Qt.Vertical - LayoutItem { - QGraphicsLinearLayout.stretchFactor: 1 - QGraphicsLinearLayout.spacing: 1 - objectName: "left" - minimumSize: "100x100" - maximumSize: "300x300" - preferredSize: "100x100" - Rectangle { objectName: "yellowRect"; color: "yellow"; anchors.fill: parent } - } - LayoutItem { - QGraphicsLinearLayout.stretchFactor: 10 - QGraphicsLinearLayout.spacing: 10 - objectName: "left" - minimumSize: "100x100" - maximumSize: "300x300" - preferredSize: "100x100" - Rectangle { objectName: "yellowRect"; color: "blue"; anchors.fill: parent } - } - } - } - QGraphicsWidget { - layout: QGraphicsLinearLayout { - spacing: 10; orientation: Qt.Horizontal; contentsMargin: 10 - LayoutItem { - objectName: "left" - minimumSize: "100x100" - maximumSize: "300x300" - preferredSize: "100x100" - Rectangle { objectName: "yellowRect"; color: "red"; anchors.fill: parent } - } - LayoutItem { - objectName: "left" - minimumSize: "100x100" - maximumSize: "300x300" - preferredSize: "100x100" - Rectangle { objectName: "yellowRect"; color: "green"; anchors.fill: parent } - } - } - } - } -} - diff --git a/tests/auto/declarative/graphicswidgets/graphicswidgets.pro b/tests/auto/declarative/graphicswidgets/graphicswidgets.pro deleted file mode 100644 index b77b430..0000000 --- a/tests/auto/declarative/graphicswidgets/graphicswidgets.pro +++ /dev/null @@ -1,10 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui -macx:CONFIG -= app_bundle - -SOURCES += tst_graphicswidgets.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" - -CONFIG += parallel_test diff --git a/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp b/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp deleted file mode 100644 index f1a71d5..0000000 --- a/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <qtest.h> -#include <QFile> -#include <QtDeclarative/qdeclarativeengine.h> -#include <QtDeclarative/qdeclarativecomponent.h> -#include <QtGui/qgraphicswidget.h> - -class tst_graphicswidgets : public QObject - -{ - Q_OBJECT -public: - tst_graphicswidgets(); - -private slots: - void widgets(); -}; - -tst_graphicswidgets::tst_graphicswidgets() -{ -} - -void tst_graphicswidgets::widgets() -{ - QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/graphicswidgets.qml")); - QGraphicsWidget *obj = qobject_cast<QGraphicsWidget*>(c.create()); - - QVERIFY(obj != 0); - delete obj; -} - -QTEST_MAIN(tst_graphicswidgets) - -#include "tst_graphicswidgets.moc" diff --git a/tests/auto/declarative/parserstress/parserstress.pro b/tests/auto/declarative/parserstress/parserstress.pro index 8830511..a95a855 100644 --- a/tests/auto/declarative/parserstress/parserstress.pro +++ b/tests/auto/declarative/parserstress/parserstress.pro @@ -4,7 +4,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_parserstress.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = ..\..\qscriptjstestsuite\tests + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/parserstress/tst_parserstress.cpp b/tests/auto/declarative/parserstress/tst_parserstress.cpp index 294f2f7..c86908b 100644 --- a/tests/auto/declarative/parserstress/tst_parserstress.cpp +++ b/tests/auto/declarative/parserstress/tst_parserstress.cpp @@ -86,12 +86,15 @@ QStringList tst_parserstress::findJSFiles(const QDir &d) void tst_parserstress::ecmascript_data() { +#ifdef Q_OS_SYMBIAN + QDir dir("tests"); +#else QDir dir(SRCDIR); dir.cdUp(); dir.cdUp(); dir.cd("qscriptjstestsuite"); dir.cd("tests"); - +#endif QStringList files = findJSFiles(dir); QTest::addColumn<QString>("file"); @@ -129,6 +132,7 @@ void tst_parserstress::ecmascript() QByteArray qmlData = qml.toUtf8(); QDeclarativeComponent component(&engine); + component.setData(qmlData, QUrl::fromLocalFile(SRCDIR + QString("/dummy.qml"))); QFileInfo info(file); diff --git a/tests/auto/declarative/qdeclarativeanchors/data/anchorsqgraphicswidget.qml b/tests/auto/declarative/qdeclarativeanchors/data/anchorsqgraphicswidget.qml index 91973a3..d430c2c 100644 --- a/tests/auto/declarative/qdeclarativeanchors/data/anchorsqgraphicswidget.qml +++ b/tests/auto/declarative/qdeclarativeanchors/data/anchorsqgraphicswidget.qml @@ -1,5 +1,4 @@ import Qt 4.7 -import Qt.widgets 4.7 Rectangle { color: "white" diff --git a/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro b/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro index a2403f2..452ad55 100644 --- a/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro +++ b/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro @@ -3,7 +3,14 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativeanchors.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp index dff62c7..e169fa2 100644 --- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp +++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -48,6 +48,7 @@ #include <private/qdeclarativerectangle_p.h> #include <private/qdeclarativetext_p.h> #include <QtDeclarative/private/qdeclarativeanchors_p_p.h> +#include <QtDeclarative/private/qdeclarativeitem_p.h> Q_DECLARE_METATYPE(QDeclarativeAnchors::Anchor) Q_DECLARE_METATYPE(QDeclarativeAnchorLine::AnchorLine) @@ -376,15 +377,16 @@ void tst_qdeclarativeanchors::reset() anchor.anchorLine = anchorLine; QDeclarativeItem *item = new QDeclarativeItem; + QDeclarativeItemPrivate *itemPrivate = QDeclarativeItemPrivate::get(item); - const QMetaObject *meta = item->anchors()->metaObject(); + const QMetaObject *meta = itemPrivate->anchors()->metaObject(); QMetaProperty p = meta->property(meta->indexOfProperty(side.toUtf8().constData())); - QVERIFY(p.write(item->anchors(), qVariantFromValue(anchor))); - QCOMPARE(item->anchors()->usedAnchors().testFlag(usedAnchor), true); + QVERIFY(p.write(itemPrivate->anchors(), qVariantFromValue(anchor))); + QCOMPARE(itemPrivate->anchors()->usedAnchors().testFlag(usedAnchor), true); - QVERIFY(p.reset(item->anchors())); - QCOMPARE(item->anchors()->usedAnchors().testFlag(usedAnchor), false); + QVERIFY(p.reset(itemPrivate->anchors())); + QCOMPARE(itemPrivate->anchors()->usedAnchors().testFlag(usedAnchor), false); delete item; delete baseItem; @@ -410,18 +412,19 @@ void tst_qdeclarativeanchors::resetConvenience() { QDeclarativeItem *baseItem = new QDeclarativeItem; QDeclarativeItem *item = new QDeclarativeItem; + QDeclarativeItemPrivate *itemPrivate = QDeclarativeItemPrivate::get(item); //fill - item->anchors()->setFill(baseItem); - QVERIFY(item->anchors()->fill() == baseItem); - item->anchors()->resetFill(); - QVERIFY(item->anchors()->fill() == 0); + itemPrivate->anchors()->setFill(baseItem); + QVERIFY(itemPrivate->anchors()->fill() == baseItem); + itemPrivate->anchors()->resetFill(); + QVERIFY(itemPrivate->anchors()->fill() == 0); //centerIn - item->anchors()->setCenterIn(baseItem); - QVERIFY(item->anchors()->centerIn() == baseItem); - item->anchors()->resetCenterIn(); - QVERIFY(item->anchors()->centerIn() == 0); + itemPrivate->anchors()->setCenterIn(baseItem); + QVERIFY(itemPrivate->anchors()->centerIn() == baseItem); + itemPrivate->anchors()->resetCenterIn(); + QVERIFY(itemPrivate->anchors()->centerIn() == 0); delete item; delete baseItem; @@ -433,12 +436,13 @@ void tst_qdeclarativeanchors::nullItem() QDeclarativeAnchorLine anchor; QDeclarativeItem *item = new QDeclarativeItem; + QDeclarativeItemPrivate *itemPrivate = QDeclarativeItemPrivate::get(item); - const QMetaObject *meta = item->anchors()->metaObject(); + const QMetaObject *meta = itemPrivate->anchors()->metaObject(); QMetaProperty p = meta->property(meta->indexOfProperty(side.toUtf8().constData())); QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML Item: Cannot anchor to a null item."); - QVERIFY(p.write(item->anchors(), qVariantFromValue(anchor))); + QVERIFY(p.write(itemPrivate->anchors(), qVariantFromValue(anchor))); delete item; } @@ -486,15 +490,16 @@ void tst_qdeclarativeanchors::fill() qApp->processEvents(); QDeclarativeRectangle* rect = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("filler")); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QCOMPARE(rect->x(), 0.0 + 10.0); QCOMPARE(rect->y(), 0.0 + 30.0); QCOMPARE(rect->width(), 200.0 - 10.0 - 20.0); QCOMPARE(rect->height(), 200.0 - 30.0 - 40.0); //Alter Offsets (tests QTBUG-6631) - rect->anchors()->setLeftMargin(20.0); - rect->anchors()->setRightMargin(0.0); - rect->anchors()->setBottomMargin(0.0); - rect->anchors()->setTopMargin(10.0); + rectPrivate->anchors()->setLeftMargin(20.0); + rectPrivate->anchors()->setRightMargin(0.0); + rectPrivate->anchors()->setBottomMargin(0.0); + rectPrivate->anchors()->setTopMargin(10.0); QCOMPARE(rect->x(), 0.0 + 20.0); QCOMPARE(rect->y(), 0.0 + 10.0); QCOMPARE(rect->width(), 200.0 - 20.0); @@ -509,11 +514,12 @@ void tst_qdeclarativeanchors::centerIn() qApp->processEvents(); QDeclarativeRectangle* rect = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("centered")); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QCOMPARE(rect->x(), 75.0 + 10); QCOMPARE(rect->y(), 75.0 + 30); //Alter Offsets (tests QTBUG-6631) - rect->anchors()->setHorizontalCenterOffset(-20.0); - rect->anchors()->setVerticalCenterOffset(-10.0); + rectPrivate->anchors()->setHorizontalCenterOffset(-20.0); + rectPrivate->anchors()->setVerticalCenterOffset(-10.0); QCOMPARE(rect->x(), 75.0 - 20.0); QCOMPARE(rect->y(), 75.0 - 10.0); @@ -526,13 +532,14 @@ void tst_qdeclarativeanchors::margins() qApp->processEvents(); QDeclarativeRectangle* rect = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("filler")); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QCOMPARE(rect->x(), 5.0); QCOMPARE(rect->y(), 6.0); QCOMPARE(rect->width(), 200.0 - 5.0 - 10.0); QCOMPARE(rect->height(), 200.0 - 6.0 - 10.0); - rect->anchors()->setTopMargin(0.0); - rect->anchors()->setMargins(20.0); + rectPrivate->anchors()->setTopMargin(0.0); + rectPrivate->anchors()->setMargins(20.0); QCOMPARE(rect->x(), 5.0); QCOMPARE(rect->y(), 20.0); diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro b/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro index 74f9be0..7213abd 100644 --- a/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro +++ b/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro @@ -4,7 +4,14 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativeanimatedimage.cpp ../shared/testhttpserver.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro index ce38eeb..f7ed371 100644 --- a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro +++ b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro @@ -3,7 +3,14 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativeanimations.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index e217e34..ed7e506 100644 --- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -44,6 +44,7 @@ #include <QtDeclarative/qdeclarativeview.h> #include <private/qdeclarativerectangle_p.h> #include <private/qdeclarativeanimation_p.h> +#include <private/qdeclarativeitem_p.h> #include <QVariantAnimation> #include <QEasingCurve> @@ -324,7 +325,7 @@ void tst_qdeclarativeanimations::badTypes() QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); QVERIFY(rect); - rect->setState("state1"); + QDeclarativeItemPrivate::get(rect)->setState("state1"); QTest::qWait(1000 + 50); QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("MyRect"); QVERIFY(myRect); @@ -366,7 +367,7 @@ void tst_qdeclarativeanimations::mixedTypes() QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); QVERIFY(rect); - rect->setState("state1"); + QDeclarativeItemPrivate::get(rect)->setState("state1"); QTest::qWait(500); QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("MyRect"); QVERIFY(myRect); @@ -382,7 +383,7 @@ void tst_qdeclarativeanimations::mixedTypes() QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); QVERIFY(rect); - rect->setState("state1"); + QDeclarativeItemPrivate::get(rect)->setState("state1"); QTest::qWait(500); QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("MyRect"); QVERIFY(myRect); @@ -468,7 +469,7 @@ void tst_qdeclarativeanimations::propertiesTransition() QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); QVERIFY(rect); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); QVERIFY(myRect); QTest::qWait(waitDuration); @@ -483,7 +484,7 @@ void tst_qdeclarativeanimations::propertiesTransition() QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); QVERIFY(myRect); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); QCOMPARE(myRect->x(),qreal(200)); QCOMPARE(myRect->y(),qreal(100)); QTest::qWait(waitDuration); @@ -498,7 +499,7 @@ void tst_qdeclarativeanimations::propertiesTransition() QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); QVERIFY(myRect); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); QCOMPARE(myRect->x(),qreal(200)); QCOMPARE(myRect->y(),qreal(100)); } @@ -511,7 +512,7 @@ void tst_qdeclarativeanimations::propertiesTransition() QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); QVERIFY(myRect); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); QCOMPARE(myRect->x(),qreal(100)); QTest::qWait(waitDuration); QTIMED_COMPARE(myRect->x(),qreal(200)); @@ -525,7 +526,7 @@ void tst_qdeclarativeanimations::propertiesTransition() QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); QVERIFY(myRect); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); QCOMPARE(myRect->x(),qreal(100)); QTest::qWait(waitDuration); QTIMED_COMPARE(myRect->x(),qreal(200)); @@ -539,7 +540,7 @@ void tst_qdeclarativeanimations::propertiesTransition() QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); QVERIFY(myRect); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); QCOMPARE(myRect->x(),qreal(100)); QTest::qWait(waitDuration); QTIMED_COMPARE(myRect->x(),qreal(100)); @@ -709,7 +710,7 @@ void tst_qdeclarativeanimations::rotation() QDeclarativeRectangle *rr3 = rect->findChild<QDeclarativeRectangle*>("rr3"); QDeclarativeRectangle *rr4 = rect->findChild<QDeclarativeRectangle*>("rr4"); - rect->setState("state1"); + QDeclarativeItemPrivate::get(rect)->setState("state1"); QTest::qWait(800); qreal r1 = rr->rotation(); qreal r2 = rr2->rotation(); diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/startup2.qml b/tests/auto/declarative/qdeclarativebehaviors/data/startup2.qml new file mode 100644 index 0000000..1911cc4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativebehaviors/data/startup2.qml @@ -0,0 +1,16 @@ +import Qt 4.7 + +Rectangle { + width: 800; + height: 480; + + Text { id:theText; text: "hello world" } + + Rectangle { + objectName: "innerRect" + color: "red" + x: theText.width + Behavior on x { NumberAnimation {} } + width: 100; height: 100 + } +} diff --git a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro index c2781b8..7137af1 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro +++ b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro @@ -3,7 +3,14 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativebehaviors.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index ee9e282..1dc4b53 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -43,8 +43,10 @@ #include <QtDeclarative/qdeclarativecomponent.h> #include <QtDeclarative/qdeclarativeview.h> #include <private/qdeclarativerectangle_p.h> +#include <private/qdeclarativetext_p.h> #include <private/qdeclarativebehavior_p.h> #include <private/qdeclarativeanimation_p.h> +#include <private/qdeclarativeitem_p.h> #include "../../../shared/util.h" class tst_qdeclarativebehaviors : public QObject @@ -80,7 +82,7 @@ void tst_qdeclarativebehaviors::simpleBehavior() QTRY_VERIFY(rect); QTRY_VERIFY(qobject_cast<QDeclarativeBehavior*>(rect->findChild<QDeclarativeBehavior*>("MyBehavior"))->animation()); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() > 0); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() < 200); //i.e. the behavior has been triggered @@ -128,7 +130,7 @@ void tst_qdeclarativebehaviors::loop() QTRY_VERIFY(rect); //don't crash - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); delete rect; } @@ -140,7 +142,7 @@ void tst_qdeclarativebehaviors::colorBehavior() QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); QTRY_VERIFY(rect); - rect->setState("red"); + QDeclarativeItemPrivate::get(rect)->setState("red"); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->color() != QColor("red")); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->color() != QColor("green")); //i.e. the behavior has been triggered @@ -155,7 +157,7 @@ void tst_qdeclarativebehaviors::parentBehavior() QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); QTRY_VERIFY(rect); - rect->setState("reparented"); + QDeclarativeItemPrivate::get(rect)->setState("reparented"); QTRY_VERIFY(rect->findChild<QDeclarativeRectangle*>("MyRect")->parentItem() != rect->findChild<QDeclarativeItem*>("NewParent")); QTRY_VERIFY(rect->findChild<QDeclarativeRectangle*>("MyRect")->parentItem() == rect->findChild<QDeclarativeItem*>("NewParent")); @@ -169,7 +171,7 @@ void tst_qdeclarativebehaviors::replaceBinding() QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); QTRY_VERIFY(rect); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); QTRY_VERIFY(innerRect); QTRY_VERIFY(innerRect->x() > 0); @@ -181,7 +183,7 @@ void tst_qdeclarativebehaviors::replaceBinding() rect->setProperty("movedx", 210); QTRY_COMPARE(innerRect->x(), (qreal)210); - rect->setState(""); + QDeclarativeItemPrivate::get(rect)->setState(""); QTRY_VERIFY(innerRect->x() > 10); QTRY_VERIFY(innerRect->x() < 210); //i.e. the behavior has been triggered QTRY_COMPARE(innerRect->x(), (qreal)10); @@ -201,7 +203,7 @@ void tst_qdeclarativebehaviors::group() QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); QTRY_VERIFY(rect); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); //QTest::qWait(200); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() > 0); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() < 200); @@ -216,7 +218,7 @@ void tst_qdeclarativebehaviors::group() QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); QTRY_VERIFY(rect); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() > 0); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() < 200); //i.e. the behavior has been triggered @@ -230,11 +232,11 @@ void tst_qdeclarativebehaviors::emptyBehavior() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/empty.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QTRY_VERIFY(rect); + QVERIFY(rect); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QTRY_COMPARE(x, qreal(200)); //should change immediately + QCOMPARE(x, qreal(200)); //should change immediately delete rect; } @@ -244,9 +246,9 @@ void tst_qdeclarativebehaviors::explicitSelection() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/explicit.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QTRY_VERIFY(rect); + QVERIFY(rect); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() > 0); QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() < 200); //i.e. the behavior has been triggered @@ -259,11 +261,11 @@ void tst_qdeclarativebehaviors::nonSelectingBehavior() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/nonSelecting2.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QTRY_VERIFY(rect); + QVERIFY(rect); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QTRY_COMPARE(x, qreal(200)); //should change immediately + QCOMPARE(x, qreal(200)); //should change immediately delete rect; } @@ -275,10 +277,9 @@ void tst_qdeclarativebehaviors::reassignedAnimation() QString warning = QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml").toString() + ":9:9: QML Behavior: Cannot change the animation assigned to a Behavior."; QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QTRY_VERIFY(rect); - QTRY_COMPARE(qobject_cast<QDeclarativeNumberAnimation*>( - qobject_cast<QDeclarativeBehavior*>( - rect->findChild<QDeclarativeBehavior*>("MyBehavior"))->animation())->duration(), 200); + QVERIFY(rect); + QCOMPARE(qobject_cast<QDeclarativeNumberAnimation*>( + rect->findChild<QDeclarativeBehavior*>("MyBehavior")->animation())->duration(), 200); delete rect; } @@ -288,12 +289,12 @@ void tst_qdeclarativebehaviors::disabled() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/disabled.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QTRY_VERIFY(rect); - QTRY_COMPARE(rect->findChild<QDeclarativeBehavior*>("MyBehavior")->enabled(), false); + QVERIFY(rect); + QCOMPARE(rect->findChild<QDeclarativeBehavior*>("MyBehavior")->enabled(), false); - rect->setState("moved"); + QDeclarativeItemPrivate::get(rect)->setState("moved"); qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QTRY_COMPARE(x, qreal(200)); //should change immediately + QCOMPARE(x, qreal(200)); //should change immediately delete rect; } @@ -307,28 +308,47 @@ void tst_qdeclarativebehaviors::dontStart() QString warning = c.url().toString() + ":13:13: QML NumberAnimation: setRunning() cannot be used on non-root animation nodes."; QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QTRY_VERIFY(rect); + QVERIFY(rect); QDeclarativeAbstractAnimation *myAnim = rect->findChild<QDeclarativeAbstractAnimation*>("MyAnim"); - QTRY_VERIFY(myAnim && myAnim->qtAnimation()); - QTRY_VERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); + QVERIFY(myAnim && myAnim->qtAnimation()); + QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); delete rect; } void tst_qdeclarativebehaviors::startup() { - QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/startup.qml")); - QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QTRY_VERIFY(rect); + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/startup.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); - QDeclarativeRectangle *innerRect = rect->findChild<QDeclarativeRectangle*>("innerRect"); - QTRY_VERIFY(innerRect); + QDeclarativeRectangle *innerRect = rect->findChild<QDeclarativeRectangle*>("innerRect"); + QVERIFY(innerRect); - QTRY_COMPARE(innerRect->x(), qreal(100)); //should be set immediately + QCOMPARE(innerRect->x(), qreal(100)); //should be set immediately - delete rect; + delete rect; + } + + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/startup2.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeRectangle *innerRect = rect->findChild<QDeclarativeRectangle*>("innerRect"); + QVERIFY(innerRect); + + QDeclarativeText *text = rect->findChild<QDeclarativeText*>(); + QVERIFY(text); + + QCOMPARE(innerRect->x(), text->width()); //should be set immediately + + delete rect; + } } QTEST_MAIN(tst_qdeclarativebehaviors) diff --git a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro index 04dd6f5..04535db 100644 --- a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro +++ b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativebinding.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro b/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro index e754923..3aa2197 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro +++ b/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro @@ -6,7 +6,14 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativeborderimage.cpp ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro b/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro index e58c798..98c38ad 100644 --- a/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro +++ b/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro @@ -5,7 +5,11 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativecomponent.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-ignored.qml b/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-ignored.qml new file mode 100644 index 0000000..764d5ab --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-ignored.qml @@ -0,0 +1,8 @@ +import Qt 4.7 + +Item { + id: screen + + Connections { target: screen; onNotFooBar1: {} ignoreUnknownSignals: true } + Connections { objectName: "connections"; onNotFooBar2: {} ignoreUnknownSignals: true } +} diff --git a/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-notarget.qml b/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-notarget.qml new file mode 100644 index 0000000..09e7812 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-notarget.qml @@ -0,0 +1,7 @@ +import Qt 4.7 + +Item { + id: screen + + Connections { objectName: "connections"; target: null; onNotFooBar: {} } +} diff --git a/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-parent.qml b/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-parent.qml new file mode 100644 index 0000000..478503d --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals-parent.qml @@ -0,0 +1,7 @@ +import Qt 4.7 + +Item { + id: screen + + Connections { objectName: "connections"; onFooBar: {} } +} diff --git a/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals.qml b/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals.qml new file mode 100644 index 0000000..d4e8d7e --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconnection/data/connection-unknownsignals.qml @@ -0,0 +1,7 @@ +import Qt 4.7 + +Item { + id: screen + + Connections { objectName: "connections"; target: screen; onFooBar: {} } +} diff --git a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro index 959354d..bbf8630 100644 --- a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro +++ b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeconnection.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp b/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp index 0efae3b..00e97ca 100644 --- a/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp +++ b/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp @@ -59,6 +59,8 @@ private slots: void connection(); void trimming(); void targetChanged(); + void unknownSignals_data(); + void unknownSignals(); private: QDeclarativeEngine engine; @@ -156,6 +158,41 @@ void tst_qdeclarativeconnection::targetChanged() delete item; } +void tst_qdeclarativeconnection::unknownSignals_data() +{ + QTest::addColumn<QString>("file"); + QTest::addColumn<QString>("error"); + + QTest::newRow("basic") << "connection-unknownsignals.qml" << ":6:5: QML Connections: Cannot assign to non-existent property \"onFooBar\""; + QTest::newRow("parent") << "connection-unknownsignals-parent.qml" << ":6:5: QML Connections: Cannot assign to non-existent property \"onFooBar\""; + QTest::newRow("ignored") << "connection-unknownsignals-ignored.qml" << ""; // should be NO error + QTest::newRow("notarget") << "connection-unknownsignals-notarget.qml" << ""; // should be NO error +} + +void tst_qdeclarativeconnection::unknownSignals() +{ + QFETCH(QString, file); + QFETCH(QString, error); + + QUrl url = QUrl::fromLocalFile(SRCDIR "/data/" + file); + if (!error.isEmpty()) { + QTest::ignoreMessage(QtWarningMsg, (url.toString() + error).toLatin1()); + } else { + // QTest has no way to insist no message (i.e. fail) + } + + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, url); + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(c.create()); + QVERIFY(item != 0); + + // check that connection is created (they are all runtime errors) + QDeclarativeConnections *connections = item->findChild<QDeclarativeConnections*>("connections"); + QVERIFY(connections); + + delete item; +} + QTEST_MAIN(tst_qdeclarativeconnection) #include "tst_qdeclarativeconnection.moc" diff --git a/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro b/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro index 5db9a9e..0e1a5b1 100644 --- a/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro +++ b/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro @@ -3,7 +3,11 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativecontext.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro b/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro index 466c563..9f1e50c 100644 --- a/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro +++ b/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro @@ -4,7 +4,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativedom.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index a951827..6c19566 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -419,10 +419,8 @@ void tst_qdeclarativedom::loadSyntaxErrors() void tst_qdeclarativedom::loadRemoteErrors() { QByteArray qml = "import Qt 4.7\n" + "import \"http://localhost/exampleQmlScript.js\" as Script\n" "Item {\n" - " Script {\n" - " source: \"http://localhost/exampleQmlScript.js\"" - " }\n" "}"; QDeclarativeDomDocument document; QVERIFY(false == document.load(&engine, qml)); diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/blank.js b/tests/auto/declarative/qdeclarativeecmascript/data/blank.js new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/blank.js diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml index 72b59ae..2337e44 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml @@ -19,7 +19,7 @@ QtObject { myObject.deleteOnSet = 1; - test3 = myObject.value == undefined; - test4 = obj.value == undefined; + test3 = myObject == null + test4 = obj == null } } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/dynamicCreation.qml b/tests/auto/declarative/qdeclarativeecmascript/data/dynamicCreation.qml index 3047e9b..7b132e1 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/dynamicCreation.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/dynamicCreation.qml @@ -11,7 +11,7 @@ MyQmlObject{ function createTwo() { var component = Qt.createComponent('dynamicCreation.helper.qml'); - obj.objectProperty = component.createObject(); + obj.objectProperty = component.createObject(obj); } function createThree() @@ -22,6 +22,6 @@ MyQmlObject{ function dontCrash() { var component = Qt.createComponent('file-doesnt-exist.qml'); - obj.objectProperty = component.createObject(); + obj.objectProperty = component.createObject(obj); } } diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/eval.qml b/tests/auto/declarative/qdeclarativeecmascript/data/eval.qml new file mode 100644 index 0000000..bc2df98 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/eval.qml @@ -0,0 +1,23 @@ +import Qt 4.7 + +QtObject { + property bool test1: false; + property bool test2: false; + property bool test3: false; + property bool test4: false; + property bool test5: false; + + + property int a: 7 + property int b: 8 + + Component.onCompleted: { + var b = 9; + + test1 = (eval("a") == 7); + test2 = (eval("b") == 9); + test3 = (eval("c") == undefined); + test4 = (eval("console") == console); + test5 = (eval("Qt") == Qt); + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/exception.js b/tests/auto/declarative/qdeclarativeecmascript/data/exception.js new file mode 100644 index 0000000..160bbfa --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/exception.js @@ -0,0 +1 @@ +throw("Whoops!"); diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/function.qml b/tests/auto/declarative/qdeclarativeecmascript/data/function.qml new file mode 100644 index 0000000..b435f58 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/function.qml @@ -0,0 +1,19 @@ +import Qt 4.7 + +QtObject { + property bool test1: false; + property bool test2: false; + property bool test3: false; + + Component.onCompleted: { + var a = 10; + + var func1 = new Function("a", "return a + 7"); + var func2 = new Function("a", "return Qt.atob(a)"); + var func3 = new Function("return a"); + + test1 = (func1(4) == 11); + test2 = (func2("Hello World!") == Qt.atob("Hello World!")); + test3 = (func3() == undefined); + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.1.qml new file mode 100644 index 0000000..09540f1 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.1.qml @@ -0,0 +1,5 @@ +import Qt.test 1.0 + +MyQmlObject { + property variant a: function myFunction() { return 2; } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.2.qml new file mode 100644 index 0000000..948b39c --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/functionAssignment.2.qml @@ -0,0 +1,13 @@ +import Qt.test 1.0 + +MyQmlObject { + property variant a + property bool runTest: false + onRunTestChanged: { + function myFunction() { + console.log("hello world"); + } + a = myFunction; + } + +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include.js b/tests/auto/declarative/qdeclarativeecmascript/data/include.js new file mode 100644 index 0000000..232fd80 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include.js @@ -0,0 +1,8 @@ +var test1 = true +var test2 = false +var test3 = false + +function go() { + Qt.include("js/include2.js"); +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include.qml new file mode 100644 index 0000000..18543b2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include.qml @@ -0,0 +1,23 @@ +import Qt 4.7 +import "include.js" as IncludeTest + +QtObject { + property int test0: 0 + property bool test1: false + property bool test2: false + property bool test2_1: false + property bool test3: false + property bool test3_1: false + + property int testValue: 99 + + Component.onCompleted: { + IncludeTest.go(); + test0 = IncludeTest.value + test1 = IncludeTest.test1 + test2 = IncludeTest.test2 + test2_1 = IncludeTest.test2_1 + test3 = IncludeTest.test3 + test3_1 = IncludeTest.test3_1 + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.js b/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.js new file mode 100644 index 0000000..ea19eba --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.js @@ -0,0 +1,11 @@ +function go() { + var a = Qt.include("missing.js", function(o) { test2 = o.status == o.NETWORK_ERROR }); + test1 = a.status == a.NETWORK_ERROR + + var b = Qt.include("blank.js", function(o) { test4 = o.status == o.OK }); + test3 = b.status == b.OK + + var c = Qt.include("exception.js", function(o) { test6 = o.status == o.EXCEPTION }); + test5 = c.status == c.EXCEPTION +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.qml new file mode 100644 index 0000000..a39e821 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_callback.qml @@ -0,0 +1,15 @@ +import Qt 4.7 +import "include_callback.js" as IncludeTest + +QtObject { + property bool test1: false + property bool test2: false + property bool test3: false + property bool test4: false + property bool test5: false + property bool test6: false + + Component.onCompleted: { + IncludeTest.go(); + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.js b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.js new file mode 100644 index 0000000..e6a4676 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.js @@ -0,0 +1,26 @@ +var myvar = 10; + +function go() +{ + var a = Qt.include("http://127.0.0.1:8111/remote_file.js", + function(o) { + test2 = o.status == o.OK + test3 = a.status == a.OK + test4 = myvar == 13 + + done = true; + }); + test1 = a.status == a.LOADING + + + var b = Qt.include("http://127.0.0.1:8111/exception.js", + function(o) { + test7 = o.status == o.EXCEPTION + test8 = b.status == a.EXCEPTION + test9 = b.exception.toString() == "Whoops!"; + test10 = o.exception.toString() == "Whoops!"; + + done2 = true; + }); + test6 = b.status == b.LOADING +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.qml new file mode 100644 index 0000000..06bd174 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote.qml @@ -0,0 +1,21 @@ +import Qt 4.7 +import "include_remote.js" as IncludeTest + +QtObject { + property bool done: false + property bool done2: false + + property bool test1: false + property bool test2: false + property bool test3: false + property bool test4: false + property bool test5: false + + property bool test6: false + property bool test7: false + property bool test8: false + property bool test9: false + property bool test10: false + + Component.onCompleted: IncludeTest.go(); +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.js b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.js new file mode 100644 index 0000000..cc90860 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.js @@ -0,0 +1,13 @@ +function go() +{ + var a = Qt.include("http://127.0.0.1:8111/missing.js", + function(o) { + test2 = o.status == o.NETWORK_ERROR + test3 = a.status == a.NETWORK_ERROR + + done = true; + }); + + test1 = a.status == a.LOADING +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.qml new file mode 100644 index 0000000..8e486b2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_remote_missing.qml @@ -0,0 +1,12 @@ +import Qt 4.7 +import "include_remote_missing.js" as IncludeTest + +QtObject { + property bool done: false + + property bool test1: false + property bool test2: false + property bool test3: false + + Component.onCompleted: IncludeTest.go(); +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.js b/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.js new file mode 100644 index 0000000..a49c07b --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.js @@ -0,0 +1,12 @@ +.pragma library + +var test1 = true +var test2 = false +var test3 = false + +var testValue = 99; + +function go() { + Qt.include("js/include2.js"); +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.qml new file mode 100644 index 0000000..e957018 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_shared.qml @@ -0,0 +1,22 @@ +import Qt 4.7 +import "include_shared.js" as IncludeTest + +QtObject { + property int test0: 0 + property bool test1: false + property bool test2: false + property bool test2_1: false + property bool test3: false + property bool test3_1: false + + Component.onCompleted: { + IncludeTest.go(); + test0 = IncludeTest.value + test1 = IncludeTest.test1 + test2 = IncludeTest.test2 + test2_1 = IncludeTest.test2_1 + test3 = IncludeTest.test3 + test3_1 = IncludeTest.test3_1 + } +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/js/include2.js b/tests/auto/declarative/qdeclarativeecmascript/data/js/include2.js new file mode 100644 index 0000000..2a0c039 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/js/include2.js @@ -0,0 +1,4 @@ +test2 = true +var test2_1 = true + +Qt.include("include3.js"); diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/js/include3.js b/tests/auto/declarative/qdeclarativeecmascript/data/js/include3.js new file mode 100644 index 0000000..84b2770 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/js/include3.js @@ -0,0 +1,3 @@ +test3 = true +var test3_1 = true +var value = testValue diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_10696.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_10696.qml new file mode 100644 index 0000000..cb5c4c9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_10696.qml @@ -0,0 +1,26 @@ +import Qt 4.7 + +QtObject { + property string test: "aaaa" + + "bbbb" + + "cccc" + + "cccc" + + "cccc" + + "cccc" + + "cccc" + + "cccc" + + "cccc" + + "cccc" + + "cccc" + + "cccc" + + "cccc" + + "cccc" + + "cccc" + + "cccc" + + "cccc" + + "cccc" + + "cccc" + + "cccc" + + "cccc" + + "cccc"; +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qtcreatorbug_1289.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qtcreatorbug_1289.qml new file mode 100644 index 0000000..b6d31d5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qtcreatorbug_1289.qml @@ -0,0 +1,13 @@ +import Qt 4.7 + +QtObject { + id: root + property QtObject object: QtObject { + id: nested + property QtObject nestedObject + } + + Component.onCompleted: { + nested.nestedObject = root; + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/remote_file.js b/tests/auto/declarative/qdeclarativeecmascript/data/remote_file.js new file mode 100644 index 0000000..1b123ae --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/remote_file.js @@ -0,0 +1,2 @@ +myvar = 13; +test5 = true; diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.2.qml new file mode 100644 index 0000000..a36b4c0 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.2.qml @@ -0,0 +1,14 @@ +import Qt 4.7 + +QtObject { + id: root + + property variant a: 10 + property int x: 10 + property int test: a.x + + Component.onCompleted: { + a = 11; + a = root; + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro index eabed26..c907be5 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro +++ b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro @@ -1,13 +1,18 @@ load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative script +contains(QT_CONFIG,declarative): QT += declarative script network macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeecmascript.cpp \ - testtypes.cpp -HEADERS += testtypes.h + testtypes.cpp \ + ../shared/testhttpserver.cpp +HEADERS += testtypes.h \ + ../shared/testhttpserver.h +INCLUDEPATH += ../shared # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov +DEFINES += SRCDIR=\\\"$$PWD\\\" + CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 491a736..64e5b3f 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -51,6 +51,7 @@ #include <private/qdeclarativeengine_p.h> #include <private/qdeclarativeglobalscriptclass_p.h> #include "testtypes.h" +#include "testhttpserver.h" /* This test covers evaluation of ECMAScript expressions and bindings from within @@ -142,8 +143,15 @@ private slots: void libraryScriptAssert(); void variantsAssignedUndefined(); void qtbug_9792(); + void qtcreatorbug_1289(); void noSpuriousWarningsAtShutdown(); void canAssignNullToQObject(); + void functionAssignment(); + void eval(); + void function(); + void qtbug_10696(); + + void include(); void callQtInvokables(); private: @@ -1100,7 +1108,7 @@ void tst_qdeclarativeecmascript::exceptionClearsOnReeval() QDeclarativeComponent component(&engine, TEST_FILE("exceptionClearsOnReeval.qml")); QString url = component.url().toString(); - QString warning = url + ":4: TypeError: Result of expression 'objectProperty.objectProperty' [undefined] is not an object."; + QString warning = url + ":4: TypeError: Result of expression 'objectProperty' [null] is not an object."; QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); @@ -1149,6 +1157,7 @@ static void transientErrorsMsgHandler(QtMsgType, const char *) // Check that transient binding errors are not displayed void tst_qdeclarativeecmascript::transientErrors() { + { QDeclarativeComponent component(&engine, TEST_FILE("transientErrors.qml")); transientErrorsMsgCount = 0; @@ -1160,6 +1169,22 @@ void tst_qdeclarativeecmascript::transientErrors() qInstallMsgHandler(old); QCOMPARE(transientErrorsMsgCount, 0); + } + + // One binding erroring multiple times, but then resolving + { + QDeclarativeComponent component(&engine, TEST_FILE("transientErrors.2.qml")); + + transientErrorsMsgCount = 0; + QtMsgHandler old = qInstallMsgHandler(transientErrorsMsgHandler); + + QObject *object = component.create(); + QVERIFY(object != 0); + + qInstallMsgHandler(old); + + QCOMPARE(transientErrorsMsgCount, 0); + } } // Check that errors during shutdown are minimized @@ -2188,6 +2213,27 @@ void tst_qdeclarativeecmascript::qtbug_9792() delete object; } +// Verifies that QDeclarativeGuard<>s used in the vmemetaobject are cleaned correctly +void tst_qdeclarativeecmascript::qtcreatorbug_1289() +{ + QDeclarativeComponent component(&engine, TEST_FILE("qtcreatorbug_1289.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + QObject *nested = qvariant_cast<QObject *>(o->property("object")); + QVERIFY(nested != 0); + + QVERIFY(qvariant_cast<QObject *>(nested->property("nestedObject")) == o); + + delete nested; + nested = qvariant_cast<QObject *>(o->property("object")); + QVERIFY(nested == 0); + + // If the bug is present, the next line will crash + delete o; +} + // Test that we shut down without stupid warnings void tst_qdeclarativeecmascript::noSpuriousWarningsAtShutdown() { @@ -2252,6 +2298,189 @@ void tst_qdeclarativeecmascript::canAssignNullToQObject() } } +void tst_qdeclarativeecmascript::functionAssignment() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("functionAssignment.1.qml")); + + QString url = component.url().toString(); + QString warning = url + ":4: Unable to assign a function to a property."; + QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); + + MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(o != 0); + + QVERIFY(!o->property("a").isValid()); + + delete o; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("functionAssignment.2.qml")); + + MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(o != 0); + + QVERIFY(!o->property("a").isValid()); + + QString url = component.url().toString(); + QString warning = url + ":10: Error: Cannot assign a function to a property."; + QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); + + o->setProperty("runTest", true); + + QVERIFY(!o->property("a").isValid()); + + delete o; + } +} + +void tst_qdeclarativeecmascript::eval() +{ + QDeclarativeComponent component(&engine, TEST_FILE("eval.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + QCOMPARE(o->property("test3").toBool(), true); + QCOMPARE(o->property("test4").toBool(), true); + QCOMPARE(o->property("test5").toBool(), true); + + delete o; +} + +void tst_qdeclarativeecmascript::function() +{ + QDeclarativeComponent component(&engine, TEST_FILE("function.qml")); + + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + QCOMPARE(o->property("test3").toBool(), true); + + delete o; +} + +#define TRY_WAIT(expr) \ + do { \ + for (int ii = 0; ii < 6; ++ii) { \ + if ((expr)) break; \ + QTest::qWait(50); \ + } \ + QVERIFY((expr)); \ + } while (false) + +// Test the "Qt.include" method +void tst_qdeclarativeecmascript::include() +{ + // Non-library relative include + { + QDeclarativeComponent component(&engine, TEST_FILE("include.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test0").toInt(), 99); + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + QCOMPARE(o->property("test2_1").toBool(), true); + QCOMPARE(o->property("test3").toBool(), true); + QCOMPARE(o->property("test3_1").toBool(), true); + + delete o; + } + + // Library relative include + { + QDeclarativeComponent component(&engine, TEST_FILE("include_shared.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test0").toInt(), 99); + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + QCOMPARE(o->property("test2_1").toBool(), true); + QCOMPARE(o->property("test3").toBool(), true); + QCOMPARE(o->property("test3_1").toBool(), true); + + delete o; + } + + // Callback + { + QDeclarativeComponent component(&engine, TEST_FILE("include_callback.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + QCOMPARE(o->property("test3").toBool(), true); + QCOMPARE(o->property("test4").toBool(), true); + QCOMPARE(o->property("test5").toBool(), true); + QCOMPARE(o->property("test6").toBool(), true); + + delete o; + } + + // Remote - success + { + TestHTTPServer server(8111); + QVERIFY(server.isValid()); + server.serveDirectory(SRCDIR "/data"); + + QDeclarativeComponent component(&engine, TEST_FILE("include_remote.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + + TRY_WAIT(o->property("done").toBool() == true); + TRY_WAIT(o->property("done2").toBool() == true); + + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + QCOMPARE(o->property("test3").toBool(), true); + QCOMPARE(o->property("test4").toBool(), true); + QCOMPARE(o->property("test5").toBool(), true); + + QCOMPARE(o->property("test6").toBool(), true); + QCOMPARE(o->property("test7").toBool(), true); + QCOMPARE(o->property("test8").toBool(), true); + QCOMPARE(o->property("test9").toBool(), true); + QCOMPARE(o->property("test10").toBool(), true); + + delete o; + } + + // Remote - error + { + TestHTTPServer server(8111); + QVERIFY(server.isValid()); + server.serveDirectory(SRCDIR "/data"); + + QDeclarativeComponent component(&engine, TEST_FILE("include_remote_missing.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + + TRY_WAIT(o->property("done").toBool() == true); + + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + QCOMPARE(o->property("test3").toBool(), true); + + delete o; + } +} + +void tst_qdeclarativeecmascript::qtbug_10696() +{ + QDeclarativeComponent component(&engine, TEST_FILE("qtbug_10696.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + delete o; +} + QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" diff --git a/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro b/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro index e0ea2e5..23afd07 100644 --- a/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro +++ b/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro @@ -5,7 +5,11 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeengine.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro b/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro index 501f32c..fae11f9 100644 --- a/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro +++ b/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro @@ -3,7 +3,11 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativeerror.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro b/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro index 07637c9..7a70109 100644 --- a/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro +++ b/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeflickable.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp index 9ce9c49..2c6890e 100644 --- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp +++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp @@ -61,6 +61,7 @@ private slots: void maximumFlickVelocity(); void flickDeceleration(); void pressDelay(); + void flickableDirection(); private: QDeclarativeEngine engine; @@ -224,6 +225,33 @@ void tst_qdeclarativeflickable::pressDelay() QCOMPARE(spy.count(),1); } +void tst_qdeclarativeflickable::flickableDirection() +{ + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.7; Flickable { flickableDirection: Flickable.VerticalFlick; }", QUrl::fromLocalFile("")); + QDeclarativeFlickable *flickable = qobject_cast<QDeclarativeFlickable*>(component.create()); + QSignalSpy spy(flickable, SIGNAL(flickableDirectionChanged())); + + QVERIFY(flickable); + QCOMPARE(flickable->flickableDirection(), QDeclarativeFlickable::VerticalFlick); + + flickable->setFlickableDirection(QDeclarativeFlickable::HorizontalAndVerticalFlick); + QCOMPARE(flickable->flickableDirection(), QDeclarativeFlickable::HorizontalAndVerticalFlick); + QCOMPARE(spy.count(),1); + + flickable->setFlickableDirection(QDeclarativeFlickable::AutoFlickDirection); + QCOMPARE(flickable->flickableDirection(), QDeclarativeFlickable::AutoFlickDirection); + QCOMPARE(spy.count(),2); + + flickable->setFlickableDirection(QDeclarativeFlickable::HorizontalFlick); + QCOMPARE(flickable->flickableDirection(), QDeclarativeFlickable::HorizontalFlick); + QCOMPARE(spy.count(),3); + + flickable->setFlickableDirection(QDeclarativeFlickable::HorizontalFlick); + QCOMPARE(flickable->flickableDirection(), QDeclarativeFlickable::HorizontalFlick); + QCOMPARE(spy.count(),3); +} + QTEST_MAIN(tst_qdeclarativeflickable) #include "tst_qdeclarativeflickable.moc" diff --git a/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro b/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro index 9830b55..9b4fbc9 100644 --- a/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro +++ b/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeflipable.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro b/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro index 687c80c..c021fcf 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro +++ b/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro @@ -3,5 +3,12 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativefocusscope.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} diff --git a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro index 9a8a3ff..dbe0dcb 100644 --- a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro +++ b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro @@ -6,7 +6,14 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativefontloader.cpp ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro b/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro index b069260..033e20e 100644 --- a/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro +++ b/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativegridview.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro b/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro index ff365ee..a8b8eca 100644 --- a/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro +++ b/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro @@ -6,7 +6,14 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativeimage.cpp ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro b/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro index 22be991..1b828a5 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro +++ b/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro @@ -9,7 +9,14 @@ SOURCES += tst_qdeclarativeimageprovider.cpp # LIBS += -lgcov # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro index bb54d6c..c6719c0 100644 --- a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro +++ b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro @@ -4,7 +4,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeinfo.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro b/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro index 0daa9e5..350f6c6 100644 --- a/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro +++ b/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro @@ -3,7 +3,11 @@ contains(QT_CONFIG,declarative): QT += declarative script SOURCES += tst_qdeclarativeinstruction.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeitem/data/childrenRect.qml b/tests/auto/declarative/qdeclarativeitem/data/childrenRect.qml new file mode 100644 index 0000000..f351b53 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeitem/data/childrenRect.qml @@ -0,0 +1,27 @@ +import Qt 4.7 + +Rectangle { + width: 400 + height: 400 + + property int childCount: 0; + + Item { + objectName: "testItem" + width: childrenRect.width + height: childrenRect.height + + Repeater { + id: repeater + model: childCount + delegate: Rectangle { + x: index*10 + y: index*20 + width: 10 + height: 20 + + color: "red" + } + } + } +} diff --git a/tests/auto/declarative/qdeclarativeitem/data/keyspriority.qml b/tests/auto/declarative/qdeclarativeitem/data/keyspriority.qml new file mode 100644 index 0000000..171536b --- /dev/null +++ b/tests/auto/declarative/qdeclarativeitem/data/keyspriority.qml @@ -0,0 +1,9 @@ +import Qt 4.7 +import Test 1.0 + +KeyTestItem { + focus: true + Keys.onPressed: keysTestObject.keyPress(event.key, event.text, event.modifiers) + Keys.onReleased: { keysTestObject.keyRelease(event.key, event.text, event.modifiers); event.accepted = true; } + Keys.priority: keysTestObject.processLast ? Keys.AfterItem : Keys.BeforeItem +} diff --git a/tests/auto/declarative/qdeclarativeitem/data/mouseFocus.qml b/tests/auto/declarative/qdeclarativeitem/data/mouseFocus.qml new file mode 100644 index 0000000..a562b8b --- /dev/null +++ b/tests/auto/declarative/qdeclarativeitem/data/mouseFocus.qml @@ -0,0 +1,20 @@ +import Qt 4.7 + +QGraphicsWidget { + size: "200x100" + focusPolicy: QGraphicsWidget.ClickFocus + Item { + objectName: "declarativeItem" + id: item + width: 200 + height: 100 + MouseArea { + anchors.fill: parent + onPressed: { + if (!item.focus) { + item.focus = true; + } + } + } + } +} diff --git a/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro b/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro index e834a4e..f494ef1 100644 --- a/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro +++ b/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro @@ -4,7 +4,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeitem.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index d2c328e..ecc813e 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -45,6 +45,7 @@ #include <QtDeclarative/qdeclarativecontext.h> #include <QtDeclarative/qdeclarativeview.h> #include <QtDeclarative/qdeclarativeitem.h> +#include "../../../shared/util.h" class tst_QDeclarativeItem : public QObject @@ -54,7 +55,9 @@ public: tst_QDeclarativeItem(); private slots: + void initTestCase(); void keys(); + void keysProcessingOrder(); void keyNavigation(); void smooth(); void clip(); @@ -63,9 +66,11 @@ private slots: void propertyChanges(); void transforms(); void transforms_data(); + void childrenRect(); void childrenProperty(); void resourcesProperty(); + void mouseFocus(); private: template<typename T> @@ -76,8 +81,11 @@ private: class KeysTestObject : public QObject { Q_OBJECT + + Q_PROPERTY(bool processLast READ processLast NOTIFY processLastChanged) + public: - KeysTestObject() : mKey(0), mModifiers(0), mForwardedKey(0) {} + KeysTestObject() : mKey(0), mModifiers(0), mForwardedKey(0), mLast(false) {} void reset() { mKey = 0; @@ -86,6 +94,14 @@ public: mForwardedKey = 0; } + bool processLast() const { return mLast; } + void setProcessLast(bool b) { + if (b != mLast) { + mLast = b; + emit processLastChanged(); + } + } + public slots: void keyPress(int key, QString text, int modifiers) { mKey = key; @@ -101,20 +117,73 @@ public slots: mForwardedKey = key; } +signals: + void processLastChanged(); + public: int mKey; QString mText; int mModifiers; int mForwardedKey; + bool mLast; private: }; +class KeyTestItem : public QDeclarativeItem +{ + Q_OBJECT +public: + KeyTestItem(QDeclarativeItem *parent=0) : QDeclarativeItem(parent), mKey(0) {} + +protected: + void keyPressEvent(QKeyEvent *e) { + keyPressPreHandler(e); + if (e->isAccepted()) + return; + + mKey = e->key(); + + if (e->key() == Qt::Key_A) + e->accept(); + else + e->ignore(); + + if (!e->isAccepted()) + QDeclarativeItem::keyPressEvent(e); + } + + void keyReleaseEvent(QKeyEvent *e) { + keyReleasePreHandler(e); + + if (e->isAccepted()) + return; + + if (e->key() == Qt::Key_B) + e->accept(); + else + e->ignore(); + + if (!e->isAccepted()) + QDeclarativeItem::keyReleaseEvent(e); + } + +public: + int mKey; +}; + +QML_DECLARE_TYPE(KeyTestItem); + tst_QDeclarativeItem::tst_QDeclarativeItem() { } +void tst_QDeclarativeItem::initTestCase() +{ + qmlRegisterType<KeyTestItem>("Test",1,0,"KeyTestItem"); +} + void tst_QDeclarativeItem::keys() { QDeclarativeView *canvas = new QDeclarativeView(0); @@ -211,6 +280,69 @@ void tst_QDeclarativeItem::keys() QCOMPARE(testObject->mKey, 0); QVERIFY(!key.isAccepted()); + canvas->rootContext()->setContextProperty("enableKeyHanding", QVariant(true)); + + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QCOMPARE(testObject->mKey, int(Qt::Key_Return)); + QVERIFY(key.isAccepted()); + + delete canvas; + delete testObject; +} + +void tst_QDeclarativeItem::keysProcessingOrder() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setFixedSize(240,320); + + KeysTestObject *testObject = new KeysTestObject; + canvas->rootContext()->setContextProperty("keysTestObject", testObject); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keyspriority.qml")); + canvas->show(); + qApp->processEvents(); + + KeyTestItem *testItem = qobject_cast<KeyTestItem*>(canvas->rootObject()); + QVERIFY(testItem); + + QEvent wa(QEvent::WindowActivate); + QApplication::sendEvent(canvas, &wa); + QFocusEvent fe(QEvent::FocusIn); + QApplication::sendEvent(canvas, &fe); + + QKeyEvent key(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier, "A", false, 1); + QApplication::sendEvent(canvas, &key); + QCOMPARE(testObject->mKey, int(Qt::Key_A)); + QCOMPARE(testObject->mText, QLatin1String("A")); + QVERIFY(testObject->mModifiers == Qt::NoModifier); + QVERIFY(key.isAccepted()); + + testObject->reset(); + + testObject->setProcessLast(true); + + key = QKeyEvent(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier, "A", false, 1); + QApplication::sendEvent(canvas, &key); + QCOMPARE(testObject->mKey, 0); + QVERIFY(key.isAccepted()); + + testObject->reset(); + + key = QKeyEvent(QEvent::KeyPress, Qt::Key_B, Qt::NoModifier, "B", false, 1); + QApplication::sendEvent(canvas, &key); + QCOMPARE(testObject->mKey, int(Qt::Key_B)); + QCOMPARE(testObject->mText, QLatin1String("B")); + QVERIFY(testObject->mModifiers == Qt::NoModifier); + QVERIFY(!key.isAccepted()); + + testObject->reset(); + + key = QKeyEvent(QEvent::KeyRelease, Qt::Key_B, Qt::NoModifier, "B", false, 1); + QApplication::sendEvent(canvas, &key); + QCOMPARE(testObject->mKey, 0); + QVERIFY(key.isAccepted()); + delete canvas; delete testObject; } @@ -465,6 +597,41 @@ void tst_QDeclarativeItem::resourcesProperty() delete o; } +void tst_QDeclarativeItem::mouseFocus() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/mouseFocus.qml")); + canvas->show(); + QVERIFY(canvas->rootObject()); + QApplication::setActiveWindow(canvas); + QTest::qWaitForWindowShown(canvas); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas)); + + QDeclarativeItem *item = findItem<QDeclarativeItem>(canvas->rootObject(), "declarativeItem"); + QVERIFY(item); + QSignalSpy focusSpy(item, SIGNAL(focusChanged(bool))); + + QTest::mouseClick(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(item->scenePos())); + QApplication::processEvents(); + QCOMPARE(focusSpy.count(), 1); + QVERIFY(item->hasFocus()); + + // make sure focusable graphics widget underneath does not steal focus + QTest::mouseClick(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(item->scenePos())); + QApplication::processEvents(); + QCOMPARE(focusSpy.count(), 1); + QVERIFY(item->hasFocus()); + + item->setFocus(false); + QVERIFY(!item->hasFocus()); + QCOMPARE(focusSpy.count(), 2); + item->setFocus(true); + QCOMPARE(focusSpy.count(), 3); + + delete canvas; +} + void tst_QDeclarativeItem::propertyChanges() { QDeclarativeView *canvas = new QDeclarativeView(0); @@ -537,6 +704,33 @@ void tst_QDeclarativeItem::propertyChanges() delete canvas; } +void tst_QDeclarativeItem::childrenRect() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setFixedSize(240,320); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/childrenRect.qml")); + canvas->show(); + + QGraphicsObject *o = canvas->rootObject(); + QDeclarativeItem *item = o->findChild<QDeclarativeItem*>("testItem"); + QCOMPARE(item->width(), qreal(0)); + QCOMPARE(item->height(), qreal(0)); + + o->setProperty("childCount", 1); + QCOMPARE(item->width(), qreal(10)); + QCOMPARE(item->height(), qreal(20)); + + o->setProperty("childCount", 5); + QCOMPARE(item->width(), qreal(50)); + QCOMPARE(item->height(), qreal(100)); + + o->setProperty("childCount", 0); + QCOMPARE(item->width(), qreal(0)); + QCOMPARE(item->height(), qreal(0)); + + delete o; +} + template<typename T> T *tst_QDeclarativeItem::findItem(QGraphicsObject *parent, const QString &objectName) { diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml index 5af3d6e..bac704e 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralToVariant.qml @@ -10,5 +10,7 @@ QtObject { property variant test7: "10x10" property variant test8: "100,100,100" property variant test9: String("#FF008800") + property variant test10: true + property variant test11: false } diff --git a/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro b/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro index 5771469..2b7eb1c 100644 --- a/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro +++ b/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro @@ -11,6 +11,13 @@ INCLUDEPATH += ../shared/ HEADERS += ../shared/testhttpserver.h SOURCES += ../shared/testhttpserver.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\"\"\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h index 89f99c8..acbe219 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h @@ -99,7 +99,7 @@ private: int m_value2; }; -class MyQmlObject : public QObject, public MyInterface, public QDeclarativeParserStatus +class MyQmlObject : public QObject, public MyInterface { Q_OBJECT Q_PROPERTY(int value READ value WRITE setValue FINAL) @@ -113,7 +113,7 @@ class MyQmlObject : public QObject, public MyInterface, public QDeclarativeParse Q_PROPERTY(MyQmlObject *qmlobjectProperty READ qmlobject WRITE setQmlobject) Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal) - Q_INTERFACES(MyInterface QDeclarativeParserStatus) + Q_INTERFACES(MyInterface) public: MyQmlObject() : m_value(-1), m_interface(0), m_qmlobject(0) { qRegisterMetaType<MyCustomVariantType>("MyCustomVariantType"); } diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index ff03005..6b070f5 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -536,6 +536,8 @@ void tst_qdeclarativelanguage::assignLiteralToVariant() QCOMPARE(object->property("test7").userType(), (int)QVariant::SizeF); QCOMPARE(object->property("test8").userType(), (int)QVariant::Vector3D); QCOMPARE(object->property("test9").userType(), (int)QVariant::String); + QCOMPARE(object->property("test10").userType(), (int)QVariant::Bool); + QCOMPARE(object->property("test11").userType(), (int)QVariant::Bool); QVERIFY(object->property("test1") == QVariant(1)); QVERIFY(object->property("test2") == QVariant((double)1.7)); @@ -546,6 +548,8 @@ void tst_qdeclarativelanguage::assignLiteralToVariant() QVERIFY(object->property("test7") == QVariant(QSizeF(10, 10))); QVERIFY(object->property("test8") == QVariant(QVector3D(100, 100, 100))); QVERIFY(object->property("test9") == QVariant(QString(QLatin1String("#FF008800")))); + QVERIFY(object->property("test10") == QVariant(bool(true))); + QVERIFY(object->property("test11") == QVariant(bool(false))); delete object; } diff --git a/tests/auto/declarative/qdeclarativelayoutitem/data/layoutItem.qml b/tests/auto/declarative/qdeclarativelayoutitem/data/layoutItem.qml new file mode 100644 index 0000000..ee881a2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelayoutitem/data/layoutItem.qml @@ -0,0 +1,9 @@ +import Qt 4.7 + +LayoutItem {//Sized by the layout + id: resizable + objectName: "resizable" + minimumSize: "100x100" + maximumSize: "300x300" + preferredSize: "200x200" +} diff --git a/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro b/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro new file mode 100644 index 0000000..79954fe --- /dev/null +++ b/tests/auto/declarative/qdeclarativelayoutitem/qdeclarativelayoutitem.pro @@ -0,0 +1,15 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativelayoutitem.cpp + +# Define SRCDIR equal to test's source directory +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +}
\ No newline at end of file diff --git a/tests/auto/declarative/qdeclarativelayoutitem/tst_qdeclarativelayoutitem.cpp b/tests/auto/declarative/qdeclarativelayoutitem/tst_qdeclarativelayoutitem.cpp new file mode 100644 index 0000000..c0c5abc --- /dev/null +++ b/tests/auto/declarative/qdeclarativelayoutitem/tst_qdeclarativelayoutitem.cpp @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include <QtTest/QtTest> +#include <qdeclarativecomponent.h> +#include <qdeclarativeengine.h> +#include <qdeclarativeitem.h> +#include <private/qdeclarativelayoutitem_p.h> +#include <qgraphicsview.h> +#include <qgraphicsscene.h> +#include <qgraphicswidget.h> +#include <qgraphicslinearlayout.h> +#include "../../../shared/util.h" + +class tst_qdeclarativelayoutitem : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativelayoutitem(); + +private slots: + void test_resizing(); +}; + +tst_qdeclarativelayoutitem::tst_qdeclarativelayoutitem() +{ +} + +void tst_qdeclarativelayoutitem::test_resizing() +{ + //Create Layout (must be done in C++) + QGraphicsView view; + QGraphicsScene scene; + QGraphicsWidget *widget = new QGraphicsWidget(); + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(); + widget->setLayout(layout); + scene.addItem(widget); + view.setScene(&scene); + //Add the QML snippet into the layout + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/layoutItem.qml")); + QDeclarativeLayoutItem* obj = static_cast<QDeclarativeLayoutItem*>(c.create()); + layout->addItem(obj); + layout->setContentsMargins(0,0,0,0); + widget->setContentsMargins(0,0,0,0); + view.show(); + + QVERIFY(obj!= 0); + + widget->setGeometry(QRectF(0,0, 400,400)); + QCOMPARE(obj->width(), 300.0); + QCOMPARE(obj->height(), 300.0); + + widget->setGeometry(QRectF(0,0, 300,300)); + QCOMPARE(obj->width(), 300.0); + QCOMPARE(obj->height(), 300.0); + + widget->setGeometry(QRectF(0,0, 200,200)); + QCOMPARE(obj->width(), 200.0); + QCOMPARE(obj->height(), 200.0); + + widget->setGeometry(QRectF(0,0, 100,100)); + QCOMPARE(obj->width(), 100.0); + QCOMPARE(obj->height(), 100.0); + + widget->setGeometry(QRectF(0,0, 40,40)); + QCOMPARE(obj->width(), 100.0); + QCOMPARE(obj->height(), 100.0); + + widget->setGeometry(QRectF(0,0, 412,112)); + QCOMPARE(obj->width(), 300.0); + QCOMPARE(obj->height(), 112.0); +} + + +QTEST_MAIN(tst_qdeclarativelayoutitem) + +#include "tst_qdeclarativelayoutitem.moc" diff --git a/tests/auto/declarative/qdeclarativelayouts/data/layouts.qml b/tests/auto/declarative/qdeclarativelayouts/data/layouts.qml deleted file mode 100644 index 0538738..0000000 --- a/tests/auto/declarative/qdeclarativelayouts/data/layouts.qml +++ /dev/null @@ -1,31 +0,0 @@ -import Qt 4.7 -import Qt.widgets 4.7 - -Item { - id: resizable - width:300 - height:300 - QGraphicsWidget { - x : resizable.x - y : resizable.y - width : resizable.width - height : resizable.height - layout: QGraphicsLinearLayout { - spacing: 0 - LayoutItem { - objectName: "left" - minimumSize: "100x100" - maximumSize: "300x300" - preferredSize: "100x100" - Rectangle { objectName: "yellowRect"; color: "yellow"; anchors.fill: parent } - } - LayoutItem { - objectName: "right" - minimumSize: "100x100" - maximumSize: "400x400" - preferredSize: "200x200" - Rectangle { objectName: "greenRect"; color: "green"; anchors.fill: parent } - } - } - } -} diff --git a/tests/auto/declarative/qdeclarativelayouts/qdeclarativelayouts.pro b/tests/auto/declarative/qdeclarativelayouts/qdeclarativelayouts.pro deleted file mode 100644 index a2065f4..0000000 --- a/tests/auto/declarative/qdeclarativelayouts/qdeclarativelayouts.pro +++ /dev/null @@ -1,10 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -SOURCES += tst_qdeclarativelayouts.cpp -macx:CONFIG -= app_bundle - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" - -CONFIG += parallel_test - diff --git a/tests/auto/declarative/qdeclarativelayouts/tst_qdeclarativelayouts.cpp b/tests/auto/declarative/qdeclarativelayouts/tst_qdeclarativelayouts.cpp deleted file mode 100644 index 412c3b7..0000000 --- a/tests/auto/declarative/qdeclarativelayouts/tst_qdeclarativelayouts.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <QtTest/QtTest> -#include <private/qlistmodelinterface_p.h> -#include <qdeclarativeview.h> -#include <private/qdeclarativelayoutitem_p.h> -#include <qdeclarativeexpression.h> -#include <QStyle> - -class tst_QDeclarativeLayouts : public QObject -{ - Q_OBJECT -public: - tst_QDeclarativeLayouts(); - -private slots: - void test_qml();//GraphicsLayout set up in Qml - void test_cpp();//GraphicsLayout set up in C++ - -private: - QDeclarativeView *createView(const QString &filename); -}; - -tst_QDeclarativeLayouts::tst_QDeclarativeLayouts() -{ -} - -void tst_QDeclarativeLayouts::test_qml() -{ - QDeclarativeView *canvas = createView(SRCDIR "/data/layouts.qml"); - - qApp->processEvents(); - QDeclarativeLayoutItem *left = static_cast<QDeclarativeLayoutItem*>(canvas->rootObject()->findChild<QDeclarativeItem*>("left")); - QVERIFY(left != 0); - - QDeclarativeLayoutItem *right = static_cast<QDeclarativeLayoutItem*>(canvas->rootObject()->findChild<QDeclarativeItem*>("right")); - QVERIFY(right != 0); - - qreal l = QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin); - qreal r = QApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin); - qreal t = QApplication::style()->pixelMetric(QStyle::PM_LayoutTopMargin); - qreal b = QApplication::style()->pixelMetric(QStyle::PM_LayoutBottomMargin); - QVERIFY2(l == r && r == t && t == b, "Test assumes equal margins."); - qreal gvMargin = l; - - QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(canvas->rootObject()); - QVERIFY(rootItem != 0); - - //Preferred Size - rootItem->setWidth(300 + 2*gvMargin); - rootItem->setHeight(300 + 2*gvMargin); - - QCOMPARE(left->x(), gvMargin); - QCOMPARE(left->y(), gvMargin); - QCOMPARE(left->width(), 100.0); - QCOMPARE(left->height(), 300.0); - - QCOMPARE(right->x(), 100.0 + gvMargin); - QCOMPARE(right->y(), 0.0 + gvMargin); - QCOMPARE(right->width(), 200.0); - QCOMPARE(right->height(), 300.0); - - //Minimum Size - rootItem->setWidth(10+2*gvMargin); - rootItem->setHeight(10+2*gvMargin); - - QCOMPARE(left->x(), gvMargin); - QCOMPARE(left->width(), 100.0); - QCOMPARE(left->height(), 100.0); - - QCOMPARE(right->x(), 100.0 + gvMargin); - QCOMPARE(right->width(), 100.0); - QCOMPARE(right->height(), 100.0); - - //Between preferred and Maximum Size - /*Note that if set to maximum size (or above) GraphicsLinearLayout behavior - is to shrink them down to preferred size. So the exact maximum size can't - be used*/ - rootItem->setWidth(670 + 2*gvMargin); - rootItem->setHeight(300 + 2*gvMargin); - - QCOMPARE(left->x(), gvMargin); - QCOMPARE(left->width(), 270.0); - QCOMPARE(left->height(), 300.0); - - QCOMPARE(right->x(), 270.0 + gvMargin); - QCOMPARE(right->width(), 400.0); - QCOMPARE(right->height(), 300.0); - - delete canvas; -} - -void tst_QDeclarativeLayouts::test_cpp() -{ - //TODO: This test! -} - -QDeclarativeView *tst_QDeclarativeLayouts::createView(const QString &filename) -{ - QDeclarativeView *canvas = new QDeclarativeView(0); - canvas->setSource(QUrl::fromLocalFile(filename)); - - return canvas; -} - - -QTEST_MAIN(tst_QDeclarativeLayouts) - -#include "tst_qdeclarativelayouts.moc" diff --git a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro index 9f1e146..53bb9ec 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro +++ b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro @@ -6,7 +6,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativelistmodel.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index ec97461..26a12f0 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -184,8 +184,8 @@ void tst_qdeclarativelistmodel::dynamic_data() QTest::newRow("count") << "count" << 0 << ""; - QTest::newRow("get1") << "{get(0)}" << 0 << "<Unknown File>: QML ListModel: get: index 0 out of range"; - QTest::newRow("get2") << "{get(-1)}" << 0 << "<Unknown File>: QML ListModel: get: index -1 out of range"; + QTest::newRow("get1") << "{get(0)}" << 0 << ""; + QTest::newRow("get2") << "{get(-1)}" << 0 << ""; QTest::newRow("append1") << "{append({'foo':123});count}" << 1 << ""; QTest::newRow("append2") << "{append({'foo':123,'bar':456});count}" << 1 << ""; @@ -196,13 +196,13 @@ void tst_qdeclarativelistmodel::dynamic_data() QTest::newRow("clear1") << "{append({'foo':456});clear();count}" << 0 << ""; QTest::newRow("clear2") << "{append({'foo':123});append({'foo':456});clear();count}" << 0 << ""; - QTest::newRow("clear3") << "{append({'foo':123});clear();get(0).foo}" << 0 << "<Unknown File>: QML ListModel: get: index 0 out of range"; + QTest::newRow("clear3") << "{append({'foo':123});clear()}" << 0 << ""; QTest::newRow("remove1") << "{append({'foo':123});remove(0);count}" << 0 << ""; QTest::newRow("remove2a") << "{append({'foo':123});append({'foo':456});remove(0);count}" << 1 << ""; QTest::newRow("remove2b") << "{append({'foo':123});append({'foo':456});remove(0);get(0).foo}" << 456 << ""; QTest::newRow("remove2c") << "{append({'foo':123});append({'foo':456});remove(1);get(0).foo}" << 123 << ""; - QTest::newRow("remove3") << "{append({'foo':123});remove(0);get(0).foo}" << 0 << "<Unknown File>: QML ListModel: get: index 0 out of range"; + QTest::newRow("remove3") << "{append({'foo':123});remove(0)}" << 0 << ""; QTest::newRow("remove3a") << "{append({'foo':123});remove(-1);count}" << 1 << "<Unknown File>: QML ListModel: remove: index -1 out of range"; QTest::newRow("remove4a") << "{remove(0)}" << 0 << "<Unknown File>: QML ListModel: remove: index 0 out of range"; QTest::newRow("remove4b") << "{append({'foo':123});remove(0);remove(0);count}" << 0 << "<Unknown File>: QML ListModel: remove: index 0 out of range"; @@ -282,7 +282,9 @@ void tst_qdeclarativelistmodel::dynamic() int actual = e.evaluate().toInt(); if (e.hasError()) qDebug() << e.error(); // errors not expected - QVERIFY(!e.hasError()); + + if (QTest::currentDataTag() != QLatin1String("clear3") && QTest::currentDataTag() != QLatin1String("remove3")) + QVERIFY(!e.hasError()); QCOMPARE(actual,result); } @@ -326,12 +328,6 @@ void tst_qdeclarativelistmodel::dynamic_worker() if (QByteArray(QTest::currentDataTag()).startsWith("nested")) QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML ListModel: Cannot add nested list values when modifying or after modification from a worker script"); - if (QByteArray(QTest::currentDataTag()).startsWith("nested-append")) { - int callsToGet = script.count(QLatin1String(";get(")); - for (int i=0; i<callsToGet; i++) - QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML ListModel: get: index 0 out of range"); - } - QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker", Q_ARG(QVariant, operations.mid(0, operations.length()-1)))); waitForWorker(item); diff --git a/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro b/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro index 5d962c0..b406fde 100644 --- a/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro +++ b/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro @@ -5,6 +5,13 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativelistview.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 22eb734..ec2afae 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -1432,8 +1432,6 @@ void tst_QDeclarativeListView::QTBUG_9791() { QDeclarativeView *canvas = createView(); - QDeclarativeContext *ctxt = canvas->rootContext(); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/strictlyenforcerange.qml")); qApp->processEvents(); diff --git a/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml b/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml index 9bb0b37..3b851c1 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml @@ -1,5 +1,4 @@ import Qt 4.7 -import Qt.widgets 4.6 QGraphicsWidget { size: "250x250" diff --git a/tests/auto/declarative/qdeclarativeloader/data/NoResize.qml b/tests/auto/declarative/qdeclarativeloader/data/NoResize.qml index 6aa3d2f..72cd3b9 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/NoResize.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/NoResize.qml @@ -1,7 +1,8 @@ import Qt 4.7 -Loader { - resizeMode: "NoResize" +Item { width: 200; height: 80 - source: "Rect120x60.qml" + Loader { + source: "Rect120x60.qml" + } } diff --git a/tests/auto/declarative/qdeclarativeloader/data/NoResizeGraphicsWidget.qml b/tests/auto/declarative/qdeclarativeloader/data/NoResizeGraphicsWidget.qml index 9322141..0cff506 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/NoResizeGraphicsWidget.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/NoResizeGraphicsWidget.qml @@ -1,8 +1,9 @@ import Qt 4.7 -Loader { - resizeMode: Loader.NoResize - source: "GraphicsWidget250x250.qml" +Item { width: 200 - height: 80 + height: 80 + Loader { + source: "GraphicsWidget250x250.qml" + } } diff --git a/tests/auto/declarative/qdeclarativeloader/data/SizeGraphicsWidgetToLoader.qml b/tests/auto/declarative/qdeclarativeloader/data/SizeGraphicsWidgetToLoader.qml index 0cfb4df..81610ad 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/SizeGraphicsWidgetToLoader.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/SizeGraphicsWidgetToLoader.qml @@ -1,7 +1,6 @@ import Qt 4.7 Loader { - resizeMode: Loader.SizeItemToLoader width: 200 height: 80 source: "GraphicsWidget250x250.qml" diff --git a/tests/auto/declarative/qdeclarativeloader/data/SizeLoaderToGraphicsWidget.qml b/tests/auto/declarative/qdeclarativeloader/data/SizeLoaderToGraphicsWidget.qml index b588c9d..a801a42 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/SizeLoaderToGraphicsWidget.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/SizeLoaderToGraphicsWidget.qml @@ -1,6 +1,5 @@ import Qt 4.7 Loader { - resizeMode: Loader.SizeLoaderToItem source: "GraphicsWidget250x250.qml" } diff --git a/tests/auto/declarative/qdeclarativeloader/data/SizeToItem.qml b/tests/auto/declarative/qdeclarativeloader/data/SizeToItem.qml index 93be6f1..77aa8d9 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/SizeToItem.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/SizeToItem.qml @@ -1,6 +1,5 @@ import Qt 4.7 Loader { - resizeMode: "SizeLoaderToItem" source: "Rect120x60.qml" } diff --git a/tests/auto/declarative/qdeclarativeloader/data/SizeToLoader.qml b/tests/auto/declarative/qdeclarativeloader/data/SizeToLoader.qml index 04b46fb..0098927 100644 --- a/tests/auto/declarative/qdeclarativeloader/data/SizeToLoader.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/SizeToLoader.qml @@ -1,7 +1,6 @@ import Qt 4.7 Loader { - resizeMode: "SizeItemToLoader" width: 200; height: 80 source: "Rect120x60.qml" } diff --git a/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro b/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro index 96fea5b..9334928 100644 --- a/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro +++ b/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro @@ -7,7 +7,14 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativeloader.cpp \ ../shared/testhttpserver.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index 7cdadb4..59580ea 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -104,13 +104,14 @@ tst_QDeclarativeLoader::tst_QDeclarativeLoader() void tst_QDeclarativeLoader::url() { QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.7\nLoader { source: \"Rect120x60.qml\" }"), TEST_FILE("")); + component.setData(QByteArray("import Qt 4.7\nLoader { property int did_load: 0; onLoaded: did_load=123; source: \"Rect120x60.qml\" }"), TEST_FILE("")); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader != 0); QVERIFY(loader->item()); QVERIFY(loader->source() == QUrl::fromLocalFile(SRCDIR "/data/Rect120x60.qml")); QCOMPARE(loader->progress(), 1.0); QCOMPARE(loader->status(), QDeclarativeLoader::Ready); + QCOMPARE(loader->property("did_load").toInt(), 123); QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); delete loader; @@ -270,7 +271,6 @@ void tst_QDeclarativeLoader::sizeLoaderToItem() QDeclarativeComponent component(&engine, TEST_FILE("/SizeToItem.qml")); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader != 0); - QVERIFY(loader->resizeMode() == QDeclarativeLoader::SizeLoaderToItem); QCOMPARE(loader->width(), 120.0); QCOMPARE(loader->height(), 60.0); @@ -282,20 +282,28 @@ void tst_QDeclarativeLoader::sizeLoaderToItem() QCOMPARE(loader->width(), 150.0); QCOMPARE(loader->height(), 45.0); + // Check explicit width + loader->setWidth(200.0); + QCOMPARE(loader->width(), 200.0); + QCOMPARE(rect->width(), 200.0); + rect->setWidth(100.0); // when rect changes ... + QCOMPARE(rect->width(), 100.0); // ... it changes + QCOMPARE(loader->width(), 200.0); // ... but loader stays the same + + // Check explicit height + loader->setHeight(200.0); + QCOMPARE(loader->height(), 200.0); + QCOMPARE(rect->height(), 200.0); + rect->setHeight(100.0); // when rect changes ... + QCOMPARE(rect->height(), 100.0); // ... it changes + QCOMPARE(loader->height(), 200.0); // ... but loader stays the same + // Switch mode - loader->setResizeMode(QDeclarativeLoader::SizeItemToLoader); loader->setWidth(180); loader->setHeight(30); QCOMPARE(rect->width(), 180.0); QCOMPARE(rect->height(), 30.0); - // notify - QSignalSpy spy(loader, SIGNAL(resizeModeChanged())); - loader->setResizeMode(QDeclarativeLoader::NoResize); - QCOMPARE(spy.count(),1); - loader->setResizeMode(QDeclarativeLoader::NoResize); - QCOMPARE(spy.count(),1); - delete loader; } @@ -304,7 +312,6 @@ void tst_QDeclarativeLoader::sizeItemToLoader() QDeclarativeComponent component(&engine, TEST_FILE("/SizeToLoader.qml")); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader != 0); - QVERIFY(loader->resizeMode() == QDeclarativeLoader::SizeItemToLoader); QCOMPARE(loader->width(), 200.0); QCOMPARE(loader->height(), 80.0); @@ -320,7 +327,8 @@ void tst_QDeclarativeLoader::sizeItemToLoader() QCOMPARE(rect->height(), 30.0); // Switch mode - loader->setResizeMode(QDeclarativeLoader::SizeLoaderToItem); + loader->resetWidth(); // reset explicit size + loader->resetHeight(); rect->setWidth(160); rect->setHeight(45); QCOMPARE(loader->width(), 160.0); @@ -332,17 +340,12 @@ void tst_QDeclarativeLoader::sizeItemToLoader() void tst_QDeclarativeLoader::noResize() { QDeclarativeComponent component(&engine, TEST_FILE("/NoResize.qml")); - QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); - QVERIFY(loader != 0); - QCOMPARE(loader->width(), 200.0); - QCOMPARE(loader->height(), 80.0); - - QDeclarativeItem *rect = qobject_cast<QDeclarativeItem*>(loader->item()); - QVERIFY(rect); - QCOMPARE(rect->width(), 120.0); - QCOMPARE(rect->height(), 60.0); + QDeclarativeItem* item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item != 0); + QCOMPARE(item->width(), 200.0); + QCOMPARE(item->height(), 80.0); - delete loader; + delete item; } void tst_QDeclarativeLoader::sizeLoaderToGraphicsWidget() @@ -353,7 +356,6 @@ void tst_QDeclarativeLoader::sizeLoaderToGraphicsWidget() scene.addItem(loader); QVERIFY(loader != 0); - QVERIFY(loader->resizeMode() == QDeclarativeLoader::SizeLoaderToItem); QCOMPARE(loader->width(), 250.0); QCOMPARE(loader->height(), 250.0); @@ -365,7 +367,6 @@ void tst_QDeclarativeLoader::sizeLoaderToGraphicsWidget() QCOMPARE(loader->height(), 45.0); // Switch mode - loader->setResizeMode(QDeclarativeLoader::SizeItemToLoader); loader->setWidth(180); loader->setHeight(30); QCOMPARE(widget->size().width(), 180.0); @@ -382,7 +383,6 @@ void tst_QDeclarativeLoader::sizeGraphicsWidgetToLoader() scene.addItem(loader); QVERIFY(loader != 0); - QVERIFY(loader->resizeMode() == QDeclarativeLoader::SizeItemToLoader); QCOMPARE(loader->width(), 200.0); QCOMPARE(loader->height(), 80.0); @@ -398,7 +398,8 @@ void tst_QDeclarativeLoader::sizeGraphicsWidgetToLoader() QCOMPARE(widget->size().height(), 30.0); // Switch mode - loader->setResizeMode(QDeclarativeLoader::SizeLoaderToItem); + loader->resetWidth(); // reset explicit size + loader->resetHeight(); widget->resize(QSizeF(160,45)); QCOMPARE(loader->width(), 160.0); QCOMPARE(loader->height(), 45.0); @@ -409,20 +410,15 @@ void tst_QDeclarativeLoader::sizeGraphicsWidgetToLoader() void tst_QDeclarativeLoader::noResizeGraphicsWidget() { QDeclarativeComponent component(&engine, TEST_FILE("/NoResizeGraphicsWidget.qml")); - QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); QGraphicsScene scene; - scene.addItem(loader); - - QVERIFY(loader != 0); - QCOMPARE(loader->width(), 200.0); - QCOMPARE(loader->height(), 80.0); + scene.addItem(item); - QGraphicsWidget *widget = qobject_cast<QGraphicsWidget*>(loader->item()); - QVERIFY(widget); - QCOMPARE(widget->size().width(), 250.0); - QCOMPARE(widget->size().height(), 250.0); + QVERIFY(item != 0); + QCOMPARE(item->width(), 200.0); + QCOMPARE(item->height(), 80.0); - delete loader; + delete item; } void tst_QDeclarativeLoader::networkRequestUrl() @@ -432,7 +428,7 @@ void tst_QDeclarativeLoader::networkRequestUrl() server.serveDirectory(SRCDIR "/data"); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.7\nLoader { source: \"http://127.0.0.1:14450/Rect120x60.qml\" }"), QUrl::fromLocalFile(SRCDIR "/dummy.qml")); + component.setData(QByteArray("import Qt 4.7\nLoader { property int did_load : 0; source: \"http://127.0.0.1:14450/Rect120x60.qml\"; onLoaded: did_load=123 }"), QUrl::fromLocalFile(SRCDIR "/dummy.qml")); if (component.isError()) qDebug() << component.errors(); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); @@ -442,6 +438,7 @@ void tst_QDeclarativeLoader::networkRequestUrl() QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); + QCOMPARE(loader->property("did_load").toInt(), 123); QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); delete loader; @@ -488,7 +485,7 @@ void tst_QDeclarativeLoader::failNetworkRequest() QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Network error for URL http://127.0.0.1:14450/IDontExist.qml"); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.7\nLoader { source: \"http://127.0.0.1:14450/IDontExist.qml\" }"), QUrl::fromLocalFile("http://127.0.0.1:14450/dummy.qml")); + component.setData(QByteArray("import Qt 4.7\nLoader { property int did_load: 123; source: \"http://127.0.0.1:14450/IDontExist.qml\"; onLoaded: did_load=456 }"), QUrl::fromLocalFile("http://127.0.0.1:14450/dummy.qml")); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader != 0); @@ -496,6 +493,7 @@ void tst_QDeclarativeLoader::failNetworkRequest() QVERIFY(loader->item() == 0); QCOMPARE(loader->progress(), 0.0); + QCOMPARE(loader->property("did_load").toInt(), 123); QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 0); delete loader; diff --git a/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro b/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro index cf3fa65..0d32ab8 100644 --- a/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro +++ b/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro @@ -3,7 +3,11 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativemetatype.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp index 36efe13..76e86c9 100644 --- a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp +++ b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp @@ -88,7 +88,10 @@ QML_DECLARE_TYPE(TestType); class ParserStatusTestType : public QObject, public QDeclarativeParserStatus { Q_OBJECT + void classBegin(){} + void componentComplete(){} Q_CLASSINFO("DefaultProperty", "foo") // Missing default property + Q_INTERFACES(QDeclarativeParserStatus) }; QML_DECLARE_TYPE(ParserStatusTestType); diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro index fc77225..173a302 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro +++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro @@ -4,3 +4,6 @@ SOURCES = plugin.cpp QT = core declarative DESTDIR = ../imports/com/nokia/AutoTestQmlPluginType +symbian: { + TARGET.EPOCALLOWDLLDATA=1 +} diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro index d895ed0..29a1009 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro +++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro @@ -2,4 +2,11 @@ load(qttest_p4) SOURCES = tst_qdeclarativemoduleplugin.cpp QT += declarative CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} diff --git a/tests/auto/declarative/qdeclarativemousearea/data/rejectEvent.qml b/tests/auto/declarative/qdeclarativemousearea/data/rejectEvent.qml new file mode 100644 index 0000000..c01e938 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemousearea/data/rejectEvent.qml @@ -0,0 +1,28 @@ +import Qt 4.7 + +Rectangle { + id: root + color: "#ffffff" + width: 320; height: 240 + property bool mr1_pressed: false + property bool mr1_released: false + property bool mr1_canceled: false + property bool mr2_pressed: false + property bool mr2_released: false + property bool mr2_canceled: false + + MouseArea { + id: mouseRegion1 + anchors.fill: parent + onPressed: { root.mr1_pressed = true } + onReleased: { root.mr1_released = true } + onCanceled: { root.mr1_canceled = true } + } + MouseArea { + id: mouseRegion2 + width: 120; height: 120 + onPressed: { root.mr2_pressed = true; mouse.accepted = false } + onReleased: { root.mr2_released = true } + onCanceled: { root.mr2_canceled = true } + } +} diff --git a/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro b/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro index 48fe025..6f9c98c 100644 --- a/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro +++ b/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro @@ -6,7 +6,14 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativemousearea.cpp ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp index eb4aa12..ff3bf45 100644 --- a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp +++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp @@ -56,6 +56,8 @@ private slots: void updateMouseAreaPosOnClick(); void updateMouseAreaPosOnResize(); void noOnClickedWithPressAndHold(); + void onMousePressRejected(); + private: QDeclarativeView *createView(); }; @@ -320,7 +322,7 @@ void tst_QDeclarativeMouseArea::noOnClickedWithPressAndHold() QTest::qWait(1000); - QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMousePress); + QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease); releaseEvent.setScenePos(QPointF(100, 100)); releaseEvent.setButton(Qt::LeftButton); releaseEvent.setButtons(Qt::LeftButton); @@ -330,6 +332,48 @@ void tst_QDeclarativeMouseArea::noOnClickedWithPressAndHold() QVERIFY(canvas->rootObject()->property("held").toBool()); } +void tst_QDeclarativeMouseArea::onMousePressRejected() +{ + QDeclarativeView *canvas = createView(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/rejectEvent.qml")); + canvas->show(); + canvas->setFocus(); + QVERIFY(canvas->rootObject() != 0); + + QVERIFY(!canvas->rootObject()->property("mr1_pressed").toBool()); + QVERIFY(!canvas->rootObject()->property("mr1_released").toBool()); + QVERIFY(!canvas->rootObject()->property("mr1_canceled").toBool()); + QVERIFY(!canvas->rootObject()->property("mr2_pressed").toBool()); + QVERIFY(!canvas->rootObject()->property("mr2_released").toBool()); + QVERIFY(!canvas->rootObject()->property("mr2_canceled").toBool()); + + QGraphicsScene *scene = canvas->scene(); + QGraphicsSceneMouseEvent pressEvent(QEvent::GraphicsSceneMousePress); + pressEvent.setScenePos(QPointF(100, 100)); + pressEvent.setButton(Qt::LeftButton); + pressEvent.setButtons(Qt::LeftButton); + QApplication::sendEvent(scene, &pressEvent); + + QVERIFY(canvas->rootObject()->property("mr1_pressed").toBool()); + QVERIFY(!canvas->rootObject()->property("mr1_released").toBool()); + QVERIFY(!canvas->rootObject()->property("mr1_canceled").toBool()); + QVERIFY(canvas->rootObject()->property("mr2_pressed").toBool()); + QVERIFY(!canvas->rootObject()->property("mr2_released").toBool()); + QVERIFY(canvas->rootObject()->property("mr2_canceled").toBool()); + + QTest::qWait(200); + + QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease); + releaseEvent.setScenePos(QPointF(100, 100)); + releaseEvent.setButton(Qt::LeftButton); + releaseEvent.setButtons(Qt::LeftButton); + QApplication::sendEvent(scene, &releaseEvent); + + QVERIFY(canvas->rootObject()->property("mr1_released").toBool()); + QVERIFY(!canvas->rootObject()->property("mr1_canceled").toBool()); + QVERIFY(!canvas->rootObject()->property("mr2_released").toBool()); +} + QTEST_MAIN(tst_QDeclarativeMouseArea) #include "tst_qdeclarativemousearea.moc" diff --git a/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro b/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro index 8a061c3..31172a9 100644 --- a/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro +++ b/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeparticles.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathUpdateOnStartChanged.qml b/tests/auto/declarative/qdeclarativepathview/data/pathUpdateOnStartChanged.qml new file mode 100644 index 0000000..ce0f0c9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativepathview/data/pathUpdateOnStartChanged.qml @@ -0,0 +1,38 @@ +import Qt 4.7 + +Rectangle { + width: 800 + height: 480 + color: "black" + resources: [ + ListModel { + id: appModel + ListElement { color: "green" } + }, + Component { + id: appDelegate + Rectangle { + id: wrapper + objectName: "wrapper" + color: "green" + width: 100 + height: 100 + } + } + ] + PathView { + id: pathView + objectName: "pathView" + model: appModel + anchors.fill: parent + + transformOrigin: "Top" + delegate: appDelegate + path: Path { + objectName: "path" + startX: pathView.width / 2 // startX: 400 <- this works as expected + startY: 300 + PathLine { x: 400; y: 120 } + } + } +} diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview_package.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview_package.qml new file mode 100644 index 0000000..082da13 --- /dev/null +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview_package.qml @@ -0,0 +1,88 @@ +import Qt 4.7 + +Item { + width: 800; height: 600 + Component { + id: photoDelegate + Package { + Item { id: pathItem; objectName: "pathItem"; Package.name: 'path'; width: 85; height: 85; scale: pathItem.PathView.scale } + Item { id: linearItem; Package.name: 'linear'; width: 85; height: 85 } + Rectangle { + id: wrapper + width: 85; height: 85; color: lColor + + transform: Rotation { + id: itemRotation; origin.x: wrapper.width/2; origin.y: wrapper.height/2 + axis.y: 1; axis.z: 0 + } + state: 'path' + states: [ + State { + name: 'path' + ParentChange { target: wrapper; parent: pathItem; x: 0; y: 0 } + PropertyChanges { target: wrapper; opacity: pathItem.PathView.onPath ? 1.0 : 0 } + } + ] + } + } + } + ListModel { + id: rssModel + ListElement { lColor: "red" } + ListElement { lColor: "green" } + ListElement { lColor: "yellow" } + ListElement { lColor: "blue" } + ListElement { lColor: "purple" } + ListElement { lColor: "gray" } + ListElement { lColor: "brown" } + ListElement { lColor: "thistle" } + } + VisualDataModel { id: visualModel; model: rssModel; delegate: photoDelegate } + + PathView { + id: photoPathView + objectName: "photoPathView" + width: 800; height: 330; pathItemCount: 4; offset: 1 + dragMargin: 24 + preferredHighlightBegin: 0.50 + preferredHighlightEnd: 0.50 + + path: Path { + startX: -50; startY: 40; + + PathAttribute { name: "scale"; value: 0.5 } + PathAttribute { name: "angle"; value: -45 } + + PathCubic { + x: 400; y: 220 + control1X: 140; control1Y: 40 + control2X: 210; control2Y: 220 + } + + PathAttribute { name: "scale"; value: 1.2 } + PathAttribute { name: "angle"; value: 0 } + + PathCubic { + x: 850; y: 40 + control2X: 660; control2Y: 40 + control1X: 590; control1Y: 220 + } + + PathAttribute { name: "scale"; value: 0.5 } + PathAttribute { name: "angle"; value: 45 } + } + + model: visualModel.parts.path + } + + PathView { + y: 400; width: 800; height: 330; pathItemCount: 8 + + path: Path { + startX: 0; startY: 40; + PathLine { x: 800; y: 40 } + } + + model: visualModel.parts.linear + } +} diff --git a/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro b/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro index 3c327d5..6bef61c 100644 --- a/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro +++ b/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativepathview.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index 0e3a74d..0e16f66 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -77,6 +77,8 @@ private slots: void pathChanges(); void componentChanges(); void modelChanges(); + void pathUpdateOnStartChanged(); + void package(); private: @@ -436,7 +438,8 @@ void tst_QDeclarativePathView::pathMoved() for(int i=0; i<model.count(); i++){ QDeclarativeRectangle *curItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", i); - QCOMPARE(curItem->pos() + offset, path->pointAt(0.25 + i*0.25)); + QPointF itemPos(path->pointAt(0.25 + i*0.25)); + QCOMPARE(curItem->pos() + offset, QPointF(qRound(itemPos.x()), qRound(itemPos.y()))); } pathview->setOffset(0.0); @@ -477,13 +480,36 @@ void tst_QDeclarativePathView::setCurrentIndex() QCOMPARE(canvas->rootObject()->property("currentB").toInt(), 0); pathview->setCurrentIndex(2); - QTest::qWait(1000); firstItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 2); - QCOMPARE(firstItem->pos() + offset, start); + QTRY_COMPARE(firstItem->pos() + offset, start); QCOMPARE(canvas->rootObject()->property("currentA").toInt(), 2); QCOMPARE(canvas->rootObject()->property("currentB").toInt(), 2); + pathview->decrementCurrentIndex(); + QTRY_COMPARE(pathview->currentIndex(), 1); + firstItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 1); + QVERIFY(firstItem); + QTRY_COMPARE(firstItem->pos() + offset, start); + + pathview->decrementCurrentIndex(); + QTRY_COMPARE(pathview->currentIndex(), 0); + firstItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 0); + QVERIFY(firstItem); + QTRY_COMPARE(firstItem->pos() + offset, start); + + pathview->decrementCurrentIndex(); + QTRY_COMPARE(pathview->currentIndex(), 3); + firstItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 3); + QVERIFY(firstItem); + QTRY_COMPARE(firstItem->pos() + offset, start); + + pathview->incrementCurrentIndex(); + QTRY_COMPARE(pathview->currentIndex(), 0); + firstItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 0); + QVERIFY(firstItem); + QTRY_COMPARE(firstItem->pos() + offset, start); + delete canvas; } @@ -672,6 +698,44 @@ void tst_QDeclarativePathView::modelChanges() delete canvas; } +void tst_QDeclarativePathView::pathUpdateOnStartChanged() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathUpdateOnStartChanged.qml")); + + QDeclarativePathView *pathView = canvas->rootObject()->findChild<QDeclarativePathView*>("pathView"); + QVERIFY(pathView); + + QDeclarativePath *path = canvas->rootObject()->findChild<QDeclarativePath*>("path"); + QVERIFY(path); + QCOMPARE(path->startX(), 400.0); + QCOMPARE(path->startY(), 300.0); + + QDeclarativeItem *item = findItem<QDeclarativeItem>(pathView, "wrapper", 0); + QVERIFY(item); + QCOMPARE(item->x(), path->startX() - item->width() / 2.0); + QCOMPARE(item->y(), path->startY() - item->height() / 2.0); + + delete canvas; +} + +void tst_QDeclarativePathView::package() +{ + QDeclarativeView *canvas = createView(); + QVERIFY(canvas); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathview_package.qml")); + + QDeclarativePathView *pathView = canvas->rootObject()->findChild<QDeclarativePathView*>("photoPathView"); + QVERIFY(pathView); + + QDeclarativeItem *item = findItem<QDeclarativeItem>(pathView, "pathItem"); + QVERIFY(item); + QVERIFY(item->scale() != 1.0); + + delete canvas; +} + QDeclarativeView *tst_QDeclarativePathView::createView() { QDeclarativeView *canvas = new QDeclarativeView(0); diff --git a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro index 4b247fc..99a94bc 100644 --- a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro +++ b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro @@ -9,7 +9,14 @@ INCLUDEPATH += ../shared/ HEADERS += ../shared/testhttpserver.h SOURCES += ../shared/testhttpserver.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov diff --git a/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro b/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro index dbe2cbee..2c5b473 100644 --- a/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro +++ b/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro @@ -4,7 +4,14 @@ SOURCES += tst_qdeclarativepositioners.cpp macx:CONFIG -= app_bundle # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp index b4ac0e1..e639014 100644 --- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp +++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp @@ -41,6 +41,7 @@ #include <QtTest/QtTest> #include <private/qlistmodelinterface_p.h> #include <qdeclarativeview.h> +#include <qdeclarativeengine.h> #include <private/qdeclarativerectangle_p.h> #include <private/qdeclarativepositioners_p.h> #include <private/qdeclarativetransition_p.h> @@ -69,6 +70,7 @@ private slots: void test_repeater(); void test_flow(); void test_flow_resize(); + void test_conflictinganchors(); private: QDeclarativeView *createView(const QString &filename); }; @@ -100,6 +102,8 @@ void tst_QDeclarativePositioners::test_horizontal() QDeclarativeItem *row = canvas->rootObject()->findChild<QDeclarativeItem*>("row"); QCOMPARE(row->width(), 110.0); QCOMPARE(row->height(), 50.0); + + delete canvas; } void tst_QDeclarativePositioners::test_horizontal_spacing() @@ -125,6 +129,8 @@ void tst_QDeclarativePositioners::test_horizontal_spacing() QDeclarativeItem *row = canvas->rootObject()->findChild<QDeclarativeItem*>("row"); QCOMPARE(row->width(), 130.0); QCOMPARE(row->height(), 50.0); + + delete canvas; } void tst_QDeclarativePositioners::test_horizontal_animated() @@ -175,6 +181,8 @@ void tst_QDeclarativePositioners::test_horizontal_animated() QTRY_COMPARE(two->x(), 50.0); QTRY_COMPARE(three->x(), 100.0); + + delete canvas; } void tst_QDeclarativePositioners::test_vertical() @@ -201,6 +209,8 @@ void tst_QDeclarativePositioners::test_vertical() QVERIFY(column); QCOMPARE(column->height(), 80.0); QCOMPARE(column->width(), 50.0); + + delete canvas; } void tst_QDeclarativePositioners::test_vertical_spacing() @@ -226,6 +236,8 @@ void tst_QDeclarativePositioners::test_vertical_spacing() QDeclarativeItem *column = canvas->rootObject()->findChild<QDeclarativeItem*>("column"); QCOMPARE(column->height(), 100.0); QCOMPARE(column->width(), 50.0); + + delete canvas; } void tst_QDeclarativePositioners::test_vertical_animated() @@ -273,6 +285,7 @@ void tst_QDeclarativePositioners::test_vertical_animated() QTRY_COMPARE(two->y(), 50.0); QTRY_COMPARE(three->y(), 100.0); + delete canvas; } void tst_QDeclarativePositioners::test_grid() @@ -304,6 +317,8 @@ void tst_QDeclarativePositioners::test_grid() QDeclarativeItem *grid = canvas->rootObject()->findChild<QDeclarativeItem*>("grid"); QCOMPARE(grid->width(), 120.0); QCOMPARE(grid->height(), 100.0); + + delete canvas; } void tst_QDeclarativePositioners::test_grid_topToBottom() @@ -335,6 +350,8 @@ void tst_QDeclarativePositioners::test_grid_topToBottom() QDeclarativeItem *grid = canvas->rootObject()->findChild<QDeclarativeItem*>("grid"); QCOMPARE(grid->width(), 100.0); QCOMPARE(grid->height(), 120.0); + + delete canvas; } void tst_QDeclarativePositioners::test_grid_spacing() @@ -366,6 +383,8 @@ void tst_QDeclarativePositioners::test_grid_spacing() QDeclarativeItem *grid = canvas->rootObject()->findChild<QDeclarativeItem*>("grid"); QCOMPARE(grid->width(), 128.0); QCOMPARE(grid->height(), 104.0); + + delete canvas; } void tst_QDeclarativePositioners::test_grid_animated() @@ -446,6 +465,7 @@ void tst_QDeclarativePositioners::test_grid_animated() QTRY_COMPARE(five->x(), 50.0); QTRY_COMPARE(five->y(), 50.0); + delete canvas; } void tst_QDeclarativePositioners::test_grid_zero_columns() @@ -477,6 +497,8 @@ void tst_QDeclarativePositioners::test_grid_zero_columns() QDeclarativeItem *grid = canvas->rootObject()->findChild<QDeclarativeItem*>("grid"); QCOMPARE(grid->width(), 170.0); QCOMPARE(grid->height(), 60.0); + + delete canvas; } void tst_QDeclarativePositioners::test_propertychanges() @@ -534,6 +556,8 @@ void tst_QDeclarativePositioners::test_propertychanges() grid->setRows(2); QCOMPARE(columnsSpy.count(),2); QCOMPARE(rowsSpy.count(),2); + + delete canvas; } void tst_QDeclarativePositioners::test_repeater() @@ -555,6 +579,8 @@ void tst_QDeclarativePositioners::test_repeater() QCOMPARE(two->y(), 0.0); QCOMPARE(three->x(), 100.0); QCOMPARE(three->y(), 0.0); + + delete canvas; } void tst_QDeclarativePositioners::test_flow() @@ -587,6 +613,8 @@ void tst_QDeclarativePositioners::test_flow() QVERIFY(flow); QCOMPARE(flow->width(), 90.0); QCOMPARE(flow->height(), 120.0); + + delete canvas; } void tst_QDeclarativePositioners::test_flow_resize() @@ -618,6 +646,101 @@ void tst_QDeclarativePositioners::test_flow_resize() QCOMPARE(four->y(), 50.0); QCOMPARE(five->x(), 50.0); QCOMPARE(five->y(), 50.0); + + delete canvas; +} + +QString warningMessage; + +void interceptWarnings(QtMsgType type, const char *msg) +{ + Q_UNUSED( type ); + warningMessage = msg; +} + +void tst_QDeclarativePositioners::test_conflictinganchors() +{ + qInstallMsgHandler(interceptWarnings); + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + + component.setData("import Qt 4.7\nColumn { Item {} }", QUrl::fromLocalFile("")); + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QVERIFY(warningMessage.isEmpty()); + + component.setData("import Qt 4.7\nRow { Item {} }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QVERIFY(warningMessage.isEmpty()); + + component.setData("import Qt 4.7\nGrid { Item {} }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QVERIFY(warningMessage.isEmpty()); + + component.setData("import Qt 4.7\nFlow { Item {} }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QVERIFY(warningMessage.isEmpty()); + + component.setData("import Qt 4.7\nColumn { Item { anchors.top: parent.top } }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column")); + warningMessage.clear(); + + component.setData("import Qt 4.7\nColumn { Item { anchors.centerIn: parent } }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QCOMPARE(warningMessage, QString("file::2:1: QML Column: Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column")); + warningMessage.clear(); + + component.setData("import Qt 4.7\nColumn { Item { anchors.left: parent.left } }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QVERIFY(warningMessage.isEmpty()); + warningMessage.clear(); + + component.setData("import Qt 4.7\nRow { Item { anchors.left: parent.left } }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row")); + warningMessage.clear(); + + component.setData("import Qt 4.7\nRow { Item { anchors.fill: parent } }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QCOMPARE(warningMessage, QString("file::2:1: QML Row: Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row")); + warningMessage.clear(); + + component.setData("import Qt 4.7\nRow { Item { anchors.top: parent.top } }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QVERIFY(warningMessage.isEmpty()); + warningMessage.clear(); + + component.setData("import Qt 4.7\nGrid { Item { anchors.horizontalCenter: parent.horizontalCenter } }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid")); + warningMessage.clear(); + + component.setData("import Qt 4.7\nGrid { Item { anchors.centerIn: parent } }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QCOMPARE(warningMessage, QString("file::2:1: QML Grid: Cannot specify anchors for items inside Grid")); + warningMessage.clear(); + + component.setData("import Qt 4.7\nFlow { Item { anchors.verticalCenter: parent.verticalCenter } }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow")); + + component.setData("import Qt 4.7\nFlow { Item { anchors.fill: parent } }", QUrl::fromLocalFile("")); + item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow")); } QDeclarativeView *tst_QDeclarativePositioners::createView(const QString &filename) diff --git a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro index 6910ccc..f37d952 100644 --- a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro +++ b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro @@ -4,7 +4,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeproperty.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeqt/data/darker.qml b/tests/auto/declarative/qdeclarativeqt/data/darker.qml index f6333fe..738095d 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/darker.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/darker.qml @@ -3,9 +3,10 @@ import Qt 4.7 QtObject { property variant test1: Qt.darker(Qt.rgba(1, 0.8, 0.3)) property variant test2: Qt.darker() - property variant test3: Qt.darker(Qt.rgba(1, 0.8, 0.3), 10) + property variant test3: Qt.darker(Qt.rgba(1, 0.8, 0.3), 2.8) property variant test4: Qt.darker("red"); property variant test5: Qt.darker("perfectred"); // Non-existant color property variant test6: Qt.darker(10); + property variant test7: Qt.darker(Qt.rgba(1, 0.8, 0.3), 2.8, 10) } diff --git a/tests/auto/declarative/qdeclarativeqt/data/fontFamilies.qml b/tests/auto/declarative/qdeclarativeqt/data/fontFamilies.qml new file mode 100644 index 0000000..e66c7be --- /dev/null +++ b/tests/auto/declarative/qdeclarativeqt/data/fontFamilies.qml @@ -0,0 +1,6 @@ +import Qt 4.7 + +QtObject { + property variant test1: Qt.fontFamilies(10) + property variant test2: Qt.fontFamilies(); +} diff --git a/tests/auto/declarative/qdeclarativeqt/data/lighter.qml b/tests/auto/declarative/qdeclarativeqt/data/lighter.qml index 6c0053ba..ddaf78d 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/lighter.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/lighter.qml @@ -3,8 +3,9 @@ import Qt 4.7 QtObject { property variant test1: Qt.lighter(Qt.rgba(1, 0.8, 0.3)) property variant test2: Qt.lighter() - property variant test3: Qt.lighter(Qt.rgba(1, 0.8, 0.3), 10) + property variant test3: Qt.lighter(Qt.rgba(1, 0.8, 0.3), 1.8) property variant test4: Qt.lighter("red"); property variant test5: Qt.lighter("perfectred"); // Non-existant color property variant test6: Qt.lighter(10); + property variant test7: Qt.lighter(Qt.rgba(1, 0.8, 0.3), 1.8, 5) } diff --git a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro index 10e10a3..b381a9b 100644 --- a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro +++ b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro @@ -3,7 +3,14 @@ contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qdeclarativeqt.cpp macx:CONFIG -= app_bundle -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp index 7cbd8db..5095be8 100644 --- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp +++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp @@ -42,6 +42,7 @@ #include <qtest.h> #include <QDebug> #include <QDeclarativeEngine> +#include <QFontDatabase> #include <QFileInfo> #include <QDeclarativeComponent> #include <QDesktopServices> @@ -76,6 +77,7 @@ private slots: void isQtObject(); void btoa(); void atob(); + void fontFamilies(); private: QDeclarativeEngine engine; @@ -232,7 +234,7 @@ void tst_qdeclarativeqt::lighter() QDeclarativeComponent component(&engine, TEST_FILE("lighter.qml")); QString warning1 = component.url().toString() + ":5: Error: Qt.lighter(): Invalid arguments"; - QString warning2 = component.url().toString() + ":6: Error: Qt.lighter(): Invalid arguments"; + QString warning2 = component.url().toString() + ":10: Error: Qt.lighter(): Invalid arguments"; QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); @@ -241,7 +243,7 @@ void tst_qdeclarativeqt::lighter() QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0.8, 0.3).lighter()); QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor()); + QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor::fromRgbF(1, 0.8, 0.3).lighter(180)); QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor("red").lighter()); QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor()); QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor()); @@ -254,7 +256,7 @@ void tst_qdeclarativeqt::darker() QDeclarativeComponent component(&engine, TEST_FILE("darker.qml")); QString warning1 = component.url().toString() + ":5: Error: Qt.darker(): Invalid arguments"; - QString warning2 = component.url().toString() + ":6: Error: Qt.darker(): Invalid arguments"; + QString warning2 = component.url().toString() + ":10: Error: Qt.darker(): Invalid arguments"; QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); @@ -263,7 +265,7 @@ void tst_qdeclarativeqt::darker() QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0.8, 0.3).darker()); QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor()); + QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor::fromRgbF(1, 0.8, 0.3).darker(280)); QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor("red").darker()); QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor()); QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor()); @@ -483,6 +485,22 @@ void tst_qdeclarativeqt::atob() delete object; } +void tst_qdeclarativeqt::fontFamilies() +{ + QDeclarativeComponent component(&engine, TEST_FILE("fontFamilies.qml")); + + QString warning1 = component.url().toString() + ":4: Error: Qt.fontFamilies(): Invalid arguments"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QFontDatabase database; + QCOMPARE(object->property("test2"), QVariant::fromValue(database.families())); + + delete object; +} + QTEST_MAIN(tst_qdeclarativeqt) #include "tst_qdeclarativeqt.moc" diff --git a/tests/auto/declarative/qdeclarativerepeater/data/objlist.qml b/tests/auto/declarative/qdeclarativerepeater/data/objlist.qml index 17c5d8d..e1bd2e2 100644 --- a/tests/auto/declarative/qdeclarativerepeater/data/objlist.qml +++ b/tests/auto/declarative/qdeclarativerepeater/data/objlist.qml @@ -14,7 +14,7 @@ Rectangle { property int instantiated: 0 Component { Item{ - Component.onCompleted: {if(index!=model.idx) repeater.errors += 1; repeater.instantiated++} + Component.onCompleted: {if(index!=modelData.idx) repeater.errors += 1; repeater.instantiated++} } } } diff --git a/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro b/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro index abd36e0..51667af 100644 --- a/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro +++ b/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro @@ -5,6 +5,13 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativerepeater.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp index 8be7d80..e6b2fdd 100644 --- a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp +++ b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp @@ -185,15 +185,24 @@ void tst_QDeclarativeRepeater::numberModel() delete canvas; } +class MyObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(int idx READ idx CONSTANT) +public: + MyObject(int i) : QObject(), m_idx(i) {} + + int idx() const { return m_idx; } + + int m_idx; +}; + void tst_QDeclarativeRepeater::objectList() { QDeclarativeView *canvas = createView(); - QObjectList data; - for(int i=0; i<100; i++){ - data << new QObject(); - data.back()->setProperty("idx", i); - } + for(int i=0; i<100; i++) + data << new MyObject(i); QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testData", QVariant::fromValue(data)); diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro index 80b757d..6b98f1e 100644 --- a/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro +++ b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativesmoothedanimation.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro b/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro index 7f737c2..eb7d793 100644 --- a/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro +++ b/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativesmoothedfollow.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro b/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro index 6f400a3..6ed8924 100644 --- a/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro +++ b/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativespringfollow.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro b/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro index 3ff4529..9cdb884 100644 --- a/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro +++ b/tests/auto/declarative/qdeclarativesqldatabase/qdeclarativesqldatabase.pro @@ -6,7 +6,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativesqldatabase.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash2.qml b/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash2.qml new file mode 100644 index 0000000..2215ee4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash2.qml @@ -0,0 +1,24 @@ +import Qt 4.7 + +Rectangle { + id: myRect + width: 400 + height: 400 + + states: [ + State { + name: "state1" + PropertyChanges { + target: myRect + onHeightChanged: console.log("Hello World") + color: "green" + } + }, + State { + name: "state2"; extend: "state1" + PropertyChanges { + target: myRect + color: "red" + } + }] +} diff --git a/tests/auto/declarative/qdeclarativestates/data/unnamedWhen.qml b/tests/auto/declarative/qdeclarativestates/data/unnamedWhen.qml new file mode 100644 index 0000000..a70840c --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/unnamedWhen.qml @@ -0,0 +1,14 @@ +import Qt 4.7 + +Rectangle { + id: theRect + property bool triggerState: false + property string stateString: "" + states: State { + when: triggerState + PropertyChanges { + target: theRect + stateString: "inState" + } + } +} diff --git a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro index 706d045..6f4ecb3 100644 --- a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro +++ b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro @@ -5,6 +5,13 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativestates.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index a016fa7..ea074a4 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -47,6 +47,7 @@ #include <private/qdeclarativetext_p.h> #include <private/qdeclarativepropertychanges_p.h> #include <private/qdeclarativestategroup_p.h> +#include <private/qdeclarativeitem_p.h> class MyRect : public QDeclarativeRectangle @@ -86,6 +87,7 @@ private slots: void basicBinding(); void signalOverride(); void signalOverrideCrash(); + void signalOverrideCrash2(); void parentChange(); void parentChangeErrors(); void anchorChanges(); @@ -109,6 +111,7 @@ private slots: void illegalObjectCreation(); void whenOrdering(); void urlResolution(); + void unnamedWhen(); }; void tst_qdeclarativestates::initTestCase() @@ -128,63 +131,66 @@ void tst_qdeclarativestates::basicChanges() { QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("red")); } { QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges2.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); - rect->setState("green"); + rectPrivate->setState("green"); QCOMPARE(rect->color(),QColor("green")); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("red")); - rect->setState("green"); + rectPrivate->setState("green"); QCOMPARE(rect->color(),QColor("green")); } { QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges3.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); QCOMPARE(rect->border()->width(),1); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); QCOMPARE(rect->border()->width(),1); - rect->setState("bordered"); + rectPrivate->setState("bordered"); QCOMPARE(rect->color(),QColor("red")); QCOMPARE(rect->border()->width(),2); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("red")); QCOMPARE(rect->border()->width(),1); //### we should be checking that this is an implicit rather than explicit 1 (which currently fails) - rect->setState("bordered"); + rectPrivate->setState("bordered"); QCOMPARE(rect->color(),QColor("red")); QCOMPARE(rect->border()->width(),2); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); QCOMPARE(rect->border()->width(),1); @@ -220,32 +226,33 @@ void tst_qdeclarativestates::basicExtension() { QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicExtension.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); QCOMPARE(rect->border()->width(),1); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); QCOMPARE(rect->border()->width(),1); - rect->setState("bordered"); + rectPrivate->setState("bordered"); QCOMPARE(rect->color(),QColor("blue")); QCOMPARE(rect->border()->width(),2); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); QCOMPARE(rect->border()->width(),1); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("red")); QCOMPARE(rect->border()->width(),1); - rect->setState("bordered"); + rectPrivate->setState("bordered"); QCOMPARE(rect->color(),QColor("blue")); QCOMPARE(rect->border()->width(),2); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("red")); QCOMPARE(rect->border()->width(),1); } @@ -253,26 +260,27 @@ void tst_qdeclarativestates::basicExtension() { QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/fakeExtension.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); - rect->setState("green"); + rectPrivate->setState("green"); QCOMPARE(rect->color(),QColor("green")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); - rect->setState("green"); + rectPrivate->setState("green"); QCOMPARE(rect->color(),QColor("green")); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("red")); - rect->setState("green"); + rectPrivate->setState("green"); QCOMPARE(rect->color(),QColor("green")); } } @@ -284,77 +292,80 @@ void tst_qdeclarativestates::basicBinding() { QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("red")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); rect->setProperty("sourceColor", QColor("green")); QCOMPARE(rect->color(),QColor("green")); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("red")); rect->setProperty("sourceColor", QColor("yellow")); QCOMPARE(rect->color(),QColor("red")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("yellow")); } { QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding2.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("red")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); rect->setProperty("sourceColor", QColor("green")); QCOMPARE(rect->color(),QColor("blue")); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("green")); rect->setProperty("sourceColor", QColor("yellow")); QCOMPARE(rect->color(),QColor("yellow")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("yellow")); } { QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding3.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); rect->setProperty("sourceColor", QColor("green")); QCOMPARE(rect->color(),QColor("green")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); rect->setProperty("sourceColor", QColor("red")); QCOMPARE(rect->color(),QColor("blue")); rect->setProperty("sourceColor2", QColor("yellow")); QCOMPARE(rect->color(),QColor("yellow")); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("red")); rect->setProperty("sourceColor2", QColor("green")); QCOMPARE(rect->color(),QColor("red")); @@ -365,27 +376,28 @@ void tst_qdeclarativestates::basicBinding() { QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding4.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QVERIFY(rect != 0); QCOMPARE(rect->color(),QColor("red")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); rect->setProperty("sourceColor", QColor("yellow")); QCOMPARE(rect->color(),QColor("yellow")); - rect->setState("green"); + rectPrivate->setState("green"); QCOMPARE(rect->color(),QColor("green")); rect->setProperty("sourceColor", QColor("purple")); QCOMPARE(rect->color(),QColor("green")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("purple")); - rect->setState("green"); + rectPrivate->setState("green"); QCOMPARE(rect->color(),QColor("green")); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("red")); } } @@ -403,7 +415,7 @@ void tst_qdeclarativestates::signalOverride() rect->doSomething(); QCOMPARE(rect->color(),QColor("blue")); - rect->setState("green"); + QDeclarativeItemPrivate::get(rect)->setState("green"); rect->doSomething(); QCOMPARE(rect->color(),QColor("green")); } @@ -418,8 +430,7 @@ void tst_qdeclarativestates::signalOverride() QCOMPARE(rect->color(),QColor("blue")); QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("extendedRect")); - - innerRect->setState("green"); + QDeclarativeItemPrivate::get(innerRect)->setState("green"); rect->doSomething(); QCOMPARE(rect->color(),QColor("blue")); QCOMPARE(innerRect->color(),QColor("green")); @@ -435,10 +446,25 @@ void tst_qdeclarativestates::signalOverrideCrash() MyRect *rect = qobject_cast<MyRect*>(rectComponent.create()); QVERIFY(rect != 0); - rect->setState("overridden"); + QDeclarativeItemPrivate::get(rect)->setState("overridden"); rect->doSomething(); } +void tst_qdeclarativestates::signalOverrideCrash2() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverrideCrash2.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QDeclarativeItemPrivate::get(rect)->setState("state1"); + QDeclarativeItemPrivate::get(rect)->setState("state2"); + QDeclarativeItemPrivate::get(rect)->setState("state1"); + + delete rect; +} + void tst_qdeclarativestates::parentChange() { QDeclarativeEngine engine; @@ -463,7 +489,7 @@ void tst_qdeclarativestates::parentChange() QCOMPARE(pChange->parent(), nParent); - rect->setState("reparented"); + QDeclarativeItemPrivate::get(rect)->setState("reparented"); QCOMPARE(innerRect->rotation(), qreal(0)); QCOMPARE(innerRect->scale(), qreal(1)); QCOMPARE(innerRect->x(), qreal(-133)); @@ -474,11 +500,11 @@ void tst_qdeclarativestates::parentChange() QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange2.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); QVERIFY(rect != 0); - + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); QVERIFY(innerRect != 0); - rect->setState("reparented"); + rectPrivate->setState("reparented"); QCOMPARE(innerRect->rotation(), qreal(15)); QCOMPARE(innerRect->scale(), qreal(.5)); QCOMPARE(QString("%1").arg(innerRect->x()), QString("%1").arg(-19.9075)); @@ -489,17 +515,17 @@ void tst_qdeclarativestates::parentChange() QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange3.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); QVERIFY(rect != 0); - + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); QVERIFY(innerRect != 0); - rect->setState("reparented"); + rectPrivate->setState("reparented"); QCOMPARE(innerRect->rotation(), qreal(-37)); QCOMPARE(innerRect->scale(), qreal(.25)); QCOMPARE(QString("%1").arg(innerRect->x()), QString("%1").arg(-217.305)); QCOMPARE(QString("%1").arg(innerRect->y()), QString("%1").arg(-164.413)); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(innerRect->rotation(), qreal(0)); QCOMPARE(innerRect->scale(), qreal(1)); QCOMPARE(innerRect->x(), qreal(5)); @@ -521,7 +547,7 @@ void tst_qdeclarativestates::parentChangeErrors() QVERIFY(innerRect != 0); QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/parentChange4.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under non-uniform scale"); - rect->setState("reparented"); + QDeclarativeItemPrivate::get(rect)->setState("reparented"); QCOMPARE(innerRect->rotation(), qreal(0)); QCOMPARE(innerRect->scale(), qreal(1)); QCOMPARE(innerRect->x(), qreal(5)); @@ -537,7 +563,7 @@ void tst_qdeclarativestates::parentChangeErrors() QVERIFY(innerRect != 0); QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/parentChange5.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under complex transform"); - rect->setState("reparented"); + QDeclarativeItemPrivate::get(rect)->setState("reparented"); QCOMPARE(innerRect->rotation(), qreal(0)); QCOMPARE(innerRect->scale(), qreal(1)); QCOMPARE(innerRect->x(), qreal(5)); @@ -552,6 +578,7 @@ void tst_qdeclarativestates::anchorChanges() QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges1.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); QVERIFY(rect != 0); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); QVERIFY(innerRect != 0); @@ -564,14 +591,14 @@ void tst_qdeclarativestates::anchorChanges() QDeclarativeAnchorChanges *aChanges = qobject_cast<QDeclarativeAnchorChanges*>(state->operationAt(0)); QVERIFY(aChanges != 0); - rect->setState("right"); + rectPrivate->setState("right"); QCOMPARE(innerRect->x(), qreal(150)); QCOMPARE(aChanges->object(), qobject_cast<QDeclarativeItem*>(innerRect)); - QCOMPARE(aChanges->object()->anchors()->left().anchorLine, QDeclarativeAnchorLine::Invalid); //### was reset (how do we distinguish from not set at all) - QCOMPARE(aChanges->object()->anchors()->right().item, rect->right().item); - QCOMPARE(aChanges->object()->anchors()->right().anchorLine, rect->right().anchorLine); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->left().anchorLine, QDeclarativeAnchorLine::Invalid); //### was reset (how do we distinguish from not set at all) + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->right().item, rectPrivate->right().item); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->right().anchorLine, rectPrivate->right().anchorLine); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(innerRect->x(), qreal(5)); delete rect; @@ -584,14 +611,15 @@ void tst_qdeclarativestates::anchorChanges2() QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges2.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); QVERIFY(rect != 0); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); QVERIFY(innerRect != 0); - rect->setState("right"); + rectPrivate->setState("right"); QCOMPARE(innerRect->x(), qreal(150)); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(innerRect->x(), qreal(5)); delete rect; @@ -604,6 +632,7 @@ void tst_qdeclarativestates::anchorChanges3() QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges3.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); QVERIFY(rect != 0); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); QVERIFY(innerRect != 0); @@ -622,23 +651,23 @@ void tst_qdeclarativestates::anchorChanges3() QDeclarativeAnchorChanges *aChanges = qobject_cast<QDeclarativeAnchorChanges*>(state->operationAt(0)); QVERIFY(aChanges != 0); - rect->setState("reanchored"); + rectPrivate->setState("reanchored"); QCOMPARE(aChanges->object(), qobject_cast<QDeclarativeItem*>(innerRect)); - QCOMPARE(aChanges->object()->anchors()->left().item, leftGuideline->left().item); - QCOMPARE(aChanges->object()->anchors()->left().anchorLine, leftGuideline->left().anchorLine); - QCOMPARE(aChanges->object()->anchors()->right().item, rect->right().item); - QCOMPARE(aChanges->object()->anchors()->right().anchorLine, rect->right().anchorLine); - QCOMPARE(aChanges->object()->anchors()->top().item, rect->top().item); - QCOMPARE(aChanges->object()->anchors()->top().anchorLine, rect->top().anchorLine); - QCOMPARE(aChanges->object()->anchors()->bottom().item, bottomGuideline->bottom().item); - QCOMPARE(aChanges->object()->anchors()->bottom().anchorLine, bottomGuideline->bottom().anchorLine); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->left().item, QDeclarativeItemPrivate::get(leftGuideline)->left().item); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->left().anchorLine, QDeclarativeItemPrivate::get(leftGuideline)->left().anchorLine); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->right().item, rectPrivate->right().item); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->right().anchorLine, rectPrivate->right().anchorLine); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->top().item, rectPrivate->top().item); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->top().anchorLine, rectPrivate->top().anchorLine); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->bottom().item, QDeclarativeItemPrivate::get(bottomGuideline)->bottom().item); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->bottom().anchorLine, QDeclarativeItemPrivate::get(bottomGuideline)->bottom().anchorLine); QCOMPARE(innerRect->x(), qreal(10)); QCOMPARE(innerRect->y(), qreal(0)); QCOMPARE(innerRect->width(), qreal(190)); QCOMPARE(innerRect->height(), qreal(150)); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(innerRect->x(), qreal(0)); QCOMPARE(innerRect->y(), qreal(10)); QCOMPARE(innerRect->width(), qreal(150)); @@ -672,12 +701,12 @@ void tst_qdeclarativestates::anchorChanges4() QDeclarativeAnchorChanges *aChanges = qobject_cast<QDeclarativeAnchorChanges*>(state->operationAt(0)); QVERIFY(aChanges != 0); - rect->setState("reanchored"); + QDeclarativeItemPrivate::get(rect)->setState("reanchored"); QCOMPARE(aChanges->object(), qobject_cast<QDeclarativeItem*>(innerRect)); - QCOMPARE(aChanges->object()->anchors()->horizontalCenter().item, bottomGuideline->horizontalCenter().item); - QCOMPARE(aChanges->object()->anchors()->horizontalCenter().anchorLine, bottomGuideline->horizontalCenter().anchorLine); - QCOMPARE(aChanges->object()->anchors()->verticalCenter().item, leftGuideline->verticalCenter().item); - QCOMPARE(aChanges->object()->anchors()->verticalCenter().anchorLine, leftGuideline->verticalCenter().anchorLine); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->horizontalCenter().item, QDeclarativeItemPrivate::get(bottomGuideline)->horizontalCenter().item); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->horizontalCenter().anchorLine, QDeclarativeItemPrivate::get(bottomGuideline)->horizontalCenter().anchorLine); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->verticalCenter().item, QDeclarativeItemPrivate::get(leftGuideline)->verticalCenter().item); + QCOMPARE(QDeclarativeItemPrivate::get(aChanges->object())->anchors()->verticalCenter().anchorLine, QDeclarativeItemPrivate::get(leftGuideline)->verticalCenter().anchorLine); delete rect; } @@ -707,7 +736,7 @@ void tst_qdeclarativestates::anchorChanges5() QDeclarativeAnchorChanges *aChanges = qobject_cast<QDeclarativeAnchorChanges*>(state->operationAt(0)); QVERIFY(aChanges != 0); - rect->setState("reanchored"); + QDeclarativeItemPrivate::get(rect)->setState("reanchored"); QCOMPARE(aChanges->object(), qobject_cast<QDeclarativeItem*>(innerRect)); //QCOMPARE(aChanges->anchors()->horizontalCenter().item, bottomGuideline->horizontalCenter().item); //QCOMPARE(aChanges->anchors()->horizontalCenter().anchorLine, bottomGuideline->horizontalCenter().anchorLine); @@ -726,7 +755,7 @@ void tst_qdeclarativestates::anchorChangesCrash() QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); QVERIFY(rect != 0); - rect->setState("reanchored"); + QDeclarativeItemPrivate::get(rect)->setState("reanchored"); delete rect; } @@ -739,13 +768,13 @@ void tst_qdeclarativestates::script() QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/script.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); QVERIFY(rect != 0); - + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QCOMPARE(rect->color(),QColor("red")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("blue")); // a script isn't reverted } } @@ -757,13 +786,13 @@ void tst_qdeclarativestates::restoreEntryValues() QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/restoreEntryValues.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); QVERIFY(rect != 0); - + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QCOMPARE(rect->color(),QColor("red")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("blue")); } @@ -774,7 +803,7 @@ void tst_qdeclarativestates::explicitChanges() QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/explicit.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); QVERIFY(rect != 0); - + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QDeclarativeListReference list(rect, "states"); QDeclarativeState *state = qobject_cast<QDeclarativeState*>(list.at(0)); QVERIFY(state != 0); @@ -786,18 +815,18 @@ void tst_qdeclarativestates::explicitChanges() QCOMPARE(rect->color(),QColor("red")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); rect->setProperty("sourceColor", QColor("green")); QCOMPARE(rect->color(),QColor("blue")); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("red")); rect->setProperty("sourceColor", QColor("yellow")); QCOMPARE(rect->color(),QColor("red")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("yellow")); } @@ -812,7 +841,7 @@ void tst_qdeclarativestates::propertyErrors() QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\""); QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/propertyErrors.qml") + ":8:9: QML PropertyChanges: Cannot assign to read-only property \"wantsFocus\""); - rect->setState("blue"); + QDeclarativeItemPrivate::get(rect)->setState("blue"); } void tst_qdeclarativestates::incorrectRestoreBug() @@ -822,22 +851,22 @@ void tst_qdeclarativestates::incorrectRestoreBug() QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); QVERIFY(rect != 0); - + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QCOMPARE(rect->color(),QColor("red")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("red")); // make sure if we change the base state value, we then restore to it correctly rect->setColor(QColor("green")); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("green")); } @@ -865,12 +894,12 @@ void tst_qdeclarativestates::deletingChange() QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/deleting.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); QVERIFY(rect != 0); - - rect->setState("blue"); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); QCOMPARE(rect->radius(),qreal(5)); - rect->setState(""); + rectPrivate->setState(""); QCOMPARE(rect->color(),QColor("red")); QCOMPARE(rect->radius(),qreal(0)); @@ -883,7 +912,7 @@ void tst_qdeclarativestates::deletingChange() qmlExecuteDeferred(state); QCOMPARE(state->operationCount(), 1); - rect->setState("blue"); + rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("red")); QCOMPARE(rect->radius(),qreal(5)); @@ -928,11 +957,11 @@ void tst_qdeclarativestates::tempState() QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/legalTempState.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); QVERIFY(rect != 0); - + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QTest::ignoreMessage(QtDebugMsg, "entering placed"); QTest::ignoreMessage(QtDebugMsg, "entering idle"); - rect->setState("placed"); - QCOMPARE(rect->state(), QLatin1String("idle")); + rectPrivate->setState("placed"); + QCOMPARE(rectPrivate->state(), QLatin1String("idle")); } void tst_qdeclarativestates::illegalTempState() @@ -942,10 +971,10 @@ void tst_qdeclarativestates::illegalTempState() QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/illegalTempState.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); QVERIFY(rect != 0); - + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML StateGroup: Can't apply a state change as part of a state definition."); - rect->setState("placed"); - QCOMPARE(rect->state(), QLatin1String("placed")); + rectPrivate->setState("placed"); + QCOMPARE(rectPrivate->state(), QLatin1String("placed")); } void tst_qdeclarativestates::nonExistantProperty() @@ -955,10 +984,10 @@ void tst_qdeclarativestates::nonExistantProperty() QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/nonExistantProp.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); QVERIFY(rect != 0); - + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); QTest::ignoreMessage(QtWarningMsg, fullDataPath("/data/nonExistantProp.qml") + ":9:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\""); - rect->setState("blue"); - QCOMPARE(rect->state(), QLatin1String("blue")); + rectPrivate->setState("blue"); + QCOMPARE(rectPrivate->state(), QLatin1String("blue")); } void tst_qdeclarativestates::reset() @@ -974,7 +1003,7 @@ void tst_qdeclarativestates::reset() QCOMPARE(text->width(), qreal(40.)); QVERIFY(text->width() < text->height()); - rect->setState("state1"); + QDeclarativeItemPrivate::get(rect)->setState("state1"); QVERIFY(text->width() > 41); QVERIFY(text->width() > text->height()); @@ -1000,19 +1029,20 @@ void tst_qdeclarativestates::whenOrdering() QDeclarativeComponent c(&engine, SRCDIR "/data/whenOrdering.qml"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); QVERIFY(rect != 0); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); - QCOMPARE(rect->state(), QLatin1String("")); + QCOMPARE(rectPrivate->state(), QLatin1String("")); rect->setProperty("condition2", true); - QCOMPARE(rect->state(), QLatin1String("state2")); + QCOMPARE(rectPrivate->state(), QLatin1String("state2")); rect->setProperty("condition1", true); - QCOMPARE(rect->state(), QLatin1String("state1")); + QCOMPARE(rectPrivate->state(), QLatin1String("state1")); rect->setProperty("condition2", false); - QCOMPARE(rect->state(), QLatin1String("state1")); + QCOMPARE(rectPrivate->state(), QLatin1String("state1")); rect->setProperty("condition2", true); - QCOMPARE(rect->state(), QLatin1String("state1")); + QCOMPARE(rectPrivate->state(), QLatin1String("state1")); rect->setProperty("condition1", false); rect->setProperty("condition2", false); - QCOMPARE(rect->state(), QLatin1String("")); + QCOMPARE(rectPrivate->state(), QLatin1String("")); } void tst_qdeclarativestates::urlResolution() @@ -1029,13 +1059,32 @@ void tst_qdeclarativestates::urlResolution() QDeclarativeImage *image3 = rect->findChild<QDeclarativeImage*>("image3"); QVERIFY(myType != 0 && image1 != 0 && image2 != 0 && image3 != 0); - myType->setState("SetImageState"); + QDeclarativeItemPrivate::get(myType)->setState("SetImageState"); QUrl resolved = QUrl::fromLocalFile(SRCDIR "/data/Implementation/images/qt-logo.png"); QCOMPARE(image1->source(), resolved); QCOMPARE(image2->source(), resolved); QCOMPARE(image3->source(), resolved); } +void tst_qdeclarativestates::unnamedWhen() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, SRCDIR "/data/unnamedWhen.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect != 0); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + + QCOMPARE(rectPrivate->state(), QLatin1String("")); + QCOMPARE(rect->property("stateString").toString(), QLatin1String("")); + rect->setProperty("triggerState", true); + QCOMPARE(rectPrivate->state(), QLatin1String("anonymousState1")); + QCOMPARE(rect->property("stateString").toString(), QLatin1String("inState")); + rect->setProperty("triggerState", false); + QCOMPARE(rectPrivate->state(), QLatin1String("")); + QCOMPARE(rect->property("stateString").toString(), QLatin1String("")); +} + QTEST_MAIN(tst_qdeclarativestates) #include "tst_qdeclarativestates.moc" diff --git a/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro b/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro index b2705fa..786bc1b 100644 --- a/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro +++ b/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro @@ -4,5 +4,12 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativesystempalette.cpp +# Define SRCDIR equal to test's source directory +symbian: { + DEFINES += SRCDIR=\".\" +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} + CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro b/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro index e70443e..51c7f43 100644 --- a/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro +++ b/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro @@ -9,7 +9,14 @@ INCLUDEPATH += ../shared/ HEADERS += ../shared/testhttpserver.h SOURCES += ../shared/testhttpserver.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativetextedit/data/geometrySignals.qml b/tests/auto/declarative/qdeclarativetextedit/data/geometrySignals.qml new file mode 100644 index 0000000..b39ba5b --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextedit/data/geometrySignals.qml @@ -0,0 +1,12 @@ +import Qt 4.7 + +Item { + width: 400; height: 500; + property int bindingWidth: text.width + property int bindingHeight: text.height + + TextInput { + id: text + anchors.fill: parent + } +} diff --git a/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro b/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro index 2228f11..2adb2b8 100644 --- a/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro +++ b/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro @@ -6,4 +6,11 @@ SOURCES += tst_qdeclarativetextedit.cpp ../shared/testhttpserver.cpp HEADERS += ../shared/testhttpserver.h # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 3307b7c..c65c883 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -84,7 +84,7 @@ private slots: void navigation(); void readOnly(); void sendRequestSoftwareInputPanelEvent(); - + void geometrySignals(); private: void simulateKey(QDeclarativeView *, int key); QDeclarativeView *createView(const QString &filename); @@ -202,7 +202,7 @@ void tst_qdeclarativetextedit::width() QFont f; QFontMetricsF fm(f); qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); - metricWidth = floor(metricWidth); + metricWidth = ceil(metricWidth); QString componentStr = "import Qt 4.7\nTextEdit { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); @@ -219,7 +219,7 @@ void tst_qdeclarativetextedit::width() document.setHtml(richText.at(i)); document.setDocumentMargin(0); - int documentWidth = document.idealWidth(); + int documentWidth = ceil(document.idealWidth()); QString componentStr = "import Qt 4.7\nTextEdit { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); @@ -793,8 +793,6 @@ void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent() view.viewport()->setInputContext(&ic); QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( view.style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); - if ((behavior != QStyle::RSIP_OnMouseClick)) - QSKIP("This test need to have a style with RSIP_OnMouseClick", SkipSingle); QDeclarativeTextEdit edit; edit.setText("Hello world"); edit.setPos(0, 0); @@ -806,8 +804,26 @@ void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent() QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); QApplication::processEvents(); - QCOMPARE(ic.softwareInputPanelEventReceived, true); + if (behavior == QStyle::RSIP_OnMouseClickAndAlreadyFocused) { + QCOMPARE(ic.softwareInputPanelEventReceived, false); + QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); + QApplication::processEvents(); + QCOMPARE(ic.softwareInputPanelEventReceived, true); + } else if (behavior == QStyle::RSIP_OnMouseClick) { + QCOMPARE(ic.softwareInputPanelEventReceived, true); + } +} + +void tst_qdeclarativetextedit::geometrySignals() +{ + QDeclarativeComponent component(&engine, SRCDIR "/data/geometrySignals.qml"); + QObject *o = component.create(); + QVERIFY(o); + QCOMPARE(o->property("bindingWidth").toInt(), 400); + QCOMPARE(o->property("bindingHeight").toInt(), 500); + delete o; } + QTEST_MAIN(tst_qdeclarativetextedit) #include "tst_qdeclarativetextedit.moc" diff --git a/tests/auto/declarative/qdeclarativetextinput/data/geometrySignals.qml b/tests/auto/declarative/qdeclarativetextinput/data/geometrySignals.qml new file mode 100644 index 0000000..a9b50fe --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextinput/data/geometrySignals.qml @@ -0,0 +1,12 @@ +import Qt 4.7 + +Item { + width: 400; height: 500; + property int bindingWidth: text.width + property int bindingHeight: text.height + + TextEdit { + id: text + anchors.fill: parent + } +} diff --git a/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro b/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro index 957e75c..2953567 100644 --- a/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro +++ b/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro @@ -5,5 +5,12 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativetextinput.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 83ebe6c..ac80edb 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -76,6 +76,7 @@ private slots: void focusOutClearSelection(); void echoMode(); + void geometrySignals(); private: void simulateKey(QDeclarativeView *, int key); QDeclarativeView *createView(const QString &filename); @@ -575,6 +576,14 @@ void tst_qdeclarativetextinput::navigation() simulateKey(canvas, Qt::Key_Left); QVERIFY(input->hasFocus() == true); + // Up and Down should NOT do Home/End, even on Mac OS X (QTBUG-10438). + input->setCursorPosition(2); + QCOMPARE(input->cursorPosition(),2); + simulateKey(canvas, Qt::Key_Up); + QCOMPARE(input->cursorPosition(),2); + simulateKey(canvas, Qt::Key_Down); + QCOMPARE(input->cursorPosition(),2); + delete canvas; } @@ -734,8 +743,6 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent() view.viewport()->setInputContext(&ic); QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( view.style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); - if ((behavior != QStyle::RSIP_OnMouseClick)) - QSKIP("This test need to have a style with RSIP_OnMouseClick", SkipSingle); QDeclarativeTextInput input; input.setText("Hello world"); input.setPos(0, 0); @@ -747,7 +754,14 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent() QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); QApplication::processEvents(); - QCOMPARE(ic.softwareInputPanelEventReceived, true); + if (behavior == QStyle::RSIP_OnMouseClickAndAlreadyFocused) { + QCOMPARE(ic.softwareInputPanelEventReceived, false); + QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); + QApplication::processEvents(); + QCOMPARE(ic.softwareInputPanelEventReceived, true); + } else if (behavior == QStyle::RSIP_OnMouseClick) { + QCOMPARE(ic.softwareInputPanelEventReceived, true); + } } class MyTextInput : public QDeclarativeTextInput @@ -805,6 +819,16 @@ void tst_qdeclarativetextinput::focusOutClearSelection() QTRY_COMPARE(input.selectedText(), QLatin1String("")); } +void tst_qdeclarativetextinput::geometrySignals() +{ + QDeclarativeComponent component(&engine, SRCDIR "/data/geometrySignals.qml"); + QObject *o = component.create(); + QVERIFY(o); + QCOMPARE(o->property("bindingWidth").toInt(), 400); + QCOMPARE(o->property("bindingHeight").toInt(), 500); + delete o; +} + QTEST_MAIN(tst_qdeclarativetextinput) #include "tst_qdeclarativetextinput.moc" diff --git a/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro b/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro index 42604d8..d95165c 100644 --- a/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro +++ b/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro @@ -4,6 +4,10 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativetimer.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/matrix4x4_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/matrix4x4_read.qml new file mode 100644 index 0000000..6c4a682 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/matrix4x4_read.qml @@ -0,0 +1,22 @@ +import Test 1.0 + +MyTypeObject { + property real v_m11: matrix.m11 + property real v_m12: matrix.m12 + property real v_m13: matrix.m13 + property real v_m14: matrix.m14 + property real v_m21: matrix.m21 + property real v_m22: matrix.m22 + property real v_m23: matrix.m23 + property real v_m24: matrix.m24 + property real v_m31: matrix.m31 + property real v_m32: matrix.m32 + property real v_m33: matrix.m33 + property real v_m34: matrix.m34 + property real v_m41: matrix.m41 + property real v_m42: matrix.m42 + property real v_m43: matrix.m43 + property real v_m44: matrix.m44 + property variant copy: matrix +} + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/matrix4x4_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/matrix4x4_write.qml new file mode 100644 index 0000000..2a9f154 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/matrix4x4_write.qml @@ -0,0 +1,21 @@ +import Test 1.0 + +MyTypeObject { + matrix.m11: if (true) 11 + matrix.m12: if (true) 12 + matrix.m13: if (true) 13 + matrix.m14: if (true) 14 + matrix.m21: if (true) 21 + matrix.m22: if (true) 22 + matrix.m23: if (true) 23 + matrix.m24: if (true) 24 + matrix.m31: if (true) 31 + matrix.m32: if (true) 32 + matrix.m33: if (true) 33 + matrix.m34: if (true) 34 + matrix.m41: if (true) 41 + matrix.m42: if (true) 42 + matrix.m43: if (true) 43 + matrix.m44: if (true) 44 +} + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/quaternion_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/quaternion_read.qml new file mode 100644 index 0000000..d1a21dc --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/quaternion_read.qml @@ -0,0 +1,10 @@ +import Test 1.0 + +MyTypeObject { + property real v_scalar: quaternion.scalar + property real v_x: quaternion.x + property real v_y: quaternion.y + property real v_z: quaternion.z + property variant copy: quaternion +} + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/quaternion_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/quaternion_write.qml new file mode 100644 index 0000000..0c3e5af --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/quaternion_write.qml @@ -0,0 +1,9 @@ +import Test 1.0 + +MyTypeObject { + quaternion.scalar: if (true) 88.5 + quaternion.x: if (true) -0.3 + quaternion.y: if (true) -12.9 + quaternion.z: if (true) 907.4 +} + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/varAssignment.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/varAssignment.qml new file mode 100644 index 0000000..e4715ab --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/varAssignment.qml @@ -0,0 +1,14 @@ +import Qt 4.7 + +QtObject { + property int x; + property int y; + property int z; + + Component.onCompleted: { + var vec3 = Qt.vector3d(1, 2, 3); + x = vec3.x; + y = vec3.y; + z = vec3.z; + } +} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/vector2d_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector2d_read.qml new file mode 100644 index 0000000..fc315f7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/vector2d_read.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + property real v_x: vector2.x + property real v_y: vector2.y + property variant copy: vector2 +} + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/vector2d_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector2d_write.qml new file mode 100644 index 0000000..f0e35ff --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/vector2d_write.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + vector2.x: if (true) -0.3 + vector2.y: if (true) -12.9 +} + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/vector4d_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector4d_read.qml new file mode 100644 index 0000000..f9d5d60 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/vector4d_read.qml @@ -0,0 +1,10 @@ +import Test 1.0 + +MyTypeObject { + property real v_x: vector4.x + property real v_y: vector4.y + property real v_z: vector4.z + property real v_w: vector4.w + property variant copy: vector4 +} + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/vector4d_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector4d_write.qml new file mode 100644 index 0000000..5486981 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/vector4d_write.qml @@ -0,0 +1,9 @@ +import Test 1.0 + +MyTypeObject { + vector4.x: if (true) -0.3 + vector4.y: if (true) -12.9 + vector4.z: if (true) 907.4 + vector4.w: if (true) 88.5 +} + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro index d9f1c13..02c480c 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro +++ b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro @@ -7,7 +7,14 @@ HEADERS += testtypes.h SOURCES += tst_qdeclarativevaluetypes.cpp \ testtypes.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h index 8a9b981..1da9990 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h +++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h @@ -48,7 +48,11 @@ #include <QSizeF> #include <QRect> #include <QRectF> +#include <QVector2D> #include <QVector3D> +#include <QVector4D> +#include <QQuaternion> +#include <QMatrix4x4> #include <QFont> #include <qdeclarative.h> #include <QDeclarativePropertyValueSource> @@ -66,7 +70,11 @@ class MyTypeObject : public QObject Q_PROPERTY(QSize sizereadonly READ size NOTIFY changed) Q_PROPERTY(QRect rect READ rect WRITE setRect NOTIFY changed) Q_PROPERTY(QRectF rectf READ rectf WRITE setRectf NOTIFY changed) + Q_PROPERTY(QVector2D vector2 READ vector2 WRITE setVector2 NOTIFY changed) Q_PROPERTY(QVector3D vector READ vector WRITE setVector NOTIFY changed) + Q_PROPERTY(QVector4D vector4 READ vector4 WRITE setVector4 NOTIFY changed) + Q_PROPERTY(QQuaternion quaternion READ quaternion WRITE setQuaternion NOTIFY changed) + Q_PROPERTY(QMatrix4x4 matrix READ matrix WRITE setMatrix NOTIFY changed) Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY changed) public: @@ -77,7 +85,11 @@ public: m_sizef(0.1, 100923.2), m_rect(2, 3, 109, 102), m_rectf(103.8, 99.2, 88.1, 77.6), - m_vector(23.88, 3.1, 4.3) + m_vector2(32.88, 1.3), + m_vector(23.88, 3.1, 4.3), + m_vector4(54.2, 23.88, 3.1, 4.3), + m_quaternion(4.3, 54.2, 23.88, 3.1), + m_matrix(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) { m_font.setFamily("Arial"); m_font.setBold(true); @@ -116,10 +128,26 @@ public: QRectF rectf() const { return m_rectf; } void setRectf(const QRectF &v) { m_rectf = v; emit changed(); } + QVector2D m_vector2; + QVector2D vector2() const { return m_vector2; } + void setVector2(const QVector2D &v) { m_vector2 = v; emit changed(); } + QVector3D m_vector; QVector3D vector() const { return m_vector; } void setVector(const QVector3D &v) { m_vector = v; emit changed(); } + QVector4D m_vector4; + QVector4D vector4() const { return m_vector4; } + void setVector4(const QVector4D &v) { m_vector4 = v; emit changed(); } + + QQuaternion m_quaternion; + QQuaternion quaternion() const { return m_quaternion; } + void setQuaternion(const QQuaternion &v) { m_quaternion = v; emit changed(); } + + QMatrix4x4 m_matrix; + QMatrix4x4 matrix() const { return m_matrix; } + void setMatrix(const QMatrix4x4 &v) { m_matrix = v; emit changed(); } + QFont m_font; QFont font() const { return m_font; } void setFont(const QFont &v) { m_font = v; emit changed(); } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp index b733b10..95b9baa 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -62,7 +62,11 @@ private slots: void sizereadonly(); void rect(); void rectf(); + void vector2d(); void vector3d(); + void vector4d(); + void quaternion(); + void matrix4x4(); void font(); void bindingAssignment(); @@ -80,6 +84,7 @@ private slots: void enums(); void conflictingBindings(); void returnValues(); + void varAssignment(); private: QDeclarativeEngine engine; @@ -293,6 +298,31 @@ void tst_qdeclarativevaluetypes::rectf() } } +void tst_qdeclarativevaluetypes::vector2d() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("vector2d_read.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE((float)object->property("v_x").toDouble(), (float)32.88); + QCOMPARE((float)object->property("v_y").toDouble(), (float)1.3); + QCOMPARE(object->property("copy"), QVariant(QVector2D(32.88, 1.3))); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("vector2d_write.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->vector2(), QVector2D(-0.3, -12.9)); + + delete object; + } +} + void tst_qdeclarativevaluetypes::vector3d() { { @@ -319,6 +349,106 @@ void tst_qdeclarativevaluetypes::vector3d() } } +void tst_qdeclarativevaluetypes::vector4d() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("vector4d_read.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE((float)object->property("v_x").toDouble(), (float)54.2); + QCOMPARE((float)object->property("v_y").toDouble(), (float)23.88); + QCOMPARE((float)object->property("v_z").toDouble(), (float)3.1); + QCOMPARE((float)object->property("v_w").toDouble(), (float)4.3); + QCOMPARE(object->property("copy"), QVariant(QVector4D(54.2, 23.88, 3.1, 4.3))); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("vector4d_write.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->vector4(), QVector4D(-0.3, -12.9, 907.4, 88.5)); + + delete object; + } +} + +void tst_qdeclarativevaluetypes::quaternion() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("quaternion_read.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE((float)object->property("v_scalar").toDouble(), (float)4.3); + QCOMPARE((float)object->property("v_x").toDouble(), (float)54.2); + QCOMPARE((float)object->property("v_y").toDouble(), (float)23.88); + QCOMPARE((float)object->property("v_z").toDouble(), (float)3.1); + QCOMPARE(object->property("copy"), QVariant(QQuaternion(4.3, 54.2, 23.88, 3.1))); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("quaternion_write.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->quaternion(), QQuaternion(88.5, -0.3, -12.9, 907.4)); + + delete object; + } +} + +void tst_qdeclarativevaluetypes::matrix4x4() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("matrix4x4_read.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE((float)object->property("v_m11").toDouble(), (float)1); + QCOMPARE((float)object->property("v_m12").toDouble(), (float)2); + QCOMPARE((float)object->property("v_m13").toDouble(), (float)3); + QCOMPARE((float)object->property("v_m14").toDouble(), (float)4); + QCOMPARE((float)object->property("v_m21").toDouble(), (float)5); + QCOMPARE((float)object->property("v_m22").toDouble(), (float)6); + QCOMPARE((float)object->property("v_m23").toDouble(), (float)7); + QCOMPARE((float)object->property("v_m24").toDouble(), (float)8); + QCOMPARE((float)object->property("v_m31").toDouble(), (float)9); + QCOMPARE((float)object->property("v_m32").toDouble(), (float)10); + QCOMPARE((float)object->property("v_m33").toDouble(), (float)11); + QCOMPARE((float)object->property("v_m34").toDouble(), (float)12); + QCOMPARE((float)object->property("v_m41").toDouble(), (float)13); + QCOMPARE((float)object->property("v_m42").toDouble(), (float)14); + QCOMPARE((float)object->property("v_m43").toDouble(), (float)15); + QCOMPARE((float)object->property("v_m44").toDouble(), (float)16); + QCOMPARE(object->property("copy"), + QVariant(QMatrix4x4(1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16))); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("matrix4x4_write.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->matrix(), QMatrix4x4(11, 12, 13, 14, + 21, 22, 23, 24, + 31, 32, 33, 34, + 41, 42, 43, 44)); + + delete object; + } +} + void tst_qdeclarativevaluetypes::font() { { @@ -665,7 +795,12 @@ void tst_qdeclarativevaluetypes::cppClasses() CPP_TEST(QDeclarativeSizeFValueType, QSizeF(-100.7, 18.2)); CPP_TEST(QDeclarativeRectValueType, QRect(13, 39, 10928, 88)); CPP_TEST(QDeclarativeRectFValueType, QRectF(88.2, -90.1, 103.2, 118)); + CPP_TEST(QDeclarativeVector2DValueType, QVector2D(19.7, 1002)); CPP_TEST(QDeclarativeVector3DValueType, QVector3D(18.2, 19.7, 1002)); + CPP_TEST(QDeclarativeVector4DValueType, QVector4D(18.2, 19.7, 1002, 54)); + CPP_TEST(QDeclarativeQuaternionValueType, QQuaternion(18.2, 19.7, 1002, 54)); + CPP_TEST(QDeclarativeMatrix4x4ValueType, + QMatrix4x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); CPP_TEST(QDeclarativeFontValueType, QFont("Helvetica")); } @@ -777,6 +912,19 @@ void tst_qdeclarativevaluetypes::returnValues() delete object; } +void tst_qdeclarativevaluetypes::varAssignment() +{ + QDeclarativeComponent component(&engine, TEST_FILE("varAssignment.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("x").toInt(), 1); + QCOMPARE(object->property("y").toInt(), 2); + QCOMPARE(object->property("z").toInt(), 3); + + delete object; +} + QTEST_MAIN(tst_qdeclarativevaluetypes) #include "tst_qdeclarativevaluetypes.moc" diff --git a/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro b/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro index d6be728..ad54713 100644 --- a/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro +++ b/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro @@ -4,4 +4,11 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeview.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} diff --git a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp index 1ed51c1..dd2f46e 100644 --- a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp +++ b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp @@ -147,7 +147,7 @@ void tst_QDeclarativeView::resizemodedeclarativeitem() declarativeItem->setHeight(80); QCOMPARE(canvas->width(), 80); QCOMPARE(canvas->height(), 100); - QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(QSize(declarativeItem->width(), declarativeItem->height()), canvas->sizeHint()); QCOMPARE(sceneResizedSpy2.count(), 2); // size update from view @@ -230,7 +230,7 @@ void tst_QDeclarativeView::resizemodegraphicswidget() canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView); graphicsWidget->resize(QSizeF(60,80)); QCOMPARE(canvas->size(), QSize(80,100)); - QCOMPARE(canvas->size(), canvas->sizeHint()); + QCOMPARE(QSize(graphicsWidget->size().width(), graphicsWidget->size().height()), canvas->sizeHint()); QCOMPARE(sceneResizedSpy2.count(), 2); // size update from view diff --git a/tests/auto/declarative/qdeclarativeviewer/data/orientation.qml b/tests/auto/declarative/qdeclarativeviewer/data/orientation.qml new file mode 100644 index 0000000..687fac6 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeviewer/data/orientation.qml @@ -0,0 +1,10 @@ +import Qt 4.7 +Rectangle { + color: "black" + width: (runtime.orientation == Orientation.Landscape) ? 300 : 200 + height: (runtime.orientation == Orientation.Landscape) ? 200 : 300 + Text { + text: runtime.orientation == Orientation.Landscape ? "Landscape" : "Portrait" + color: "white" + } +}
\ No newline at end of file diff --git a/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro b/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro new file mode 100644 index 0000000..9bb6161 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeviewer/qdeclarativeviewer.pro @@ -0,0 +1,18 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +include(../../../../tools/qml/qml.pri) + +SOURCES += tst_qdeclarativeviewer.cpp + +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} + +CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp b/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp new file mode 100644 index 0000000..9429dc9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeviewer/tst_qdeclarativeviewer.cpp @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <qtest.h> +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativeview.h> +#include <QtDeclarative/qdeclarativeitem.h> +#include "qmlruntime.h" + +class tst_QDeclarativeViewer : public QObject + +{ + Q_OBJECT +public: + tst_QDeclarativeViewer(); + +private slots: + void orientation(); + +private: + QDeclarativeEngine engine; +}; + +tst_QDeclarativeViewer::tst_QDeclarativeViewer() +{ +} + +void tst_QDeclarativeViewer::orientation() +{ + QWidget window; + QDeclarativeViewer *viewer = new QDeclarativeViewer(&window); + QVERIFY(viewer); + viewer->open(SRCDIR "/data/orientation.qml"); + QVERIFY(viewer->view()); + QVERIFY(viewer->menuBar()); + QDeclarativeItem* rootItem = qobject_cast<QDeclarativeItem*>(viewer->view()->rootObject()); + QVERIFY(rootItem); + window.show(); + + QCOMPARE(rootItem->width(), 200.0); + QCOMPARE(rootItem->height(), 300.0); + QCOMPARE(viewer->view()->size(), QSize(200, 300)); + QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(200, 300)); + QCOMPARE(viewer->size(), QSize(200, 300+viewer->menuBar()->height())); + QCOMPARE(viewer->size(), viewer->sizeHint()); + + viewer->toggleOrientation(); + qApp->processEvents(); + + QCOMPARE(rootItem->width(), 300.0); + QCOMPARE(rootItem->height(), 200.0); + QCOMPARE(viewer->view()->size(), QSize(300, 200)); + QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(300, 200)); + QCOMPARE(viewer->size(), QSize(300, 200+viewer->menuBar()->height())); + QCOMPARE(viewer->size(), viewer->sizeHint()); + + viewer->toggleOrientation(); + qApp->processEvents(); + + QCOMPARE(rootItem->width(), 200.0); + QCOMPARE(rootItem->height(), 300.0); + QCOMPARE(viewer->view()->size(), QSize(200, 300)); + QCOMPARE(viewer->view()->sceneRect().size(), QSizeF(200, 300)); + QCOMPARE(viewer->size(), QSize(200, 300+viewer->menuBar()->height())); + QCOMPARE(viewer->size(), viewer->sizeHint()); +} + +QTEST_MAIN(tst_QDeclarativeViewer) + +#include "tst_qdeclarativeviewer.moc" diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/data/objectlist.qml b/tests/auto/declarative/qdeclarativevisualdatamodel/data/objectlist.qml new file mode 100644 index 0000000..f5198c9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/data/objectlist.qml @@ -0,0 +1,16 @@ +import Qt 4.7 + +ListView { + width: 100 + height: 100 + anchors.fill: parent + model: myModel + delegate: Component { + Rectangle { + height: 25 + width: 100 + color: model.modelData.color + Text { objectName: "name"; text: name } + } + } +} diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro b/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro index d76b582..c87171b 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/qdeclarativevisualdatamodel.pro @@ -4,8 +4,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativevisualdatamodel.cpp -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp index 7de15a3..c238ef9 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp @@ -44,6 +44,10 @@ #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativecomponent.h> #include <QtDeclarative/qdeclarativecontext.h> +#include <QtDeclarative/qdeclarativeexpression.h> +#include <QtDeclarative/qdeclarativeview.h> +#include <private/qdeclarativelistview_p.h> +#include <private/qdeclarativetext_p.h> #include <private/qdeclarativevisualitemmodel_p.h> #include <private/qdeclarativevaluetype_p.h> #include <math.h> @@ -74,9 +78,50 @@ public: private slots: void rootIndex(); + void objectListModel(); private: QDeclarativeEngine engine; + template<typename T> + T *findItem(QGraphicsObject *parent, const QString &objectName, int index); +}; + +class DataObject : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + Q_PROPERTY(QString color READ color WRITE setColor NOTIFY colorChanged) + +public: + DataObject(QObject *parent=0) : QObject(parent) {} + DataObject(const QString &name, const QString &color, QObject *parent=0) + : QObject(parent), m_name(name), m_color(color) { } + + + QString name() const { return m_name; } + void setName(const QString &name) { + if (name != m_name) { + m_name = name; + emit nameChanged(); + } + } + + QString color() const { return m_color; } + void setColor(const QString &color) { + if (color != m_color) { + m_color = color; + emit colorChanged(); + } + } + +signals: + void nameChanged(); + void colorChanged(); + +private: + QString m_name; + QString m_color; }; tst_qdeclarativevisualdatamodel::tst_qdeclarativevisualdatamodel() @@ -105,6 +150,60 @@ void tst_qdeclarativevisualdatamodel::rootIndex() delete obj; } +void tst_qdeclarativevisualdatamodel::objectListModel() +{ + QDeclarativeView view; + + QList<QObject*> dataList; + dataList.append(new DataObject("Item 1", "red")); + dataList.append(new DataObject("Item 2", "green")); + dataList.append(new DataObject("Item 3", "blue")); + dataList.append(new DataObject("Item 4", "yellow")); + + QDeclarativeContext *ctxt = view.rootContext(); + ctxt->setContextProperty("myModel", QVariant::fromValue(dataList)); + + view.setSource(QUrl::fromLocalFile(SRCDIR "/data/objectlist.qml")); + + QDeclarativeListView *listview = qobject_cast<QDeclarativeListView*>(view.rootObject()); + QVERIFY(listview != 0); + + QDeclarativeItem *viewport = listview->viewport(); + QVERIFY(viewport != 0); + + QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "name", 0); + QCOMPARE(name->text(), QString("Item 1")); + + dataList[0]->setProperty("name", QLatin1String("Changed")); + QCOMPARE(name->text(), QString("Changed")); +} + +template<typename T> +T *tst_qdeclarativevisualdatamodel::findItem(QGraphicsObject *parent, const QString &objectName, int index) +{ + const QMetaObject &mo = T::staticMetaObject; + //qDebug() << parent->childItems().count() << "children"; + for (int i = 0; i < parent->childItems().count(); ++i) { + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(parent->childItems().at(i)); + if(!item) + continue; + //qDebug() << "try" << item; + if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { + if (index != -1) { + QDeclarativeExpression e(qmlContext(item), "index", item); + if (e.evaluate().toInt() == index) + return static_cast<T*>(item); + } else { + return static_cast<T*>(item); + } + } + item = findItem<T>(item, objectName, index); + if (item) + return static_cast<T*>(item); + } + + return 0; +} QTEST_MAIN(tst_qdeclarativevisualdatamodel) diff --git a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro index 956272f..8caa393 100644 --- a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro +++ b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro @@ -6,6 +6,13 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativewebview.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro index 2e3da4d..36b3449 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro +++ b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro @@ -5,7 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeworkerscript.cpp # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro index 160300e..b54f670 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro @@ -8,9 +8,15 @@ HEADERS += ../shared/testhttpserver.h SOURCES += tst_qdeclarativexmlhttprequest.cpp \ ../shared/testhttpserver.cpp - # Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro index 8c5052a..1bf1c58 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro +++ b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro @@ -8,7 +8,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativexmllistmodel.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian: { + DEFINES += SRCDIR=\".\" + importFiles.sources = data + importFiles.path = + DEPLOYMENT = importFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} CONFIG += parallel_test diff --git a/tests/auto/declarative/qmlvisual/animation/pauseAnimation/pauseAnimation-visual.qml b/tests/auto/declarative/qmlvisual/animation/pauseAnimation/pauseAnimation-visual.qml index d82c6df..cc9a639 100644 --- a/tests/auto/declarative/qmlvisual/animation/pauseAnimation/pauseAnimation-visual.qml +++ b/tests/auto/declarative/qmlvisual/animation/pauseAnimation/pauseAnimation-visual.qml @@ -16,7 +16,7 @@ Rectangle { id: img source: "pics/qtlogo.png" x: 60-width/2 - y: 100 + y: 200-img.height SequentialAnimation on y { loops: Animation.Infinite NumberAnimation { @@ -24,7 +24,7 @@ Rectangle { easing.type: "InOutQuad" } NumberAnimation { - to: 100 + to: 200-img.height easing.type: "OutBounce" duration: 2000 } diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.0.png b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.0.png Binary files differnew file mode 100644 index 0000000..d8be67b --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.0.png diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.1.png b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.1.png Binary files differnew file mode 100644 index 0000000..249e0dd --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.1.png diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.2.png b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.2.png Binary files differnew file mode 100644 index 0000000..044f823 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.2.png diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.3.png b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.3.png Binary files differnew file mode 100644 index 0000000..d8be67b --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.3.png diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.qml b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.qml new file mode 100644 index 0000000..dc8e2e2 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/qtbug10586/data/qtbug10586.qml @@ -0,0 +1,1151 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 32 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 48 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 64 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 80 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 96 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 112 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 128 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 144 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 160 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 176 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 192 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 208 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 224 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 240 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 256 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 272 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 288 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 304 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 320 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 336 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 352 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 368 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 384 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 400 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 416 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 432 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 448 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 464 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 480 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 496 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 512 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 528 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 544 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 560 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 576 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 592 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 608 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 624 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 640 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 656 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 672 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 688 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 704 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 720 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 736 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 752 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 768 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 784 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 800 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 816 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 832 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 848 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 864 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 880 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 896 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 912 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 928 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 944 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 960 + image: "qtbug10586.0.png" + } + Frame { + msec: 976 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 992 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1008 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1024 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1040 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1056 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1072 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1088 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1104 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1120 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1136 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1152 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1168 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1184 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1200 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1216 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1232 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1248 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1264 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1280 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1296 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1312 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 174; y: 204 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1328 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1344 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1360 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1376 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1392 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 170; y: 204 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1408 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 156; y: 204 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1424 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 1440 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 130; y: 204 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 130; y: 204 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1456 + hash: "8b7dd0f0a3881f10d76b47cbec4754c3" + } + Frame { + msec: 1472 + hash: "b6fc4990acb245e015c35261a3c6fd75" + } + Frame { + msec: 1488 + hash: "849fa4174134804dadc000323141b341" + } + Frame { + msec: 1504 + hash: "35f2d6405ed7d992bb62eb6e24478492" + } + Frame { + msec: 1520 + hash: "673ebb4499522c3f27b775dff1dbbe44" + } + Frame { + msec: 1536 + hash: "96945f5489ffd0dc8ab995c96eb5da43" + } + Frame { + msec: 1552 + hash: "2e4543754429ac3db831a2432098c063" + } + Frame { + msec: 1568 + hash: "02253fe8a9fd5009a07265c2c6ffc8e4" + } + Frame { + msec: 1584 + hash: "200a89949df1e9ef58d005a139857d2c" + } + Frame { + msec: 1600 + hash: "ceb28be34c7ea8eff5fa00fdea087439" + } + Frame { + msec: 1616 + hash: "a9ece475c51f126094c5eff4e20f4a19" + } + Frame { + msec: 1632 + hash: "aa0776f84aef87d6971affdfa2d8dd82" + } + Frame { + msec: 1648 + hash: "4c74661e1c73fefc9c5154b257239352" + } + Frame { + msec: 1664 + hash: "c10d23df3a75966aad5016bd8ba8e9d8" + } + Frame { + msec: 1680 + hash: "41692977d654a55d3b1d037aea9f2c03" + } + Frame { + msec: 1696 + hash: "2f1835a1de94f962eb5dc781c85b4c32" + } + Frame { + msec: 1712 + hash: "7cb78e2e5f6d35d456c95f2bd8652eb5" + } + Frame { + msec: 1728 + hash: "4388aee9b1c8b4fde43634ad08f03557" + } + Frame { + msec: 1744 + hash: "1cdc71100fd11cb6e60c9ab7e65e95bf" + } + Frame { + msec: 1760 + hash: "feddbf269adfc8bb1b1a3656b5b5736d" + } + Frame { + msec: 1776 + hash: "76b39ce0ee9b9b4af8aa0141577b8460" + } + Frame { + msec: 1792 + hash: "bac963d3df2841ab7a3770a371f3a94d" + } + Frame { + msec: 1808 + hash: "403007bb6c0782fece1cedbd40994550" + } + Frame { + msec: 1824 + hash: "72076c743fdd33fab2ac789c7c22973a" + } + Frame { + msec: 1840 + hash: "662be553c32b0145b3f4fee9bb0d659d" + } + Frame { + msec: 1856 + hash: "e6b9049949a0ee4ff8a0fcaf5464f479" + } + Frame { + msec: 1872 + hash: "eb1939458851780b7bb51ee50f0a3bd7" + } + Frame { + msec: 1888 + hash: "41c8d2686ddb882981a7d3a5c8c69005" + } + Frame { + msec: 1904 + hash: "7d3b1fc34082a160cbea4409af85fc9c" + } + Frame { + msec: 1920 + image: "qtbug10586.1.png" + } + Frame { + msec: 1936 + hash: "17be4a9c3d4d19e93bf1fc3a13a374a2" + } + Frame { + msec: 1952 + hash: "d449593024a59487eb92195ee6b77a64" + } + Frame { + msec: 1968 + hash: "c6ccbc2acec8e32f043f2cfb7b7848a9" + } + Frame { + msec: 1984 + hash: "cef9f8e8cdd5e2d33b86a9a6fb64ecb4" + } + Frame { + msec: 2000 + hash: "2a8956de5ce417431bdb156144985370" + } + Frame { + msec: 2016 + hash: "73721425a9c658bd9d40eac3fcbe8e25" + } + Frame { + msec: 2032 + hash: "9a9cf8eee0bf2f09944a4fb3b1c139d5" + } + Frame { + msec: 2048 + hash: "3673cdee04343ce679ec2cebadc9f512" + } + Frame { + msec: 2064 + hash: "eedd62019867e3189f9cf6e2b4149c6d" + } + Frame { + msec: 2080 + hash: "7a66bc37f5cf917e8b121003af0530b0" + } + Frame { + msec: 2096 + hash: "401667ed0f38858553de27164e9cadb5" + } + Frame { + msec: 2112 + hash: "b391699437c4092de3ad1684a35bfd30" + } + Frame { + msec: 2128 + hash: "109c91215f075292910095a25eaded49" + } + Frame { + msec: 2144 + hash: "c44d3f6ce1fa1ab324dd9ef394f37f87" + } + Frame { + msec: 2160 + hash: "299d43cb3dcf7b95af8803df3eb17a46" + } + Frame { + msec: 2176 + hash: "7ddd97266383d954a008fbe7b95a3169" + } + Frame { + msec: 2192 + hash: "941f2837ff5145a26df9a0d9f6d20bd9" + } + Frame { + msec: 2208 + hash: "d99d76cba43f3ae953605d7732d6ce21" + } + Frame { + msec: 2224 + hash: "929f49416f7ca80d7f5f2be3b13b849e" + } + Frame { + msec: 2240 + hash: "929f49416f7ca80d7f5f2be3b13b849e" + } + Frame { + msec: 2256 + hash: "fff9bbf16d1c3f7510ddfc44af616a5e" + } + Frame { + msec: 2272 + hash: "70b6cdb95ad6723d18c623e1dc79a8db" + } + Frame { + msec: 2288 + hash: "70b6cdb95ad6723d18c623e1dc79a8db" + } + Frame { + msec: 2304 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2320 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2336 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2352 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2368 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2384 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2400 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2416 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2432 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2448 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2464 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2480 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2496 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2512 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2528 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2544 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2560 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2576 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2592 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2608 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2624 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2640 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2656 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2672 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2688 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2704 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2720 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2736 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 29; y: 239 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2752 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2768 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2784 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2800 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Frame { + msec: 2816 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 35; y: 241 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2832 + hash: "cdb3c12b1b0b6ab269ba7fcf75320f69" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 63; y: 243 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2848 + hash: "2732b282b8ac482033694cd04c6f5b7e" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 106; y: 244 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2864 + hash: "7d253797885f8b304d8fb3ba727a3c5d" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 158; y: 243 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 158; y: 243 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 2880 + image: "qtbug10586.2.png" + } + Frame { + msec: 2896 + hash: "d85a416e4ddf59dfd0723b0be0e2b418" + } + Frame { + msec: 2912 + hash: "f1934f6ca6a3c5ac5df3451596b8d8ba" + } + Frame { + msec: 2928 + hash: "28fc74a76f9eaeeccbd3063dc55a1000" + } + Frame { + msec: 2944 + hash: "eb8ad8dae734b624664fcf584cda6ba0" + } + Frame { + msec: 2960 + hash: "a6d0f4aba3e5ae1e003520f45b75d6dd" + } + Frame { + msec: 2976 + hash: "4e5a4d04dfa5f06292774e6bf4f86508" + } + Frame { + msec: 2992 + hash: "fc9e16fd8c7379d774a09fe50d4259dc" + } + Frame { + msec: 3008 + hash: "721ea322d9a5e9d48117336476f568cb" + } + Frame { + msec: 3024 + hash: "5930448341bce1c50de7acaba1f64ca1" + } + Frame { + msec: 3040 + hash: "7194bacd56906f83948844224ce6a3e7" + } + Frame { + msec: 3056 + hash: "fcf11cf70b8ac210d4bb2bc716942053" + } + Frame { + msec: 3072 + hash: "767d707db4dbb02b6f97153b3822a1d1" + } + Frame { + msec: 3088 + hash: "f8eb75b97f5233aa82b887aab34a38e3" + } + Frame { + msec: 3104 + hash: "1d3beb06b39fa1d5cabd31ec4297f59f" + } + Frame { + msec: 3120 + hash: "cadc775e0764afa7b50c5bab782035dd" + } + Frame { + msec: 3136 + hash: "385f5a6e80da0d3ddf24539a64f26eb9" + } + Frame { + msec: 3152 + hash: "34204871a684ea251c9d07fb125436da" + } + Frame { + msec: 3168 + hash: "bc3e496535e66ff0d1e800092b7c78ca" + } + Frame { + msec: 3184 + hash: "d6c4ff5bf223361be42c78d6d81248c3" + } + Frame { + msec: 3200 + hash: "cb09d41612df66a8d099153026adcbf3" + } + Frame { + msec: 3216 + hash: "f82180b8c0389ddc3623107a049c3366" + } + Frame { + msec: 3232 + hash: "1b0f65e4599c65b8a603abd8da718d48" + } + Frame { + msec: 3248 + hash: "897391a8206178356858139b3d1a4ce8" + } + Frame { + msec: 3264 + hash: "b66d268dc7a42a7b1172b1ff566f4eb8" + } + Frame { + msec: 3280 + hash: "0fe5d38a253dbd1ebcc67cca7ea86dc7" + } + Frame { + msec: 3296 + hash: "b788f8a7e1e42f768fd1fe1198ca0344" + } + Frame { + msec: 3312 + hash: "4f7f8b7f5bb78bb9327b6fa8142ce3a2" + } + Frame { + msec: 3328 + hash: "30f041278c08174671568a0dfb7cbdf7" + } + Frame { + msec: 3344 + hash: "6ecd90fc89ab9b6c4813fa6a6e9dffdb" + } + Frame { + msec: 3360 + hash: "6ecd90fc89ab9b6c4813fa6a6e9dffdb" + } + Frame { + msec: 3376 + hash: "6d79d9d0ba8da0b5654b39768b25591f" + } + Frame { + msec: 3392 + hash: "6d79d9d0ba8da0b5654b39768b25591f" + } + Frame { + msec: 3408 + hash: "6d79d9d0ba8da0b5654b39768b25591f" + } + Frame { + msec: 3424 + hash: "6d79d9d0ba8da0b5654b39768b25591f" + } + Frame { + msec: 3440 + hash: "6d79d9d0ba8da0b5654b39768b25591f" + } + Frame { + msec: 3456 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3472 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3488 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3504 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3520 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3536 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3552 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3568 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3584 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3600 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3616 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3632 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3648 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3664 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3680 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3696 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3712 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3728 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3744 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3760 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3776 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3792 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3808 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3824 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3840 + image: "qtbug10586.3.png" + } + Frame { + msec: 3856 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3872 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3888 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3904 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3920 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3936 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3952 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3968 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 3984 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4000 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4016 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4032 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4048 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4064 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Key { + type: 6 + key: 16777249 + modifiers: 67108864 + text: "" + autorep: false + count: 1 + } + Frame { + msec: 4080 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4096 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4112 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4128 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4144 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4160 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4176 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } + Frame { + msec: 4192 + hash: "cba9afe3f351e6cd6dc72d7f263401b0" + } +} diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug10586/qtbug10586.qml b/tests/auto/declarative/qmlvisual/animation/qtbug10586/qtbug10586.qml new file mode 100644 index 0000000..f1a3ef7 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/qtbug10586/qtbug10586.qml @@ -0,0 +1,27 @@ +import Qt 4.7 + +Rectangle { + width: 200 + height: 400 + Flickable { + id: flick + anchors.fill: parent + contentWidth: 1000; contentHeight: parent.height + Rectangle { + border.color: "black" + border.width: 10 + width: 1000; height: 1000 + rotation: 90 + gradient: Gradient { + GradientStop { position: 0; color: "black" } + GradientStop { position: 1; color: "white" } + } + } + } + Rectangle { + color: "red" + width: 100; height: 100 + y: flick.contentX < 10 ? 300 : 0 + Behavior on y { NumberAnimation {} } + } +} diff --git a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/mousearea-flickable.qml b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/mousearea-flickable.qml index a0b787f..e223f5e 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativemousearea/mousearea-flickable.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativemousearea/mousearea-flickable.qml @@ -25,7 +25,7 @@ Rectangle { MouseArea { anchors.fill: parent onPressed: blue.color = "lightsteelblue" - onReleased: blue.color = "steelblue" + onCanceled: blue.color = "steelblue" } } Rectangle { @@ -36,7 +36,7 @@ Rectangle { MouseArea { anchors.fill: parent onEntered: { red.color = "darkred"; tooltip.opacity = 1 } - onExited: { red.color = "red"; tooltip.opacity = 0 } + onCanceled: { red.color = "red"; tooltip.opacity = 0 } } Rectangle { id: tooltip diff --git a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data-X11/autosize.0.png b/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data-X11/autosize.0.png Binary files differdeleted file mode 100644 index 1f28b9a..0000000 --- a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data-X11/autosize.0.png +++ /dev/null diff --git a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data-X11/autosize.qml b/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data-X11/autosize.qml deleted file mode 100644 index f4c4e29..0000000 --- a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data-X11/autosize.qml +++ /dev/null @@ -1,83 +0,0 @@ -import Qt.VisualTest 4.7 - -VisualTest { - Frame { - msec: 0 - } - Frame { - msec: 16 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 32 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 48 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 64 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 80 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 96 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 112 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 128 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 144 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 160 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 176 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 192 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 208 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 224 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 240 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 256 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 272 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 288 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } - Frame { - msec: 304 - hash: "0c70d855adc847fe33d7959ccb98bb8b" - } -} diff --git a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data/autosize.0.png b/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data/autosize.0.png Binary files differdeleted file mode 100644 index 1f28b9a..0000000 --- a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data/autosize.0.png +++ /dev/null diff --git a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data/autosize.qml b/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data/autosize.qml deleted file mode 100644 index 273c2b0..0000000 --- a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/data/autosize.qml +++ /dev/null @@ -1,83 +0,0 @@ -import Qt.VisualTest 4.7 - -VisualTest { - Frame { - msec: 0 - } - Frame { - msec: 16 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 32 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 48 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 64 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 80 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 96 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 112 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 128 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 144 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 160 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 176 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 192 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 208 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 224 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 240 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 256 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 272 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 288 - hash: "66539e1b1983d95386b0d30d6e969904" - } - Frame { - msec: 304 - hash: "66539e1b1983d95386b0d30d6e969904" - } -} diff --git a/tests/auto/declarative/qmlvisual/qmlvisual.pro b/tests/auto/declarative/qmlvisual/qmlvisual.pro index a3abbe3..dca9b04 100644 --- a/tests/auto/declarative/qmlvisual/qmlvisual.pro +++ b/tests/auto/declarative/qmlvisual/qmlvisual.pro @@ -4,7 +4,34 @@ macx:CONFIG -= app_bundle SOURCES += tst_qmlvisual.cpp -DEFINES += QT_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\" +symbian: { + importFiles.path = + importFiles.sources = animation \ + fillmode \ + focusscope \ + ListView \ + qdeclarativeborderimage \ + qdeclarativeflickable \ + qdeclarativeflipable \ + qdeclarativegridview \ + qdeclarativemousearea \ + qdeclarativeparticles \ + qdeclarativepathview \ + qdeclarativepositioners \ + qdeclarativesmoothedanimation \ + qdeclarativespringfollow \ + qdeclarativetext \ + qdeclarativetextedit \ + qdeclarativetextinput \ + rect \ + repeater \ + selftest_noimages \ + webview + DEPLOYMENT = importFiles + + DEFINES += QT_TEST_SOURCE_DIR=\".\" +} else { + DEFINES += QT_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\" +} CONFIG += parallel_test - diff --git a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp index 5f25882..4aad29b 100644 --- a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp +++ b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp @@ -82,7 +82,7 @@ QString tst_qmlvisual::viewer() #if defined(Q_WS_MAC) qmlruntime = QDir(binaries).absoluteFilePath("qml.app/Contents/MacOS/qml"); -#elif defined(Q_WS_WIN) +#elif defined(Q_WS_WIN) || defined(Q_WS_S60) qmlruntime = QDir(binaries).absoluteFilePath("qml.exe"); #else qmlruntime = QDir(binaries).absoluteFilePath("qml"); @@ -101,9 +101,8 @@ void tst_qmlvisual::visual_data() files << findQmlFiles(QDir(QT_TEST_SOURCE_DIR)); else { //these are newly added tests we want to try out in CI (then move to the stable list) - files << QT_TEST_SOURCE_DIR "/qdeclarativeborderimage/borders.qml"; + files << QT_TEST_SOURCE_DIR "/animation/qtbug10586/qtbug10586.qml"; files << QT_TEST_SOURCE_DIR "/qdeclarativeborderimage/animated.qml"; - files << QT_TEST_SOURCE_DIR "/qdeclarativeborderimage/animated-smooth.qml"; files << QT_TEST_SOURCE_DIR "/qdeclarativeflipable/test-flipable.qml"; files << QT_TEST_SOURCE_DIR "/qdeclarativepositioners/usingRepeater.qml"; @@ -123,6 +122,8 @@ void tst_qmlvisual::visual_data() //these reliably fail in CI, for unknown reasons //files << QT_TEST_SOURCE_DIR "/animation/easing/easing.qml"; //files << QT_TEST_SOURCE_DIR "/animation/pauseAnimation/pauseAnimation-visual.qml"; + //files << QT_TEST_SOURCE_DIR "/qdeclarativeborderimage/borders.qml"; + //files << QT_TEST_SOURCE_DIR "/qdeclarativeborderimage/animated-smooth.qml"; //these reliably fail on Linux because of color interpolation (different float rounding) #if !defined(Q_WS_X11) && !defined(Q_WS_QWS) diff --git a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/autosize.qml b/tests/auto/declarative/qmlvisual/webview/autosize/autosize.qml index c4a502e..c4a502e 100644 --- a/tests/auto/declarative/qmlvisual/qfxwebview/autosize/autosize.qml +++ b/tests/auto/declarative/qmlvisual/webview/autosize/autosize.qml diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.0.png b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.0.png Binary files differnew file mode 100644 index 0000000..ed87174 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.0.png diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.1.png b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.1.png Binary files differnew file mode 100644 index 0000000..ed87174 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.1.png diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.2.png b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.2.png Binary files differnew file mode 100644 index 0000000..ed87174 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.2.png diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.3.png b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.3.png Binary files differnew file mode 100644 index 0000000..ed87174 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.3.png diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.4.png b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.4.png Binary files differnew file mode 100644 index 0000000..ed87174 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.4.png diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.qml b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.qml new file mode 100644 index 0000000..6122138 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/webview/autosize/data-X11/autosize.qml @@ -0,0 +1,115 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "b2d863e57dee2a297d038e18acc70f92" + } + Frame { + msec: 32 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 48 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 64 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 80 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 96 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 112 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 128 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 144 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 160 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 176 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 192 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 208 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 224 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 240 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 256 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 272 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 288 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 304 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 320 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 336 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 352 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 368 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 384 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 400 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 416 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 432 + hash: "903a4c7e619abba5342c8c827f26a722" + } +} diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.0.png b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.0.png Binary files differnew file mode 100644 index 0000000..ed87174 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.0.png diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.1.png b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.1.png Binary files differnew file mode 100644 index 0000000..ed87174 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.1.png diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.2.png b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.2.png Binary files differnew file mode 100644 index 0000000..ed87174 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.2.png diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.3.png b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.3.png Binary files differnew file mode 100644 index 0000000..ed87174 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.3.png diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.4.png b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.4.png Binary files differnew file mode 100644 index 0000000..ed87174 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.4.png diff --git a/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.qml b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.qml new file mode 100644 index 0000000..6122138 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/webview/autosize/data/autosize.qml @@ -0,0 +1,115 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "b2d863e57dee2a297d038e18acc70f92" + } + Frame { + msec: 32 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 48 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 64 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 80 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 96 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 112 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 128 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 144 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 160 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 176 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 192 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 208 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 224 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 240 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 256 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 272 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 288 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 304 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 320 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 336 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 352 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 368 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 384 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 400 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 416 + hash: "903a4c7e619abba5342c8c827f26a722" + } + Frame { + msec: 432 + hash: "903a4c7e619abba5342c8c827f26a722" + } +} diff --git a/tests/auto/declarative/qmlvisual/webview/embedding/data/nesting.0.png b/tests/auto/declarative/qmlvisual/webview/embedding/data/nesting.0.png Binary files differdeleted file mode 100644 index 57de710..0000000 --- a/tests/auto/declarative/qmlvisual/webview/embedding/data/nesting.0.png +++ /dev/null diff --git a/tests/auto/declarative/qmlvisual/webview/embedding/data/nesting.qml b/tests/auto/declarative/qmlvisual/webview/embedding/data/nesting.qml deleted file mode 100644 index 9664566..0000000 --- a/tests/auto/declarative/qmlvisual/webview/embedding/data/nesting.qml +++ /dev/null @@ -1,363 +0,0 @@ -import Qt.VisualTest 4.7 - -VisualTest { - Frame { - msec: 0 - } - Frame { - msec: 16 - hash: "5dc8dca7a73022fbf2116b654b709244" - } - Frame { - msec: 32 - hash: "5dc8dca7a73022fbf2116b654b709244" - } - Frame { - msec: 48 - hash: "34079c4076ab6aadd8b64fcba7d95e15" - } - Frame { - msec: 64 - hash: "5ab5fc62b49e78d0609dcb4be6c9a157" - } - Frame { - msec: 80 - hash: "063cc7438bbffae717648d98006021a8" - } - Frame { - msec: 96 - hash: "c5cd16663e48639cbeade82c3bfa0403" - } - Frame { - msec: 112 - hash: "ea7f8df84ddbad0f683fe97ddb0a0130" - } - Frame { - msec: 128 - hash: "3c353e09bdb3a1e6ff388ad6020f55ea" - } - Frame { - msec: 144 - hash: "5b6de430365d0c9824337011916b0c0b" - } - Frame { - msec: 160 - hash: "48d353ac9e7ee1ce41361d0a2b47e008" - } - Frame { - msec: 176 - hash: "c96e4d02d343ddd78e8d3dd6aa8e0198" - } - Frame { - msec: 192 - hash: "543c63d77ec635b77672ba4c5160a3d4" - } - Frame { - msec: 208 - hash: "2d56ad9c2352e555fef613d625e71151" - } - Frame { - msec: 224 - hash: "18e433c3e3ee64510f875f674791d51c" - } - Frame { - msec: 240 - hash: "56889122c1ddacdd8ebd88310c7410bc" - } - Frame { - msec: 256 - hash: "d51c85458e0109bd5bf9528b741d98d0" - } - Frame { - msec: 272 - hash: "ac54137afc29a3022c6f01df7cdf2fd6" - } - Frame { - msec: 288 - hash: "c7a42b389bae3b729ba9e6cba7f54530" - } - Frame { - msec: 304 - hash: "7583b55841e80891652c3472c658f989" - } - Frame { - msec: 320 - hash: "95a7f8d47c3788261427727f82c9ff59" - } - Frame { - msec: 336 - hash: "a87bad3e2f010680e16cd1e3f5e03e99" - } - Frame { - msec: 352 - hash: "e16bc51653f21819e0eec412b99a069f" - } - Frame { - msec: 368 - hash: "f1e869580ac148ae207141c5f0adc185" - } - Frame { - msec: 384 - hash: "7e496e44363a16d7c62e4258af9ce087" - } - Frame { - msec: 400 - hash: "19e97915c84d3554c66d5a9ad3aa6a3e" - } - Frame { - msec: 416 - hash: "181181b48a1085d1850f18ca9b163549" - } - Frame { - msec: 432 - hash: "4637cb04595a543867bd43b0c1c829ea" - } - Frame { - msec: 448 - hash: "bd0a074fed5507f8556de6110bf56aa4" - } - Frame { - msec: 464 - hash: "9547618923edac6f7f9a3ff324c4f2d8" - } - Frame { - msec: 480 - hash: "a2f90c88eacb7c66878d45e33c2a787d" - } - Frame { - msec: 496 - hash: "d5ffd3e35d0426887c106069310f84d8" - } - Frame { - msec: 512 - hash: "6bc50a5b76e2a2ef0e6bee762abeb330" - } - Frame { - msec: 528 - hash: "d4439933c842ed8432434d272fea2845" - } - Frame { - msec: 544 - hash: "61699e6ec476ac3f090e4f485430421d" - } - Frame { - msec: 560 - hash: "02d7fa9bcd697d2cab364d0a3ca4a0e2" - } - Frame { - msec: 576 - hash: "914178cbf1f6a6822cc40f81823475e4" - } - Frame { - msec: 592 - hash: "280f867ea27891ee764332998567d40d" - } - Frame { - msec: 608 - hash: "ea0d00fe54a172a89c24eac781f7ae6d" - } - Frame { - msec: 624 - hash: "4e910fb507964a710e26f318c62227bf" - } - Frame { - msec: 640 - hash: "b0c3392eb739f270dd21f552ad999c23" - } - Frame { - msec: 656 - hash: "f3698c83b0972bd66a53ad95d4fc301e" - } - Frame { - msec: 672 - hash: "0d303a0d6a9b626943ac93cc6f3fb230" - } - Frame { - msec: 688 - hash: "ba56d49e6f51aa6f1bd2a7500e3538fd" - } - Frame { - msec: 704 - hash: "273ce89d5194168e5bfd1dcefad49be2" - } - Frame { - msec: 720 - hash: "c2beef4fb7996dbccdaff4f54bdc33f1" - } - Frame { - msec: 736 - hash: "1e1aa7d84f27158a8e61bd8698ddbf2a" - } - Frame { - msec: 752 - hash: "24e82479802e710c673133ca0413be66" - } - Frame { - msec: 768 - hash: "b77e935a690bcb396e15b942d772cf1b" - } - Frame { - msec: 784 - hash: "7b729c74df1d15d6b0e8e1fc19c2d710" - } - Frame { - msec: 800 - hash: "fd6cbdca3e481baaf35022dfea76e74c" - } - Frame { - msec: 816 - hash: "c975f6eb592793aa81895ffcb74ca577" - } - Frame { - msec: 832 - hash: "677c4039a650df53b4e885f37b049ab3" - } - Frame { - msec: 848 - hash: "89563aae36552cb1749ec06567e46d9d" - } - Frame { - msec: 864 - hash: "01f57402874de6608cc02937aaf91794" - } - Frame { - msec: 880 - hash: "50c9c4e5eaaadee1ff230975390d34e3" - } - Frame { - msec: 896 - hash: "20b7d277d398afad59afdf9e6b41a57e" - } - Frame { - msec: 912 - hash: "8f9ea938a2375afeba419199de66dd52" - } - Frame { - msec: 928 - hash: "b96745888ba954bcf304c0840a030f93" - } - Frame { - msec: 944 - hash: "f5715e931274011123160f7ad10d6c52" - } - Frame { - msec: 960 - image: "nesting.0.png" - } - Frame { - msec: 976 - hash: "459fe967816c795a177a3926093fae75" - } - Frame { - msec: 992 - hash: "c599a26083068b6db628c8d8416bab60" - } - Frame { - msec: 1008 - hash: "e0aee7d1152c971b1beee9d36542acb7" - } - Frame { - msec: 1024 - hash: "2af0facdf6412f7b06979aae25e4db26" - } - Frame { - msec: 1040 - hash: "f147a92cb1826f95d4fdb7d011ba79b1" - } - Frame { - msec: 1056 - hash: "12a1cb894b0fb8e44152cccacf855c1a" - } - Frame { - msec: 1072 - hash: "c7500cf58b74fef2c3e9820d1de8f843" - } - Frame { - msec: 1088 - hash: "3a031b2206835f8b2dc9837016df6ae6" - } - Frame { - msec: 1104 - hash: "7a4796b419bbc04237764dea0b1d47d5" - } - Frame { - msec: 1120 - hash: "151d350f0064e2faf0bfb9c58bc3e4f2" - } - Frame { - msec: 1136 - hash: "d72c20a97e678908acc1d6c1f8114d9e" - } - Frame { - msec: 1152 - hash: "22da1e645640a3c31b064ff757113197" - } - Frame { - msec: 1168 - hash: "401f0bf370e2ecea5a84276fb72eb1da" - } - Frame { - msec: 1184 - hash: "c6e00d7b0ac14a5c3860b6a29901c915" - } - Frame { - msec: 1200 - hash: "f1f7dc55d7719fcb6e97157c0ca85fc0" - } - Frame { - msec: 1216 - hash: "6a112e1d79c7128c235d093e4f1f9325" - } - Frame { - msec: 1232 - hash: "14a2caf8cdca8d5147261a315059b69d" - } - Frame { - msec: 1248 - hash: "5645243aa3cfd12b0b32442f063bedb2" - } - Frame { - msec: 1264 - hash: "c7f72534a88e33c72a54cb8580534551" - } - Frame { - msec: 1280 - hash: "6cd5e2e8e0128586a682b3c649ae0631" - } - Frame { - msec: 1296 - hash: "67cefb4526b52d40a31811bc0dfaeb6a" - } - Frame { - msec: 1312 - hash: "fbe2a43a27bf490719c8b9e2b094e34f" - } - Frame { - msec: 1328 - hash: "e028aad6f51a47d8189efcf9c5d277ee" - } - Frame { - msec: 1344 - hash: "2b4cc50c37c07289fa6f9309991d36da" - } - Frame { - msec: 1360 - hash: "b67b2244cd0616d07e100d7b3b00bbe2" - } - Frame { - msec: 1376 - hash: "4e4690cffc98c49e91bdb600f1e94c79" - } - Frame { - msec: 1392 - hash: "e5215c727836a5547a170d42363bc5c8" - } - Frame { - msec: 1408 - hash: "26868e91d1794bb3f42d51f508fef613" - } - Frame { - msec: 1424 - hash: "1e5f431b125a66096ac9a4d5a211a2c4" - } -} diff --git a/tests/auto/declarative/qmlvisual/webview/embedding/egg.qml b/tests/auto/declarative/qmlvisual/webview/embedding/egg.qml deleted file mode 100644 index c569c9a..0000000 --- a/tests/auto/declarative/qmlvisual/webview/embedding/egg.qml +++ /dev/null @@ -1,26 +0,0 @@ -import Qt 4.7 - -Item { - property variant period : 250 - property variant color : "black" - id: root - - Item { - x: root.width/2 - y: root.height/2 - Rectangle { - radius: width/2 - color: root.color - x: -width/2 - y: -height/2 - width: root.width*1.5 - height: root.height*1.5 - } - rotation: NumberAnimation { - from: 0 - to: 360 - repeat: true - duration: root.period - } - } -} diff --git a/tests/auto/declarative/qmlvisual/webview/embedding/nesting.html b/tests/auto/declarative/qmlvisual/webview/embedding/nesting.html deleted file mode 100644 index 6e81689..0000000 --- a/tests/auto/declarative/qmlvisual/webview/embedding/nesting.html +++ /dev/null @@ -1,9 +0,0 @@ -<html> -<head><title>Nesting</title> -<link rel="icon" sizes="48x48" href="basic.png"> -</head> -<body bgcolor="green"> -<h1>Nesting</h1> -This is a test... -<OBJECT data=egg.qml TYPE=application/x-qt-plugin width=50 height=70 period=2000 color=white></OBJECT> -... with a spinning QML egg nested in it. diff --git a/tests/auto/declarative/qmlvisual/webview/embedding/nesting.qml b/tests/auto/declarative/qmlvisual/webview/embedding/nesting.qml deleted file mode 100644 index 9e008de..0000000 --- a/tests/auto/declarative/qmlvisual/webview/embedding/nesting.qml +++ /dev/null @@ -1,9 +0,0 @@ -import Qt 4.7 -import org.webkit 1.0 - -WebView { - width: 300 - height: 200 - url: "nesting.html" - settings.pluginsEnabled: true -} diff --git a/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp index b8e317e..7d34698 100644 --- a/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp +++ b/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp @@ -225,7 +225,7 @@ void tst_QPacketProtocol::read() void tst_QPacketProtocol::device() { QPacketProtocol p(m_client); - QCOMPARE(p.device(), m_client); + QVERIFY(p.device() == m_client); } void tst_QPacketProtocol::tst_QPacket_clear() diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index f8ecca3..dfadf48 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -50,6 +50,7 @@ #include <qgesturerecognizer.h> #include <qgraphicsitem.h> #include <qgraphicsview.h> +#include <qmainwindow.h> #include <qdebug.h> @@ -355,6 +356,7 @@ private slots: void deleteGestureTargetItem(); void viewportCoordinates(); void partialGesturePropagation(); + void testQGestureRecognizerCleanup(); }; tst_Gestures::tst_Gestures() @@ -1949,5 +1951,74 @@ void tst_Gestures::partialGesturePropagation() QCOMPARE(item4->gestureEventsReceived, 0); } +class WinNativePan : public QPanGesture { +public: + WinNativePan() {} +}; + +class Pan : public QPanGesture { +public: + Pan() {} +}; + +class CustomPan : public QPanGesture { +public: + CustomPan() {} +}; + +// Recognizer for active gesture triggers on mouse press +class PanRecognizer : public QGestureRecognizer { +public: + enum PanType { Platform, Default, Custom }; + + PanRecognizer(int id) : m_id(id) {} + QGesture *create(QObject *) { + switch(m_id) { + case Platform: return new WinNativePan(); + case Default: return new Pan(); + default: return new CustomPan(); + } + } + + Result recognize(QGesture *, QObject *, QEvent *) { return QGestureRecognizer::Ignore; } + + const int m_id; +}; + +void tst_Gestures::testQGestureRecognizerCleanup() +{ + // Clean first the current recognizers in QGManager + QGestureRecognizer::unregisterRecognizer(Qt::PanGesture); + + // v-- Qt singleton QGManager initialization + + // Mimic QGestureManager: register both default and "platform" recognizers + // (this is done in windows when QT_NO_NATIVE_GESTURES is not defined) + PanRecognizer *def = new PanRecognizer(PanRecognizer::Default); + QGestureRecognizer::registerRecognizer(def); + PanRecognizer *plt = new PanRecognizer(PanRecognizer::Platform); + QGestureRecognizer::registerRecognizer(plt); + qDebug () << "register: default =" << def << "; platform =" << plt; + + // ^-- Qt singleton QGManager initialization + + // Here, application code would start + + // Create QGV (has a QAScrollArea, which uses Qt::PanGesture) + QMainWindow *w = new QMainWindow; + QGraphicsView *v = new QGraphicsView(); + w->setCentralWidget(v); + + // Unregister Qt recognizers + QGestureRecognizer::unregisterRecognizer(Qt::PanGesture); + + // Register a custom Pan recognizer + //QGestureRecognizer::registerRecognizer(new PanRecognizer(PanRecognizer::Custom)); + + w->show(); + QTest::qWaitForWindowShown(w); + delete w; +} + QTEST_MAIN(tst_Gestures) #include "tst_gestures.moc" diff --git a/tests/auto/languagechange/tst_languagechange.cpp b/tests/auto/languagechange/tst_languagechange.cpp index d04707e..bcc3be4 100644 --- a/tests/auto/languagechange/tst_languagechange.cpp +++ b/tests/auto/languagechange/tst_languagechange.cpp @@ -238,8 +238,8 @@ void tst_languageChange::retranslatability() QString fooName = tmpParentDir + "/foo"; QDir dir; QCOMPARE(dir.mkpath(tmpDir), true); -#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86) - // Just create a new file instead of copying exe, because exe is not there in emulator +#if defined(Q_OS_SYMBIAN) + // Just create a new file instead of copying exe, because there is no read access to /sys/bin { QFile fooFile(fooName); QVERIFY(fooFile.open(QIODevice::WriteOnly | QIODevice::Text)); diff --git a/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro b/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro index a57c56f..2e2577d 100644 --- a/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro +++ b/tests/auto/qabstractnetworkcache/qabstractnetworkcache.pro @@ -9,3 +9,4 @@ wince*|symbian: { DEPLOYMENT += testFiles } +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qabstractsocket/qabstractsocket.pro b/tests/auto/qabstractsocket/qabstractsocket.pro index 59999af..814a7d2 100644 --- a/tests/auto/qabstractsocket/qabstractsocket.pro +++ b/tests/auto/qabstractsocket/qabstractsocket.pro @@ -7,4 +7,5 @@ QT = core network SOURCES += tst_qabstractsocket.cpp +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qbuffer/tst_qbuffer.cpp b/tests/auto/qbuffer/tst_qbuffer.cpp index fcef6a3..dd5ca91 100644 --- a/tests/auto/qbuffer/tst_qbuffer.cpp +++ b/tests/auto/qbuffer/tst_qbuffer.cpp @@ -76,6 +76,7 @@ private slots: void atEnd(); void readLineBoundaries(); void writeAfterQByteArrayResize(); + void read_null(); protected slots: void readyReadSlot(); @@ -529,5 +530,30 @@ void tst_QBuffer::writeAfterQByteArrayResize() QCOMPARE(buffer.buffer().size(), 1000); } +void tst_QBuffer::read_null() +{ + QByteArray buffer; + buffer.resize(32000); + for (int i = 0; i < buffer.size(); ++i) + buffer[i] = char(i & 0xff); + + QBuffer in(&buffer); + in.open(QIODevice::ReadOnly); + + QByteArray chunk; + + chunk.resize(16380); + in.read(chunk.data(), 16380); + + QCOMPARE(chunk, buffer.mid(0, chunk.size())); + + in.read(chunk.data(), 0); + + chunk.resize(8); + in.read(chunk.data(), chunk.size()); + + QCOMPARE(chunk, buffer.mid(16380, chunk.size())); +} + QTEST_MAIN(tst_QBuffer) #include "tst_qbuffer.moc" diff --git a/tests/auto/qcolumnview/tst_qcolumnview.cpp b/tests/auto/qcolumnview/tst_qcolumnview.cpp index 90f499d..1da8c5d 100644 --- a/tests/auto/qcolumnview/tst_qcolumnview.cpp +++ b/tests/auto/qcolumnview/tst_qcolumnview.cpp @@ -596,11 +596,11 @@ void tst_QColumnView::clicked() QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, localPoint); QCOMPARE(clickedSpy.count(), 1); qApp->processEvents(); - + if (sizeof(qreal) != sizeof(double)) { QSKIP("Skipped due to rounding errors", SkipAll); } - + for (int i = 0; i < view.createdColumns.count(); ++i) { QAbstractItemView *column = view.createdColumns.at(i); if (column && column->selectionModel() && (column->rootIndex() == home)) @@ -961,9 +961,9 @@ void tst_QColumnView::parentCurrentIndex() QVERIFY(third.isValid()); view.setCurrentIndex(third); QTest::qWait(ANIMATION_DELAY); - QCOMPARE(view.createdColumns[0]->currentIndex(), first); - QCOMPARE(view.createdColumns[1]->currentIndex(), second); - QCOMPARE(view.createdColumns[2]->currentIndex(), third); + QTRY_COMPARE(view.createdColumns[0]->currentIndex(), first); + QTRY_COMPARE(view.createdColumns[1]->currentIndex(), second); + QTRY_COMPARE(view.createdColumns[2]->currentIndex(), third); first = model.index(0, 0, QModelIndex()); second = model.index(secondRow, 0, first); diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp index 6aca996..47c54a5 100644 --- a/tests/auto/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/qdatetime/tst_qdatetime.cpp @@ -106,6 +106,8 @@ private slots: void daysTo(); void secsTo_data(); void secsTo(); + void msecsTo_data(); + void msecsTo(); void operator_eqeq(); void currentDateTime(); void currentDateTimeUtc(); @@ -910,6 +912,30 @@ void tst_QDateTime::secsTo() QVERIFY((dt >= result) == (0 >= nsecs)); } +void tst_QDateTime::msecsTo_data() +{ + addMSecs_data(); +} + +void tst_QDateTime::msecsTo() +{ + QFETCH(QDateTime, dt); + QFETCH(int, nsecs); + QFETCH(QDateTime, result); + +#ifdef Q_OS_IRIX + QEXPECT_FAIL("cet4", "IRIX databases say 1970 had DST", Abort); +#endif + QCOMPARE(dt.msecsTo(result), qint64(nsecs) * 1000); + QCOMPARE(result.msecsTo(dt), -qint64(nsecs) * 1000); + QVERIFY((dt == result) == (0 == (qint64(nsecs) * 1000))); + QVERIFY((dt != result) == (0 != (qint64(nsecs) * 1000))); + QVERIFY((dt < result) == (0 < (qint64(nsecs) * 1000))); + QVERIFY((dt <= result) == (0 <= (qint64(nsecs) * 1000))); + QVERIFY((dt > result) == (0 > (qint64(nsecs) * 1000))); + QVERIFY((dt >= result) == (0 >= (qint64(nsecs) * 1000))); +} + void tst_QDateTime::currentDateTime() { #if defined(Q_OS_WINCE) diff --git a/tests/auto/qdirmodel/tst_qdirmodel.cpp b/tests/auto/qdirmodel/tst_qdirmodel.cpp index 1bc5b7f..41bbd87 100644 --- a/tests/auto/qdirmodel/tst_qdirmodel.cpp +++ b/tests/auto/qdirmodel/tst_qdirmodel.cpp @@ -613,6 +613,11 @@ void tst_QDirModel::task196768_sorting() //this task showed that the persistent model indexes got corrupted when sorting QString path = SRCDIR; +#ifdef Q_OS_SYMBIAN + if(!RProcess().HasCapability(ECapabilityAllFiles)) + QEXPECT_FAIL("", "QTBUG-9746", Continue); +#endif + QDirModel model; /* QDirModel has a bug if we show the content of the subdirectory inside a hidden directory diff --git a/tests/auto/qdockwidget/tst_qdockwidget.cpp b/tests/auto/qdockwidget/tst_qdockwidget.cpp index a734985..2059101 100644 --- a/tests/auto/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/qdockwidget/tst_qdockwidget.cpp @@ -96,6 +96,7 @@ private slots: void task248604_infiniteResize(); void task258459_visibilityChanged(); void taskQTBUG_1665_closableChanged(); + void taskQTBUG_9758_undockedGeometry(); }; // Testing get/set functions @@ -653,7 +654,7 @@ void tst_QDockWidget::dockLocationChanged() QCOMPARE(qvariant_cast<Qt::DockWidgetArea>(spy.at(0).at(0)), Qt::TopDockWidgetArea); spy.clear(); - + dw.setFloating(true); QTest::qWait(100); dw.setFloating(false); @@ -878,6 +879,27 @@ void tst_QDockWidget::taskQTBUG_1665_closableChanged() QVERIFY(!(dock.windowFlags() & Qt::WindowCloseButtonHint)); } +void tst_QDockWidget::taskQTBUG_9758_undockedGeometry() +{ + QMainWindow window; + QDockWidget dock1(&window); + QDockWidget dock2(&window); + window.addDockWidget(Qt::RightDockWidgetArea, &dock1); + window.addDockWidget(Qt::RightDockWidgetArea, &dock2); + window.tabifyDockWidget(&dock1, &dock2); + dock1.hide(); + dock2.hide(); + window.show(); + QTest::qWaitForWindowShown(&window); + dock1.setFloating(true); + dock1.show(); + QTest::qWaitForWindowShown(&dock1); + + QVERIFY(dock1.x() >= 0); + QVERIFY(dock1.y() >= 0); +} + + QTEST_MAIN(tst_QDockWidget) #include "tst_qdockwidget.moc" diff --git a/tests/auto/qfile/largefile/tst_largefile.cpp b/tests/auto/qfile/largefile/tst_largefile.cpp index 041e5f2..60c5f89 100644 --- a/tests/auto/qfile/largefile/tst_largefile.cpp +++ b/tests/auto/qfile/largefile/tst_largefile.cpp @@ -523,6 +523,10 @@ void tst_LargeFile::mapFile() void tst_LargeFile::mapOffsetOverflow() { +#if defined(Q_OS_MAC) + QSKIP("mmap'ping beyond EOF may succeed; generate bus error on access", SkipAll); +#endif + // Out-of-range mappings should fail, and not silently clip the offset for (int i = 50; i < 63; ++i) { uchar *address = 0; diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index 38a1ee7..ca7c445 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -529,10 +529,6 @@ void tst_QFiledialog::completer() #endif ++expected; } -#if !defined(Q_OS_WIN) - if (inputStartsWithRootPath) - expected++; -#endif } QTest::qWait(1000); diff --git a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp index 6bfa8be..eee495f 100644 --- a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp @@ -76,6 +76,13 @@ # define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/" #endif +#if defined QT_BUILD_INTERNAL +QT_BEGIN_NAMESPACE +Q_GUI_EXPORT bool qt_test_isFetchedRoot(); +Q_GUI_EXPORT void qt_test_resetFetchedRoot(); +QT_END_NAMESPACE +#endif + class QNonNativeFileDialog : public QFileDialog { Q_OBJECT @@ -139,7 +146,7 @@ private: }; tst_QFileDialog2::tst_QFileDialog2() -{ +{ #if defined(Q_OS_WINCE) qApp->setAutoMaximizeThreshold(-1); #endif @@ -177,19 +184,18 @@ void tst_QFileDialog2::listRoot() QFileInfoGatherer fileInfoGatherer; fileInfoGatherer.start(); QTest::qWait(1500); - - QFileInfoGatherer::fetchedRoot = false; + qt_test_resetFetchedRoot(); QString dir(QDir::currentPath()); QNonNativeFileDialog fd(0, QString(), dir); fd.show(); - QCOMPARE(QFileInfoGatherer::fetchedRoot,false); + QCOMPARE(qt_test_isFetchedRoot(),false); fd.setDirectory(""); #ifdef Q_OS_WINCE QTest::qWait(1500); #else QTest::qWait(500); #endif - QCOMPARE(QFileInfoGatherer::fetchedRoot,true); + QCOMPARE(qt_test_isFetchedRoot(),true); #endif } diff --git a/tests/auto/qftp/qftp.pro b/tests/auto/qftp/qftp.pro index c060296..33d479a 100644 --- a/tests/auto/qftp/qftp.pro +++ b/tests/auto/qftp/qftp.pro @@ -14,6 +14,7 @@ wince*: { addFiles.path = . DEPLOYMENT += addFiles TARGET.EPOCHEAPSIZE="0x100 0x1000000" + TARGET.CAPABILITY = NetworkServices } else { DEFINES += SRCDIR=\\\"$$PWD/\\\" } diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 81097be..5a5a821 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -45,6 +45,7 @@ #include <private/qtextcontrol_p.h> #include <private/qgraphicsitem_p.h> #include <private/qgraphicsview_p.h> +#include <private/qgraphicsscene_p.h> #include <QStyleOptionGraphicsItem> #include <QAbstractTextDocumentLayout> #include <QBitmap> @@ -447,6 +448,7 @@ private slots: void QT_2649_focusScope(); void sortItemsWhileAdding(); void doNotMarkFullUpdateIfNotInScene(); + void itemDiesDuringDraggingOperation(); private: QList<QGraphicsItem *> paintedItems; @@ -10484,5 +10486,27 @@ void tst_QGraphicsItem::doNotMarkFullUpdateIfNotInScene() QTRY_COMPARE(item3->painted, 3); } +void tst_QGraphicsItem::itemDiesDuringDraggingOperation() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + QGraphicsRectItem *item = new QGraphicsRectItem(QRectF(0, 0, 100, 100)); + item->setFlag(QGraphicsItem::ItemIsMovable); + item->setAcceptDrops(true); + scene.addItem(item); + view.show(); + QApplication::setActiveWindow(&view); + QTest::qWaitForWindowShown(&view); + QTRY_COMPARE(QApplication::activeWindow(), (QWidget *)&view); + QGraphicsSceneDragDropEvent dragEnter(QEvent::GraphicsSceneDragEnter); + dragEnter.setScenePos(item->boundingRect().center()); + QApplication::sendEvent(&scene, &dragEnter); + QGraphicsSceneDragDropEvent event(QEvent::GraphicsSceneDragMove); + event.setScenePos(item->boundingRect().center()); + QApplication::sendEvent(&scene, &event); + QVERIFY(QGraphicsScenePrivate::get(&scene)->dragDropItem == item); + delete item; + QVERIFY(QGraphicsScenePrivate::get(&scene)->dragDropItem == 0); +} QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index d5f63d3..6cea834 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -3436,6 +3436,21 @@ void tst_QGraphicsProxyWidget::inputMethod() qApp->sendEvent(proxy, &event); QCOMPARE(lineEdit->inputMethodEvents, i); } + + scene.clear(); + QGraphicsView view(&scene); + QWidget *w = new QWidget; + w->setLayout(new QVBoxLayout(w)); + QLineEdit *lineEdit = new QLineEdit; + lineEdit->setEchoMode(QLineEdit::Password); + w->layout()->addWidget(lineEdit); + lineEdit->setAttribute(Qt::WA_InputMethodEnabled, true); + QGraphicsProxyWidget *proxy = scene.addWidget(w); + view.show(); + QTest::qWaitForWindowShown(&view); + QTRY_VERIFY(!(proxy->flags() & QGraphicsItem::ItemAcceptsInputMethod)); + lineEdit->setFocus(); + QVERIFY((proxy->flags() & QGraphicsItem::ItemAcceptsInputMethod)); } void tst_QGraphicsProxyWidget::clickFocus() diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 1df9a37..b8df7f6 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -218,6 +218,7 @@ private slots: void update(); void update2_data(); void update2(); + void update_ancestorClipsChildrenToShape(); void inputMethodSensitivity(); void inputContextReset(); void indirectPainting(); @@ -3758,6 +3759,62 @@ void tst_QGraphicsView::update2() #endif } +void tst_QGraphicsView::update_ancestorClipsChildrenToShape() +{ + QGraphicsScene scene(-150, -150, 300, 300); + + /* + Add three rects: + + +------------------+ + | child | + | +--------------+ | + | | parent | | + | | +-----------+ | + | | |grandParent| | + | | +-----------+ | + | +--------------+ | + +------------------+ + + ... where both the parent and the grand parent clips children to shape. + */ + QApplication::processEvents(); // Get rid of pending update. + + QGraphicsRectItem *grandParent = static_cast<QGraphicsRectItem *>(scene.addRect(0, 0, 50, 50)); + grandParent->setBrush(Qt::black); + grandParent->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + + QGraphicsRectItem *parent = static_cast<QGraphicsRectItem *>(scene.addRect(-50, -50, 100, 100)); + parent->setBrush(QColor(0, 0, 255, 125)); + parent->setParentItem(grandParent); + parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape); + + QGraphicsRectItem *child = static_cast<QGraphicsRectItem *>(scene.addRect(-100, -100, 200, 200)); + child->setBrush(QColor(255, 0, 0, 125)); + child->setParentItem(parent); + + CustomView view(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + QTRY_VERIFY(view.painted); + + view.lastUpdateRegions.clear(); + view.painted = false; + + // Call child->update() and make sure the updated area is within the ancestors' clip. + QRectF expected = child->deviceTransform(view.viewportTransform()).mapRect(child->boundingRect()); + expected &= grandParent->deviceTransform(view.viewportTransform()).mapRect(grandParent->boundingRect()); + + child->update(); + QTRY_VERIFY(view.painted); + +#ifndef QT_MAC_USE_COCOA //cocoa doesn't support drawing regions + QTRY_VERIFY(view.painted); + QCOMPARE(view.lastUpdateRegions.size(), 1); + QCOMPARE(view.lastUpdateRegions.at(0), QRegion(expected.toAlignedRect())); +#endif +} + class FocusItem : public QGraphicsRectItem { public: diff --git a/tests/auto/qhostaddress/qhostaddress.pro b/tests/auto/qhostaddress/qhostaddress.pro index b208214..7bcbfb0 100644 --- a/tests/auto/qhostaddress/qhostaddress.pro +++ b/tests/auto/qhostaddress/qhostaddress.pro @@ -12,3 +12,4 @@ wince*: { } } +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qhostinfo/qhostinfo.pro b/tests/auto/qhostinfo/qhostinfo.pro index 9bfe576..06a4b17 100644 --- a/tests/auto/qhostinfo/qhostinfo.pro +++ b/tests/auto/qhostinfo/qhostinfo.pro @@ -10,4 +10,5 @@ wince*: { win32:LIBS += -lws2_32 } +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qhttp/qhttp.pro b/tests/auto/qhttp/qhttp.pro index 8678a19..23a73c4 100644 --- a/tests/auto/qhttp/qhttp.pro +++ b/tests/auto/qhttp/qhttp.pro @@ -21,6 +21,7 @@ wince*: { addFiles.sources = rfc3252.txt trolltech addFiles.path = . DEPLOYMENT = addFiles webFiles cgi + TARGET.CAPABILITY = NetworkServices } else:vxworks*: { DEFINES += SRCDIR=\\\"\\\" } else { diff --git a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro b/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro index 0021bc1..d9e2dce 100644 --- a/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro +++ b/tests/auto/qhttpnetworkconnection/qhttpnetworkconnection.pro @@ -4,3 +4,5 @@ INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/zlib requires(contains(QT_CONFIG,private_tests)) QT = core network + +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro b/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro index 1782b43..36d56c6 100644 --- a/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro +++ b/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro @@ -4,3 +4,4 @@ INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/zlib requires(contains(QT_CONFIG,private_tests)) QT = core network +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qhttpsocketengine/qhttpsocketengine.pro b/tests/auto/qhttpsocketengine/qhttpsocketengine.pro index f6ad073..d76ebb6 100644 --- a/tests/auto/qhttpsocketengine/qhttpsocketengine.pro +++ b/tests/auto/qhttpsocketengine/qhttpsocketengine.pro @@ -8,5 +8,6 @@ MOC_DIR=tmp QT = core network +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index 1b4c502..aadee5b 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -114,6 +114,9 @@ private slots: void readFromFileAfterJunk_data(); void readFromFileAfterJunk(); + void devicePosition_data(); + void devicePosition(); + void setBackgroundColor_data(); void setBackgroundColor(); @@ -1117,7 +1120,7 @@ void tst_QImageReader::readFromFileAfterJunk() QByteArray imageData = imageFile.readAll(); QVERIFY(!imageData.isNull()); - int iterations = 10; + int iterations = 3; if (format == "ppm" || format == "pbm" || format == "pgm" || format == "svg" || format == "svgz") iterations = 1; @@ -1147,6 +1150,64 @@ void tst_QImageReader::readFromFileAfterJunk() } } +void tst_QImageReader::devicePosition_data() +{ + QTest::addColumn<QString>("fileName"); + QTest::addColumn<QByteArray>("format"); + + QTest::newRow("pbm") << QString("image.pbm") << QByteArray("pbm"); + QTest::newRow("pgm") << QString("image.pgm") << QByteArray("pgm"); + QTest::newRow("ppm-1") << QString("image.ppm") << QByteArray("ppm"); +#ifdef QTEST_HAVE_JPEG + QTest::newRow("jpeg-1") << QString("beavis.jpg") << QByteArray("jpeg"); + QTest::newRow("jpeg-2") << QString("YCbCr_cmyk.jpg") << QByteArray("jpeg"); + QTest::newRow("jpeg-3") << QString("YCbCr_rgb.jpg") << QByteArray("jpeg"); +#endif +#if defined QTEST_HAVE_GIF + QTest::newRow("gif-1") << QString("earth.gif") << QByteArray("gif"); +#endif + QTest::newRow("xbm") << QString("gnus.xbm") << QByteArray("xbm"); + QTest::newRow("xpm") << QString("marble.xpm") << QByteArray("xpm"); + QTest::newRow("bmp-1") << QString("colorful.bmp") << QByteArray("bmp"); + QTest::newRow("bmp-2") << QString("font.bmp") << QByteArray("bmp"); + QTest::newRow("png") << QString("kollada.png") << QByteArray("png"); +// QTest::newRow("mng-1") << QString("images/ball.mng") << QByteArray("mng"); +// QTest::newRow("mng-2") << QString("images/fire.mng") << QByteArray("mng"); +#if defined QTEST_HAVE_SVG + QTest::newRow("svg") << QString("rect.svg") << QByteArray("svg"); + QTest::newRow("svgz") << QString("rect.svgz") << QByteArray("svgz"); +#endif +} + +void tst_QImageReader::devicePosition() +{ + QFETCH(QString, fileName); + QFETCH(QByteArray, format); + + QImage expected(prefix + fileName); + QVERIFY(!expected.isNull()); + + QFile imageFile(prefix + fileName); + QVERIFY(imageFile.open(QFile::ReadOnly)); + QByteArray imageData = imageFile.readAll(); + QVERIFY(!imageData.isNull()); + int imageDataSize = imageData.size(); + + const char *preStr = "prebeef\n"; + int preLen = qstrlen(preStr); + imageData.prepend(preStr); + if (format != "svg" && format != "svgz") // Doesn't handle trailing data + imageData.append("\npostbeef"); + QBuffer buf(&imageData); + buf.open(QIODevice::ReadOnly); + buf.seek(preLen); + QImageReader reader(&buf, format); + QCOMPARE(expected, reader.read()); + if (format != "ppm" && format != "gif") // Known not to work + QCOMPARE(buf.pos(), qint64(preLen+imageDataSize)); +} + + void tst_QImageReader::description_data() { QTest::addColumn<QString>("fileName"); diff --git a/tests/auto/qiodevice/qiodevice.pro b/tests/auto/qiodevice/qiodevice.pro index e695bf6..716cdce 100644 --- a/tests/auto/qiodevice/qiodevice.pro +++ b/tests/auto/qiodevice/qiodevice.pro @@ -14,6 +14,7 @@ wince*: { addFiles.sources = tst_qiodevice.cpp addFiles.path = . DEPLOYMENT += addFiles + TARGET.CAPABILITY = NetworkServices } else { DEFINES += SRCDIR=\\\"$$PWD/\\\" contains(QT_CONFIG, qt3support):QT += qt3support diff --git a/tests/auto/qlocalsocket/qlocalsocket.pro b/tests/auto/qlocalsocket/qlocalsocket.pro index 0849453..287e946 100644 --- a/tests/auto/qlocalsocket/qlocalsocket.pro +++ b/tests/auto/qlocalsocket/qlocalsocket.pro @@ -1,3 +1,4 @@ TEMPLATE = subdirs SUBDIRS = lackey test !wince*:!symbian*: SUBDIRS += example +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qmessagebox/tst_qmessagebox.cpp b/tests/auto/qmessagebox/tst_qmessagebox.cpp index 2de1c52..d4ca064 100644 --- a/tests/auto/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/qmessagebox/tst_qmessagebox.cpp @@ -140,6 +140,8 @@ private: tst_QMessageBox::tst_QMessageBox() : keyToSend(-1) { + int argc = qApp->argc(); + QT_REQUIRE_VERSION(argc, qApp->argv(), "4.6.2") } int tst_QMessageBox::exec(QMessageBox *msgBox, int key) diff --git a/tests/auto/qnativesocketengine/qnativesocketengine.pro b/tests/auto/qnativesocketengine/qnativesocketengine.pro index ad40d53..0275d37 100644 --- a/tests/auto/qnativesocketengine/qnativesocketengine.pro +++ b/tests/auto/qnativesocketengine/qnativesocketengine.pro @@ -9,4 +9,5 @@ MOC_DIR=tmp QT = core network +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qnetworkaccessmanager/qnetworkaccessmanager.pro b/tests/auto/qnetworkaccessmanager/qnetworkaccessmanager.pro index e2889c1..3ccbffb 100644 --- a/tests/auto/qnetworkaccessmanager/qnetworkaccessmanager.pro +++ b/tests/auto/qnetworkaccessmanager/qnetworkaccessmanager.pro @@ -2,4 +2,5 @@ load(qttest_p4) SOURCES += tst_qnetworkaccessmanager.cpp QT = core network +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qnetworkaccessmanager_and_qprogressdialog/qnetworkaccessmanager_and_qprogressdialog.pro b/tests/auto/qnetworkaccessmanager_and_qprogressdialog/qnetworkaccessmanager_and_qprogressdialog.pro index 7ed5b07..378deba 100644 --- a/tests/auto/qnetworkaccessmanager_and_qprogressdialog/qnetworkaccessmanager_and_qprogressdialog.pro +++ b/tests/auto/qnetworkaccessmanager_and_qprogressdialog/qnetworkaccessmanager_and_qprogressdialog.pro @@ -2,4 +2,5 @@ load(qttest_p4) SOURCES += tst_qnetworkaccessmanager_and_qprogressdialog.cpp QT += network +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qnetworkaddressentry/qnetworkaddressentry.pro b/tests/auto/qnetworkaddressentry/qnetworkaddressentry.pro index 8feb95f..885dbf7 100644 --- a/tests/auto/qnetworkaddressentry/qnetworkaddressentry.pro +++ b/tests/auto/qnetworkaddressentry/qnetworkaddressentry.pro @@ -2,3 +2,5 @@ load(qttest_p4) SOURCES += tst_qnetworkaddressentry.cpp QT = core network + +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qnetworkcachemetadata/qnetworkcachemetadata.pro b/tests/auto/qnetworkcachemetadata/qnetworkcachemetadata.pro index b24fe00..77ad347 100644 --- a/tests/auto/qnetworkcachemetadata/qnetworkcachemetadata.pro +++ b/tests/auto/qnetworkcachemetadata/qnetworkcachemetadata.pro @@ -2,4 +2,5 @@ load(qttest_p4) QT += network SOURCES += tst_qnetworkcachemetadata.cpp +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp index ce3acb7..a3cccb2 100644 --- a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp +++ b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp @@ -45,6 +45,13 @@ #include <QtNetwork/qnetworkconfiguration.h> #include <QtNetwork/qnetworkconfigmanager.h> +/* + Although this unit test doesn't use QNetworkAccessManager + this include is used to ensure that bearer continues to compile against + Qt 4.7+ which has a QNetworkConfiguration enabled QNetworkAccessManager +*/ +#include <QNetworkAccessManager> + #if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) #include <stdio.h> #include <iapconf.h> diff --git a/tests/auto/qnetworkcookie/qnetworkcookie.pro b/tests/auto/qnetworkcookie/qnetworkcookie.pro index 95d8b6e..2f31138 100644 --- a/tests/auto/qnetworkcookie/qnetworkcookie.pro +++ b/tests/auto/qnetworkcookie/qnetworkcookie.pro @@ -2,3 +2,4 @@ load(qttest_p4) SOURCES += tst_qnetworkcookie.cpp QT = core network +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qnetworkcookiejar/qnetworkcookiejar.pro b/tests/auto/qnetworkcookiejar/qnetworkcookiejar.pro index 3a8e61b..6d75fab 100644 --- a/tests/auto/qnetworkcookiejar/qnetworkcookiejar.pro +++ b/tests/auto/qnetworkcookiejar/qnetworkcookiejar.pro @@ -2,3 +2,4 @@ load(qttest_p4) SOURCES += tst_qnetworkcookiejar.cpp QT = core network +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qnetworkdiskcache/qnetworkdiskcache.pro b/tests/auto/qnetworkdiskcache/qnetworkdiskcache.pro index f47d6d7..3b13087 100644 --- a/tests/auto/qnetworkdiskcache/qnetworkdiskcache.pro +++ b/tests/auto/qnetworkdiskcache/qnetworkdiskcache.pro @@ -2,4 +2,5 @@ load(qttest_p4) QT += network SOURCES += tst_qnetworkdiskcache.cpp +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qnetworkinterface/qnetworkinterface.pro b/tests/auto/qnetworkinterface/qnetworkinterface.pro index 26095e9..1c5feee 100644 --- a/tests/auto/qnetworkinterface/qnetworkinterface.pro +++ b/tests/auto/qnetworkinterface/qnetworkinterface.pro @@ -3,4 +3,5 @@ SOURCES += tst_qnetworkinterface.cpp QT = core network +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qnetworkproxy/qnetworkproxy.pro b/tests/auto/qnetworkproxy/qnetworkproxy.pro index 8ffc80c..fc0a216 100644 --- a/tests/auto/qnetworkproxy/qnetworkproxy.pro +++ b/tests/auto/qnetworkproxy/qnetworkproxy.pro @@ -7,4 +7,5 @@ QT = core network SOURCES += tst_qnetworkproxy.cpp +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qnetworkreply/qnetworkreply.pro b/tests/auto/qnetworkreply/qnetworkreply.pro index fd8454c..86d3155 100644 --- a/tests/auto/qnetworkreply/qnetworkreply.pro +++ b/tests/auto/qnetworkreply/qnetworkreply.pro @@ -4,3 +4,4 @@ SUBDIRS = test requires(contains(QT_CONFIG,private_tests)) !wince*:SUBDIRS += echo +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qnetworkreply/smb-file.txt b/tests/auto/qnetworkreply/smb-file.txt new file mode 100644 index 0000000..73c3ac2 --- /dev/null +++ b/tests/auto/qnetworkreply/smb-file.txt @@ -0,0 +1 @@ +This is 34 bytes. Do not change...
\ No newline at end of file diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index ff79c09..9d942bf 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -522,8 +522,8 @@ public: active->connectToHost("127.0.0.1", server.serverPort()); #ifndef Q_OS_SYMBIAN // need more time as working with embedded - // device and testing from emualtor - // things tend to get slower + // device and testing from emualtor + // things tend to get slower if (!active->waitForConnected(1000)) return false; @@ -929,7 +929,7 @@ void tst_QNetworkReply::invalidProtocol() void tst_QNetworkReply::getFromData_data() { - QTest::addColumn<QString>("request"); + QTest::addColumn<QString>("request"); QTest::addColumn<QByteArray>("expected"); QTest::addColumn<QString>("mimeType"); @@ -1025,7 +1025,7 @@ void tst_QNetworkReply::getFromData() void tst_QNetworkReply::getFromFile() { - // create the file: + // create the file: QTemporaryFile file(QDir::currentPath() + "/temp-XXXXXX"); file.setAutoRemove(true); QVERIFY(file.open()); @@ -1073,11 +1073,14 @@ void tst_QNetworkReply::getFromFileSpecial_data() QTest::newRow("resource") << ":/resource" << "qrc:/resource"; QTest::newRow("search-path") << "srcdir:/rfc3252.txt" << "srcdir:/rfc3252.txt"; QTest::newRow("bigfile-path") << "srcdir:/bigfile" << "srcdir:/bigfile"; +#ifdef Q_OS_WIN + QTest::newRow("smb-path") << "srcdir:/smb-file.txt" << "file://" + QtNetworkSettings::winServerName() + "/testshare/test.pri"; +#endif } void tst_QNetworkReply::getFromFileSpecial() { - QFETCH(QString, fileName); + QFETCH(QString, fileName); QFETCH(QString, url); // open the resource so we can find out its size @@ -1107,7 +1110,7 @@ void tst_QNetworkReply::getFromFtp_data() void tst_QNetworkReply::getFromFtp() { - QFETCH(QString, referenceName); + QFETCH(QString, referenceName); QFETCH(QString, url); QFile reference(referenceName); @@ -1136,7 +1139,7 @@ void tst_QNetworkReply::getFromHttp_data() void tst_QNetworkReply::getFromHttp() { - QFETCH(QString, referenceName); + QFETCH(QString, referenceName); QFETCH(QString, url); QFile reference(referenceName); @@ -3456,8 +3459,8 @@ void tst_QNetworkReply::downloadProgress_data() QTest::newRow("big") << 4096; #else // it can run even with 4096 - // but it takes lot time - //especially on emulator + // but it takes lot time + //especially on emulator QTest::newRow("big") << 1024; #endif } @@ -3646,7 +3649,7 @@ void tst_QNetworkReply::receiveCookiesFromHttp_data() void tst_QNetworkReply::receiveCookiesFromHttp() { - QFETCH(QString, cookieString); + QFETCH(QString, cookieString); QByteArray data = cookieString.toLatin1() + '\n'; QUrl url("http://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/set-cookie.cgi"); diff --git a/tests/auto/qnetworkrequest/qnetworkrequest.pro b/tests/auto/qnetworkrequest/qnetworkrequest.pro index f576ba2..f96fd3b 100644 --- a/tests/auto/qnetworkrequest/qnetworkrequest.pro +++ b/tests/auto/qnetworkrequest/qnetworkrequest.pro @@ -2,3 +2,4 @@ load(qttest_p4) SOURCES += tst_qnetworkrequest.cpp QT = core network +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qnetworksession/lackey/main.cpp b/tests/auto/qnetworksession/lackey/main.cpp index 8759b52..ec2fad9 100644 --- a/tests/auto/qnetworksession/lackey/main.cpp +++ b/tests/auto/qnetworksession/lackey/main.cpp @@ -47,6 +47,8 @@ #include <QtNetwork/qnetworkconfigmanager.h> #include <QtNetwork/qnetworksession.h> +#include <QEventLoop> +#include <QTimer> #include <QDebug> QT_USE_NAMESPACE @@ -60,15 +62,14 @@ int main(int argc, char** argv) { QCoreApplication app(argc, argv); - // Cannot read/write to processes on WinCE or Symbian. - // Easiest alternative is to use sockets for IPC. - - QLocalSocket oopSocket; - - oopSocket.connectToServer("tst_qnetworksession"); - oopSocket.waitForConnected(-1); - + // Update configurations so that everything is up to date for this process too. + // Event loop is used to wait for awhile. QNetworkConfigurationManager manager; + manager.updateConfigurations(); + QEventLoop iIgnoreEventLoop; + QTimer::singleShot(3000, &iIgnoreEventLoop, SLOT(quit())); + iIgnoreEventLoop.exec(); + QList<QNetworkConfiguration> discovered = manager.allConfigurations(QNetworkConfiguration::Discovered); @@ -82,6 +83,13 @@ int main(int argc, char** argv) return NO_DISCOVERED_CONFIGURATIONS_ERROR; } + // Cannot read/write to processes on WinCE or Symbian. + // Easiest alternative is to use sockets for IPC. + QLocalSocket oopSocket; + + oopSocket.connectToServer("tst_qnetworksession"); + oopSocket.waitForConnected(-1); + qDebug() << "Lackey started"; QNetworkSession *session = 0; diff --git a/tests/auto/qnetworksession/qnetworksession.pro b/tests/auto/qnetworksession/qnetworksession.pro index a85925b..34761e5 100644 --- a/tests/auto/qnetworksession/qnetworksession.pro +++ b/tests/auto/qnetworksession/qnetworksession.pro @@ -1,2 +1,3 @@ TEMPLATE = subdirs SUBDIRS = lackey test +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp index 23cdc6a..934a50e 100644 --- a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp @@ -100,6 +100,7 @@ private slots: private: QNetworkConfigurationManager manager; + QMap<QString, bool> testsToRun; int inProcessSessionManagementCount; @@ -117,6 +118,7 @@ private: bool openSession(QNetworkSession *session); bool closeSession(QNetworkSession *session, bool lastSessionOnConfiguration = true); void updateConfigurations(); +void printConfigurations(); QNetworkConfiguration suitableConfiguration(QString bearerType, QNetworkConfiguration::Type configType); void tst_QNetworkSession::initTestCase() @@ -125,7 +127,19 @@ void tst_QNetworkSession::initTestCase() qRegisterMetaType<QNetworkSession::SessionError>("QNetworkSession::SessionError"); qRegisterMetaType<QNetworkConfiguration>("QNetworkConfiguration"); qRegisterMetaType<QNetworkConfiguration::Type>("QNetworkConfiguration::Type"); - + + // If you wish to skip tests, set value as false. This is often very convinient because tests are so lengthy. + // Better way still would be to make this readable from a file. + testsToRun["robustnessBombing"] = true; + testsToRun["outOfProcessSession"] = true; + testsToRun["invalidSession"] = true; + testsToRun["repeatedOpenClose"] = true; + testsToRun["roamingErrorCodes"] = true; + testsToRun["sessionStop"] = true; + testsToRun["sessionProperties"] = true; + testsToRun["userChoiceSession"] = true; + testsToRun["sessionOpenCloseStop"] = true; + #if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) iapconf = new Maemo::IAPConf("007"); iapconf->setValue("ipv4_type", "AUTO"); @@ -238,6 +252,10 @@ void tst_QNetworkSession::cleanupTestCase() // Robustness test for calling interfaces in nonsense order / with nonsense parameters void tst_QNetworkSession::robustnessBombing() { + if (!testsToRun["robustnessBombing"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } + QNetworkConfigurationManager mgr; QNetworkSession testSession(mgr.defaultConfiguration()); // Should not reset even session is not opened @@ -245,15 +263,14 @@ void tst_QNetworkSession::robustnessBombing() testSession.accept(); testSession.ignore(); testSession.reject(); - quint64 temp; - temp = testSession.bytesWritten(); - temp = testSession.bytesReceived(); - temp = testSession.activeTime(); } void tst_QNetworkSession::invalidSession() -{ +{ + if (!testsToRun["invalidSession"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } // 1. Verify that session created with invalid configuration remains in invalid state QNetworkSession session(QNetworkConfiguration(), 0); QVERIFY(!session.isOpen()); @@ -270,11 +287,24 @@ void tst_QNetworkSession::invalidSession() QVERIFY(error == QNetworkSession::InvalidConfigurationError); QVERIFY(session.error() == QNetworkSession::InvalidConfigurationError); QVERIFY(session.state() == QNetworkSession::Invalid); - + #ifdef QNETWORKSESSION_MANUAL_TESTS + + QNetworkConfiguration invalidatedConfig = suitableConfiguration("WLAN",QNetworkConfiguration::InternetAccessPoint); + if (invalidatedConfig.isValid()) { + // 3. Verify that invalidating a session after its successfully configured works + QNetworkSession invalidatedSession(invalidatedConfig); + qDebug() << "Delete the WLAN IAP from phone now (waiting 60 seconds): " << invalidatedConfig.name(); + QTest::qWait(60000); + QVERIFY(!invalidatedConfig.isValid()); + QVERIFY(invalidatedSession.state() == QNetworkSession::Invalid); + qDebug() << "Add the WLAN IAP back (waiting 60 seconds): " << invalidatedConfig.name(); + QTest::qWait(60000); + } + QNetworkConfiguration definedConfig = suitableConfiguration("WLAN",QNetworkConfiguration::InternetAccessPoint); if (definedConfig.isValid()) { - // 3. Verify that opening a session with defined configuration emits error and enters notavailable-state + // 4. Verify that opening a session with defined configuration emits error and enters notavailable-state // TODO these timer waits should be changed to waiting appropriate signals, now these wait excessively qDebug() << "Shutdown WLAN IAP (waiting 60 seconds): " << definedConfig.name(); QTest::qWait(60000); @@ -283,43 +313,27 @@ void tst_QNetworkSession::invalidSession() QNetworkSession definedSession(definedConfig); QSignalSpy errorSpy(&definedSession, SIGNAL(error(QNetworkSession::SessionError))); QNetworkSession::SessionError sessionError; + updateConfigurations(); definedSession.open(); +#ifdef Q_OS_SYMBIAN + // On symbian, the connection opening is tried even with defined state. + qDebug("Waiting for 10 seconds to all signals to propagate."); + QTest::qWait(10000); +#endif + updateConfigurations(); QVERIFY(definedConfig.isValid()); // Session remains valid QVERIFY(definedSession.state() == QNetworkSession::NotAvailable); // State is not available because WLAN is not in coverage QVERIFY(!errorSpy.isEmpty()); // Session tells with error about invalidated configuration sessionError = qvariant_cast<QNetworkSession::SessionError> (errorSpy.first().at(0)); - qDebug() << "Error code is: " << sessionError; QVERIFY(sessionError == QNetworkSession::InvalidConfigurationError); - qDebug() << "Turn the WLAN IAP back on (waiting 60 seconds): " << definedConfig.name(); QTest::qWait(60000); - updateConfigurations(); - + updateConfigurations(); QVERIFY(definedConfig.state() == QNetworkConfiguration::Discovered); } - - QNetworkConfiguration invalidatedConfig = suitableConfiguration("WLAN",QNetworkConfiguration::InternetAccessPoint); - if (invalidatedConfig.isValid()) { - // 4. Verify that invalidating a session after its successfully configured works - QNetworkSession invalidatedSession(invalidatedConfig); - QSignalSpy errorSpy(&invalidatedSession, SIGNAL(error(QNetworkSession::SessionError))); - QNetworkSession::SessionError sessionError; - - qDebug() << "Delete the WLAN IAP from phone now (waiting 60 seconds): " << invalidatedConfig.name(); - QTest::qWait(60000); - - invalidatedSession.open(); - QVERIFY(!invalidatedConfig.isValid()); - QVERIFY(invalidatedSession.state() == QNetworkSession::Invalid); - QVERIFY(!errorSpy.isEmpty()); - - sessionError = qvariant_cast<QNetworkSession::SessionError> (errorSpy.first().at(0)); - QVERIFY(sessionError == QNetworkSession::InvalidConfigurationError); - qDebug() << "Add the WLAN IAP back (waiting 60 seconds): " << invalidatedConfig.name(); - QTest::qWait(60000); - } + #endif } @@ -337,12 +351,12 @@ void tst_QNetworkSession::sessionProperties_data() void tst_QNetworkSession::sessionProperties() { + if (!testsToRun["sessionProperties"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } QFETCH(QNetworkConfiguration, configuration); - QNetworkSession session(configuration); - QVERIFY(session.configuration() == configuration); - QStringList validBearerNames = QStringList() << QLatin1String("Unknown") << QLatin1String("Ethernet") << QLatin1String("WLAN") @@ -356,9 +370,6 @@ void tst_QNetworkSession::sessionProperties() if (!configuration.isValid()) { QVERIFY(configuration.bearerName().isEmpty()); } else { - qDebug() << "Type:" << configuration.type() - << "Bearer:" << configuration.bearerName(); - switch (configuration.type()) { case QNetworkConfiguration::ServiceNetwork: @@ -374,9 +385,7 @@ void tst_QNetworkSession::sessionProperties() // QNetworkSession::interface() should return an invalid interface unless // session is in the connected state. - qDebug() << "Session state:" << session.state(); #ifndef QT_NO_NETWORKINTERFACE - qDebug() << "Session iface:" << session.interface().isValid() << session.interface().name(); #if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) // On Symbian emulator, the support for data bearers is limited QCOMPARE(session.state() == QNetworkSession::Connected, session.interface().isValid()); @@ -420,7 +429,12 @@ void tst_QNetworkSession::repeatedOpenClose_data() { } // Tests repeated-open close. -void tst_QNetworkSession::repeatedOpenClose() { +void tst_QNetworkSession::repeatedOpenClose() +{ + if (!testsToRun["repeatedOpenClose"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } + QFETCH(QString, bearerType); QFETCH(QNetworkConfiguration::Type, configurationType); QFETCH(int, repeatTimes); @@ -436,13 +450,20 @@ void tst_QNetworkSession::repeatedOpenClose() { !closeSession(&permanentSession)) { QSKIP("Unable to open/close session, skipping this round of repeated open-close test.", SkipSingle); } - for (int i = repeatTimes; i > 0; i--) { + for (int i = 0; i < repeatTimes; i++) { + qDebug() << "Opening, loop number " << i; QVERIFY(openSession(&permanentSession)); + qDebug() << "Closing, loop number, then waiting 5 seconds: " << i; QVERIFY(closeSession(&permanentSession)); + QTest::qWait(5000); } } -void tst_QNetworkSession::roamingErrorCodes() { +void tst_QNetworkSession::roamingErrorCodes() +{ + if (!testsToRun["roamingErrorCodes"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } #ifndef Q_OS_SYMBIAN QSKIP("Roaming supported on Symbian.", SkipAll); #else @@ -466,41 +487,11 @@ void tst_QNetworkSession::roamingErrorCodes() { adminIapSession.stop(); // requires NetworkControl capabilities QTRY_VERIFY(!errorSpy.isEmpty()); // wait for error signals QNetworkSession::SessionError error = qvariant_cast<QNetworkSession::SessionError>(errorSpy.first().at(0)); + QTest::qWait(2000); // Wait for a moment to all platform signals to propagate QVERIFY(error == QNetworkSession::SessionAbortedError); QVERIFY(iapSession.state() == QNetworkSession::Disconnected); QVERIFY(adminIapSession.state() == QNetworkSession::Disconnected); #endif // Q_OS_SYMBIAN - -#ifdef QNETWORKSESSION_MANUAL_TESTS - // Check for roaming error. - // Case requires that you have controllable WLAN in Internet SNAP (only). - QNetworkConfiguration snapConfig = suitableConfiguration("bearer_not_relevant_with_snaps", QNetworkConfiguration::ServiceNetwork); - if (!snapConfig.isValid()) { - QSKIP("No SNAP accessible, skipping test.", SkipAll); - } - QNetworkSession snapSession(snapConfig); - QVERIFY(openSession(&snapSession)); - QSignalSpy errorSpySnap(&snapSession, SIGNAL(error(QNetworkSession::SessionError))); - qDebug("Disconnect the WLAN now"); - QTRY_VERIFY(!errorSpySnap.isEmpty()); // wait for error signals - QVERIFY(errorSpySnap.count() == 1); - error = qvariant_cast<QNetworkSession::SessionError>(errorSpySnap.first().at(0)); - qDebug() << "Error received when turning off wlan on SNAP: " << error; - QVERIFY(error == QNetworkSession::RoamingError); - - qDebug("Connect the WLAN now"); - QTest::qWait(60000); // Wait for WLAN to get up - QNetworkConfiguration wlanIapConfig2 = suitableConfiguration("WLAN", QNetworkConfiguration::InternetAccessPoint); - QNetworkSession iapSession2(wlanIapConfig2); - QVERIFY(openSession(&iapSession2)); - QSignalSpy errorSpy2(&iapSession2, SIGNAL(error(QNetworkSession::SessionError))); - qDebug("Disconnect the WLAN now"); - QTRY_VERIFY(!errorSpy2.isEmpty()); // wait for error signals - QVERIFY(errorSpy2.count() == 1); - error = qvariant_cast<QNetworkSession::SessionError>(errorSpy2.first().at(0)); - QVERIFY(error == QNetworkSession::SessionAbortedError); - QVERIFY(iapSession2.state() == QNetworkSession::Disconnected); -#endif } @@ -515,6 +506,9 @@ void tst_QNetworkSession::sessionStop_data() { void tst_QNetworkSession::sessionStop() { + if (!testsToRun["sessionStop"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } #ifndef Q_OS_SYMBIAN QSKIP("Testcase contains mainly Symbian specific checks, because it is only platform to really support interface (IAP-level) Stop.", SkipAll); #endif @@ -522,6 +516,9 @@ void tst_QNetworkSession::sessionStop() QFETCH(QNetworkConfiguration::Type, configurationType); int configWaitdelayInMs = 2000; + + updateConfigurations(); + printConfigurations(); QNetworkConfiguration config = suitableConfiguration(bearerType, configurationType); if (!config.isValid()) { @@ -539,6 +536,9 @@ void tst_QNetworkSession::sessionStop() QSignalSpy closedSessionStateChangedSpy(&closedSession, SIGNAL(stateChanged(QNetworkSession::State))); QSignalSpy closedErrorSpy(&closedSession, SIGNAL(error(QNetworkSession::SessionError))); + QSignalSpy openedSessionClosedSpy(&openedSession, SIGNAL(closed())); + QSignalSpy openedSessionStateChangedSpy(&openedSession, SIGNAL(stateChanged(QNetworkSession::State))); + QSignalSpy innocentSessionClosedSpy(&innocentSession, SIGNAL(closed())); QSignalSpy innocentSessionStateChangedSpy(&innocentSession, SIGNAL(stateChanged(QNetworkSession::State))); QSignalSpy innocentErrorSpy(&innocentSession, SIGNAL(error(QNetworkSession::SessionError))); @@ -554,10 +554,18 @@ void tst_QNetworkSession::sessionStop() closedSessionClosedSpy.clear(); closedSessionStateChangedSpy.clear(); closedErrorSpy.clear(); + openedSessionStateChangedSpy.clear(); + openedSessionClosedSpy.clear(); + openedSession.stop(); - QVERIFY(openedSession.state() == QNetworkSession::Disconnected); + qDebug("Waiting for %d ms to get all configurationChange signals from platform.", configWaitdelayInMs); QTest::qWait(configWaitdelayInMs); // Wait to get all relevant configurationChange() signals + + // First to closing, then to disconnected + QVERIFY(openedSessionStateChangedSpy.count() == 2); + QVERIFY(!openedSessionClosedSpy.isEmpty()); + QVERIFY(openedSession.state() == QNetworkSession::Disconnected); QVERIFY(config.state() != QNetworkConfiguration::Active); // 2. Verify that stopping a session based on non-connected configuration does nothing @@ -583,18 +591,20 @@ void tst_QNetworkSession::sessionStop() // 3. Check that stopping a opened session affects also other opened session based on the same configuration. if (config.type() == QNetworkConfiguration::InternetAccessPoint) { qDebug("----------3. Check that stopping a opened session affects also other opened session based on the same configuration."); + QVERIFY(openSession(&openedSession)); QVERIFY(openSession(&innocentSession)); - + configChangeSpy.clear(); innocentSessionClosedSpy.clear(); innocentSessionStateChangedSpy.clear(); innocentErrorSpy.clear(); - + openedSession.stop(); qDebug("Waiting for %d ms to get all configurationChange signals from platform.", configWaitdelayInMs); QTest::qWait(configWaitdelayInMs); // Wait to get all relevant configurationChange() signals - + QTest::qWait(configWaitdelayInMs); // Wait to get all relevant configurationChange() signals + QVERIFY(!innocentSessionClosedSpy.isEmpty()); QVERIFY(!innocentSessionStateChangedSpy.isEmpty()); QVERIFY(!innocentErrorSpy.isEmpty()); @@ -614,14 +624,19 @@ void tst_QNetworkSession::sessionStop() if (config.type() == QNetworkConfiguration::ServiceNetwork) { qDebug("----------4. Skip for SNAP configuration."); } else if (config.type() == QNetworkConfiguration::InternetAccessPoint) { - qDebug("----------4. Check that stopping a non-opened session stops the other session based on the same configuration"); - QVERIFY(openSession(&innocentSession)); + qDebug("----------4. Check that stopping a non-opened session stops the other session based on the same configuration"); + qDebug("----------4.1 Opening innocent session"); + QVERIFY(openSession(&innocentSession)); qDebug("Waiting for %d ms after open to make sure all platform indications are propagated", configWaitdelayInMs); QTest::qWait(configWaitdelayInMs); + qDebug("----------4.2 Calling closedSession.stop()"); closedSession.stop(); qDebug("Waiting for %d ms to get all configurationChange signals from platform..", configWaitdelayInMs); QTest::qWait(configWaitdelayInMs); // Wait to get all relevant configurationChange() signals + QTest::qWait(configWaitdelayInMs); + QTest::qWait(configWaitdelayInMs); + QVERIFY(!innocentSessionClosedSpy.isEmpty()); QVERIFY(!innocentSessionStateChangedSpy.isEmpty()); QVERIFY(!innocentErrorSpy.isEmpty()); @@ -653,6 +668,9 @@ void tst_QNetworkSession::userChoiceSession_data() void tst_QNetworkSession::userChoiceSession() { + if (!testsToRun["userChoiceSession"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } QFETCH(QNetworkConfiguration, configuration); QVERIFY(configuration.type() == QNetworkConfiguration::UserChoice); @@ -682,7 +700,20 @@ void tst_QNetworkSession::userChoiceSession() session.open(); +#if defined(Q_OS_SYMBIAN) + // Opening & closing multiple connections in a row sometimes + // results hanging of connection opening on Symbian devices + // => If first open fails, wait a moment and try again. + if (!session.waitForOpened()) { + qDebug("**** Session open Timeout - Wait 5 seconds and try once again ****"); + session.close(); + QTest::qWait(5000); // Wait a while before trying to open session again + session.open(); + session.waitForOpened(); + } +#else session.waitForOpened(); +#endif if (session.isOpen()) QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty()); @@ -786,6 +817,9 @@ void tst_QNetworkSession::sessionOpenCloseStop_data() void tst_QNetworkSession::sessionOpenCloseStop() { + if (!testsToRun["sessionOpenCloseStop"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } QFETCH(QNetworkConfiguration, configuration); QFETCH(bool, forceSessionStop); @@ -818,7 +852,20 @@ void tst_QNetworkSession::sessionOpenCloseStop() session.open(); +#if defined(Q_OS_SYMBIAN) + // Opening & closing multiple connections in a row sometimes + // results hanging of connection opening on Symbian devices + // => If first open fails, wait a moment and try again. + if (!session.waitForOpened()) { + qDebug("**** Session open Timeout - Wait 5 seconds and try once again ****"); + session.close(); + QTest::qWait(5000); // Wait a while before trying to open session again + session.open(); + session.waitForOpened(); + } +#else session.waitForOpened(); +#endif if (session.isOpen()) QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty()); @@ -894,26 +941,30 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(session.error() == QNetworkSession::UnknownSessionError); session2.open(); - + QTRY_VERIFY(!sessionOpenedSpy2.isEmpty() || !errorSpy2.isEmpty()); + if (errorSpy2.isEmpty()) { + QVERIFY(session2.isOpen()); + QVERIFY(session2.state() == QNetworkSession::Connected); + } QVERIFY(session.isOpen()); - QVERIFY(session2.isOpen()); QVERIFY(session.state() == QNetworkSession::Connected); - QVERIFY(session2.state() == QNetworkSession::Connected); #ifndef QT_NO_NETWORKINTERFACE #if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) // On Symbian emulator, the support for data bearers is limited QVERIFY(session.interface().isValid()); #endif - QCOMPARE(session.interface().hardwareAddress(), session2.interface().hardwareAddress()); - QCOMPARE(session.interface().index(), session2.interface().index()); + if (errorSpy2.isEmpty()) { + QCOMPARE(session.interface().hardwareAddress(), session2.interface().hardwareAddress()); + QCOMPARE(session.interface().index(), session2.interface().index()); + } #endif } sessionOpenedSpy2.clear(); - if (forceSessionStop) { + if (forceSessionStop && session2.isOpen()) { // Test forcing the second session to stop the interface. QNetworkSession::State previousState = session.state(); #ifdef Q_CC_NOKIAX86 @@ -922,15 +973,17 @@ void tst_QNetworkSession::sessionOpenCloseStop() #else bool expectStateChange = previousState != QNetworkSession::Disconnected; #endif - session2.stop(); + // QNetworkSession::stop() must result either closed() signal + // or error() signal QTRY_VERIFY(!sessionClosedSpy2.isEmpty() || !errorSpy2.isEmpty()); - QVERIFY(!session2.isOpen()); if (!errorSpy2.isEmpty()) { - QVERIFY(!errorSpy.isEmpty()); + // QNetworkSession::stop() resulted error() signal for session2 + // => also session should emit error() signal + QTRY_VERIFY(!errorSpy.isEmpty()); // check for SessionAbortedError QNetworkSession::SessionError error = @@ -950,9 +1003,12 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(errorSpy.isEmpty()); QVERIFY(errorSpy2.isEmpty()); - + + // Wait for Disconnected state + QTRY_NOOP(session2.state() == QNetworkSession::Disconnected); + if (expectStateChange) - QTRY_VERIFY(stateChangedSpy2.count() >= 2 || !errorSpy2.isEmpty()); + QTRY_VERIFY(stateChangedSpy2.count() >= 1 || !errorSpy2.isEmpty()); if (!errorSpy2.isEmpty()) { QVERIFY(session2.state() == previousState); @@ -996,16 +1052,29 @@ void tst_QNetworkSession::sessionOpenCloseStop() state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(3).at(0)); QVERIFY(state == QNetworkSession::Disconnected); + + QTRY_VERIFY(session.state() == QNetworkSession::Roaming || + session.state() == QNetworkSession::Connected || + session.state() == QNetworkSession::Disconnected); + QTRY_VERIFY(stateChangedSpy.count() > 0); - state = qvariant_cast<QNetworkSession::State>(stateChangedSpy.at(0).at(0)); + state = qvariant_cast<QNetworkSession::State>(stateChangedSpy.at(stateChangedSpy.count() - 1).at(0)); + if (state == QNetworkSession::Roaming) { - QTRY_VERIFY(!errorSpy.isEmpty() || stateChangedSpy.count() > 1); - if (stateChangedSpy.count() > 1 && - qvariant_cast<QNetworkSession::State>(stateChangedSpy.at(1).at(0)) == - QNetworkSession::Connected) { - roamedSuccessfully = true; + QTRY_VERIFY(session.state() == QNetworkSession::Connected); + QTRY_VERIFY(session2.state() == QNetworkSession::Connected); + roamedSuccessfully = true; + } else if (state == QNetworkSession::Disconnected) { + QTRY_VERIFY(!errorSpy.isEmpty()); + QTRY_VERIFY(session2.state() == QNetworkSession::Disconnected); + } else if (state == QNetworkSession::Connected) { + QTRY_VERIFY(errorSpy.isEmpty()); + if (stateChangedSpy.count() > 1) { + state = qvariant_cast<QNetworkSession::State>(stateChangedSpy.at(stateChangedSpy.count() - 2).at(0)); + QVERIFY(state == QNetworkSession::Roaming); } - } + roamedSuccessfully = true; + } if (roamedSuccessfully) { QString configId = session.sessionProperty("ActiveConfiguration").toString(); @@ -1013,37 +1082,36 @@ void tst_QNetworkSession::sessionOpenCloseStop() QNetworkSession session3(config); QSignalSpy errorSpy3(&session3, SIGNAL(error(QNetworkSession::SessionError))); QSignalSpy sessionOpenedSpy3(&session3, SIGNAL(opened())); - session3.open(); - session3.waitForOpened(); - + session3.waitForOpened(); if (session.isOpen()) QVERIFY(!sessionOpenedSpy3.isEmpty() || !errorSpy3.isEmpty()); - session.stop(); - QTRY_VERIFY(session.state() == QNetworkSession::Disconnected); - QTRY_VERIFY(session3.state() == QNetworkSession::Disconnected); } #ifndef Q_CC_NOKIAX86 if (!roamedSuccessfully) QVERIFY(!errorSpy.isEmpty()); #endif } else { - QCOMPARE(stateChangedSpy2.count(), 2); - - QNetworkSession::State state = - qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(0).at(0)); - QVERIFY(state == QNetworkSession::Closing); - - state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(1).at(0)); - QVERIFY(state == QNetworkSession::Disconnected); + QTest::qWait(2000); // Wait awhile to get all signals from platform + + if (stateChangedSpy2.count() == 2) { + QNetworkSession::State state = + qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(0).at(0)); + QVERIFY(state == QNetworkSession::Closing); + state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(1).at(0)); + QVERIFY(state == QNetworkSession::Disconnected); + } else { // Assume .count() == 1 + QCOMPARE(stateChangedSpy2.count(), 1); + QNetworkSession::State state = qvariant_cast<QNetworkSession::State>(stateChangedSpy2.at(0).at(0)); + // Symbian version dependant. + QVERIFY(state == QNetworkSession::Disconnected); + } } QTRY_VERIFY(!sessionClosedSpy.isEmpty()); - QTRY_VERIFY(session.state() == QNetworkSession::Disconnected); - QTRY_VERIFY(session2.state() == QNetworkSession::Disconnected); } QVERIFY(errorSpy2.isEmpty()); @@ -1062,7 +1130,7 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(!session.isOpen()); #endif QVERIFY(!session2.isOpen()); - } else { + } else if (session2.isOpen()) { // Test closing the second session. { int stateChangedCountBeforeClose = stateChangedSpy2.count(); @@ -1161,11 +1229,15 @@ QDebug operator<<(QDebug debug, const QList<QNetworkConfiguration> &list) // at Discovered -state. void tst_QNetworkSession::outOfProcessSession() { - qDebug() << "START"; - + if (!testsToRun["outOfProcessSession"]) { + QSKIP("Temporary skip due to value set false (or it is missing) in testsToRun map", SkipAll); + } #if defined(Q_OS_SYMBIAN) && defined(__WINS__) QSKIP("Symbian emulator does not support two [QR]PRocesses linking a dll (QtBearer.dll) with global writeable static data.", SkipAll); #endif + updateConfigurations(); + QTest::qWait(2000); + QNetworkConfigurationManager manager; // Create a QNetworkConfigurationManager to detect configuration changes made in Lackey. This // is actually the essence of this testcase - to check that platform mediates/reflects changes @@ -1182,16 +1254,15 @@ void tst_QNetworkSession::outOfProcessSession() QLocalServer::removeServer("tst_qnetworksession"); oopServer.listen("tst_qnetworksession"); - qDebug() << "starting lackey"; QProcess lackey; lackey.start("lackey/lackey"); qDebug() << lackey.error() << lackey.errorString(); QVERIFY(lackey.waitForStarted()); - qDebug() << "waiting for connection"; + QVERIFY(oopServer.waitForNewConnection(-1)); QLocalSocket *oopSocket = oopServer.nextPendingConnection(); - qDebug() << "got connection"; + do { QByteArray output; @@ -1258,7 +1329,6 @@ void tst_QNetworkSession::outOfProcessSession() default: QSKIP("Lackey failed", SkipAll); } - qDebug("STOP"); } // A convinience / helper function for testcases. Return the first matching configuration. @@ -1269,6 +1339,7 @@ QNetworkConfiguration suitableConfiguration(QString bearerType, QNetworkConfigur // Refresh configurations and derive configurations matching given parameters. QNetworkConfigurationManager mgr; QSignalSpy updateSpy(&mgr, SIGNAL(updateCompleted())); + mgr.updateConfigurations(); QTRY_NOOP(updateSpy.count() == 1); if (updateSpy.count() != 1) { @@ -1277,8 +1348,7 @@ QNetworkConfiguration suitableConfiguration(QString bearerType, QNetworkConfigur } QList<QNetworkConfiguration> discoveredConfigs = mgr.allConfigurations(QNetworkConfiguration::Discovered); foreach(QNetworkConfiguration config, discoveredConfigs) { - if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { - // qDebug() << "Dumping config because is active: " << config.name(); + if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { discoveredConfigs.removeOne(config); } else if (config.type() != configType) { // qDebug() << "Dumping config because type (IAP/SNAP) mismatches: " << config.name(); @@ -1315,9 +1385,23 @@ void updateConfigurations() QTRY_NOOP(updateSpy.count() == 1); } +// A convinience-function: updates and prints all available confiurations and their states +void printConfigurations() +{ + QNetworkConfigurationManager manager; + QList<QNetworkConfiguration> allConfigs = + manager.allConfigurations(); + qDebug("tst_QNetworkSession::printConfigurations QNetworkConfigurationManager gives following configurations: "); + foreach(QNetworkConfiguration config, allConfigs) { + qDebug() << "Name of the configuration: " << config.name(); + qDebug() << "State of the configuration: " << config.state(); + } +} + // A convinience function for test-cases: opens the given configuration and return // true if it was done gracefully. bool openSession(QNetworkSession *session) { + bool result = true; QNetworkConfigurationManager mgr; QSignalSpy openedSpy(session, SIGNAL(opened())); QSignalSpy stateChangeSpy(session, SIGNAL(stateChanged(QNetworkSession::State))); @@ -1327,43 +1411,57 @@ bool openSession(QNetworkSession *session) { // active by some other session QNetworkConfiguration::StateFlags configInitState = session->configuration().state(); QNetworkSession::State sessionInitState = session->state(); + qDebug() << "tst_QNetworkSession::openSession() name of the configuration to be opened: " << session->configuration().name(); + qDebug() << "tst_QNetworkSession::openSession() state of the configuration to be opened: " << session->configuration().state(); + qDebug() << "tst_QNetworkSession::openSession() state of the session to be opened: " << session->state(); if (session->isOpen() || !session->sessionProperty("ActiveConfiguration").toString().isEmpty()) { qDebug("tst_QNetworkSession::openSession() failure: session was already open / active."); - return false; + result = false; } else { session->open(); session->waitForOpened(120000); // Bringing interfaces up and down may take time at platform } + QTest::qWait(5000); // Wait a moment to ensure all signals are propagated // Check that connection opening went by the book. Add checks here if more strictness needed. if (!session->isOpen()) { qDebug("tst_QNetworkSession::openSession() failure: QNetworkSession::open() failed."); - return false; + result = false; } if (openedSpy.count() != 1) { qDebug("tst_QNetworkSession::openSession() failure: QNetworkSession::opened() - signal not received."); - return false; + result = false; } if (!errorSpy.isEmpty()) { qDebug("tst_QNetworkSession::openSession() failure: QNetworkSession::error() - signal was detected."); - return false; + result = false; } if (sessionInitState != QNetworkSession::Connected && stateChangeSpy.isEmpty()) { qDebug("tst_QNetworkSession::openSession() failure: QNetworkSession::stateChanged() - signals not detected."); - return false; + result = false; } if (configInitState != QNetworkConfiguration::Active && configChangeSpy.isEmpty()) { qDebug("tst_QNetworkSession::openSession() failure: QNetworkConfigurationManager::configurationChanged() - signals not detected."); - return false; + result = false; } if (session->configuration().state() != QNetworkConfiguration::Active) { qDebug("tst_QNetworkSession::openSession() failure: session's configuration is not in 'Active' -state."); - return false; + qDebug() << "tst_QNetworkSession::openSession() state is: " << session->configuration().state(); + result = false; + } + if (result == false) { + qDebug() << "tst_QNetworkSession::openSession() opening session failed."; + } else { + qDebug() << "tst_QNetworkSession::openSession() opening session succeeded."; } - return true; + qDebug() << "tst_QNetworkSession::openSession() name of the configuration is: " << session->configuration().name(); + qDebug() << "tst_QNetworkSession::openSession() configuration state is: " << session->configuration().state(); + qDebug() << "tst_QNetworkSession::openSession() session state is: " << session->state(); + + return result; } // Helper function for closing opened session. Performs checks that @@ -1376,6 +1474,11 @@ bool closeSession(QNetworkSession *session, bool lastSessionOnConfiguration) { qDebug("tst_QNetworkSession::closeSession() failure: NULL session given"); return false; } + + qDebug() << "tst_QNetworkSession::closeSession() name of the configuration to be closed: " << session->configuration().name(); + qDebug() << "tst_QNetworkSession::closeSession() state of the configuration to be closed: " << session->configuration().state(); + qDebug() << "tst_QNetworkSession::closeSession() state of the session to be closed: " << session->state(); + if (session->state() != QNetworkSession::Connected || !session->isOpen()) { qDebug("tst_QNetworkSession::closeSession() failure: session is not opened."); @@ -1387,38 +1490,48 @@ bool closeSession(QNetworkSession *session, bool lastSessionOnConfiguration) { QSignalSpy sessionErrorSpy(session, SIGNAL(error(QNetworkSession::SessionError))); QSignalSpy configChangeSpy(&mgr, SIGNAL(configurationChanged(QNetworkConfiguration))); + bool result = true; session->close(); + QTest::qWait(5000); // Wait a moment so that all signals are propagated if (!sessionErrorSpy.isEmpty()) { qDebug("tst_QNetworkSession::closeSession() failure: QNetworkSession::error() received."); - return false; + result = false; } if (sessionClosedSpy.count() != 1) { qDebug("tst_QNetworkSession::closeSession() failure: QNetworkSession::closed() signal not received."); - return false; + result = false; } if (lastSessionOnConfiguration && sessionStateChangedSpy.isEmpty()) { qDebug("tst_QNetworkSession::closeSession() failure: QNetworkSession::stateChanged() signals not received."); - return false; + result = false; } if (lastSessionOnConfiguration && session->state() != QNetworkSession::Disconnected) { qDebug("tst_QNetworkSession::closeSession() failure: QNetworkSession is not in Disconnected -state"); - return false; + result = false; } QTRY_NOOP(!configChangeSpy.isEmpty()); if (lastSessionOnConfiguration && configChangeSpy.isEmpty()) { qDebug("tst_QNetworkSession::closeSession() failure: QNetworkConfigurationManager::configurationChanged() - signal not detected."); - return false; + result = false; } if (lastSessionOnConfiguration && session->configuration().state() == QNetworkConfiguration::Active) { qDebug("tst_QNetworkSession::closeSession() failure: session's configuration is still in active state."); - return false; + result = false; } - return true; + if (result == false) { + qDebug() << "tst_QNetworkSession::closeSession() closing session failed."; + } else { + qDebug() << "tst_QNetworkSession::closeSession() closing session succeeded."; + } + qDebug() << "tst_QNetworkSession::closeSession() name of the configuration is: " << session->configuration().name(); + qDebug() << "tst_QNetworkSession::closeSession() configuration state is: " << session->configuration().state(); + qDebug() << "tst_QNetworkSession::closeSession() session state is: " << session->state(); + return result; } void tst_QNetworkSession::sessionAutoClose_data() diff --git a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp index f8951f5..70f2ac3 100644 --- a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp +++ b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#define Q_TEST_QPIXMAPCACHE #include <QtTest/QtTest> @@ -152,6 +153,7 @@ void tst_QPixmapCache::setCacheLimit() p1 = new QPixmap(2, 3); key = QPixmapCache::insert(*p1); QVERIFY(QPixmapCache::find(key, p1) != 0); + p1->detach(); // dectach so that the cache thinks no-one is using it. QPixmapCache::setCacheLimit(0); QVERIFY(QPixmapCache::find(key, p1) == 0); QPixmapCache::setCacheLimit(1000); @@ -169,6 +171,8 @@ void tst_QPixmapCache::setCacheLimit() key = QPixmapCache::insert(*p1); QVERIFY(QPixmapCache::find(key, &p2) != 0); //we flush the cache + p1->detach(); + p2.detach(); QPixmapCache::setCacheLimit(0); QPixmapCache::setCacheLimit(1000); QPixmapCache::Key key2 = QPixmapCache::insert(*p1); @@ -180,21 +184,25 @@ void tst_QPixmapCache::setCacheLimit() delete p1; //Here we simulate the flushing when the app is idle - /*QPixmapCache::clear(); + QPixmapCache::clear(); QPixmapCache::setCacheLimit(originalCacheLimit); p1 = new QPixmap(300, 300); key = QPixmapCache::insert(*p1); + p1->detach(); QCOMPARE(getPrivate(key)->key, 1); key2 = QPixmapCache::insert(*p1); + p1->detach(); key2 = QPixmapCache::insert(*p1); + p1->detach(); QPixmapCache::Key key3 = QPixmapCache::insert(*p1); - QTest::qWait(32000); + p1->detach(); + QPixmapCache::flushDetachedPixmaps(); key2 = QPixmapCache::insert(*p1); QCOMPARE(getPrivate(key2)->key, 1); //This old key is not valid anymore after the flush QCOMPARE(getPrivate(key)->isValid, false); QVERIFY(QPixmapCache::find(key, &p2) == 0); - delete p1;*/ + delete p1; } void tst_QPixmapCache::find() @@ -225,12 +233,14 @@ void tst_QPixmapCache::find() QPixmapCache::clear(); QPixmapCache::setCacheLimit(128); - key = QPixmapCache::insert(p1); + QPixmap p4(10,10); + key = QPixmapCache::insert(p4); + p4.detach(); - //The int part of the API + QPixmap p5(10,10); QList<QPixmapCache::Key> keys; for (int i = 0; i < 4000; ++i) - QPixmapCache::insert(p1); + QPixmapCache::insert(p5); //at that time the first key has been erase because no more place in the cache QVERIFY(QPixmapCache::find(key, &p1) == 0); @@ -257,8 +267,10 @@ void tst_QPixmapCache::insert() QPixmapCache::insert("0", p1); // ditto - for (int j = 0; j < numberOfKeys; ++j) - QPixmapCache::insert(QString::number(j), p1); + for (int j = 0; j < numberOfKeys; ++j) { + QPixmap p3(10, 10); + QPixmapCache::insert(QString::number(j), p3); + } int num = 0; for (int k = 0; k < numberOfKeys; ++k) { @@ -286,8 +298,10 @@ void tst_QPixmapCache::insert() //The int part of the API // make sure it doesn't explode QList<QPixmapCache::Key> keys; - for (int i = 0; i < numberOfKeys; ++i) - keys.append(QPixmapCache::insert(p1)); + for (int i = 0; i < numberOfKeys; ++i) { + QPixmap p3(10,10); + keys.append(QPixmapCache::insert(p3)); + } num = 0; for (int k = 0; k < numberOfKeys; ++k) { diff --git a/tests/auto/qprinter/tst_qprinter.cpp b/tests/auto/qprinter/tst_qprinter.cpp index 49bddb2..8b79533 100644 --- a/tests/auto/qprinter/tst_qprinter.cpp +++ b/tests/auto/qprinter/tst_qprinter.cpp @@ -110,6 +110,7 @@ private slots: void testCurrentPage(); void taskQTBUG4497_reusePrinterOnDifferentFiles(); + void testPdfTitle(); private: }; @@ -417,7 +418,7 @@ void tst_QPrinter::testMargins() printer.setFullPage(fullpage); printer.setPageSize((QPrinter::PageSize)pagesize); if (withPainter) - painter = new QPainter(&printer); + painter = new QPainter(&printer); #ifdef QT3_SUPPORT Q3PaintDeviceMetrics metrics(&printer); @@ -1028,5 +1029,30 @@ void tst_QPrinter::testCurrentPage() } +void tst_QPrinter::testPdfTitle() +{ + // Check the document name is represented correctly in produced pdf + { + QPainter painter; + QPrinter printer; + // This string is just the UTF-8 encoding of the string: \()f ø hiragana o + const char title[]={0x5c, 0x28, 0x29, 0x66, 0xc3, 0xb8, 0xe3, 0x81, 0x8a, 0x00}; + printer.setOutputFileName("file.pdf"); + printer.setDocName(QString::fromUtf8(title)); + painter.begin(&printer); + painter.end(); + } + QFile file("file.pdf"); + QVERIFY(file.open(QIODevice::ReadOnly)); + // The we expect the title to appear in the PDF as: + // ASCII('\title (') UTF16(\\\(\)f ø hiragana o) ASCII(')'). + // which has the following binary representation + const char expected[] = { + 0x2f, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x20, 0x28, 0xfe, + 0xff, 0x00, 0x5c, 0x5c, 0x00, 0x5c, 0x28, 0x00, 0x5c, + 0x29, 0x00, 0x66, 0x00, 0xf8, 0x30, 0x4a, 0x29}; + QVERIFY(file.readAll().contains(QByteArray(expected, 26))); +} + QTEST_MAIN(tst_QPrinter) #include "tst_qprinter.moc" diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp index 849b8b2..ea527de 100644 --- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp @@ -133,6 +133,7 @@ private slots: void twoAnimations(); void deletedInUpdateCurrentTime(); void totalDuration(); + void zeroLoopCount(); }; tst_QPropertyAnimation::tst_QPropertyAnimation() @@ -1214,6 +1215,29 @@ void tst_QPropertyAnimation::totalDuration() QCOMPARE(anim.totalDuration(), 0); } +void tst_QPropertyAnimation::zeroLoopCount() +{ + DummyPropertyAnimation* anim; + anim = new DummyPropertyAnimation; + anim->setStartValue(0); + anim->setDuration(20); + anim->setLoopCount(0); + + QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); + QSignalSpy finishedSpy(anim, SIGNAL(finished())); + + QCOMPARE(anim->state(), QAnimationGroup::Stopped); + QCOMPARE(anim->currentValue().toInt(), 0); + QCOMPARE(runningSpy.count(), 0); + QCOMPARE(finishedSpy.count(), 0); + + anim->start(); + + QCOMPARE(anim->state(), QAnimationGroup::Stopped); + QCOMPARE(anim->currentValue().toInt(), 0); + QCOMPARE(runningSpy.count(), 0); + QCOMPARE(finishedSpy.count(), 0); +} QTEST_MAIN(tst_QPropertyAnimation) #include "tst_qpropertyanimation.moc" diff --git a/tests/auto/qsocketnotifier/qsocketnotifier.pro b/tests/auto/qsocketnotifier/qsocketnotifier.pro index ec924c1..c43c96a 100644 --- a/tests/auto/qsocketnotifier/qsocketnotifier.pro +++ b/tests/auto/qsocketnotifier/qsocketnotifier.pro @@ -6,5 +6,6 @@ requires(contains(QT_CONFIG,private_tests)) include(../qnativesocketengine/qsocketengine.pri) +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qsocks5socketengine/qsocks5socketengine.pro b/tests/auto/qsocks5socketengine/qsocks5socketengine.pro index 4a32852..cd5e6e7 100644 --- a/tests/auto/qsocks5socketengine/qsocks5socketengine.pro +++ b/tests/auto/qsocks5socketengine/qsocks5socketengine.pro @@ -11,6 +11,7 @@ QT = core network # Symbian toolchain does not support correct include semantics symbian:INCPATH+=..\..\..\include\QtNetwork\private +symbian: TARGET.CAPABILITY = NetworkServices requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 2339b21..992c95e 100644 --- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -138,6 +138,7 @@ private slots: void taskQTBUG_6205_doubleProxySelectionSetSourceModel(); void taskQTBUG_7537_appearsAndSort(); void taskQTBUG_7716_unnecessaryDynamicSorting(); + void taskQTBUG_10287_unnecessaryMapCreation(); void testMultipleProxiesWithSelection(); @@ -3038,5 +3039,65 @@ void tst_QSortFilterProxyModel::testMultipleProxiesWithSelection() } +class Model10287 : public QStandardItemModel +{ + Q_OBJECT + +public: + Model10287(QObject *parent = 0) + : QStandardItemModel(0, 1, parent) + { + parentItem = new QStandardItem("parent"); + parentItem->setData(false, Qt::UserRole); + appendRow(parentItem); + + childItem = new QStandardItem("child"); + childItem->setData(true, Qt::UserRole); + parentItem->appendRow(childItem); + + childItem2 = new QStandardItem("child2"); + childItem2->setData(true, Qt::UserRole); + parentItem->appendRow(childItem2); + } + + void removeChild() + { + childItem2->setData(false, Qt::UserRole); + parentItem->removeRow(0); + } + +private: + QStandardItem *parentItem, *childItem, *childItem2; +}; + +class Proxy10287 : public QSortFilterProxyModel +{ + Q_OBJECT + +public: + Proxy10287(QAbstractItemModel *model, QObject *parent = 0) + : QSortFilterProxyModel(parent) + { + setSourceModel(model); + setDynamicSortFilter(true); + } + +protected: + virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const + { + // Filter based on UserRole in model + QModelIndex i = sourceModel()->index(source_row, 0, source_parent); + return i.data(Qt::UserRole).toBool(); + } +}; + +void tst_QSortFilterProxyModel::taskQTBUG_10287_unnecessaryMapCreation() +{ + Model10287 m; + Proxy10287 p(&m); + m.removeChild(); + // No assert failure, it passes. +} + QTEST_MAIN(tst_QSortFilterProxyModel) #include "tst_qsortfilterproxymodel.moc" diff --git a/tests/auto/qsslcertificate/qsslcertificate.pro b/tests/auto/qsslcertificate/qsslcertificate.pro index b237f2e..d7671ea 100644 --- a/tests/auto/qsslcertificate/qsslcertificate.pro +++ b/tests/auto/qsslcertificate/qsslcertificate.pro @@ -24,4 +24,5 @@ wince*: { DEFINES += SRCDIR=\\\".\\\" } else:!symbian { DEFINES += SRCDIR=\\\"$$PWD/\\\" + TARGET.CAPABILITY = NetworkServices } diff --git a/tests/auto/qsslcipher/qsslcipher.pro b/tests/auto/qsslcipher/qsslcipher.pro index 6eae588..78fd387 100644 --- a/tests/auto/qsslcipher/qsslcipher.pro +++ b/tests/auto/qsslcipher/qsslcipher.pro @@ -14,4 +14,5 @@ win32 { } } +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qsslerror/qsslerror.pro b/tests/auto/qsslerror/qsslerror.pro index ee5872b..5b907fb 100644 --- a/tests/auto/qsslerror/qsslerror.pro +++ b/tests/auto/qsslerror/qsslerror.pro @@ -14,4 +14,5 @@ win32 { } } +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qsslkey/qsslkey.pro b/tests/auto/qsslkey/qsslkey.pro index 32138f8..e3eeef9 100644 --- a/tests/auto/qsslkey/qsslkey.pro +++ b/tests/auto/qsslkey/qsslkey.pro @@ -24,4 +24,5 @@ wince*: { DEFINES += SRCDIR=\\\".\\\" } else:!symbian { DEFINES+= SRCDIR=\\\"$$PWD\\\" + TARGET.CAPABILITY = NetworkServices } diff --git a/tests/auto/qsslsocket/qsslsocket.pro b/tests/auto/qsslsocket/qsslsocket.pro index 541b2d9..3557fc8 100644 --- a/tests/auto/qsslsocket/qsslsocket.pro +++ b/tests/auto/qsslsocket/qsslsocket.pro @@ -24,7 +24,7 @@ wince* { } else:symbian { DEFINES += QSSLSOCKET_CERTUNTRUSTED_WORKAROUND TARGET.EPOCHEAPSIZE="0x100 0x1000000" - TARGET.CAPABILITY="ALL -TCB" + TARGET.CAPABILITY=NetworkServices certFiles.sources = certs ssl.tar.gz certFiles.path = . diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp index e0512a9..e370309 100644 --- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -98,6 +98,7 @@ private slots: void complexWidgetFocus(); void task188195_baseBackground(); void task232085_spinBoxLineEditBg(); + void changeStyleInChangeEvent(); //at the end because it mess with the style. void widgetStyle(); @@ -1256,7 +1257,7 @@ void tst_QStyleSheetStyle::proxyStyle() QStyleOptionViewItemV4 opt; opt.initFrom(w); opt.features |= QStyleOptionViewItemV2::HasCheckIndicator; - QVERIFY(pb5->style()->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, + QVERIFY(pb5->style()->subElementRect(QStyle::SE_ItemViewItemCheckIndicator, &opt, pb5).width() == 3); delete w; delete proxy; @@ -1579,6 +1580,34 @@ void tst_QStyleSheetStyle::task232085_spinBoxLineEditBg() .toLocal8Bit().constData()); } +class ChangeEventWidget : public QWidget +{ public: + void changeEvent(QEvent * event) + { + if(event->type() == QEvent::StyleChange) { + static bool recurse = false; + if (!recurse) { + recurse = true; + QStyle *style = new QMotifStyle; + style->setParent(this); + setStyle(style); + recurse = false; + } + } + QWidget::changeEvent(event); + } +}; + +void tst_QStyleSheetStyle::changeStyleInChangeEvent() +{ //must not crash; + ChangeEventWidget wid; + wid.ensurePolished(); + wid.setStyleSheet(" /* */ "); + wid.ensurePolished(); + wid.setStyleSheet(" /* ** */ "); + wid.ensurePolished(); +} + QTEST_MAIN(tst_QStyleSheetStyle) #include "tst_qstylesheetstyle.moc" diff --git a/tests/auto/qtcpserver/qtcpserver.pro b/tests/auto/qtcpserver/qtcpserver.pro index fe5ea37..a3744a2 100644 --- a/tests/auto/qtcpserver/qtcpserver.pro +++ b/tests/auto/qtcpserver/qtcpserver.pro @@ -1,5 +1,6 @@ TEMPLATE = subdirs SUBDIRS = test crashingServer +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qtcpsocket/qtcpsocket.pro b/tests/auto/qtcpsocket/qtcpsocket.pro index 3d4eba3..370a695 100644 --- a/tests/auto/qtcpsocket/qtcpsocket.pro +++ b/tests/auto/qtcpsocket/qtcpsocket.pro @@ -6,3 +6,4 @@ wince*|symbian*|vxworks* : SUBDIRS = test requires(contains(QT_CONFIG,private_tests)) +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp index cd512a1..31cae40 100644 --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp @@ -144,6 +144,7 @@ private slots: void blockingIMAP(); void nonBlockingIMAP(); void hostNotFound(); + void timeoutConnect_data(); void timeoutConnect(); void delayedClose(); void partialRead(); @@ -544,19 +545,36 @@ void tst_QTcpSocket::hostNotFound() } //---------------------------------------------------------------------------------- +void tst_QTcpSocket::timeoutConnect_data() +{ + QTest::addColumn<QString>("address"); + QTest::newRow("host") << QtNetworkSettings::serverName(); + QTest::newRow("ip") << QtNetworkSettings::serverIP().toString(); +} void tst_QTcpSocket::timeoutConnect() { + QFETCH(QString, address); QTcpSocket *socket = newSocket(); - // Outgoing port 53 is firewalled in the Oslo office. - socket->connectToHost("cisco.com", 53); + QElapsedTimer timer; + timer.start(); + + // Port 1357 is configured to drop packets on the test server + socket->connectToHost(address, 1357); + QVERIFY(timer.elapsed() < 50); QVERIFY(!socket->waitForConnected(200)); QCOMPARE(socket->state(), QTcpSocket::UnconnectedState); QCOMPARE(int(socket->error()), int(QTcpSocket::SocketTimeoutError)); - socket->connectToHost("cisco.com", 53); - QTest::qSleep(50); + timer.start(); + socket->connectToHost(address, 1357); + QVERIFY(timer.elapsed() < 50); + QTimer::singleShot(50, &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(5); + QVERIFY(!QTestEventLoop::instance().timeout()); + QVERIFY(socket->state() == QTcpSocket::ConnectingState + || socket->state() == QTcpSocket::HostLookupState); socket->abort(); QCOMPARE(socket->state(), QTcpSocket::UnconnectedState); QCOMPARE(socket->openMode(), QIODevice::NotOpen); diff --git a/tests/auto/qudpsocket/qudpsocket.pro b/tests/auto/qudpsocket/qudpsocket.pro index 4ef8a40..8fd3545 100644 --- a/tests/auto/qudpsocket/qudpsocket.pro +++ b/tests/auto/qudpsocket/qudpsocket.pro @@ -1,5 +1,6 @@ TEMPLATE = subdirs SUBDIRS = test clientserver +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qurl/qurl.pro b/tests/auto/qurl/qurl.pro index 72c93bc..018bb38 100644 --- a/tests/auto/qurl/qurl.pro +++ b/tests/auto/qurl/qurl.pro @@ -1,3 +1,4 @@ load(qttest_p4) SOURCES += tst_qurl.cpp QT = core +symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 76e20b9..5d47aed 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -9514,6 +9514,8 @@ void tst_QWidget::destroyBackingStore() w.update(); QApplication::processEvents(); QCOMPARE(w.numPaintEvents, 2); +#else + QSKIP("Test case relies on developer build (AUTOTEST_EXPORT)", SkipAll); #endif } @@ -9992,6 +9994,7 @@ void tst_QWidget::focusProxyAndInputMethods() delete toplevel; } +#ifdef QT_BUILD_INTERNAL class scrollWidgetWBS : public QWidget { public: @@ -10011,9 +10014,11 @@ public: } } }; +#endif void tst_QWidget::scrollWithoutBackingStore() { +#ifdef QT_BUILD_INTERNAL scrollWidgetWBS scrollable; scrollable.resize(100,100); QLabel child(QString("@"),&scrollable); @@ -10027,6 +10032,9 @@ void tst_QWidget::scrollWithoutBackingStore() QCOMPARE(child.pos(),QPoint(25,25)); scrollable.enableBackingStore(); QCOMPARE(child.pos(),QPoint(25,25)); +#else + QSKIP("Test case relies on developer build (AUTOTEST_EXPORT)", SkipAll); +#endif } void tst_QWidget::taskQTBUG_7532_tabOrderWithFocusProxy() diff --git a/tests/auto/qwidgetaction/tst_qwidgetaction.cpp b/tests/auto/qwidgetaction/tst_qwidgetaction.cpp index 5dfcd43..53dc4b5 100644 --- a/tests/auto/qwidgetaction/tst_qwidgetaction.cpp +++ b/tests/auto/qwidgetaction/tst_qwidgetaction.cpp @@ -51,6 +51,8 @@ #include <qmainwindow.h> #include <qmenubar.h> +#include "../../shared/util.h" + //TESTED_CLASS= //TESTED_FILES= @@ -190,8 +192,8 @@ void tst_QWidgetAction::visibilityUpdate() QVERIFY(action->isVisible()); action->setVisible(false); - QTest::qWait(100); //the call to hide is delayed by the toolbar layout - QVERIFY(!combo->isVisible()); + qApp->processEvents(); //the call to hide is delayed by the toolbar layout + QTRY_VERIFY(!combo->isVisible()); delete action; // action also deletes combo diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp index be0d708..6fd9b93 100644 --- a/tests/auto/qxmlquery/tst_qxmlquery.cpp +++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp @@ -857,7 +857,7 @@ void tst_QXmlQuery::bindVariableXSLTSuccess() const stylesheet.bindVariable(QLatin1String("paramSelectWithTypeIntBoundWithBindVariableRequired"), QVariant(QLatin1String("param5"))); - stylesheet.setQuery(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/parameters.xsl")))); + stylesheet.setQuery(QUrl(inputFileAsURI(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/parameters.xsl")))); QVERIFY(stylesheet.isValid()); @@ -1798,11 +1798,11 @@ void tst_QXmlQuery::setFocusQUrl() const { QXmlQuery query(QXmlQuery::XSLT20); - const TestURIResolver resolver(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml")))); + const TestURIResolver resolver(QUrl(inputFileAsURI(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml")))); query.setUriResolver(&resolver); QVERIFY(query.setFocus(QUrl(QLatin1String("arbitraryURI")))); - query.setQuery(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/copyWholeDocument.xsl")))); + query.setQuery(QUrl(inputFileAsURI(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/copyWholeDocument.xsl")))); QVERIFY(query.isValid()); QBuffer result; @@ -2997,7 +2997,7 @@ void tst_QXmlQuery::setInitialTemplateNameQXmlName() const QCOMPARE(query.initialTemplateName(), name); - query.setQuery(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/namedTemplate.xsl")))); + query.setQuery(QUrl(inputFileAsURI(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/namedTemplate.xsl")))); QVERIFY(query.isValid()); QBuffer result; @@ -3059,7 +3059,7 @@ void tst_QXmlQuery::setNetworkAccessManager() const /* Ensure fn:doc() picks up the right QNetworkAccessManager. */ { NetworkOverrider networkOverrider(QUrl(QLatin1String("tag:example.com:DOESNOTEXIST")), - QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/queries/simpleDocument.xml")))); + QUrl(inputFileAsURI(QLatin1String(SRCDIR "../xmlpatterns/queries/simpleDocument.xml")))); QXmlQuery query; query.setNetworkAccessManager(&networkOverrider); @@ -3075,7 +3075,7 @@ void tst_QXmlQuery::setNetworkAccessManager() const /* Ensure setQuery() is using the right network manager. */ { NetworkOverrider networkOverrider(QUrl(QLatin1String("tag:example.com:DOESNOTEXIST")), - QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/queries/concat.xq")))); + QUrl(inputFileAsURI(QLatin1String(SRCDIR "../xmlpatterns/queries/concat.xq")))); QXmlQuery query; query.setNetworkAccessManager(&networkOverrider); @@ -3135,7 +3135,7 @@ void tst_QXmlQuery::multipleDocsAndFocus() const query.setQuery(QLatin1String("string(doc('") + inputFile(QLatin1String(SRCDIR "../xmlpatterns/queries/simpleDocument.xml")) + QLatin1String("'))")); - query.setFocus(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml")))); + query.setFocus(QUrl(inputFileAsURI(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml")))); query.setQuery(QLatin1String("string(.)")); QStringList result; @@ -3159,11 +3159,11 @@ void tst_QXmlQuery::multipleEvaluationsWithDifferentFocus() const QXmlQuery query; QStringList result; - query.setFocus(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml")))); + query.setFocus(QUrl(inputFileAsURI(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml")))); query.setQuery(QLatin1String("string(.)")); QVERIFY(query.evaluateTo(&result)); - query.setFocus(QUrl(inputFile(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml")))); + query.setFocus(QUrl(inputFileAsURI(QLatin1String(SRCDIR "../xmlpatterns/stylesheets/documentElement.xml")))); QVERIFY(query.evaluateTo(&result)); } diff --git a/tests/auto/xmlpatternsxqts/tst_suitetest.cpp b/tests/auto/xmlpatternsxqts/tst_suitetest.cpp index 64120c7..ec63858 100644 --- a/tests/auto/xmlpatternsxqts/tst_suitetest.cpp +++ b/tests/auto/xmlpatternsxqts/tst_suitetest.cpp @@ -89,10 +89,17 @@ void tst_SuiteTest::runTestSuite() const TestSuite::SuiteType suiteType; switch (m_suiteType) { - case XQuerySuite: suiteType = TestSuite::XQuerySuite; - case XsltSuite: suiteType = TestSuite::XsltSuite; - case XsdSuite: suiteType = TestSuite::XsdSuite; - default: break; + case XQuerySuite: + suiteType = TestSuite::XQuerySuite; + break; + case XsltSuite: + suiteType = TestSuite::XsltSuite; + break; + case XsdSuite: + suiteType = TestSuite::XsdSuite; + break; + default: + break; } TestSuite *const ts = TestSuite::openCatalog(catalogPath, errMsg, true, suiteType); |