summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-11-17 05:02:50 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-11-17 05:02:50 (GMT)
commite48194ee16a35eab44b4663b3d38f72def5d8803 (patch)
treeaf3e5c83ffab9dbcfb61df72ec39de32ceb67098 /tests/auto
parent9600df5fa3661addb8aaa817e64a2bc6c3abbcc3 (diff)
parent8b4c4ae19f95bafdbb0315c97edb313a6a3d51ec (diff)
downloadQt-e48194ee16a35eab44b4663b3d38f72def5d8803.zip
Qt-e48194ee16a35eab44b4663b3d38f72def5d8803.tar.gz
Qt-e48194ee16a35eab44b4663b3d38f72def5d8803.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/anchors/data/anchors.qml18
-rw-r--r--tests/auto/declarative/anchors/data/illegal1.qml12
-rw-r--r--tests/auto/declarative/anchors/data/illegal2.qml13
-rw-r--r--tests/auto/declarative/anchors/data/illegal3.qml12
-rw-r--r--tests/auto/declarative/anchors/tst_anchors.cpp96
-rw-r--r--tests/auto/declarative/animations/tst_animations.cpp105
-rw-r--r--tests/auto/declarative/debugger/debugger.pro5
-rw-r--r--tests/auto/declarative/debugger/debugutil.cpp173
-rw-r--r--tests/auto/declarative/debugger/debugutil_p.h142
-rw-r--r--tests/auto/declarative/declarative.pro9
-rw-r--r--tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml57
-rw-r--r--tests/auto/declarative/graphicswidgets/graphicswidgets.pro8
-rw-r--r--tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp77
-rw-r--r--tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp286
-rw-r--r--tests/auto/declarative/qmldebug/qmldebug.pro (renamed from tests/auto/declarative/debugger/qmldebug/qmldebug.pro)4
-rw-r--r--tests/auto/declarative/qmldebug/tst_qmldebug.cpp (renamed from tests/auto/declarative/debugger/qmldebug/tst_qmldebug.cpp)2
-rw-r--r--tests/auto/declarative/qmldebugclient/qmldebugclient.pro (renamed from tests/auto/declarative/debugger/qmldebugclient/qmldebugclient.pro)4
-rw-r--r--tests/auto/declarative/qmldebugclient/tst_qmldebugclient.cpp (renamed from tests/auto/declarative/debugger/qmldebugclient/tst_qmldebugclient.cpp)2
-rw-r--r--tests/auto/declarative/qmldebugservice/qmldebugservice.pro (renamed from tests/auto/declarative/debugger/qmldebugservice/qmldebugservice.pro)4
-rw-r--r--tests/auto/declarative/qmldebugservice/tst_qmldebugservice.cpp (renamed from tests/auto/declarative/debugger/qmldebugservice/tst_qmldebugservice.cpp)2
-rw-r--r--tests/auto/declarative/qmlengine/tst_qmlengine.cpp8
-rw-r--r--tests/auto/declarative/qmlinstruction/qmlinstruction.pro6
-rw-r--r--tests/auto/declarative/qmlinstruction/tst_qmlinstruction.cpp609
-rw-r--r--tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp18
-rw-r--r--tests/auto/declarative/qpacketprotocol/qpacketprotocol.pro (renamed from tests/auto/declarative/debugger/qpacketprotocol/qpacketprotocol.pro)4
-rw-r--r--tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp (renamed from tests/auto/declarative/debugger/qpacketprotocol/tst_qpacketprotocol.cpp)2
-rw-r--r--tests/auto/declarative/sql/data/2-selection-bindnames.js24
-rw-r--r--tests/auto/declarative/sql/data/6-iteration-efficient.js6
-rw-r--r--tests/auto/declarative/sql/tst_sql.cpp7
29 files changed, 1252 insertions, 463 deletions
diff --git a/tests/auto/declarative/anchors/data/anchors.qml b/tests/auto/declarative/anchors/data/anchors.qml
index b880762..b64d0b0 100644
--- a/tests/auto/declarative/anchors/data/anchors.qml
+++ b/tests/auto/declarative/anchors/data/anchors.qml
@@ -130,6 +130,24 @@ Rectangle {
anchors.bottom: masterRect.bottom
anchors.bottomMargin: 5
}
+ Rectangle {
+ id: rect24; objectName: "rect24"
+ width: 10; height: 10
+ anchors.horizontalCenter: masterRect.left
+ anchors.horizontalCenterOffset: width/2
+ }
+ Rectangle {
+ id: rect25; objectName: "rect25"
+ width: 10; height: 10
+ anchors.verticalCenter: rect12.top
+ anchors.verticalCenterOffset: height/2
+ }
+ Rectangle {
+ id: rect26; objectName: "rect26"
+ width: 10; height: 10
+ anchors.baseline: masterRect.top
+ anchors.baselineOffset: height/2
+ }
Text {
id: text1; objectName: "text1"
y: 200;
diff --git a/tests/auto/declarative/anchors/data/illegal1.qml b/tests/auto/declarative/anchors/data/illegal1.qml
deleted file mode 100644
index 53af443..0000000
--- a/tests/auto/declarative/anchors/data/illegal1.qml
+++ /dev/null
@@ -1,12 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: rect
- width: 120; height: 200; color: "white"
- Rectangle { id: theRect; width: 100; height: 100 }
- Rectangle {
- anchors.left: theRect.left
- anchors.right: theRect.right
- anchors.horizontalCenter: theRect.horizontalCenter
- }
-}
diff --git a/tests/auto/declarative/anchors/data/illegal2.qml b/tests/auto/declarative/anchors/data/illegal2.qml
deleted file mode 100644
index 978be52..0000000
--- a/tests/auto/declarative/anchors/data/illegal2.qml
+++ /dev/null
@@ -1,13 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: rect
- width: 120; height: 200; color: "white"
- Text { id: text1; text: "Hello" }
- Text {
- id: text2;
- anchors.baseline: text1.baseline;
- anchors.top: text1.top;
- text: "World"
- }
-}
diff --git a/tests/auto/declarative/anchors/data/illegal3.qml b/tests/auto/declarative/anchors/data/illegal3.qml
deleted file mode 100644
index 065ceb5..0000000
--- a/tests/auto/declarative/anchors/data/illegal3.qml
+++ /dev/null
@@ -1,12 +0,0 @@
-import Qt 4.6
-
-Rectangle {
- id: rect
- width: 120; height: 200; color: "white"
- Item {
- Rectangle { id: theRect; width: 100; height: 100 }
- }
- Rectangle {
- anchors.left: theRect.left
- }
-}
diff --git a/tests/auto/declarative/anchors/tst_anchors.cpp b/tests/auto/declarative/anchors/tst_anchors.cpp
index 34c1e01..22f8327 100644
--- a/tests/auto/declarative/anchors/tst_anchors.cpp
+++ b/tests/auto/declarative/anchors/tst_anchors.cpp
@@ -60,6 +60,7 @@ private slots:
void basicAnchors();
void loops();
void illegalSets();
+ void illegalSets_data();
void reset();
void nullItem();
void crash1();
@@ -143,6 +144,11 @@ void tst_anchors::basicAnchors()
QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect23"))->width(), 86.0);
QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect23"))->height(), 10.0);
+ // offsets
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect24"))->x(), 26.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect25"))->y(), 60.0);
+ QCOMPARE(findItem<QmlGraphicsRectangle>(view->root(), QLatin1String("rect26"))->y(), 5.0);
+
//baseline
QmlGraphicsText *text1 = findItem<QmlGraphicsText>(view->root(), QLatin1String("text1"));
QmlGraphicsText *text2 = findItem<QmlGraphicsText>(view->root(), QLatin1String("text2"));
@@ -185,44 +191,71 @@ void tst_anchors::loops()
void tst_anchors::illegalSets()
{
- {
- QmlView *view = new QmlView;
+ QFETCH(QString, qml);
+ QFETCH(QString, warning);
+
+ QTest::ignoreMessage(QtWarningMsg, warning.toLatin1());
+
+ QmlEngine engine;
+ QmlComponent component(&engine, QByteArray("import Qt 4.6\n" + qml.toUtf8()), QUrl("file://"));
+ if (!component.isReady())
+ qWarning() << "Test errors:" << component.errors();
+ QVERIFY(component.isReady());
+ QObject *o = component.create();
+ delete o;
+}
- view->setUrl(QUrl("file://" SRCDIR "/data/illegal1.qml"));
+void tst_anchors::illegalSets_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QString>("warning");
- QString expect = "QML QmlGraphicsRectangle (" + view->url().toString() + ":7:5" + ") Can't specify left, right, and hcenter anchors.";
- QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
- view->execute();
- qApp->processEvents();
+ QTest::newRow("H - too many anchors")
+ << "Rectangle { id: rect; Rectangle { anchors.left: rect.left; anchors.right: rect.right; anchors.horizontalCenter: rect.horizontalCenter } }"
+ << "QML QmlGraphicsRectangle (file::2:23) Can't specify left, right, and hcenter anchors.";
- delete view;
- }
+ QTest::newRow("H - anchor to V")
+ << "Rectangle { Rectangle { anchors.left: parent.top } }"
+ << "QML QmlGraphicsRectangle (file::2:13) Can't anchor a horizontal edge to a vertical edge.";
- {
- QmlView *view = new QmlView;
+ QTest::newRow("H - anchor to non parent/sibling")
+ << "Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.left: rect.left } }"
+ << "QML QmlGraphicsRectangle (file::2:45) Can't anchor to an item that isn't a parent or sibling.";
- view->setUrl(QUrl("file://" SRCDIR "/data/illegal2.qml"));
+ QTest::newRow("H - anchor to self")
+ << "Rectangle { id: rect; anchors.left: rect.left }"
+ << "QML QmlGraphicsRectangle (file::2:1) Can't anchor item to self.";
- QString expect = "QML QmlGraphicsText (" + view->url().toString() + ":7:5" + ") Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors.";
- QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
- view->execute();
- //qApp->processEvents();
- delete view;
- }
+ QTest::newRow("V - too many anchors")
+ << "Rectangle { id: rect; Rectangle { anchors.top: rect.top; anchors.bottom: rect.bottom; anchors.verticalCenter: rect.verticalCenter } }"
+ << "QML QmlGraphicsRectangle (file::2:23) Can't specify top, bottom, and vcenter anchors.";
- {
- QmlView *view = new QmlView;
+ QTest::newRow("V - too many anchors with baseline")
+ << "Rectangle { Text { id: text1; text: \"Hello\" } Text { anchors.baseline: text1.baseline; anchors.top: text1.top; } }"
+ << "QML QmlGraphicsText (file::2:47) Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors.";
- view->setUrl(QUrl("file://" SRCDIR "/data/illegal3.qml"));
+ QTest::newRow("V - anchor to H")
+ << "Rectangle { Rectangle { anchors.top: parent.left } }"
+ << "QML QmlGraphicsRectangle (file::2:13) Can't anchor a vertical edge to a horizontal edge.";
- QString expect = "QML QmlGraphicsRectangle (" + view->url().toString() + ":9:5" + ") Can't anchor to an item that isn't a parent or sibling.";
- QTest::ignoreMessage(QtWarningMsg, expect.toLatin1());
- view->execute();
- //qApp->processEvents();
+ QTest::newRow("V - anchor to non parent/sibling")
+ << "Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.top: rect.top } }"
+ << "QML QmlGraphicsRectangle (file::2:45) Can't anchor to an item that isn't a parent or sibling.";
- delete view;
- }
+ QTest::newRow("V - anchor to self")
+ << "Rectangle { id: rect; anchors.top: rect.top }"
+ << "QML QmlGraphicsRectangle (file::2:1) Can't anchor item to self.";
+
+
+ QTest::newRow("centerIn - anchor to non parent/sibling")
+ << "Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.centerIn: rect} }"
+ << "QML QmlGraphicsRectangle (file::2:45) Can't anchor to an item that isn't a parent or sibling.";
+
+
+ QTest::newRow("fill - anchor to non parent/sibling")
+ << "Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.fill: rect} }"
+ << "QML QmlGraphicsRectangle (file::2:45) Can't anchor to an item that isn't a parent or sibling.";
}
void tst_anchors::reset()
@@ -243,10 +276,17 @@ void tst_anchors::reset()
void tst_anchors::nullItem()
{
QmlGraphicsAnchorLine anchor;
+ QmlGraphicsItem *item;
QTest::ignoreMessage(QtWarningMsg, "QML QmlGraphicsItem (unknown location) Can't anchor to a null item.");
- QmlGraphicsItem *item = new QmlGraphicsItem;
+ item = new QmlGraphicsItem;
+ item->anchors()->setLeft(anchor);
+ delete item;
+
+ QTest::ignoreMessage(QtWarningMsg, "QML QmlGraphicsItem (unknown location) Can't anchor to a null item.");
+ item = new QmlGraphicsItem;
item->anchors()->setBottom(anchor);
+ delete item;
}
void tst_anchors::crash1()
diff --git a/tests/auto/declarative/animations/tst_animations.cpp b/tests/auto/declarative/animations/tst_animations.cpp
index 2692cb6..2506337 100644
--- a/tests/auto/declarative/animations/tst_animations.cpp
+++ b/tests/auto/declarative/animations/tst_animations.cpp
@@ -57,6 +57,8 @@ private slots:
void simpleNumber();
void simpleColor();
void alwaysRunToEnd();
+ void complete();
+ void resume();
void dotProperty();
void badTypes();
void badProperties();
@@ -64,6 +66,7 @@ private slots:
void properties();
void propertiesTransition();
void easingStringConversion();
+ void invalidDuration();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -96,6 +99,7 @@ void tst_animations::simpleProperty()
QVERIFY(animation.isRunning());
QVERIFY(animation.isPaused());
animation.setCurrentTime(125);
+ QVERIFY(animation.currentTime() == 125);
QCOMPARE(rect.pos(), QPointF(100,100));
}
@@ -120,6 +124,7 @@ void tst_animations::simpleNumber()
QVERIFY(animation.isRunning());
QVERIFY(animation.isPaused());
animation.setCurrentTime(125);
+ QVERIFY(animation.currentTime() == 125);
QCOMPARE(rect.x(), qreal(100));
}
@@ -144,6 +149,7 @@ void tst_animations::simpleColor()
QVERIFY(animation.isRunning());
QVERIFY(animation.isPaused());
animation.setCurrentTime(125);
+ QVERIFY(animation.currentTime() == 125);
QCOMPARE(rect.color(), QColor::fromRgbF(0.498039, 0, 0.498039, 1));
}
@@ -157,6 +163,8 @@ void tst_animations::alwaysRunToEnd()
animation.setDuration(1000);
animation.setRepeat(true);
animation.setAlwaysRunToEnd(true);
+ QVERIFY(animation.repeat() == true);
+ QVERIFY(animation.alwaysRunToEnd() == true);
animation.start();
QTest::qWait(1500);
animation.stop();
@@ -165,6 +173,54 @@ void tst_animations::alwaysRunToEnd()
QTIMED_COMPARE(rect.x(), qreal(200));
}
+void tst_animations::complete()
+{
+ QmlGraphicsRectangle rect;
+ QmlPropertyAnimation animation;
+ animation.setTarget(&rect);
+ animation.setProperty("x");
+ animation.setFrom(1);
+ animation.setTo(200);
+ animation.setDuration(500);
+ QVERIFY(animation.from() == 1);
+ animation.start();
+ QTest::qWait(50);
+ animation.stop();
+ QVERIFY(rect.x() != qreal(200));
+ animation.start();
+ QTest::qWait(50);
+ QVERIFY(animation.isRunning());
+ animation.complete();
+ QCOMPARE(rect.x(), qreal(200));
+}
+
+void tst_animations::resume()
+{
+ QmlGraphicsRectangle rect;
+ QmlPropertyAnimation animation;
+ animation.setTarget(&rect);
+ animation.setProperty("x");
+ animation.setFrom(10);
+ animation.setTo(200);
+ animation.setDuration(500);
+ QVERIFY(animation.from() == 10);
+
+ animation.start();
+ QTest::qWait(50);
+ animation.pause();
+ qreal x = rect.x();
+ QVERIFY(x != qreal(200));
+ QVERIFY(animation.isRunning());
+ QVERIFY(animation.isPaused());
+
+ animation.resume();
+ QVERIFY(animation.isRunning());
+ QVERIFY(!animation.isPaused());
+ QTest::qWait(50);
+ animation.stop();
+ QVERIFY(rect.x() > x);
+}
+
void tst_animations::dotProperty()
{
QmlGraphicsRectangle rect;
@@ -180,6 +236,7 @@ void tst_animations::dotProperty()
animation.start();
animation.pause();
animation.setCurrentTime(125);
+ QVERIFY(animation.currentTime() == 125);
QCOMPARE(rect.border()->width(), 5);
}
@@ -427,6 +484,7 @@ void tst_animations::easingStringConversion()
{
QmlNumberAnimation *animation = new QmlNumberAnimation;
animation->setEasing("easeInOutQuad");
+ QCOMPARE(animation->easing(),QLatin1String("easeInOutQuad"));
QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve(), QEasingCurve(QEasingCurve::InOutQuad));
animation->setEasing("OutQuad");
@@ -436,9 +494,56 @@ void tst_animations::easingStringConversion()
QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::OutBounce);
QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().amplitude(), qreal(5));
+ animation->setEasing("easeOutElastic(amplitude: 5, period: 3)");
+ QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::OutElastic);
+ QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().amplitude(), qreal(5));
+ QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().period(), qreal(3));
+
+ animation->setEasing("easeInOutBack(overshoot: 2)");
+ QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::InOutBack);
+ QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().overshoot(), qreal(2));
+
+ QTest::ignoreMessage(QtWarningMsg, "QML QmlNumberAnimation (unknown location) Unmatched parenthesis in easing function \"easeInOutBack(overshoot: 2\"");
+ animation->setEasing("easeInOutBack(overshoot: 2");
+ QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::Linear);
+
+ QTest::ignoreMessage(QtWarningMsg, "QML QmlNumberAnimation (unknown location) Easing function \"InOutBack(overshoot: 2)\" must start with \"ease\"");
+ animation->setEasing("InOutBack(overshoot: 2)");
+ QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::Linear);
+
+ QTest::ignoreMessage(QtWarningMsg, "QML QmlNumberAnimation (unknown location) Unknown easing curve \"NonExistantEase\"");
+ animation->setEasing("NonExistantEase");
+ QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::Linear);
+
+ QTest::ignoreMessage(QtWarningMsg, "QML QmlNumberAnimation (unknown location) Improperly specified parameter in easing function \"easeInOutElastic(amplitude 5)\"");
+ animation->setEasing("easeInOutElastic(amplitude 5)");
+ QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::InOutElastic);
+
+ QTest::ignoreMessage(QtWarningMsg, "QML QmlNumberAnimation (unknown location) Improperly specified parameter in easing function \"easeInOutElastic(amplitude: yes)\"");
+ animation->setEasing("easeInOutElastic(amplitude: yes)");
+ QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::InOutElastic);
+ QVERIFY(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().amplitude() != qreal(5));
+
+ QTest::ignoreMessage(QtWarningMsg, "QML QmlNumberAnimation (unknown location) Unknown easing parameter \"nonexistantproperty\"");
+ animation->setEasing("easeOutQuad(nonexistantproperty: 12)");
+ QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::OutQuad);
+
delete animation;
}
+void tst_animations::invalidDuration()
+{
+ QmlPropertyAnimation *animation = new QmlPropertyAnimation;
+ QTest::ignoreMessage(QtWarningMsg, "QML QmlPropertyAnimation (unknown location) Cannot set a duration of < 0");
+ animation->setDuration(-1);
+ QCOMPARE(animation->duration(), 250);
+
+ QmlPauseAnimation *pauseAnimation = new QmlPauseAnimation;
+ QTest::ignoreMessage(QtWarningMsg, "QML QmlPauseAnimation (unknown location) Cannot set a duration of < 0");
+ pauseAnimation->setDuration(-1);
+ QCOMPARE(pauseAnimation->duration(), 250);
+}
+
QTEST_MAIN(tst_animations)
#include "tst_animations.moc"
diff --git a/tests/auto/declarative/debugger/debugger.pro b/tests/auto/declarative/debugger/debugger.pro
deleted file mode 100644
index a341ca9..0000000
--- a/tests/auto/declarative/debugger/debugger.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS += qmldebug \
- qmldebugclient \
- qmldebugservice \
- qpacketprotocol
diff --git a/tests/auto/declarative/debugger/debugutil.cpp b/tests/auto/declarative/debugger/debugutil.cpp
deleted file mode 100644
index 7008529..0000000
--- a/tests/auto/declarative/debugger/debugutil.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 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 <QSignalSpy>
-#include <QEventLoop>
-#include <QTimer>
-
-#include <private/qmldebugclient_p.h>
-#include <private/qmldebugservice_p.h>
-
-#include "debugutil_p.h"
-
-bool QmlDebugTest::waitForSignal(QObject *receiver, const char *member, int timeout) {
- QEventLoop loop;
- QTimer timer;
- QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
- QObject::connect(receiver, member, &loop, SLOT(quit()));
- timer.start(timeout);
- loop.exec();
- return timer.isActive();
-}
-
-
-QmlDebugTestData::QmlDebugTestData(QEventLoop *el)
- : exitCode(-1), loop(el)
-{
-}
-
-QmlDebugTestData::~QmlDebugTestData()
-{
- qDeleteAll(items);
-}
-
-void QmlDebugTestData::testsFinished(int code)
-{
- exitCode = code;
- loop->quit();
-}
-
-
-
-QmlDebugTestService::QmlDebugTestService(const QString &s, QObject *parent)
- : QmlDebugService(s, parent), enabled(false)
-{
-}
-
-void QmlDebugTestService::messageReceived(const QByteArray &ba)
-{
- sendMessage(ba);
-}
-
-void QmlDebugTestService::enabledChanged(bool e)
-{
- emit enabledStateChanged();
- enabled = e;
-}
-
-
-QmlDebugTestClient::QmlDebugTestClient(const QString &s, QmlDebugConnection *c)
- : QmlDebugClient(s, c)
-{
-}
-
-QByteArray QmlDebugTestClient::waitForResponse()
-{
- QSignalSpy spy(this, SIGNAL(serverMessage(QByteArray)));
- QmlDebugTest::waitForSignal(this, SIGNAL(serverMessage(QByteArray)));
- if (spy.count() == 0) {
- qWarning() << "tst_QmlDebugClient: no response from server!";
- return QByteArray();
- }
- return spy.at(0).at(0).value<QByteArray>();
-}
-
-void QmlDebugTestClient::messageReceived(const QByteArray &ba)
-{
- emit serverMessage(ba);
-}
-
-
-tst_QmlDebug_Thread::tst_QmlDebug_Thread(QmlDebugTestData *data, QmlTestFactory *factory)
- : m_ready(false), m_data(data), m_factory(factory)
-{
-}
-
-void tst_QmlDebug_Thread::run()
-{
- QTest::qWait(1000);
-
- QmlDebugConnection conn;
- conn.connectToHost("127.0.0.1", 3768);
- bool ok = conn.waitForConnected(5000);
- Q_ASSERT(ok);
-
- while (!m_ready)
- QTest::qWait(100);
-
- m_data->conn = &conn;
-
- Q_ASSERT(m_factory);
- QObject *test = m_factory->createTest(m_data);
- Q_ASSERT(test);
- int code = QTest::qExec(test);
- emit testsFinished(code);
-}
-
-
-int QmlDebugTest::runTests(QmlTestFactory *factory, const QList<QByteArray> &qml)
-{
- qputenv("QML_DEBUG_SERVER_PORT", "3768");
-
- QEventLoop loop;
- QmlDebugTestData data(&loop);
-
- tst_QmlDebug_Thread thread(&data, factory);
- QObject::connect(&thread, SIGNAL(testsFinished(int)), &data, SLOT(testsFinished(int)));
- thread.start();
-
- QmlEngine engine; // blocks until client connects
-
- foreach (const QByteArray &code, qml) {
- QmlComponent c(&engine, code, QUrl("file://"));
- Q_ASSERT(c.isReady()); // fails if bad syntax
- data.items << qobject_cast<QmlGraphicsItem*>(c.create());
- }
-
- // start the test
- data.engine = &engine;
- thread.m_ready = true;
-
- loop.exec();
-
- return data.exitCode;
-}
-
-
diff --git a/tests/auto/declarative/debugger/debugutil_p.h b/tests/auto/declarative/debugger/debugutil_p.h
deleted file mode 100644
index 665aeda..0000000
--- a/tests/auto/declarative/debugger/debugutil_p.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 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 <QSignalSpy>
-#include <QEventLoop>
-#include <QPointer>
-#include <QTimer>
-#include <QThread>
-#include <QTest>
-
-#include <QtDeclarative/qmlengine.h>
-
-#include <private/qmldebugclient_p.h>
-#include <private/qmldebugservice_p.h>
-#include <private/qmlgraphicsitem_p.h>
-
-
-class QmlDebugTestData : public QObject
-{
- Q_OBJECT
-public:
- QmlDebugTestData(QEventLoop *el);
-
- ~QmlDebugTestData();
-
- QmlEngine *engine;
- QmlDebugConnection *conn;
-
- int exitCode;
- QEventLoop *loop;
-
- QList<QmlGraphicsItem *> items;
-
-public slots:
- void testsFinished(int code);
-};
-
-
-class QmlTestFactory
-{
-public:
- QmlTestFactory() {}
- virtual ~QmlTestFactory() {}
-
- virtual QObject *createTest(QmlDebugTestData *data) = 0;
-};
-
-
-namespace QmlDebugTest {
-
- bool waitForSignal(QObject *receiver, const char *member, int timeout = 5000);
-
- int runTests(QmlTestFactory *factory, const QList<QByteArray> &qml = QList<QByteArray>());
-}
-
-class QmlDebugTestService : public QmlDebugService
-{
- Q_OBJECT
-public:
- QmlDebugTestService(const QString &s, QObject *parent = 0);
- bool enabled;
-
-signals:
- void enabledStateChanged();
-
-protected:
- virtual void messageReceived(const QByteArray &ba);
-
- virtual void enabledChanged(bool e);
-};
-
-class QmlDebugTestClient : public QmlDebugClient
-{
- Q_OBJECT
-public:
- QmlDebugTestClient(const QString &s, QmlDebugConnection *c);
-
- QByteArray waitForResponse();
-
-signals:
- void serverMessage(const QByteArray &);
-
-protected:
- virtual void messageReceived(const QByteArray &ba);
-};
-
-class tst_QmlDebug_Thread : public QThread
-{
- Q_OBJECT
-public:
- tst_QmlDebug_Thread(QmlDebugTestData *data, QmlTestFactory *factory);
-
- void run();
-
- bool m_ready;
-
-signals:
- void testsFinished(int);
-
-private:
- QmlDebugTestData *m_data;
- QmlTestFactory *m_factory;
-};
-
-
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index ec2c7d0..cc8660f 100644
--- a/tests/auto/declarative/declarative.pro
+++ b/tests/auto/declarative/declarative.pro
@@ -2,11 +2,9 @@ TEMPLATE = subdirs
SUBDIRS += \
anchors \ # Cover
animatedimage \ # Cover
- animations \ # Cover
- behaviors \ # Cover
datetimeformatter \ # Cover
- debugger \ # Cover
examples \
+ graphicswidgets \ # Cover
layouts \ # Cover
numberformatter \ # Cover
parserstress \ # Cover
@@ -15,6 +13,9 @@ SUBDIRS += \
qmlbinding \ # Cover
qmlconnection \ # Cover
qmlcontext \ # Cover
+ qmldebug \ # Cover
+ qmldebugclient \ # Cover
+ qmldebugservice \ # Cover
qmldom \ # Cover
qmleasefollow \ # Cover
qmlecmascript \ # Cover
@@ -36,6 +37,7 @@ SUBDIRS += \
qmlgraphicstextinput \ # Cover
qmlgraphicswebview \ # Cover
qmlinfo \ # Cover
+ qmlinstruction \ # Cover
qmllanguage \ # Cover
qmllist \ # Cover
qmllistaccessor \ # Cover
@@ -49,6 +51,7 @@ SUBDIRS += \
qmlsystempalette \ # Cover
qmltimer \ # Cover
qmlxmllistmodel \ # Cover
+ qpacketprotocol \ # Cover
repeater \ # Cover
sql \ # Cover
states \ # Cover
diff --git a/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml b/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml
new file mode 100644
index 0000000..70fafd6
--- /dev/null
+++ b/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml
@@ -0,0 +1,57 @@
+import Qt 4.6
+
+QGraphicsView {
+ objectName: "GView"
+ size: "800x600"
+
+ QGraphicsScene {
+ objectName: "GScene"
+ sceneRect: "0,0,500x300"
+
+ QGraphicsWidget {
+ layout: QGraphicsLinearLayout {
+ orientation: Qt.Horizontal
+ QGraphicsWidget {
+ layout: QGraphicsLinearLayout {
+ spacing: 10; orientation: Qt.Vertical
+ LayoutItem {
+ QGraphicsLinearLayout.stretchFactor: 1
+ objectName: "left"
+ minimumSize: "100x100"
+ maximumSize: "300x300"
+ preferredSize: "100x100"
+ Rectangle { objectName: "yellowRect"; color: "yellow"; anchors.fill: parent }
+ }
+ LayoutItem {
+ QGraphicsLinearLayout.stretchFactor: 10
+ objectName: "left"
+ minimumSize: "100x100"
+ maximumSize: "300x300"
+ preferredSize: "100x100"
+ Rectangle { objectName: "yellowRect"; color: "blue"; anchors.fill: parent }
+ }
+ }
+ }
+ QGraphicsWidget {
+ layout: QGraphicsLinearLayout {
+ spacing: 10; orientation: Qt.Vertical
+ 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
new file mode 100644
index 0000000..712c34c
--- /dev/null
+++ b/tests/auto/declarative/graphicswidgets/graphicswidgets.pro
@@ -0,0 +1,8 @@
+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\\\"
diff --git a/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp b/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp
new file mode 100644
index 0000000..783094b
--- /dev/null
+++ b/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 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/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <private/graphicswidgets_p.h>
+
+class tst_graphicswidgets : public QObject
+
+{
+ Q_OBJECT
+public:
+ tst_graphicswidgets();
+
+private slots:
+ void widgets();
+};
+
+tst_graphicswidgets::tst_graphicswidgets()
+{
+}
+
+void tst_graphicswidgets::widgets()
+{
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/graphicswidgets.qml"));
+ QGraphicsView *obj = qobject_cast<QGraphicsView*>(c.create());
+
+ QVERIFY(obj != 0);
+ QVERIFY(obj->scene() != 0);
+ QList<QObject*> list;
+ QVERIFY(obj->scene()->children() != list);
+ delete obj;
+}
+
+QTEST_MAIN(tst_graphicswidgets)
+
+#include "tst_graphicswidgets.moc"
diff --git a/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
index 9beec17..71eefdd 100644
--- a/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
+++ b/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
@@ -25,6 +25,7 @@ private slots:
void create();
void className();
void superClass();
+ void flags();
void method();
void slot();
void signal();
@@ -37,6 +38,7 @@ private slots:
void staticMetacall();
void copyMetaObject();
void serialize();
+ void removeNotifySignal();
private:
static bool checkForSideEffects
@@ -46,6 +48,61 @@ private:
(const QMetaObject *meta1, const QMetaObject *meta2);
};
+// Dummy class that has something of every type of thing moc can generate.
+class SomethingOfEverything : public QObject
+{
+ Q_OBJECT
+ Q_CLASSINFO("ci_foo", "ABC")
+ Q_CLASSINFO("ci_bar", "DEF")
+ Q_PROPERTY(QString prop READ prop WRITE setProp NOTIFY propChanged)
+ Q_PROPERTY(QString prop2 READ prop WRITE setProp)
+ Q_PROPERTY(SomethingEnum eprop READ eprop)
+ Q_PROPERTY(SomethingFlagEnum fprop READ fprop)
+ Q_PROPERTY(QLocale::Language language READ language)
+ Q_ENUMS(SomethingEnum)
+ Q_FLAGS(SomethingFlagEnum)
+public:
+ Q_INVOKABLE SomethingOfEverything() {}
+ ~SomethingOfEverything() {}
+
+ enum SomethingEnum
+ {
+ GHI,
+ JKL = 10
+ };
+
+ enum SomethingFlagEnum
+ {
+ XYZ = 1,
+ UVW = 8
+ };
+
+ Q_INVOKABLE Q_SCRIPTABLE void method1() {}
+
+ QString prop() const { return QString(); }
+ void setProp(const QString& v) { Q_UNUSED(v); }
+
+ SomethingOfEverything::SomethingEnum eprop() const { return GHI; }
+ SomethingOfEverything::SomethingFlagEnum fprop() const { return XYZ; }
+ QLocale::Language language() const { return QLocale::English; }
+
+public slots:
+ void slot1(const QString&) {}
+ void slot2(int, const QString&) {}
+
+private slots:
+ void slot3() {}
+
+protected slots:
+ Q_SCRIPTABLE void slot4(int) {}
+ void slot5(int a, const QString& b) { Q_UNUSED(a); Q_UNUSED(b); }
+
+signals:
+ void sig1();
+ void sig2(int x, const QString& y);
+ void propChanged(const QString&);
+};
+
void tst_QMetaObjectBuilder::mocVersionCheck()
{
// This test will fail when the moc version number is changed.
@@ -112,10 +169,33 @@ void tst_QMetaObjectBuilder::superClass()
QVERIFY(checkForSideEffects(builder, QMetaObjectBuilder::SuperClass));
}
+void tst_QMetaObjectBuilder::flags()
+{
+ QMetaObjectBuilder builder;
+
+ // Check default
+ QVERIFY(builder.flags() == 0);
+
+ // Set flags
+ builder.setFlags(QMetaObjectBuilder::DynamicMetaObject);
+ QVERIFY(builder.flags() == QMetaObjectBuilder::DynamicMetaObject);
+}
+
void tst_QMetaObjectBuilder::method()
{
QMetaObjectBuilder builder;
+ // Check null method
+ QMetaMethodBuilder nullMethod;
+ QCOMPARE(nullMethod.signature(), QByteArray());
+ QVERIFY(nullMethod.methodType() == QMetaMethod::Method);
+ QVERIFY(nullMethod.returnType().isEmpty());
+ QVERIFY(nullMethod.parameterNames().isEmpty());
+ QVERIFY(nullMethod.tag().isEmpty());
+ QVERIFY(nullMethod.access() == QMetaMethod::Public);
+ QCOMPARE(nullMethod.attributes(), 0);
+ QCOMPARE(nullMethod.index(), 0);
+
// Add a method and check its attributes.
QMetaMethodBuilder method1 = builder.addMethod("foo(const QString&, int)");
QCOMPARE(method1.signature(), QByteArray("foo(QString,int)"));
@@ -129,10 +209,10 @@ void tst_QMetaObjectBuilder::method()
QCOMPARE(builder.methodCount(), 1);
// Add another method and check again.
- QMetaMethodBuilder method2 = builder.addMethod("bar(QString)");
+ QMetaMethodBuilder method2 = builder.addMethod("bar(QString)", "int");
QCOMPARE(method2.signature(), QByteArray("bar(QString)"));
QVERIFY(method2.methodType() == QMetaMethod::Method);
- QVERIFY(method2.returnType().isEmpty());
+ QCOMPARE(method2.returnType(), QByteArray("int"));
QVERIFY(method2.parameterNames().isEmpty());
QVERIFY(method2.tag().isEmpty());
QVERIFY(method2.access() == QMetaMethod::Public);
@@ -163,7 +243,7 @@ void tst_QMetaObjectBuilder::method()
QCOMPARE(method1.index(), 0);
QCOMPARE(method2.signature(), QByteArray("bar(QString)"));
QVERIFY(method2.methodType() == QMetaMethod::Method);
- QVERIFY(method2.returnType().isEmpty());
+ QCOMPARE(method2.returnType(), QByteArray("int"));
QVERIFY(method2.parameterNames().isEmpty());
QVERIFY(method2.tag().isEmpty());
QVERIFY(method2.access() == QMetaMethod::Public);
@@ -214,6 +294,8 @@ void tst_QMetaObjectBuilder::method()
QCOMPARE(builder.indexOfMethod("foo(const QString&, int)"), -1);
QCOMPARE(builder.indexOfMethod("bar(QString)"), 0);
QCOMPARE(builder.indexOfMethod("baz()"), -1);
+ QCOMPARE(builder.method(0).signature(), QByteArray("bar(QString)"));
+ QCOMPARE(builder.method(9).signature(), QByteArray());
// Check that nothing else changed.
QVERIFY(checkForSideEffects(builder, QMetaObjectBuilder::Methods));
@@ -247,6 +329,11 @@ void tst_QMetaObjectBuilder::slot()
QCOMPARE(method2.index(), 1);
QCOMPARE(builder.methodCount(), 2);
+ // Perform index-based lookup
+ QCOMPARE(builder.indexOfSlot("foo(const QString &, int)"), 0);
+ QCOMPARE(builder.indexOfSlot("bar(QString)"), 1);
+ QCOMPARE(builder.indexOfSlot("baz()"), -1);
+
// Check that nothing else changed.
QVERIFY(checkForSideEffects(builder, QMetaObjectBuilder::Methods));
}
@@ -279,6 +366,11 @@ void tst_QMetaObjectBuilder::signal()
QCOMPARE(method2.index(), 1);
QCOMPARE(builder.methodCount(), 2);
+ // Perform index-based lookup
+ QCOMPARE(builder.indexOfSignal("foo(const QString &, int)"), 0);
+ QCOMPARE(builder.indexOfSignal("bar(QString)"), 1);
+ QCOMPARE(builder.indexOfSignal("baz()"), -1);
+
// Check that nothing else changed.
QVERIFY(checkForSideEffects(builder, QMetaObjectBuilder::Methods));
}
@@ -315,6 +407,8 @@ void tst_QMetaObjectBuilder::constructor()
QCOMPARE(builder.indexOfConstructor("foo(const QString&, int)"), 0);
QCOMPARE(builder.indexOfConstructor("bar(QString)"), 1);
QCOMPARE(builder.indexOfConstructor("baz()"), -1);
+ QCOMPARE(builder.constructor(1).signature(), QByteArray("bar(QString)"));
+ QCOMPARE(builder.constructor(9).signature(), QByteArray());
// Modify the attributes on ctor1.
ctor1.setReturnType("int");
@@ -386,6 +480,17 @@ void tst_QMetaObjectBuilder::constructor()
QCOMPARE(builder.indexOfConstructor("bar(QString)"), 0);
QCOMPARE(builder.indexOfConstructor("baz()"), -1);
+ // Add constructor from prototype
+ QMetaMethod prototype = SomethingOfEverything::staticMetaObject.constructor(0);
+ QMetaMethodBuilder prototypeConstructor = builder.addMethod(prototype);
+ QCOMPARE(builder.constructorCount(), 2);
+
+ QCOMPARE(prototypeConstructor.signature(), QByteArray("SomethingOfEverything()"));
+ QVERIFY(prototypeConstructor.methodType() == QMetaMethod::Constructor);
+ QCOMPARE(prototypeConstructor.returnType(), QByteArray());
+ QVERIFY(prototypeConstructor.access() == QMetaMethod::Public);
+ QCOMPARE(prototypeConstructor.index(), 1);
+
// Check that nothing else changed.
QVERIFY(checkForSideEffects(builder, QMetaObjectBuilder::Constructors));
}
@@ -394,6 +499,24 @@ void tst_QMetaObjectBuilder::property()
{
QMetaObjectBuilder builder;
+ // Null property builder
+ QMetaPropertyBuilder nullProp;
+ QCOMPARE(nullProp.name(), QByteArray());
+ QCOMPARE(nullProp.type(), QByteArray());
+ QVERIFY(!nullProp.hasNotifySignal());
+ QVERIFY(!nullProp.isReadable());
+ QVERIFY(!nullProp.isWritable());
+ QVERIFY(!nullProp.isResettable());
+ QVERIFY(!nullProp.isDesignable());
+ QVERIFY(!nullProp.isScriptable());
+ QVERIFY(!nullProp.isStored());
+ QVERIFY(!nullProp.isEditable());
+ QVERIFY(!nullProp.isUser());
+ QVERIFY(!nullProp.hasStdCppSet());
+ QVERIFY(!nullProp.isEnumOrFlag());
+ QVERIFY(!nullProp.isDynamic());
+ QCOMPARE(nullProp.index(), 0);
+
// Add a property and check its attributes.
QMetaPropertyBuilder prop1 = builder.addProperty("foo", "const QString &");
QCOMPARE(prop1.name(), QByteArray("foo"));
@@ -409,6 +532,7 @@ void tst_QMetaObjectBuilder::property()
QVERIFY(!prop1.isUser());
QVERIFY(!prop1.hasStdCppSet());
QVERIFY(!prop1.isEnumOrFlag());
+ QVERIFY(!prop1.isDynamic());
QCOMPARE(prop1.index(), 0);
QCOMPARE(builder.propertyCount(), 1);
@@ -427,6 +551,7 @@ void tst_QMetaObjectBuilder::property()
QVERIFY(!prop2.isUser());
QVERIFY(!prop2.hasStdCppSet());
QVERIFY(!prop2.isEnumOrFlag());
+ QVERIFY(!prop2.isDynamic());
QCOMPARE(prop2.index(), 1);
QCOMPARE(builder.propertyCount(), 2);
@@ -434,6 +559,8 @@ void tst_QMetaObjectBuilder::property()
QCOMPARE(builder.indexOfProperty("foo"), 0);
QCOMPARE(builder.indexOfProperty("bar"), 1);
QCOMPARE(builder.indexOfProperty("baz"), -1);
+ QCOMPARE(builder.property(1).name(), QByteArray("bar"));
+ QCOMPARE(builder.property(9).name(), QByteArray());
// Modify the attributes on prop1.
prop1.setReadable(false);
@@ -446,6 +573,7 @@ void tst_QMetaObjectBuilder::property()
prop1.setUser(true);
prop1.setStdCppSet(true);
prop1.setEnumOrFlag(true);
+ prop1.setDynamic(true);
// Check that prop1 is changed, but prop2 is not.
QCOMPARE(prop1.name(), QByteArray("foo"));
@@ -460,6 +588,7 @@ void tst_QMetaObjectBuilder::property()
QVERIFY(prop1.isUser());
QVERIFY(prop1.hasStdCppSet());
QVERIFY(prop1.isEnumOrFlag());
+ QVERIFY(prop1.isDynamic());
QVERIFY(prop2.isReadable());
QVERIFY(prop2.isWritable());
QCOMPARE(prop2.name(), QByteArray("bar"));
@@ -472,6 +601,7 @@ void tst_QMetaObjectBuilder::property()
QVERIFY(!prop2.isUser());
QVERIFY(!prop2.hasStdCppSet());
QVERIFY(!prop2.isEnumOrFlag());
+ QVERIFY(!prop2.isDynamic());
// Remove prop1 and check that prop2 becomes index 0.
builder.removeProperty(0);
@@ -487,6 +617,7 @@ void tst_QMetaObjectBuilder::property()
QVERIFY(!prop2.isUser());
QVERIFY(!prop2.hasStdCppSet());
QVERIFY(!prop2.isEnumOrFlag());
+ QVERIFY(!prop2.isDynamic());
QCOMPARE(prop2.index(), 0);
// Perform index-based lookup again.
@@ -510,6 +641,7 @@ void tst_QMetaObjectBuilder::property()
prop2.setUser(false); \
prop2.setStdCppSet(false); \
prop2.setEnumOrFlag(false); \
+ prop2.setDynamic(false); \
} while (0)
#define COUNT_FLAGS() \
((prop2.isReadable() ? 1 : 0) + \
@@ -521,7 +653,8 @@ void tst_QMetaObjectBuilder::property()
(prop2.isEditable() ? 1 : 0) + \
(prop2.isUser() ? 1 : 0) + \
(prop2.hasStdCppSet() ? 1 : 0) + \
- (prop2.isEnumOrFlag() ? 1 : 0))
+ (prop2.isEnumOrFlag() ? 1 : 0) + \
+ (prop2.isDynamic() ? 1 : 0))
#define CHECK_FLAG(setFunc,isFunc) \
do { \
CLEAR_FLAGS(); \
@@ -540,9 +673,20 @@ void tst_QMetaObjectBuilder::property()
CHECK_FLAG(setUser, isUser);
CHECK_FLAG(setStdCppSet, hasStdCppSet);
CHECK_FLAG(setEnumOrFlag, isEnumOrFlag);
+ CHECK_FLAG(setDynamic, isDynamic);
// Check that nothing else changed.
QVERIFY(checkForSideEffects(builder, QMetaObjectBuilder::Properties));
+
+ // Add property from prototype
+ QMetaProperty prototype = SomethingOfEverything::staticMetaObject.property(1);
+ QVERIFY(prototype.name() == QByteArray("prop"));
+ QMetaPropertyBuilder prototypeProp = builder.addProperty(prototype);
+ QCOMPARE(prototypeProp.name(), QByteArray("prop"));
+ QVERIFY(prototypeProp.hasNotifySignal());
+ QCOMPARE(prototypeProp.notifySignal().signature(), QByteArray("propChanged(QString)"));
+ QCOMPARE(builder.methodCount(), 1);
+ QCOMPARE(builder.method(0).signature(), QByteArray("propChanged(QString)"));
}
void tst_QMetaObjectBuilder::notifySignal()
@@ -601,6 +745,8 @@ void tst_QMetaObjectBuilder::enumerator()
QCOMPARE(builder.indexOfEnumerator("foo"), 0);
QCOMPARE(builder.indexOfEnumerator("bar"), 1);
QCOMPARE(builder.indexOfEnumerator("baz"), -1);
+ QCOMPARE(builder.enumerator(1).name(), QByteArray("bar"));
+ QCOMPARE(builder.enumerator(9).name(), QByteArray());
// Modify the attributes on enum1.
enum1.setIsFlag(true);
@@ -616,6 +762,7 @@ void tst_QMetaObjectBuilder::enumerator()
QCOMPARE(enum1.key(0), QByteArray("ABC"));
QCOMPARE(enum1.key(1), QByteArray("DEF"));
QCOMPARE(enum1.key(2), QByteArray("GHI"));
+ QCOMPARE(enum1.key(3), QByteArray());
QCOMPARE(enum1.value(0), 0);
QCOMPARE(enum1.value(1), 1);
QCOMPARE(enum1.value(2), -1);
@@ -637,6 +784,7 @@ void tst_QMetaObjectBuilder::enumerator()
QCOMPARE(enum1.key(0), QByteArray("ABC"));
QCOMPARE(enum1.key(1), QByteArray("DEF"));
QCOMPARE(enum1.key(2), QByteArray("GHI"));
+ QCOMPARE(enum1.key(3), QByteArray());
QCOMPARE(enum1.value(0), 0);
QCOMPARE(enum1.value(1), 1);
QCOMPARE(enum1.value(2), -1);
@@ -646,6 +794,29 @@ void tst_QMetaObjectBuilder::enumerator()
QCOMPARE(enum2.index(), 1);
QCOMPARE(enum2.key(0), QByteArray("XYZ"));
QCOMPARE(enum2.key(1), QByteArray("UVW"));
+ QCOMPARE(enum2.key(2), QByteArray());
+ QCOMPARE(enum2.value(0), 10);
+ QCOMPARE(enum2.value(1), 19);
+
+ // Remove enum1 key
+ enum1.removeKey(2);
+ QCOMPARE(enum1.name(), QByteArray("foo"));
+ QVERIFY(enum1.isFlag());
+ QCOMPARE(enum1.keyCount(), 2);
+ QCOMPARE(enum1.index(), 0);
+ QCOMPARE(enum1.key(0), QByteArray("ABC"));
+ QCOMPARE(enum1.key(1), QByteArray("DEF"));
+ QCOMPARE(enum1.key(2), QByteArray());
+ QCOMPARE(enum1.value(0), 0);
+ QCOMPARE(enum1.value(1), 1);
+ QCOMPARE(enum1.value(2), -1);
+ QCOMPARE(enum2.name(), QByteArray("bar"));
+ QVERIFY(enum2.isFlag());
+ QCOMPARE(enum2.keyCount(), 2);
+ QCOMPARE(enum2.index(), 1);
+ QCOMPARE(enum2.key(0), QByteArray("XYZ"));
+ QCOMPARE(enum2.key(1), QByteArray("UVW"));
+ QCOMPARE(enum2.key(2), QByteArray());
QCOMPARE(enum2.value(0), 10);
QCOMPARE(enum2.value(1), 19);
@@ -659,6 +830,7 @@ void tst_QMetaObjectBuilder::enumerator()
QCOMPARE(enum2.index(), 0);
QCOMPARE(enum2.key(0), QByteArray("XYZ"));
QCOMPARE(enum2.key(1), QByteArray("UVW"));
+ QCOMPARE(enum2.key(2), QByteArray());
QCOMPARE(enum2.value(0), 10);
QCOMPARE(enum2.value(1), 19);
@@ -682,6 +854,8 @@ void tst_QMetaObjectBuilder::classInfo()
QCOMPARE(builder.classInfoValue(0), QByteArray("value1"));
QCOMPARE(builder.classInfoName(1), QByteArray("bar"));
QCOMPARE(builder.classInfoValue(1), QByteArray("value2"));
+ QCOMPARE(builder.classInfoName(9), QByteArray());
+ QCOMPARE(builder.classInfoValue(9), QByteArray());
QCOMPARE(builder.classInfoCount(), 2);
// Perform index-based lookup.
@@ -738,61 +912,6 @@ void tst_QMetaObjectBuilder::staticMetacall()
QVERIFY(checkForSideEffects(builder, QMetaObjectBuilder::StaticMetacall));
}
-// Dummy class that has something of every type of thing moc can generate.
-class SomethingOfEverything : public QObject
-{
- Q_OBJECT
- Q_CLASSINFO("ci_foo", "ABC")
- Q_CLASSINFO("ci_bar", "DEF")
- Q_PROPERTY(QString prop READ prop WRITE setProp NOTIFY propChanged)
- Q_PROPERTY(QString prop2 READ prop WRITE setProp)
- Q_PROPERTY(SomethingEnum eprop READ eprop)
- Q_PROPERTY(SomethingFlagEnum fprop READ fprop)
- Q_PROPERTY(QLocale::Language language READ language)
- Q_ENUMS(SomethingEnum)
- Q_FLAGS(SomethingFlagEnum)
-public:
- Q_INVOKABLE SomethingOfEverything() {}
- ~SomethingOfEverything() {}
-
- enum SomethingEnum
- {
- GHI,
- JKL = 10
- };
-
- enum SomethingFlagEnum
- {
- XYZ = 1,
- UVW = 8
- };
-
- Q_INVOKABLE Q_SCRIPTABLE void method1() {}
-
- QString prop() const { return QString(); }
- void setProp(const QString& v) { Q_UNUSED(v); }
-
- SomethingOfEverything::SomethingEnum eprop() const { return GHI; }
- SomethingOfEverything::SomethingFlagEnum fprop() const { return XYZ; }
- QLocale::Language language() const { return QLocale::English; }
-
-public slots:
- void slot1(const QString&) {}
- void slot2(int, const QString&) {}
-
-private slots:
- void slot3() {}
-
-protected slots:
- Q_SCRIPTABLE void slot4(int) {}
- void slot5(int a, const QString& b) { Q_UNUSED(a); Q_UNUSED(b); }
-
-signals:
- void sig1();
- void sig2(int x, const QString& y);
- void propChanged(const QString&);
-};
-
// Copy the entire contents of a static QMetaObject and then check
// that QMetaObjectBuilder will produce an exact copy as output.
void tst_QMetaObjectBuilder::copyMetaObject()
@@ -817,6 +936,8 @@ void tst_QMetaObjectBuilder::copyMetaObject()
// it round-trips to the exact same value.
void tst_QMetaObjectBuilder::serialize()
{
+ // Full QMetaObjectBuilder
+ {
QMetaObjectBuilder builder(&SomethingOfEverything::staticMetaObject);
QMetaObject *meta = builder.toMetaObject();
@@ -835,6 +956,53 @@ void tst_QMetaObjectBuilder::serialize()
QVERIFY(sameMetaObject(meta, meta2));
qFree(meta);
qFree(meta2);
+ }
+
+ // Partial QMetaObjectBuilder
+ {
+ QMetaObjectBuilder builder;
+ builder.setClassName("Test");
+ builder.addProperty("foo", "int");
+ builder.setSuperClass(0);
+
+ QByteArray data;
+ QDataStream stream(&data, QIODevice::WriteOnly | QIODevice::Append);
+ builder.serialize(stream);
+
+ QMetaObjectBuilder builder2;
+ QDataStream stream2(data);
+ builder2.deserialize(stream2, QMap<QByteArray, const QMetaObject *>());
+
+ QCOMPARE(builder.superClass(), builder2.superClass());
+ QCOMPARE(builder.className(), builder2.className());
+ QCOMPARE(builder.propertyCount(), builder2.propertyCount());
+ QCOMPARE(builder.property(0).name(), builder2.property(0).name());
+ QCOMPARE(builder.property(0).type(), builder2.property(0).type());
+ }
+}
+
+// Check that removing a method updates notify signals appropriately
+void tst_QMetaObjectBuilder::removeNotifySignal()
+{
+ QMetaObjectBuilder builder;
+
+ QMetaMethodBuilder method1 = builder.addSignal("foo(const QString&, int)");
+ QMetaMethodBuilder method2 = builder.addSignal("bar(QString)");
+
+ // Setup property
+ QMetaPropertyBuilder prop = builder.addProperty("prop", "const QString &");
+ prop.setNotifySignal(method2);
+ QVERIFY(prop.hasNotifySignal());
+ QCOMPARE(prop.notifySignal().index(), 1);
+
+ // Remove non-notify signal
+ builder.removeMethod(0);
+ QVERIFY(prop.hasNotifySignal());
+ QCOMPARE(prop.notifySignal().index(), 0);
+
+ // Remove notify signal
+ builder.removeMethod(0);
+ QVERIFY(!prop.hasNotifySignal());
}
// Check that the only changes to a "builder" relative to the default
diff --git a/tests/auto/declarative/debugger/qmldebug/qmldebug.pro b/tests/auto/declarative/qmldebug/qmldebug.pro
index 0af30e1..f79829d 100644
--- a/tests/auto/declarative/debugger/qmldebug/qmldebug.pro
+++ b/tests/auto/declarative/qmldebug/qmldebug.pro
@@ -2,6 +2,6 @@ load(qttest_p4)
contains(QT_CONFIG,declarative): QT += network declarative
macx:CONFIG -= app_bundle
-HEADERS += ../debugutil_p.h
+HEADERS += ../shared/debugutil_p.h
SOURCES += tst_qmldebug.cpp \
- ../debugutil.cpp
+ ../shared/debugutil.cpp
diff --git a/tests/auto/declarative/debugger/qmldebug/tst_qmldebug.cpp b/tests/auto/declarative/qmldebug/tst_qmldebug.cpp
index 70404f6..6916cc9 100644
--- a/tests/auto/declarative/debugger/qmldebug/tst_qmldebug.cpp
+++ b/tests/auto/declarative/qmldebug/tst_qmldebug.cpp
@@ -59,7 +59,7 @@
#include <private/qmldebugservice_p.h>
#include <private/qmlgraphicsrectangle_p.h>
-#include "../debugutil_p.h"
+#include "../shared/debugutil_p.h"
Q_DECLARE_METATYPE(QmlDebugWatch::State)
diff --git a/tests/auto/declarative/debugger/qmldebugclient/qmldebugclient.pro b/tests/auto/declarative/qmldebugclient/qmldebugclient.pro
index c0aa7b2..36aa818 100644
--- a/tests/auto/declarative/debugger/qmldebugclient/qmldebugclient.pro
+++ b/tests/auto/declarative/qmldebugclient/qmldebugclient.pro
@@ -2,6 +2,6 @@ load(qttest_p4)
contains(QT_CONFIG,declarative): QT += network declarative
macx:CONFIG -= app_bundle
-HEADERS += ../debugutil_p.h
+HEADERS += ../shared/debugutil_p.h
SOURCES += tst_qmldebugclient.cpp \
- ../debugutil.cpp
+ ../shared/debugutil.cpp
diff --git a/tests/auto/declarative/debugger/qmldebugclient/tst_qmldebugclient.cpp b/tests/auto/declarative/qmldebugclient/tst_qmldebugclient.cpp
index 6c4a1a3..8325731 100644
--- a/tests/auto/declarative/debugger/qmldebugclient/tst_qmldebugclient.cpp
+++ b/tests/auto/declarative/qmldebugclient/tst_qmldebugclient.cpp
@@ -52,7 +52,7 @@
#include <private/qmldebugclient_p.h>
#include <private/qmldebugservice_p.h>
-#include "../debugutil_p.h"
+#include "../shared/debugutil_p.h"
class tst_QmlDebugClient : public QObject
{
diff --git a/tests/auto/declarative/debugger/qmldebugservice/qmldebugservice.pro b/tests/auto/declarative/qmldebugservice/qmldebugservice.pro
index cce277a..9995f1f 100644
--- a/tests/auto/declarative/debugger/qmldebugservice/qmldebugservice.pro
+++ b/tests/auto/declarative/qmldebugservice/qmldebugservice.pro
@@ -2,6 +2,6 @@ load(qttest_p4)
contains(QT_CONFIG,declarative): QT += network declarative
macx:CONFIG -= app_bundle
-HEADERS += ../debugutil_p.h
+HEADERS += ../shared/debugutil_p.h
SOURCES += tst_qmldebugservice.cpp \
- ../debugutil.cpp
+ ../shared/debugutil.cpp
diff --git a/tests/auto/declarative/debugger/qmldebugservice/tst_qmldebugservice.cpp b/tests/auto/declarative/qmldebugservice/tst_qmldebugservice.cpp
index 0c02929..625d1f5 100644
--- a/tests/auto/declarative/debugger/qmldebugservice/tst_qmldebugservice.cpp
+++ b/tests/auto/declarative/qmldebugservice/tst_qmldebugservice.cpp
@@ -52,7 +52,7 @@
#include <private/qmldebugclient_p.h>
#include <private/qmldebugservice_p.h>
-#include "../debugutil_p.h"
+#include "../shared/debugutil_p.h"
class tst_QmlDebugService : public QObject
{
diff --git a/tests/auto/declarative/qmlengine/tst_qmlengine.cpp b/tests/auto/declarative/qmlengine/tst_qmlengine.cpp
index 54f916f..5471691 100644
--- a/tests/auto/declarative/qmlengine/tst_qmlengine.cpp
+++ b/tests/auto/declarative/qmlengine/tst_qmlengine.cpp
@@ -161,10 +161,18 @@ void tst_qmlengine::contextForObject()
void tst_qmlengine::offlineStoragePath()
{
+ // Without these set, QDesktopServices::storageLocation returns
+ // strings with extra "//" at the end. We set them to ignore this problem.
+ qApp->setApplicationName("tst_qmlengine");
+ qApp->setOrganizationName("Nokia");
+ qApp->setOrganizationDomain("nokia.com");
+
QmlEngine engine;
QDir dir(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
+ dir.mkpath("QML");
dir.cd("QML");
+ dir.mkpath("OfflineStorage");
dir.cd("OfflineStorage");
QCOMPARE(engine.offlineStoragePath(), dir.path());
diff --git a/tests/auto/declarative/qmlinstruction/qmlinstruction.pro b/tests/auto/declarative/qmlinstruction/qmlinstruction.pro
new file mode 100644
index 0000000..41be488
--- /dev/null
+++ b/tests/auto/declarative/qmlinstruction/qmlinstruction.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative script
+SOURCES += tst_qmlinstruction.cpp
+macx:CONFIG -= app_bundle
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qmlinstruction/tst_qmlinstruction.cpp b/tests/auto/declarative/qmlinstruction/tst_qmlinstruction.cpp
new file mode 100644
index 0000000..f493e0e
--- /dev/null
+++ b/tests/auto/declarative/qmlinstruction/tst_qmlinstruction.cpp
@@ -0,0 +1,609 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 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 <private/qmlcompiler_p.h>
+
+class tst_qmlinstruction : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qmlinstruction() {}
+
+private slots:
+ void dump();
+};
+
+static QStringList messages;
+static void msgHandler(QtMsgType, const char *msg)
+{
+ messages << QLatin1String(msg);
+}
+
+void tst_qmlinstruction::dump()
+{
+ QmlCompiledData *data = new QmlCompiledData;
+ {
+ QmlInstruction i;
+ i.line = 0;
+ i.type = QmlInstruction::Init;
+ data->bytecode << i;
+ }
+
+ {
+ QmlCompiledData::TypeReference ref;
+ ref.className = "Test";
+ data->types << ref;
+
+ QmlInstruction i;
+ i.line = 1;
+ i.type = QmlInstruction::CreateObject;
+ i.create.type = 0;
+ i.create.data = -1;
+ i.create.bindingBits = -1;
+ i.create.column = 10;
+ data->bytecode << i;
+ }
+
+ {
+ data->primitives << "testId";
+
+ QmlInstruction i;
+ i.line = 2;
+ i.type = QmlInstruction::SetId;
+ i.setId.value = 0;
+ i.setId.index = 0;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 3;
+ i.type = QmlInstruction::SetDefault;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 4;
+ i.type = QmlInstruction::CreateComponent;
+ i.createComponent.count = 3;
+ i.createComponent.column = 4;
+ i.createComponent.endLine = 14;
+ i.createComponent.metaObject = 0;
+
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 5;
+ i.type = QmlInstruction::StoreMetaObject;
+ i.storeMeta.data = 3;
+ i.storeMeta.aliasData = 6;
+ i.storeMeta.propertyCache = 7;
+
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 6;
+ i.type = QmlInstruction::StoreFloat;
+ i.storeFloat.propertyIndex = 3;
+ i.storeFloat.value = 11.3;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 7;
+ i.type = QmlInstruction::StoreDouble;
+ i.storeDouble.propertyIndex = 4;
+ i.storeDouble.value = 14.8;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 8;
+ i.type = QmlInstruction::StoreInteger;
+ i.storeInteger.propertyIndex = 5;
+ i.storeInteger.value = 9;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 9;
+ i.type = QmlInstruction::StoreBool;
+ i.storeBool.propertyIndex = 6;
+ i.storeBool.value = true;
+
+ data->bytecode << i;
+ }
+
+ {
+ data->primitives << "Test String";
+ QmlInstruction i;
+ i.line = 10;
+ i.type = QmlInstruction::StoreString;
+ i.storeString.propertyIndex = 7;
+ i.storeString.value = 1;
+ data->bytecode << i;
+ }
+
+ {
+ data->primitives << "http://www.nokia.com";
+ QmlInstruction i;
+ i.line = 11;
+ i.type = QmlInstruction::StoreUrl;
+ i.storeUrl.propertyIndex = 8;
+ i.storeUrl.value = 2;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 12;
+ i.type = QmlInstruction::StoreColor;
+ i.storeColor.propertyIndex = 9;
+ i.storeColor.value = 0xFF00FF00;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 13;
+ i.type = QmlInstruction::StoreDate;
+ i.storeDate.propertyIndex = 10;
+ i.storeDate.value = 9;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 14;
+ i.type = QmlInstruction::StoreTime;
+ i.storeTime.propertyIndex = 11;
+ i.storeTime.valueIndex = 33;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 15;
+ i.type = QmlInstruction::StoreDateTime;
+ i.storeDateTime.propertyIndex = 12;
+ i.storeDateTime.valueIndex = 44;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 16;
+ i.type = QmlInstruction::StorePoint;
+ i.storeRealPair.propertyIndex = 13;
+ i.storeRealPair.valueIndex = 3;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 17;
+ i.type = QmlInstruction::StorePointF;
+ i.storeRealPair.propertyIndex = 14;
+ i.storeRealPair.valueIndex = 9;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 18;
+ i.type = QmlInstruction::StoreSize;
+ i.storeRealPair.propertyIndex = 15;
+ i.storeRealPair.valueIndex = 8;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 19;
+ i.type = QmlInstruction::StoreSizeF;
+ i.storeRealPair.propertyIndex = 16;
+ i.storeRealPair.valueIndex = 99;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 20;
+ i.type = QmlInstruction::StoreRect;
+ i.storeRect.propertyIndex = 17;
+ i.storeRect.valueIndex = 2;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 21;
+ i.type = QmlInstruction::StoreRectF;
+ i.storeRect.propertyIndex = 18;
+ i.storeRect.valueIndex = 19;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 22;
+ i.type = QmlInstruction::StoreVector3D;
+ i.storeVector3D.propertyIndex = 19;
+ i.storeVector3D.valueIndex = 9;
+ data->bytecode << i;
+ }
+
+ {
+ data->primitives << "color(1, 1, 1, 1)";
+ QmlInstruction i;
+ i.line = 23;
+ i.type = QmlInstruction::StoreVariant;
+ i.storeString.propertyIndex = 20;
+ i.storeString.value = 3;
+
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 24;
+ i.type = QmlInstruction::StoreObject;
+ i.storeObject.propertyIndex = 21;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 25;
+ i.type = QmlInstruction::StoreVariantObject;
+ i.storeObject.propertyIndex = 22;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 26;
+ i.type = QmlInstruction::StoreInterface;
+ i.storeObject.propertyIndex = 23;
+ data->bytecode << i;
+ }
+
+ {
+ data->primitives << "print(1921)";
+
+ QmlInstruction i;
+ i.line = 27;
+ i.type = QmlInstruction::StoreSignal;
+ i.storeSignal.signalIndex = 2;
+ i.storeSignal.value = 4;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 28;
+ i.type = QmlInstruction::StoreScript;
+ i.storeScript.value = 2;
+ i.storeScript.fileName = 18;
+ i.storeScript.lineNumber = 28;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 29;
+ i.type = QmlInstruction::StoreScriptString;
+ i.storeScriptString.propertyIndex = 24;
+ i.storeScriptString.value = 3;
+ i.storeScriptString.scope = 1;
+ data->bytecode << i;
+ }
+
+ {
+ data->datas << "mySignal";
+
+ QmlInstruction i;
+ i.line = 30;
+ i.type = QmlInstruction::AssignSignalObject;
+ i.assignSignalObject.signal = 0;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 31;
+ i.type = QmlInstruction::AssignCustomType;
+ i.assignCustomType.propertyIndex = 25;
+ i.assignCustomType.valueIndex = 4;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 32;
+ i.type = QmlInstruction::StoreBinding;
+ i.assignBinding.property = 26;
+ i.assignBinding.value = 3;
+ i.assignBinding.context = 2;
+ i.assignBinding.owner = 0;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 33;
+ i.type = QmlInstruction::StoreIdOptBinding;
+ i.assignIdOptBinding.property = 27;
+ i.assignIdOptBinding.id = 2;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 34;
+ i.type = QmlInstruction::StoreObjPropBinding;
+ i.assignObjPropBinding.property = 28;
+ i.assignObjPropBinding.contextIdx = 3;
+ i.assignObjPropBinding.context = 7;
+ i.assignObjPropBinding.notifyIdx = 4;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 35;
+ i.type = QmlInstruction::StoreValueSource;
+ i.assignValueSource.property = 29;
+ i.assignValueSource.owner = 1;
+ i.assignValueSource.castValue = 4;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 36;
+ i.type = QmlInstruction::StoreValueInterceptor;
+ i.assignValueInterceptor.property = 30;
+ i.assignValueInterceptor.owner = 2;
+ i.assignValueInterceptor.castValue = -4;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 37;
+ i.type = QmlInstruction::BeginObject;
+ i.begin.castValue = 4;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 38;
+ i.type = QmlInstruction::StoreObjectQmlList;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 39;
+ i.type = QmlInstruction::StoreObjectQList;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 40;
+ i.type = QmlInstruction::AssignObjectList;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 41;
+ i.type = QmlInstruction::FetchAttached;
+ i.fetchAttached.id = 23;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 42;
+ i.type = QmlInstruction::FetchQmlList;
+ i.fetchQmlList.property = 31;
+ i.fetchQmlList.type = 3;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 43;
+ i.type = QmlInstruction::FetchQList;
+ i.fetch.property = 32;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 44;
+ i.type = QmlInstruction::FetchObject;
+ i.fetch.property = 33;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 45;
+ i.type = QmlInstruction::FetchValueType;
+ i.fetchValue.property = 34;
+ i.fetchValue.type = 6;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 46;
+ i.type = QmlInstruction::PopFetchedObject;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 47;
+ i.type = QmlInstruction::PopQList;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 48;
+ i.type = QmlInstruction::PopValueType;
+ i.fetchValue.property = 35;
+ i.fetchValue.type = 8;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 49;
+ i.type = QmlInstruction::Defer;
+ i.defer.deferCount = 7;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = -1;
+ i.type = QmlInstruction::Defer;
+ i.defer.deferCount = 7;
+ data->bytecode << i;
+ }
+
+ {
+ QmlInstruction i;
+ i.line = 50;
+ i.type = (QmlInstruction::Type)(QmlInstruction::Defer + 1); // Non-existant
+ data->bytecode << i;
+ }
+
+ QStringList expect;
+ expect
+ << "Index\tLine\tOperation\t\tData1\tData2\tData3\tComments"
+ << "-------------------------------------------------------------------------------"
+ << "0\t\t0\tINIT"
+ << "1\t\t1\tCREATE\t\t\t0\t\t\t\"Test\""
+ << "2\t\t2\tSETID\t\t\t0\t\t\t\"testId\""
+ << "3\t\t3\tSET_DEFAULT"
+ << "4\t\t4\tCREATE_COMPONENT\t3"
+ << "5\t\t5\tSTORE_META\t\t3"
+ << "6\t\t6\tSTORE_FLOAT\t\t3\t11.3"
+ << "7\t\t7\tSTORE_DOUBLE\t\t4\t14.8"
+ << "8\t\t8\tSTORE_INTEGER\t\t5\t9"
+ << "9\t\t9\tSTORE_BOOL\t\t6\ttrue"
+ << "10\t\t10\tSTORE_STRING\t\t7\t1\t\t\"Test String\""
+ << "11\t\t11\tSTORE_URL\t\t8\t2\t\t\"http://www.nokia.com\""
+ << "12\t\t12\tSTORE_COLOR\t\t9\t\t\t\"ff00ff00\""
+ << "13\t\t13\tSTORE_DATE\t\t10\t9"
+ << "14\t\t14\tSTORE_TIME\t\t11\t33"
+ << "15\t\t15\tSTORE_DATETIME\t\t12\t44"
+ << "16\t\t16\tSTORE_POINT\t\t13\t3"
+ << "17\t\t17\tSTORE_POINTF\t\t14\t9"
+ << "18\t\t18\tSTORE_SIZE\t\t15\t8"
+ << "19\t\t19\tSTORE_SIZEF\t\t16\t99"
+ << "20\t\t20\tSTORE_RECT\t\t17\t2"
+ << "21\t\t21\tSTORE_RECTF\t\t18\t19"
+ << "22\t\t22\tSTORE_VECTOR3D\t\t19\t9"
+ << "23\t\t23\tSTORE_VARIANT\t\t20\t3\t\t\"color(1, 1, 1, 1)\""
+ << "24\t\t24\tSTORE_OBJECT\t\t21"
+ << "25\t\t25\tSTORE_VARIANT_OBJECT\t22"
+ << "26\t\t26\tSTORE_INTERFACE\t\t23"
+ << "27\t\t27\tSTORE_SIGNAL\t\t2\t4\t\t\"print(1921)\""
+ << "28\t\t28\tSTORE_SCRIPT\t\t2\t18\t28"
+ << "29\t\t29\tSTORE_SCRIPT_STRING\t24\t3\t1"
+ << "30\t\t30\tASSIGN_SIGNAL_OBJECT\t0\t\t\t\"mySignal\""
+ << "31\t\t31\tASSIGN_CUSTOMTYPE\t25\t4"
+ << "32\t\t32\tSTORE_COMPILED_BINDING\t26\t3\t2"
+ << "33\t\t33\tSTORE_ID_OPT_BINDING\t27\t2"
+ << "34\t\t34\tSTORE_OBJ_PROP_BINDING\t28\t3\t7\t4"
+ << "35\t\t35\tSTORE_VALUE_SOURCE\t29\t4"
+ << "36\t\t36\tSTORE_VALUE_INTERCEPTOR\t30\t-4"
+ << "37\t\t37\tBEGIN\t\t\t4"
+ << "38\t\t38\tSTORE_OBJECT_QMLLIST"
+ << "39\t\t39\tSTORE_OBJECT_QLIST"
+ << "40\t\t40\tASSIGN_OBJECT_LIST"
+ << "41\t\t41\tFETCH_ATTACHED\t\t23"
+ << "42\t\t42\tFETCH_QMLLIST\t\t31\t3"
+ << "43\t\t43\tFETCH_QLIST\t\t32"
+ << "44\t\t44\tFETCH\t\t\t33"
+ << "45\t\t45\tFETCH_VALUE\t\t34\t6"
+ << "46\t\t46\tPOP"
+ << "47\t\t47\tPOP_QLIST"
+ << "48\t\t48\tPOP_VALUE\t\t35\t8"
+ << "49\t\t49\tDEFER\t\t\t7"
+ << "50\t\tNA\tDEFER\t\t\t7"
+ << "51\t\t50\tXXX UNKOWN INSTRUCTION\t50"
+ << "-------------------------------------------------------------------------------";
+
+ messages = QStringList();
+ QtMsgHandler old = qInstallMsgHandler(msgHandler);
+ data->dumpInstructions();
+ qInstallMsgHandler(old);
+
+ QCOMPARE(messages.count(), expect.count());
+ for (int ii = 0; ii < messages.count(); ++ii) {
+ QCOMPARE(messages.at(ii), expect.at(ii));
+ }
+
+ data->release();
+}
+
+QTEST_MAIN(tst_qmlinstruction)
+
+#include "tst_qmlinstruction.moc"
diff --git a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp
index 3222d42..80efd94 100644
--- a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp
+++ b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp
@@ -64,10 +64,14 @@ void tst_QmlListModel::dynamic_data()
QTest::newRow("count") << "count" << 0 << "";
+ QTest::newRow("get1") << "{get(0)}" << 0 << "QML QmlListModel (unknown location) get: index 0 out of range";
+
QTest::newRow("append1") << "{append({'foo':123});count}" << 1 << "";
QTest::newRow("append2") << "{append({'foo':123,'bar':456});count}" << 1 << "";
QTest::newRow("append3a") << "{append({'foo':123});append({'foo':456});get(0).foo}" << 123 << "";
QTest::newRow("append3b") << "{append({'foo':123});append({'foo':456});get(1).foo}" << 456 << "";
+ QTest::newRow("append4a") << "{append(123)}" << 0 << "QML QmlListModel (unknown location) append: value is not an object";
+ QTest::newRow("append4b") << "{append([1,2,3])}" << 0 << "QML QmlListModel (unknown location) append: value is not an object";
QTest::newRow("clear1") << "{append({'foo':456});clear();count}" << 0 << "";
QTest::newRow("clear2") << "{append({'foo':123});append({'foo':456});clear();count}" << 0 << "";
@@ -78,6 +82,9 @@ void tst_QmlListModel::dynamic_data()
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 << "QML QmlListModel (unknown location) get: index 0 out of range";
+ QTest::newRow("remove4a") << "{remove(0)}" << 0 << "QML QmlListModel (unknown location) remove: index 0 out of range";
+ QTest::newRow("remove4b") << "{append({'foo':123});remove(0);remove(0)}" << 0 << "QML QmlListModel (unknown location) remove: index 0 out of range";
+ QTest::newRow("remove4c") << "{append({'foo':123});remove(1)}" << 0 << "QML QmlListModel (unknown location) remove: index 1 out of range";
QTest::newRow("insert1") << "{insert(0,{'foo':123});count}" << 1 << "";
QTest::newRow("insert2") << "{insert(1,{'foo':123});count}" << 0 << "QML QmlListModel (unknown location) insert: index 1 out of range";
@@ -87,16 +94,23 @@ void tst_QmlListModel::dynamic_data()
QTest::newRow("insert3d") << "{append({'foo':123});insert(0,{'foo':456});get(0).foo}" << 456 << "";
QTest::newRow("insert3e") << "{append({'foo':123});insert(0,{'foo':456});get(1).foo}" << 123 << "";
QTest::newRow("insert4") << "{append({'foo':123});insert(-1,{'foo':456})}" << 0 << "QML QmlListModel (unknown location) insert: index -1 out of range";
+ QTest::newRow("insert5a") << "{insert(0,123)}" << 0 << "QML QmlListModel (unknown location) insert: value is not an object";
+ QTest::newRow("insert5b") << "{insert(0,[1,2,3])}" << 0 << "QML QmlListModel (unknown location) insert: value is not an object";
QTest::newRow("set1") << "{append({'foo':123});set(0,{'foo':456});count}" << 1 << "";
QTest::newRow("set2") << "{append({'foo':123});set(0,{'foo':456});get(0).foo}" << 456 << "";
QTest::newRow("set3a") << "{append({'foo':123,'bar':456});set(0,{'foo':999});get(0).foo}" << 999 << "";
QTest::newRow("set3b") << "{append({'foo':123,'bar':456});set(0,{'foo':999});get(0).bar}" << 456 << "";
+ QTest::newRow("set4a") << "{set(0,{'foo':456})}" << 0 << "QML QmlListModel (unknown location) set: index 0 out of range";
+ QTest::newRow("set5a") << "{append({'foo':123,'bar':456});set(0,123)}" << 0 << "QML QmlListModel (unknown location) set: value is not an object";
+ QTest::newRow("set5b") << "{append({'foo':123,'bar':456});set(0,[1,2,3])}" << 0 << "QML QmlListModel (unknown location) set: value is not an object";
QTest::newRow("setprop1") << "{append({'foo':123});set(0,'foo',456);count}" << 1 << "";
QTest::newRow("setprop2") << "{append({'foo':123});set(0,'foo',456);get(0).foo}" << 456 << "";
QTest::newRow("setprop3a") << "{append({'foo':123,'bar':456});set(0,'foo',999);get(0).foo}" << 999 << "";
QTest::newRow("setprop3b") << "{append({'foo':123,'bar':456});set(0,'foo',999);get(0).bar}" << 456 << "";
+ QTest::newRow("setprop4a") << "{set(0,'foo',456)}" << 0 << "QML QmlListModel (unknown location) set: index 0 out of range";
+ QTest::newRow("setprop4a") << "{append({'foo':123,'bar':456});set(1,'foo',456)}" << 0 << "QML QmlListModel (unknown location) set: index 1 out of range";
QTest::newRow("move1a") << "{append({'foo':123});append({'foo':456});move(0,1,1);count}" << 2 << "";
QTest::newRow("move1b") << "{append({'foo':123});append({'foo':456});move(0,1,1);get(0).foo}" << 456 << "";
@@ -107,6 +121,10 @@ void tst_QmlListModel::dynamic_data()
QTest::newRow("move2b") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);get(0).foo}" << 789 << "";
QTest::newRow("move2c") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);get(1).foo}" << 123 << "";
QTest::newRow("move2d") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);get(2).foo}" << 456 << "";
+ QTest::newRow("move3a") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,0,3)}" << 0 << "QML QmlListModel (unknown location) move: out of range";
+ QTest::newRow("move3b") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,-1,1)}" << 0 << "QML QmlListModel (unknown location) move: out of range";
+ QTest::newRow("move3c") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,0,-1)}" << 0 << "QML QmlListModel (unknown location) move: out of range";
+ QTest::newRow("move3d") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,3,1)}" << 0 << "QML QmlListModel (unknown location) move: out of range";
// Structured model
diff --git a/tests/auto/declarative/debugger/qpacketprotocol/qpacketprotocol.pro b/tests/auto/declarative/qpacketprotocol/qpacketprotocol.pro
index 800e5e0..f42cecc 100644
--- a/tests/auto/declarative/debugger/qpacketprotocol/qpacketprotocol.pro
+++ b/tests/auto/declarative/qpacketprotocol/qpacketprotocol.pro
@@ -2,6 +2,6 @@ load(qttest_p4)
contains(QT_CONFIG,declarative): QT += network declarative
macx:CONFIG -= app_bundle
-HEADERS += ../debugutil_p.h
+HEADERS += ../shared/debugutil_p.h
SOURCES += tst_qpacketprotocol.cpp \
- ../debugutil.cpp
+ ../shared/debugutil.cpp
diff --git a/tests/auto/declarative/debugger/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp
index 36b6317..b54f133 100644
--- a/tests/auto/declarative/debugger/qpacketprotocol/tst_qpacketprotocol.cpp
+++ b/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp
@@ -48,7 +48,7 @@
#include <private/qpacketprotocol_p.h>
-#include "../debugutil_p.h"
+#include "../shared/debugutil_p.h"
class tst_QPacketProtocol : public QObject
{
diff --git a/tests/auto/declarative/sql/data/2-selection-bindnames.js b/tests/auto/declarative/sql/data/2-selection-bindnames.js
new file mode 100644
index 0000000..c00acc14
--- /dev/null
+++ b/tests/auto/declarative/sql/data/2-selection-bindnames.js
@@ -0,0 +1,24 @@
+var db = openDatabase("QmlTestDB", "", "Test database from Qt autotests", 1000000);
+var r=0;
+
+db.transaction(
+ function(tx) {
+ tx.executeSql('SELECT * FROM Greeting WHERE salutation=:p2 AND salutee=:p1', {':p1':'world', ':p2':'hello'},
+ function(tx, rs) {
+ if ( rs.rows.length != 4 ) {
+ if (r==0) r = "SELECT RETURNED WRONG VALUE "+rs.rows.length+rs.rows.item(0)+rs.rows.item(1)
+ }
+ },
+ function(tx, error) { if (r==0) r="SELECT FAILED: "+error.message }
+ );
+ },
+ function(tx, error) { if (r==0) r="TRANSACTION FAILED: "+error.message },
+ function(tx, result) { if (r==0) r="passed" }
+);
+
+
+function test()
+{
+ if (r == 0) r = "transaction_not_finished";
+ return r;
+}
diff --git a/tests/auto/declarative/sql/data/6-iteration-efficient.js b/tests/auto/declarative/sql/data/6-iteration-efficient.js
index 2222b8a..6711fb0 100644
--- a/tests/auto/declarative/sql/data/6-iteration-efficient.js
+++ b/tests/auto/declarative/sql/data/6-iteration-efficient.js
@@ -1,12 +1,16 @@
var db = openDatabase("QmlTestDB", "", "Test database from Qt autotests", 1000000);
var r=0;
+var fbefore="FORWARD WRONG"
+var fafter="FORWARD WRONG"
db.transaction(
function(tx) {
tx.executeSql('SELECT * FROM Greeting', [],
function(tx, rs) {
var r1=""
+ if (!rs.rows.forwardOnly) fbefore=""
rs.rows.forwardOnly = true;
+ if (rs.rows.forwardOnly) fafter="";
for(var i=0; rs.rows[i]; ++i) {
r1 += rs.rows[i].salutation + ", " + rs.rows[i].salutee + ";"
}
@@ -17,7 +21,7 @@ db.transaction(
);
},
function(tx, error) { if (r==0) r="TRANSACTION FAILED: "+error.message },
- function(tx, result) { if (r==0) r="passed" }
+ function(tx, result) { if (r==0) r=fbefore+"passed"+fafter }
);
diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp
index e4f497c..973d7b1 100644
--- a/tests/auto/declarative/sql/tst_sql.cpp
+++ b/tests/auto/declarative/sql/tst_sql.cpp
@@ -139,10 +139,11 @@ void tst_sql::testQml_data()
QTest::newRow("creation") << "data/1-creation.js" << "passed" << 1 << false;
QTest::newRow("selection") << "data/2-selection.js" << "passed" << 1 << false;
+ QTest::newRow("selection-bindnames") << "data/2-selection-bindnames.js" << "passed" << 1 << true; // WebKit somehow breaks named parameters
QTest::newRow("iteration-item-function") << "data/3-iteration-item-function.js" << "passed" << 1 << false;
- QTest::newRow("iteration-index") << "data/4-iteration-index.js" << "passed" << 1 << true;
- QTest::newRow("iteration-iterator") << "data/5-iteration-iterator.js" << "passed" << 1 << true;
- QTest::newRow("iteration-efficient") << "data/6-iteration-efficient.js" << "passed" << 1 << true;
+ QTest::newRow("iteration-index") << "data/4-iteration-index.js" << "passed" << 1 << true; // Some HTML5 documents say to use rows by index, others by item() function
+ QTest::newRow("iteration-iterator") << "data/5-iteration-iterator.js" << "passed" << 1 << true; // As with previous, WebKit doesn't give an array
+ QTest::newRow("iteration-efficient") << "data/6-iteration-efficient.js" << "passed" << 1 << true; // It's very inefficient to find the total number of results, here is a solution
}
void tst_sql::validateAgainstWebkit_data()