summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-17 16:08:46 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-17 16:08:46 (GMT)
commite66fcc2b1897883d8ec0780c731c5989cb657cdf (patch)
tree8cac984418b97886793d973f0ee138f1412fbc14 /tests
parentfd36b47e8758562fc9ff350f292fc9ae9ed91d4e (diff)
parente23a519366587cfc27ad3be88180692cb49e206f (diff)
downloadQt-e66fcc2b1897883d8ec0780c731c5989cb657cdf.zip
Qt-e66fcc2b1897883d8ec0780c731c5989cb657cdf.tar.gz
Qt-e66fcc2b1897883d8ec0780c731c5989cb657cdf.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (29 commits) Recognize identifiers containing unicode escape sequences. Fix README Fix doc: QML_DECLARE_TYPE is no longer necessary Fix doc: remote contents requires qmldir Fixed parsing of inner labelled statements. Doc Remove unsupported plugin version flags in .pro files of declarative examples Documentation typo. More QML doc consistency. Ensure existing image is gone before next photo selection. Don't use zoomfactor. Doc: in QML use "real" and "enumeration", not "qreal" and "enum" Doc: Put "default" property label on same line as property name Wait for debug clients asynchronously instead of blocking creation of Test not reliable ResizeMode support for QGraphicsWidgets created with QDeclarativeView More class documentation fixes for declarative. Simplify QML import plugin deployment lines Add QML imports to s60installs.pro Cleanup photoviewer demo. ...
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/declarative.pro1
-rw-r--r--tests/auto/declarative/parserstress/tst_parserstress.cpp8
-rw-r--r--tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp91
-rw-r--r--tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp42
-rw-r--r--tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp42
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/createComponent.qml9
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml26
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/hsla.qml4
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/rgba.qml4
-rw-r--r--tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp95
-rw-r--r--tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp17
-rw-r--r--tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml5
-rw-r--r--tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml5
-rw-r--r--tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro7
-rw-r--r--tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp272
-rw-r--r--tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp8
-rw-r--r--tests/auto/declarative/shared/debugutil.cpp81
-rw-r--r--tests/auto/declarative/shared/debugutil_p.h56
18 files changed, 477 insertions, 296 deletions
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index 7834650..58371c1 100644
--- a/tests/auto/declarative/declarative.pro
+++ b/tests/auto/declarative/declarative.pro
@@ -59,6 +59,7 @@ SUBDIRS += \
qdeclarativerepeater \ # Cover
qdeclarativeworkerscript \ # Cover
qdeclarativevaluetypes \ # Cover
+ qdeclarativeview \ # Cover
qdeclarativexmlhttprequest \ # Cover
qdeclarativeimageprovider \ # Cover
qdeclarativestyledtext \ # Cover
diff --git a/tests/auto/declarative/parserstress/tst_parserstress.cpp b/tests/auto/declarative/parserstress/tst_parserstress.cpp
index 41c0a1b..f61ca9f 100644
--- a/tests/auto/declarative/parserstress/tst_parserstress.cpp
+++ b/tests/auto/declarative/parserstress/tst_parserstress.cpp
@@ -65,7 +65,7 @@ QStringList tst_parserstress::findJSFiles(const QDir &d)
{
QStringList rv;
- QStringList files = d.entryList(QStringList() << QLatin1String("*.js"),
+ QStringList files = d.entryList(QStringList() << QLatin1String("*.js"),
QDir::Files);
foreach (const QString &file, files) {
if (file == "browser.js")
@@ -73,7 +73,7 @@ QStringList tst_parserstress::findJSFiles(const QDir &d)
rv << d.absoluteFilePath(file);
}
- QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot |
+ QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot |
QDir::NoSymLinks);
foreach (const QString &dir, dirs) {
QDir sub = d;
@@ -131,8 +131,8 @@ void tst_parserstress::ecmascript()
QDeclarativeComponent component(&engine);
component.setData(qmlData, QUrl::fromLocalFile(SRCDIR + QString("/dummy.qml")));
QSet<QString> failingTests;
- failingTests << "uc-003.js" << "uc-005.js" << "regress-352044-02-n.js"
- << "regress-334158.js" << "regress-58274.js" << "dowhile-006.js" << "dowhile-005.js";
+ failingTests << "regress-352044-02-n.js"
+ << "regress-334158.js";
QFileInfo info(file);
foreach (const QString &failing, failingTests) {
if (info.fileName().endsWith(failing)) {
diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
index 133dcb8..49d430e 100644
--- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
+++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
@@ -60,6 +60,7 @@
#include <private/qdeclarativemetatype_p.h>
#include <private/qdeclarativeproperty_p.h>
+#include "../../../shared/util.h"
#include "../shared/debugutil_p.h"
Q_DECLARE_METATYPE(QDeclarativeDebugWatch::State)
@@ -69,14 +70,6 @@ class tst_QDeclarativeDebug : public QObject
{
Q_OBJECT
-public:
- tst_QDeclarativeDebug(QDeclarativeDebugTestData *data)
- {
- m_conn = data->conn;
- m_engine = data->engine;
- m_rootItem = data->items[0];
- }
-
private:
QDeclarativeDebugObjectReference findRootObject();
QDeclarativeDebugPropertyReference findProperty(const QList<QDeclarativeDebugPropertyReference> &props, const QString &name) const;
@@ -93,8 +86,11 @@ private:
QDeclarativeEngine *m_engine;
QDeclarativeItem *m_rootItem;
+ QObjectList m_components;
+
private slots:
void initTestCase();
+ void cleanupTestCase();
void watch_property();
void watch_object();
@@ -278,9 +274,50 @@ void tst_QDeclarativeDebug::compareProperties(const QDeclarativeDebugPropertyRef
void tst_QDeclarativeDebug::initTestCase()
{
+ qRegisterMetaType<QDeclarativeDebugWatch::State>();
+
+ qputenv("QML_DEBUG_SERVER_PORT", "3768");
+ m_engine = new QDeclarativeEngine(this);
+
+ QList<QByteArray> qml;
+ qml << "import Qt 4.7\n"
+ "Item {"
+ "width: 10; height: 20; scale: blueRect.scale;"
+ "Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }"
+ "Text { color: blueRect.color; }"
+ "MouseArea {"
+ "onEntered: { console.log('hello') }"
+ "}"
+ "}";
+ // add second component to test multiple root contexts
+ qml << "import Qt 4.7\n"
+ "Item {}";
+
+ for (int i=0; i<qml.count(); i++) {
+ QDeclarativeComponent component(m_engine);
+ component.setData(qml[i], QUrl::fromLocalFile(""));
+ Q_ASSERT(component.isReady()); // fails if bad syntax
+ m_components << qobject_cast<QDeclarativeItem*>(component.create());
+ }
+ m_rootItem = qobject_cast<QDeclarativeItem*>(m_components.first());
+
+
+ // add an extra context to test for multiple contexts
+ QDeclarativeContext *context = new QDeclarativeContext(m_engine->rootContext(), this);
+ context->setObjectName("tst_QDeclarativeDebug_childContext");
+
+ m_conn = new QDeclarativeDebugConnection(this);
+ m_conn->connectToHost("127.0.0.1", 3768);
+ bool ok = m_conn->waitForConnected();
+ Q_ASSERT(ok);
+ QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient());
+
m_dbg = new QDeclarativeEngineDebug(m_conn, this);
+}
- qRegisterMetaType<QDeclarativeDebugWatch::State>();
+void tst_QDeclarativeDebug::cleanupTestCase()
+{
+ qDeleteAll(m_components);
}
void tst_QDeclarativeDebug::watch_property()
@@ -804,40 +841,6 @@ void tst_QDeclarativeDebug::tst_QDeclarativeDebugPropertyReference()
compareProperties(r, ref);
}
-
-class tst_QDeclarativeDebug_Factory : public QDeclarativeTestFactory
-{
-public:
- QObject *createTest(QDeclarativeDebugTestData *data)
- {
- tst_QDeclarativeDebug *test = new tst_QDeclarativeDebug(data);
- QDeclarativeContext *c = new QDeclarativeContext(data->engine->rootContext(), test);
- c->setObjectName("tst_QDeclarativeDebug_childContext");
- return test;
- }
-};
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- QList<QByteArray> qml;
- qml << "import Qt 4.7\n"
- "Item {"
- "width: 10; height: 20; scale: blueRect.scale;"
- "Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }"
- "Text { color: blueRect.color; }"
- "MouseArea {"
- "onEntered: { console.log('hello') }"
- "}"
- "}";
- // add second component to test multiple root contexts
- qml << "import Qt 4.7\n"
- "Item {}";
- tst_QDeclarativeDebug_Factory factory;
- return QDeclarativeDebugTest::runTests(&factory, qml);
-}
-
-//QTEST_MAIN(tst_QDeclarativeDebug)
+QTEST_MAIN(tst_QDeclarativeDebug)
#include "tst_qdeclarativedebug.moc"
diff --git a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp
index d3679a7..fb17f90 100644
--- a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp
+++ b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp
@@ -52,21 +52,19 @@
#include <private/qdeclarativedebugclient_p.h>
#include <private/qdeclarativedebugservice_p.h>
+#include "../../../shared/util.h"
#include "../shared/debugutil_p.h"
class tst_QDeclarativeDebugClient : public QObject
{
Q_OBJECT
-public:
- tst_QDeclarativeDebugClient(QDeclarativeDebugTestData *data)
- {
- m_conn = data->conn;
- }
-
+private:
QDeclarativeDebugConnection *m_conn;
private slots:
+ void initTestCase();
+
void name();
void isEnabled();
void setEnabled();
@@ -74,6 +72,19 @@ private slots:
void sendMessage();
};
+void tst_QDeclarativeDebugClient::initTestCase()
+{
+ qputenv("QML_DEBUG_SERVER_PORT", "3768");
+ new QDeclarativeEngine(this);
+
+ m_conn = new QDeclarativeDebugConnection(this);
+ m_conn->connectToHost("127.0.0.1", 3768);
+ bool ok = m_conn->waitForConnected();
+ Q_ASSERT(ok);
+
+ QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient());
+}
+
void tst_QDeclarativeDebugClient::name()
{
QString name = "tst_QDeclarativeDebugClient::name()";
@@ -136,22 +147,7 @@ void tst_QDeclarativeDebugClient::sendMessage()
QCOMPARE(resp, msg);
}
-
-class tst_QDeclarativeDebugClient_Factory : public QDeclarativeTestFactory
-{
-public:
- QObject *createTest(QDeclarativeDebugTestData *data) { return new tst_QDeclarativeDebugClient(data); }
-};
-
-
-// This does not use QTEST_MAIN because the test has to be created and run
-// in a separate thread.
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- tst_QDeclarativeDebugClient_Factory factory;
- return QDeclarativeDebugTest::runTests(&factory);
-}
+QTEST_MAIN(tst_QDeclarativeDebugClient)
#include "tst_qdeclarativedebugclient.moc"
+
diff --git a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp
index c8fc001..80d7f76 100644
--- a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp
+++ b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp
@@ -52,21 +52,19 @@
#include <private/qdeclarativedebugclient_p.h>
#include <private/qdeclarativedebugservice_p.h>
+#include "../../../shared/util.h"
#include "../shared/debugutil_p.h"
+
class tst_QDeclarativeDebugService : public QObject
{
Q_OBJECT
-
-public:
- tst_QDeclarativeDebugService(QDeclarativeDebugTestData *data)
- {
- m_conn = data->conn;
- }
-
+private:
QDeclarativeDebugConnection *m_conn;
private slots:
+ void initTestCase();
+
void name();
void isEnabled();
void enabledChanged();
@@ -76,6 +74,19 @@ private slots:
void objectToString();
};
+void tst_QDeclarativeDebugService::initTestCase()
+{
+ qputenv("QML_DEBUG_SERVER_PORT", "3768");
+ new QDeclarativeEngine(this);
+
+ m_conn = new QDeclarativeDebugConnection(this);
+ m_conn->connectToHost("127.0.0.1", 3768);
+ bool ok = m_conn->waitForConnected();
+ Q_ASSERT(ok);
+
+ QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient());
+}
+
void tst_QDeclarativeDebugService::name()
{
QString name = "tst_QDeclarativeDebugService::name()";
@@ -170,21 +181,6 @@ void tst_QDeclarativeDebugService::objectToString()
delete obj;
}
-
-class tst_QDeclarativeDebugService_Factory : public QDeclarativeTestFactory
-{
-public:
- QObject *createTest(QDeclarativeDebugTestData *data) { return new tst_QDeclarativeDebugService(data); }
-};
-
-// This does not use QTEST_MAIN because the test has to be created and run
-// in a separate thread.
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- tst_QDeclarativeDebugService_Factory factory;
- return QDeclarativeDebugTest::runTests(&factory);
-}
+QTEST_MAIN(tst_QDeclarativeDebugService)
#include "tst_qdeclarativedebugservice.moc"
diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml b/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml
index d9b70ec..412c467 100644
--- a/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml
+++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml
@@ -1,19 +1,16 @@
import Qt 4.6
QtObject {
- property bool incorrectArgCount1: false
- property bool incorrectArgCount2: false
property bool emptyArg: false
property string relativeUrl
property string absoluteUrl
+ property QtObject incorectArgCount1: createComponent()
+ property QtObject incorectArgCount2: createComponent("main.qml", 10)
+
Component.onCompleted: {
- // Test that using incorrect argument count returns a null object
- incorrectArgCount1 = (createComponent() == null);
- incorrectArgCount2 = (createComponent("main.qml", 10) == null);
emptyArg = (createComponent("") == null);
-
var r = createComponent("createComponentData.qml");
relativeUrl = r.url;
diff --git a/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml b/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml
index 54a3e7d..8e6c58e 100644
--- a/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml
+++ b/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml
@@ -3,25 +3,25 @@ import Qt 4.6
Item {
id: root
- property bool incorrectArgCount1: false
- property bool incorrectArgCount2: false
+ // errors resulting in exceptions
+ property QtObject incorrectArgCount1: createQmlObject()
+ property QtObject incorrectArgCount2: createQmlObject("import Qt 4.6\nQtObject{}", root, "main.qml", 10)
+ property QtObject noParent: createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13}", 0)
+ property QtObject notAvailable: createQmlObject("import Qt 4.6\nQtObject{Blah{}}", root)
+ property QtObject errors: createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13\nproperty int test: 13\n}", root, "main.qml")
+
property bool emptyArg: false
- property bool noParent: false
- property bool notAvailable: false
- property bool runtimeError: false
- property bool errors: false
property bool success: false
Component.onCompleted: {
- // errors
- incorrectArgCount1 = (createQmlObject() == null);
- incorrectArgCount2 = (createQmlObject("import Qt 4.6\nQtObject{}", root, "main.qml", 10) == null);
+ // errors resulting in nulls
emptyArg = (createQmlObject("", root) == null);
- errors = (createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13\nproperty int test: 13\n}", root, "main.qml") == null);
- noParent = (createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13}", 0) == null);
- notAvailable = (createQmlObject("import Qt 4.6\nQtObject{Blah{}}", root) == null);
- runtimeError = (createQmlObject("import Qt 4.6\nQtObject{property int test\nonTestChanged: QtObject{}\n}", root) == null);
+ try {
+ createQmlObject("import Qt 4.6\nQtObject{property int test\nonTestChanged: QtObject{}\n}", root)
+ } catch (error) {
+ console.log("RunTimeError: ",error.message);
+ }
var o = createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13\n}", root);
success = (o.test == 13);
diff --git a/tests/auto/declarative/qdeclarativeqt/data/hsla.qml b/tests/auto/declarative/qdeclarativeqt/data/hsla.qml
index df51ccd..142410b 100644
--- a/tests/auto/declarative/qdeclarativeqt/data/hsla.qml
+++ b/tests/auto/declarative/qdeclarativeqt/data/hsla.qml
@@ -5,7 +5,7 @@ QtObject {
property color test2: Qt.hsla(1, 0.5, 0.3);
property color test3: Qt.hsla(1, 1);
property color test4: Qt.hsla(1, 1, 1, 1, 1);
- property color test5: Qt.hsla(1.2, 1, 1);
- property color test6: Qt.hsla(-0.1, 1, 1);
+ property color test5: Qt.hsla(1.2, 1.3, 1.4, 1.5);
+ property color test6: Qt.hsla(-0.1, -0.2, -0.3, -0.4);
}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/rgba.qml b/tests/auto/declarative/qdeclarativeqt/data/rgba.qml
index 6dd6565..66305a4 100644
--- a/tests/auto/declarative/qdeclarativeqt/data/rgba.qml
+++ b/tests/auto/declarative/qdeclarativeqt/data/rgba.qml
@@ -5,6 +5,6 @@ QtObject {
property color test2: Qt.rgba(1, 0.5, 0.3);
property color test3: Qt.rgba(1, 1);
property color test4: Qt.rgba(1, 1, 1, 1, 1);
- property color test5: Qt.rgba(1.2, 1, 1);
- property color test6: Qt.rgba(-0.1, 1, 1);
+ property color test5: Qt.rgba(1.2, 1.3, 1.4, 1.5);
+ property color test6: Qt.rgba(-0.1, -0.2, -0.3, -0.4);
}
diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
index 98f1200..4d22b0a 100644
--- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
+++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
@@ -102,14 +102,10 @@ void tst_qdeclarativeqt::rgba()
{
QDeclarativeComponent component(&engine, TEST_FILE("rgba.qml"));
- QString warning1 = component.url().toString() + ":6: Unable to assign null to QColor";
- QString warning2 = component.url().toString() + ":7: Unable to assign null to QColor";
- QString warning3 = component.url().toString() + ":8: Unable to assign null to QColor";
- QString warning4 = component.url().toString() + ":9: Unable to assign null to QColor";
+ QString warning1 = component.url().toString() + ":6: Error: expected 3 or 4 parameters";
+ QString warning2 = component.url().toString() + ":7: Error: expected 3 or 4 parameters";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -119,8 +115,8 @@ void tst_qdeclarativeqt::rgba()
QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromRgbF(1, 0.5, 0.3, 1));
QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor());
QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor());
- QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor());
- QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor::fromRgbF(1, 1, 1, 1));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor::fromRgbF(0, 0, 0, 0));
delete object;
}
@@ -129,14 +125,10 @@ void tst_qdeclarativeqt::hsla()
{
QDeclarativeComponent component(&engine, TEST_FILE("hsla.qml"));
- QString warning1 = component.url().toString() + ":6: Unable to assign null to QColor";
- QString warning2 = component.url().toString() + ":7: Unable to assign null to QColor";
- QString warning3 = component.url().toString() + ":8: Unable to assign null to QColor";
- QString warning4 = component.url().toString() + ":9: Unable to assign null to QColor";
+ QString warning1 = component.url().toString() + ":6: Error: expected 3 or 4 parameters";
+ QString warning2 = component.url().toString() + ":7: Error: expected 3 or 4 parameters";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4));
QObject *object = component.create();
QVERIFY(object != 0);
@@ -145,8 +137,8 @@ void tst_qdeclarativeqt::hsla()
QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromHslF(1, 0.5, 0.3, 1));
QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor());
QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor());
- QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor());
- QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor::fromHslF(1, 1, 1, 1));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor::fromHslF(0, 0, 0, 0));
delete object;
}
@@ -154,6 +146,12 @@ void tst_qdeclarativeqt::hsla()
void tst_qdeclarativeqt::rect()
{
QDeclarativeComponent component(&engine, TEST_FILE("rect.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: expected 4 parameters";
+ QString warning2 = component.url().toString() + ":7: Error: expected 4 parameters";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
QObject *object = component.create();
QVERIFY(object != 0);
@@ -169,6 +167,12 @@ void tst_qdeclarativeqt::rect()
void tst_qdeclarativeqt::point()
{
QDeclarativeComponent component(&engine, TEST_FILE("point.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: expected 2 parameters";
+ QString warning2 = component.url().toString() + ":7: Error: expected 2 parameters";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
QObject *object = component.create();
QVERIFY(object != 0);
@@ -183,6 +187,12 @@ void tst_qdeclarativeqt::point()
void tst_qdeclarativeqt::size()
{
QDeclarativeComponent component(&engine, TEST_FILE("size.qml"));
+
+ QString warning1 = component.url().toString() + ":7: Error: expected 2 parameters";
+ QString warning2 = component.url().toString() + ":8: Error: expected 2 parameters";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
QObject *object = component.create();
QVERIFY(object != 0);
@@ -198,6 +208,12 @@ void tst_qdeclarativeqt::size()
void tst_qdeclarativeqt::vector()
{
QDeclarativeComponent component(&engine, TEST_FILE("vector.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: expected 3 parameters";
+ QString warning2 = component.url().toString() + ":7: Error: expected 3 parameters";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
QObject *object = component.create();
QVERIFY(object != 0);
@@ -212,6 +228,12 @@ void tst_qdeclarativeqt::vector()
void tst_qdeclarativeqt::lighter()
{
QDeclarativeComponent component(&engine, TEST_FILE("lighter.qml"));
+
+ QString warning1 = component.url().toString() + ":5: Error: expected 1 parameter";
+ QString warning2 = component.url().toString() + ":6: Error: expected 1 parameter";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
QObject *object = component.create();
QVERIFY(object != 0);
@@ -228,6 +250,12 @@ void tst_qdeclarativeqt::lighter()
void tst_qdeclarativeqt::darker()
{
QDeclarativeComponent component(&engine, TEST_FILE("darker.qml"));
+
+ QString warning1 = component.url().toString() + ":5: Error: expected 1 parameter";
+ QString warning2 = component.url().toString() + ":6: Error: expected 1 parameter";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
QObject *object = component.create();
QVERIFY(object != 0);
@@ -245,8 +273,9 @@ void tst_qdeclarativeqt::tint()
{
QDeclarativeComponent component(&engine, TEST_FILE("tint.qml"));
- QString warning1 = component.url().toString() + ":7: Unable to assign null to QColor";
- QString warning2 = component.url().toString() + ":8: Unable to assign null to QColor";
+ QString warning1 = component.url().toString() + ":7: Error: expected 2 parameters";
+ QString warning2 = component.url().toString() + ":8: Error: expected 2 parameters";
+
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
@@ -305,13 +334,15 @@ void tst_qdeclarativeqt::md5()
void tst_qdeclarativeqt::createComponent()
{
QDeclarativeComponent component(&engine, TEST_FILE("createComponent.qml"));
+
+ QString warning1 = component.url().toString() + ":9: Error: expected 1 parameter";
+ QString warning2 = component.url().toString() + ":10: Error: expected 1 parameter";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
QObject *object = component.create();
QVERIFY(object != 0);
- QCOMPARE(object->property("incorrectArgCount1").toBool(), true);
- QCOMPARE(object->property("incorrectArgCount2").toBool(), true);
- QCOMPARE(object->property("emptyArg").toBool(), true);
-
QCOMPARE(object->property("absoluteUrl").toString(), QString("http://www.example.com/test.qml"));
QCOMPARE(object->property("relativeUrl").toString(), TEST_FILE("createComponentData.qml").toString());
@@ -322,30 +353,24 @@ void tst_qdeclarativeqt::createQmlObject()
{
QDeclarativeComponent component(&engine, TEST_FILE("createQmlObject.qml"));
- QString warning1 = "QDeclarativeEngine::createQmlObject():";
- QString warning2 = " " + TEST_FILE("main.qml").toString() + ":4:1: Duplicate property name";
- QString warning3 = "QDeclarativeEngine::createQmlObject():";
- QString warning4 = " " + TEST_FILE("inline").toString() + ":2:10: Blah is not a type";
- QString warning5 = "QDeclarativeEngine::createQmlObject():";
- QString warning6 = " " + TEST_FILE("inline").toString() + ":3: Cannot assign object type QObject with no default method";
+ QString warning1 = component.url().toString() + ":7: Error: expected 2 or 3 parameters";
+ QString warning2 = component.url().toString()+ ":10: Error: Qt.createQmlObject(): " + TEST_FILE("inline").toString() + ":2:10: Blah is not a type\n";
+ QString warning3 = component.url().toString()+ ":11: Error: Qt.createQmlObject(): " + TEST_FILE("main.qml").toString() + ":4:1: Duplicate property name\n";
+ QString warning4 = component.url().toString()+ ":9: Error: parent object not found";
+ QString warning5 = component.url().toString()+ ":8: Error: expected 2 or 3 parameters";
+ QString warning6 = "RunTimeError: Qt.createQmlObject(): " + TEST_FILE("inline").toString() + ":3: Cannot assign object type QObject with no default method\n";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning5));
- QTest::ignoreMessage(QtWarningMsg, qPrintable(warning6));
+ QTest::ignoreMessage(QtDebugMsg, qPrintable(warning6));
QObject *object = component.create();
QVERIFY(object != 0);
- QCOMPARE(object->property("incorrectArgCount1").toBool(), true);
- QCOMPARE(object->property("incorrectArgCount2").toBool(), true);
QCOMPARE(object->property("emptyArg").toBool(), true);
- QCOMPARE(object->property("errors").toBool(), true);
- QCOMPARE(object->property("noParent").toBool(), true);
- QCOMPARE(object->property("notAvailable").toBool(), true);
- QCOMPARE(object->property("runtimeError").toBool(), true);
QCOMPARE(object->property("success").toBool(), true);
QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(object);
diff --git a/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp b/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp
index a08a91c..da2d173 100644
--- a/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp
+++ b/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp
@@ -43,6 +43,7 @@
#include <QtDeclarative/qdeclarativeengine.h>
#include <QtDeclarative/qdeclarativecomponent.h>
#include <private/qdeclarativetimer_p.h>
+#include <QtDeclarative/qdeclarativeitem.h>
#include <QDebug>
class tst_qdeclarativetimer : public QObject
@@ -60,6 +61,7 @@ private slots:
void triggeredOnStartRepeat();
void changeDuration();
void restart();
+ void parentProperty();
};
class TimerHelper : public QObject
@@ -317,6 +319,21 @@ void tst_qdeclarativetimer::restart()
delete timer;
}
+void tst_qdeclarativetimer::parentProperty()
+{
+ QDeclarativeEngine engine;
+ QDeclarativeComponent component(&engine);
+ component.setData(QByteArray("import Qt 4.7\nItem { Timer { objectName: \"timer\"; running: parent.visible } }"), QUrl::fromLocalFile(""));
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create());
+ QVERIFY(item != 0);
+ QDeclarativeTimer *timer = item->findChild<QDeclarativeTimer*>("timer");
+ QVERIFY(timer != 0);
+
+ QVERIFY(timer->isRunning());
+
+ delete timer;
+}
+
QTEST_MAIN(tst_qdeclarativetimer)
#include "tst_qdeclarativetimer.moc"
diff --git a/tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml b/tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml
new file mode 100644
index 0000000..27c8454
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml
@@ -0,0 +1,5 @@
+import Qt 4.7
+Item {
+ width: 200
+ height: 200
+}
diff --git a/tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml b/tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml
new file mode 100644
index 0000000..964810c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml
@@ -0,0 +1,5 @@
+import Qt 4.7
+QGraphicsWidget {
+ width: 200
+ height: 200
+}
diff --git a/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro b/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro
new file mode 100644
index 0000000..d6be728
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeview/qdeclarativeview.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative gui
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qdeclarativeview.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp
new file mode 100644
index 0000000..1ed51c1
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp
@@ -0,0 +1,272 @@
+/****************************************************************************
+**
+** 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 <QtTest/QSignalSpy>
+#include <QtDeclarative/qdeclarativecomponent.h>
+#include <QtDeclarative/qdeclarativecontext.h>
+#include <QtDeclarative/qdeclarativeview.h>
+#include <QtDeclarative/qdeclarativeitem.h>
+#include <QtGui/qgraphicswidget.h>
+
+class tst_QDeclarativeView : public QObject
+
+{
+ Q_OBJECT
+public:
+ tst_QDeclarativeView();
+
+private slots:
+ void resizemodedeclarativeitem();
+ void resizemodegraphicswidget();
+
+private:
+ template<typename T>
+ T *findItem(QGraphicsObject *parent, const QString &objectName);
+};
+
+
+tst_QDeclarativeView::tst_QDeclarativeView()
+{
+}
+
+void tst_QDeclarativeView::resizemodedeclarativeitem()
+{
+ QWidget window;
+ QDeclarativeView *canvas = new QDeclarativeView(&window);
+ QVERIFY(canvas);
+ QSignalSpy sceneResizedSpy(canvas, SIGNAL(sceneResized(QSize)));
+ canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodedeclarativeitem.qml"));
+ QDeclarativeItem* declarativeItem = qobject_cast<QDeclarativeItem*>(canvas->rootObject());
+ QVERIFY(declarativeItem);
+ window.show();
+
+ // initial size from root object
+ QCOMPARE(declarativeItem->width(), 200.0);
+ QCOMPARE(declarativeItem->height(), 200.0);
+ QCOMPARE(canvas->size(), QSize(200, 200));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy.count(), 1);
+
+ // size update from view
+ canvas->resize(QSize(80,100));
+ QCOMPARE(declarativeItem->width(), 80.0);
+ QCOMPARE(declarativeItem->height(), 100.0);
+ QCOMPARE(canvas->size(), QSize(80, 100));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy.count(), 2);
+
+ canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject);
+
+ // size update from view disabled
+ canvas->resize(QSize(60,80));
+ QCOMPARE(declarativeItem->width(), 80.0);
+ QCOMPARE(declarativeItem->height(), 100.0);
+ QCOMPARE(canvas->size(), QSize(60, 80));
+ QCOMPARE(sceneResizedSpy.count(), 3);
+
+ // size update from root object
+ declarativeItem->setWidth(250);
+ declarativeItem->setHeight(350);
+ qApp->processEvents();
+ QCOMPARE(declarativeItem->width(), 250.0);
+ QCOMPARE(declarativeItem->height(), 350.0);
+ QCOMPARE(canvas->size(), QSize(250, 350));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy.count(), 4);
+
+ // reset canvas
+ window.hide();
+ delete canvas;
+ canvas = new QDeclarativeView(&window);
+ QVERIFY(canvas);
+ QSignalSpy sceneResizedSpy2(canvas, SIGNAL(sceneResized(QSize)));
+ canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodedeclarativeitem.qml"));
+ declarativeItem = qobject_cast<QDeclarativeItem*>(canvas->rootObject());
+ QVERIFY(declarativeItem);
+ window.show();
+
+ // initial size for root object
+ QCOMPARE(declarativeItem->width(), 200.0);
+ QCOMPARE(declarativeItem->height(), 200.0);
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy2.count(), 1);
+
+ // size update from root object
+ declarativeItem->setWidth(80);
+ declarativeItem->setHeight(100);
+ qApp->processEvents();
+ QCOMPARE(declarativeItem->width(), 80.0);
+ QCOMPARE(declarativeItem->height(), 100.0);
+ QCOMPARE(canvas->size(), QSize(80, 100));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy2.count(), 2);
+
+ // size update from root object disabled
+ canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ declarativeItem->setWidth(60);
+ declarativeItem->setHeight(80);
+ QCOMPARE(canvas->width(), 80);
+ QCOMPARE(canvas->height(), 100);
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy2.count(), 2);
+
+ // size update from view
+ canvas->resize(QSize(200,300));
+ QCOMPARE(declarativeItem->width(), 200.0);
+ QCOMPARE(declarativeItem->height(), 300.0);
+ QCOMPARE(canvas->size(), QSize(200, 300));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy2.count(), 3);
+
+ delete canvas;
+}
+
+void tst_QDeclarativeView::resizemodegraphicswidget()
+{
+ QWidget window;
+ QDeclarativeView *canvas = new QDeclarativeView(&window);
+ QVERIFY(canvas);
+ QSignalSpy sceneResizedSpy(canvas, SIGNAL(sceneResized(QSize)));
+ canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodegraphicswidget.qml"));
+ QGraphicsWidget* graphicsWidget = qobject_cast<QGraphicsWidget*>(canvas->rootObject());
+ QVERIFY(graphicsWidget);
+ window.show();
+
+ // initial size from root object
+ QCOMPARE(graphicsWidget->size(), QSizeF(200.0, 200.0));
+ QCOMPARE(canvas->size(), QSize(200, 200));
+ QCOMPARE(canvas->size(), QSize(200, 200));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy.count(), 1);
+
+ // size update from view
+ canvas->resize(QSize(80,100));
+ QCOMPARE(graphicsWidget->size(), QSizeF(80.0,100.0));
+ QCOMPARE(canvas->size(), QSize(80,100));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy.count(), 2);
+
+ // size update from view disabled
+ canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject);
+ canvas->resize(QSize(60,80));
+ QCOMPARE(graphicsWidget->size(), QSizeF(80.0,100.0));
+ QCOMPARE(canvas->size(), QSize(60, 80));
+ QCOMPARE(sceneResizedSpy.count(), 3);
+
+ // size update from root object
+ graphicsWidget->resize(QSizeF(250.0, 350.0));
+ QCOMPARE(graphicsWidget->size(), QSizeF(250.0,350.0));
+ QCOMPARE(canvas->size(), QSize(250, 350));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy.count(), 4);
+
+ // reset canvas
+ window.hide();
+ delete canvas;
+ canvas = new QDeclarativeView(&window);
+ QVERIFY(canvas);
+ QSignalSpy sceneResizedSpy2(canvas, SIGNAL(sceneResized(QSize)));
+ canvas->setResizeMode(QDeclarativeView::SizeViewToRootObject);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/resizemodegraphicswidget.qml"));
+ graphicsWidget = qobject_cast<QGraphicsWidget*>(canvas->rootObject());
+ QVERIFY(graphicsWidget);
+ window.show();
+
+ // initial size from root object
+ QCOMPARE(graphicsWidget->size(), QSizeF(200.0, 200.0));
+ QCOMPARE(canvas->size(), QSize(200, 200));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy2.count(), 1);
+
+ // size update from root object
+ graphicsWidget->resize(QSizeF(80, 100));
+ QCOMPARE(graphicsWidget->size(), QSizeF(80.0, 100.0));
+ QCOMPARE(canvas->size(), QSize(80, 100));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy2.count(), 2);
+
+ // size update from root object disabled
+ canvas->setResizeMode(QDeclarativeView::SizeRootObjectToView);
+ graphicsWidget->resize(QSizeF(60,80));
+ QCOMPARE(canvas->size(), QSize(80,100));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy2.count(), 2);
+
+ // size update from view
+ canvas->resize(QSize(200,300));
+ QCOMPARE(graphicsWidget->size(), QSizeF(200.0, 300.0));
+ QCOMPARE(canvas->size(), QSize(200, 300));
+ QCOMPARE(canvas->size(), canvas->sizeHint());
+ QCOMPARE(sceneResizedSpy2.count(), 3);
+
+ window.show();
+ delete canvas;
+}
+
+template<typename T>
+T *tst_QDeclarativeView::findItem(QGraphicsObject *parent, const QString &objectName)
+{
+ if (!parent)
+ return 0;
+
+ const QMetaObject &mo = T::staticMetaObject;
+ //qDebug() << parent->QGraphicsObject::children().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))
+ return static_cast<T*>(item);
+ item = findItem<T>(item, objectName);
+ if (item)
+ return static_cast<T*>(item);
+ }
+
+ return 0;
+}
+
+QTEST_MAIN(tst_QDeclarativeView)
+
+#include "tst_qdeclarativeview.moc"
diff --git a/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp
index 2621d65..b8e317e 100644
--- a/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp
+++ b/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp
@@ -111,14 +111,6 @@ void tst_QPacketProtocol::setMaximumPacketSize()
QPacketProtocol out(m_serverConn);
QCOMPARE(out.setMaximumPacketSize(size), expected);
-
- if (size == expected) {
- QPacketProtocol in(m_client);
- QByteArray b;
- b.fill('a', size + 1);
- out.send() << b.constData();
- QVERIFY(QDeclarativeDebugTest::waitForSignal(&in, SIGNAL(invalidPacket())));
- }
}
void tst_QPacketProtocol::setMaximumPacketSize_data()
diff --git a/tests/auto/declarative/shared/debugutil.cpp b/tests/auto/declarative/shared/debugutil.cpp
index 66f04e5..c0c3eca 100644
--- a/tests/auto/declarative/shared/debugutil.cpp
+++ b/tests/auto/declarative/shared/debugutil.cpp
@@ -47,11 +47,11 @@
#include "debugutil_p.h"
-#include <iostream>
bool QDeclarativeDebugTest::waitForSignal(QObject *receiver, const char *member, int timeout) {
QEventLoop loop;
QTimer timer;
+ timer.setSingleShot(true);
QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
QObject::connect(receiver, member, &loop, SLOT(quit()));
timer.start(timeout);
@@ -59,25 +59,6 @@ bool QDeclarativeDebugTest::waitForSignal(QObject *receiver, const char *member,
return timer.isActive();
}
-
-QDeclarativeDebugTestData::QDeclarativeDebugTestData(QEventLoop *el)
- : exitCode(-1), loop(el)
-{
-}
-
-QDeclarativeDebugTestData::~QDeclarativeDebugTestData()
-{
- qDeleteAll(items);
-}
-
-void QDeclarativeDebugTestData::testsFinished(int code)
-{
- exitCode = code;
- loop->quit();
-}
-
-
-
QDeclarativeDebugTestService::QDeclarativeDebugTestService(const QString &s, QObject *parent)
: QDeclarativeDebugService(s, parent), enabled(false)
{
@@ -117,63 +98,3 @@ void QDeclarativeDebugTestClient::messageReceived(const QByteArray &ba)
emit serverMessage(ba);
}
-
-tst_QDeclarativeDebug_Thread::tst_QDeclarativeDebug_Thread(QDeclarativeDebugTestData *data, QDeclarativeTestFactory *factory)
- : m_data(data), m_factory(factory)
-{
-}
-
-void tst_QDeclarativeDebug_Thread::run()
-{
- bool ok = false;
-
- QDeclarativeDebugConnection conn;
- conn.connectToHost("127.0.0.1", 3768);
- ok = conn.waitForConnected();
- Q_ASSERT(ok);
-
- QEventLoop loop;
- connect(m_data, SIGNAL(engineCreated()), &loop, SLOT(quit()));
- loop.exec();
-
- m_data->conn = &conn;
-
- Q_ASSERT(m_factory);
- QObject *test = m_factory->createTest(m_data);
- Q_ASSERT(test);
- int code = QTest::qExec(test, QCoreApplication::arguments());
- delete test;
- emit testsFinished(code);
-}
-
-int QDeclarativeDebugTest::runTests(QDeclarativeTestFactory *factory, const QList<QByteArray> &qml)
-{
- qputenv("QML_DEBUG_SERVER_PORT", "3768");
-
- QEventLoop loop;
- QDeclarativeDebugTestData data(&loop);
-
- tst_QDeclarativeDebug_Thread thread(&data, factory);
- QObject::connect(&thread, SIGNAL(testsFinished(int)), &data, SLOT(testsFinished(int)));
-
- QDeclarativeDebugService::notifyOnServerStart(&thread, "start");
-
- QDeclarativeEngine engine; // blocks until client connects
-
- foreach (const QByteArray &code, qml) {
- QDeclarativeComponent c(&engine);
- c.setData(code, QUrl::fromLocalFile(""));
- Q_ASSERT(c.isReady()); // fails if bad syntax
- data.items << qobject_cast<QDeclarativeItem*>(c.create());
- }
-
- // start the test
- data.engine = &engine;
- emit data.engineCreated();
-
- loop.exec();
- thread.wait();
-
- return data.exitCode;
-}
-
diff --git a/tests/auto/declarative/shared/debugutil_p.h b/tests/auto/declarative/shared/debugutil_p.h
index c152b5a..e6bb7ad 100644
--- a/tests/auto/declarative/shared/debugutil_p.h
+++ b/tests/auto/declarative/shared/debugutil_p.h
@@ -51,50 +51,10 @@
#include <private/qdeclarativedebugservice_p.h>
#include <private/qdeclarativeitem_p.h>
-class QDeclarativeTestFactory;
-
class QDeclarativeDebugTest
{
public:
static bool waitForSignal(QObject *receiver, const char *member, int timeout = 5000);
-
- static int runTests(QDeclarativeTestFactory *factory, const QList<QByteArray> &qml = QList<QByteArray>());
-};
-
-class QDeclarativeDebugTestData : public QObject
-{
- Q_OBJECT
-public:
- QDeclarativeDebugTestData(QEventLoop *el);
-
- ~QDeclarativeDebugTestData();
-
- QDeclarativeDebugConnection *conn;
- QDeclarativeEngine *engine;
-
- int exitCode;
- QEventLoop *loop;
-
- QList<QDeclarativeItem *> items;
-
-signals:
- void engineCreated();
-
-public slots:
- void testsFinished(int code);
-
-private:
- friend class QDeclarativeDebugTest;
-};
-
-
-class QDeclarativeTestFactory
-{
-public:
- QDeclarativeTestFactory() {}
- virtual ~QDeclarativeTestFactory() {}
-
- virtual QObject *createTest(QDeclarativeDebugTestData *data) = 0;
};
class QDeclarativeDebugTestService : public QDeclarativeDebugService
@@ -131,20 +91,4 @@ private:
QByteArray lastMsg;
};
-class tst_QDeclarativeDebug_Thread : public QThread
-{
- Q_OBJECT
-public:
- tst_QDeclarativeDebug_Thread(QDeclarativeDebugTestData *data, QDeclarativeTestFactory *factory);
-
- void run();
-
-signals:
- void testsFinished(int);
-
-private:
- QDeclarativeDebugTestData *m_data;
- QDeclarativeTestFactory *m_factory;
-};
-