From 282315cb9d9c0fafd8ff281401da59022f1fadf4 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Thu, 11 Feb 2010 13:45:40 +0000 Subject: Add EXPECT_FAIL to js parser tests in declarative ui Created QTBUG-8108 for handling these failures. --- tests/auto/declarative/parserstress/tst_parserstress.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/auto/declarative/parserstress/tst_parserstress.cpp b/tests/auto/declarative/parserstress/tst_parserstress.cpp index fe177d1..a607bb3 100644 --- a/tests/auto/declarative/parserstress/tst_parserstress.cpp +++ b/tests/auto/declarative/parserstress/tst_parserstress.cpp @@ -87,8 +87,8 @@ QStringList tst_parserstress::findJSFiles(const QDir &d) void tst_parserstress::ecmascript_data() { QDir dir(SRCDIR); - dir.cdUp(); - dir.cdUp(); + dir.cdUp(); + dir.cdUp(); dir.cd("qscriptjstestsuite"); dir.cd("tests"); @@ -132,6 +132,16 @@ void tst_parserstress::ecmascript() QmlComponent component(&engine); component.setData(qmlData, QUrl::fromLocalFile(SRCDIR + QString("/dummy.qml"))); + QSet 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"; + QFileInfo info(file); + foreach (const QString &failing, failingTests) { + if (info.fileName().endsWith(failing)) { + QEXPECT_FAIL("", "QTBUG-8108", Continue); + break; + } + } QVERIFY(!component.isError()); } -- cgit v0.12 From 11dfaa63a273a3ddad9b3ca610e9afd058eb4e14 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Thu, 11 Feb 2010 14:45:50 +0000 Subject: Removed the tests/auto/declarative/visual(&examples) from .pro --- tests/auto/declarative/declarative.pro | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 9bd7946..7b13b41 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -5,7 +5,6 @@ SUBDIRS += \ animations \ # Cover behaviors \ # Cover datetimeformatter \ # Cover - examples \ graphicswidgets \ # Cover layouts \ # Cover numberformatter \ # Cover @@ -58,7 +57,6 @@ SUBDIRS += \ sql \ # Cover states \ # Cover valuetypes \ # Cover - visual \ # Cover xmlhttprequest # Cover -- cgit v0.12 From 84b4f1b633c347f166c51673003e7bfde78bfd11 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Thu, 11 Feb 2010 15:04:33 +0000 Subject: Fix declarative/animatedimage autotest --- tests/auto/declarative/animatedimage/tst_animatedimage.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/auto/declarative/animatedimage/tst_animatedimage.cpp b/tests/auto/declarative/animatedimage/tst_animatedimage.cpp index c4865d2..ee072c8 100644 --- a/tests/auto/declarative/animatedimage/tst_animatedimage.cpp +++ b/tests/auto/declarative/animatedimage/tst_animatedimage.cpp @@ -129,8 +129,6 @@ void tst_animatedimage::frameCount() QmlGraphicsAnimatedImage *anim = qobject_cast(component.create()); QVERIFY(anim); QVERIFY(anim->isPlaying()); - QCOMPARE(anim->frameCount(), 0); // GIF doesn't support frameCount until first pass through - QTest::qWait(600 + 100); QCOMPARE(anim->frameCount(), 3); delete anim; -- cgit v0.12 From f8c0873871afc0a17bc4c3da446d86a9cc6ff92f Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Thu, 11 Feb 2010 16:08:56 +0000 Subject: Fix declarative/qmldom::loadDynamicProperty autotest Reviewed-by: akennedy --- tests/auto/declarative/qmldom/tst_qmldom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/qmldom/tst_qmldom.cpp b/tests/auto/declarative/qmldom/tst_qmldom.cpp index 6527b36..ce35130 100644 --- a/tests/auto/declarative/qmldom/tst_qmldom.cpp +++ b/tests/auto/declarative/qmldom/tst_qmldom.cpp @@ -486,7 +486,7 @@ void tst_qmldom::loadDynamicProperty() DP_TEST(7, h, QVariant::Date, 168, 15, "date"); DP_TEST(8, i, qMetaTypeId(), 188, 14, "var"); DP_TEST(9, j, qMetaTypeId(), 207, 18, "variant"); - DP_TEST(10, k, -1, 230, 17, "QtObject"); + DP_TEST(10, k, -1, 230, 19, "QtObject"); } { -- cgit v0.12 From ddcfc5cd767001aaeeb532ac8f7b10ad9cf891d8 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 11 Feb 2010 11:12:32 +1000 Subject: Fixed qmldebug* tests crashing. Tests would crash with `QThread: Destroyed while thread is still running' one in a billion runs, since wait() was not called on the test thread. Reviewed-by: leo --- tests/auto/declarative/shared/debugutil.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/declarative/shared/debugutil.cpp b/tests/auto/declarative/shared/debugutil.cpp index 936adda..98243d5 100644 --- a/tests/auto/declarative/shared/debugutil.cpp +++ b/tests/auto/declarative/shared/debugutil.cpp @@ -169,6 +169,8 @@ int QmlDebugTest::runTests(QmlTestFactory *factory, const QList &qml loop.exec(); + thread.wait(); + return data.exitCode; } -- cgit v0.12 From 87652f1bfd5a7cefc90ffe1aba23c179a75cfd0d Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 11 Feb 2010 11:21:01 +1000 Subject: Fix tst_qmlecmascript::callQtInvokables The assert in qmlobjectscriptclass.cpp is valid when the call is running in a correctly created QML environment, but not valid for the test case which bypasses QML. --- src/declarative/qml/qmlobjectscriptclass.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp index 7bbb7df..2823496 100644 --- a/src/declarative/qml/qmlobjectscriptclass.cpp +++ b/src/declarative/qml/qmlobjectscriptclass.cpp @@ -153,10 +153,11 @@ QmlObjectScriptClass::queryProperty(QObject *obj, const Identifier &name, if (!evalContext && context()) { // Global object, QScriptContext activation object, QmlContext object QScriptValue scopeNode = scopeChainValue(context(), -3); - Q_ASSERT(scopeNode.isValid()); - Q_ASSERT(scriptClass(scopeNode) == enginePrivate->contextClass); + if (scopeNode.isValid()) { + Q_ASSERT(scriptClass(scopeNode) == enginePrivate->contextClass); - evalContext = enginePrivate->contextClass->contextFromValue(scopeNode); + evalContext = enginePrivate->contextClass->contextFromValue(scopeNode); + } } if (evalContext) { @@ -332,10 +333,11 @@ void QmlObjectScriptClass::setProperty(QObject *obj, if (!evalContext && context()) { // Global object, QScriptContext activation object, QmlContext object QScriptValue scopeNode = scopeChainValue(context(), -3); - Q_ASSERT(scopeNode.isValid()); - Q_ASSERT(scriptClass(scopeNode) == enginePriv->contextClass); + if (scopeNode.isValid()) { + Q_ASSERT(scriptClass(scopeNode) == enginePriv->contextClass); - evalContext = enginePriv->contextClass->contextFromValue(scopeNode); + evalContext = enginePriv->contextClass->contextFromValue(scopeNode); + } } QmlAbstractBinding *delBinding = QmlMetaPropertyPrivate::setBinding(obj, *lastData, 0); -- cgit v0.12 From ad169b96c7dc878c556b8b5cc12b9d40233008bf Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 11 Feb 2010 11:30:12 +1000 Subject: Improve stability of tst_qmlecmascript::dynamicDestruction Tweak timing to be more forgiving to system load. --- tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml | 2 +- tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml b/tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml index ba87b32..0855b29 100644 --- a/tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml +++ b/tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml @@ -10,7 +10,7 @@ MyQmlObject{ function killOther() { - obj.objectProperty.destroy(100); + obj.objectProperty.destroy(500); } function killMe() diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp index 2182ff4..e5472bb 100644 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp @@ -849,8 +849,12 @@ void tst_qmlecmascript::dynamicDestruction() QTest::qWait(0); QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion); QVERIFY(createdQmlObject); - QTest::qWait(100); - QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion); + for (int ii = 0; createdQmlObject && ii < 10; ++ii) { + if (createdQmlObject) { + QTest::qWait(100); + QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion); + } + } QVERIFY(!createdQmlObject); QMetaObject::invokeMethod(object, "killMe"); -- cgit v0.12 From 4332bab3a2d478a0827bebdb343cc711aa70c613 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 11 Feb 2010 11:32:03 +1000 Subject: QML Object toString should use 64-bit address on 64-bit platforms --- src/declarative/qml/qmlobjectscriptclass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp index 2823496..1c41d46 100644 --- a/src/declarative/qml/qmlobjectscriptclass.cpp +++ b/src/declarative/qml/qmlobjectscriptclass.cpp @@ -377,7 +377,7 @@ QScriptValue QmlObjectScriptClass::tostring(QScriptContext *context, QScriptEngi ret += QString::fromUtf8(obj->metaObject()->className()); ret += QLatin1String("(0x"); - ret += QString::number((quintptr)obj,16); + ret += QString::number((intptr_t)obj,16); if (!objectName.isEmpty()) { ret += QLatin1String(", \""); -- cgit v0.12 From 6c0bdae68c9936f41934062cf80ed38cd1cc9add Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 11 Feb 2010 11:41:51 +1000 Subject: Must pass app arguments onto qExec() or else test system cannot get test results with -xml mode. --- tests/auto/declarative/shared/debugutil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/declarative/shared/debugutil.cpp b/tests/auto/declarative/shared/debugutil.cpp index 936adda..6b6e821 100644 --- a/tests/auto/declarative/shared/debugutil.cpp +++ b/tests/auto/declarative/shared/debugutil.cpp @@ -138,7 +138,7 @@ void tst_QmlDebug_Thread::run() Q_ASSERT(m_factory); QObject *test = m_factory->createTest(m_data); Q_ASSERT(test); - int code = QTest::qExec(test); + int code = QTest::qExec(test, QCoreApplication::arguments()); emit testsFinished(code); } -- cgit v0.12 From 199d5e4f0a0e72fef2c59aaefe1f843592db937e Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 11 Feb 2010 13:13:14 +1000 Subject: Clean up --- tests/auto/declarative/qmldebug/tst_qmldebug.cpp | 2 ++ tests/auto/declarative/qmldebugclient/tst_qmldebugclient.cpp | 5 +++-- tests/auto/declarative/qmldebugservice/tst_qmldebugservice.cpp | 4 ++-- tests/auto/declarative/shared/debugutil.cpp | 1 - tests/auto/declarative/shared/debugutil_p.h | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/auto/declarative/qmldebug/tst_qmldebug.cpp b/tests/auto/declarative/qmldebug/tst_qmldebug.cpp index 7615f9b..82e74ce 100644 --- a/tests/auto/declarative/qmldebug/tst_qmldebug.cpp +++ b/tests/auto/declarative/qmldebug/tst_qmldebug.cpp @@ -330,9 +330,11 @@ void tst_QmlDebug::watch_object() QmlDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); waitForQuery(q_engines); + Q_ASSERT(q_engines->engines().count() > 0); QmlDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this); waitForQuery(q_context); + Q_ASSERT(q_context->rootContext().objects().count() > 0); QmlDebugObjectQuery *q_obj = m_dbg->queryObject(q_context->rootContext().objects()[0], this); waitForQuery(q_obj); diff --git a/tests/auto/declarative/qmldebugclient/tst_qmldebugclient.cpp b/tests/auto/declarative/qmldebugclient/tst_qmldebugclient.cpp index 8325731..4ee0837 100644 --- a/tests/auto/declarative/qmldebugclient/tst_qmldebugclient.cpp +++ b/tests/auto/declarative/qmldebugclient/tst_qmldebugclient.cpp @@ -62,11 +62,9 @@ public: tst_QmlDebugClient(QmlDebugTestData *data) { m_conn = data->conn; - m_engine = data->engine; } QmlDebugConnection *m_conn; - QmlEngine *m_engine; private slots: void name(); @@ -145,6 +143,9 @@ public: QObject *createTest(QmlDebugTestData *data) { return new tst_QmlDebugClient(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); diff --git a/tests/auto/declarative/qmldebugservice/tst_qmldebugservice.cpp b/tests/auto/declarative/qmldebugservice/tst_qmldebugservice.cpp index 625d1f5..4e7bc27 100644 --- a/tests/auto/declarative/qmldebugservice/tst_qmldebugservice.cpp +++ b/tests/auto/declarative/qmldebugservice/tst_qmldebugservice.cpp @@ -62,11 +62,9 @@ public: tst_QmlDebugService(QmlDebugTestData *data) { m_conn = data->conn; - m_engine = data->engine; } QmlDebugConnection *m_conn; - QmlEngine *m_engine; private slots: void name(); @@ -178,6 +176,8 @@ public: QObject *createTest(QmlDebugTestData *data) { return new tst_QmlDebugService(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); diff --git a/tests/auto/declarative/shared/debugutil.cpp b/tests/auto/declarative/shared/debugutil.cpp index 677c6cd..aa0cd31 100644 --- a/tests/auto/declarative/shared/debugutil.cpp +++ b/tests/auto/declarative/shared/debugutil.cpp @@ -168,7 +168,6 @@ int QmlDebugTest::runTests(QmlTestFactory *factory, const QList &qml thread.m_ready = true; 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 cb20f5c..313d16c 100644 --- a/tests/auto/declarative/shared/debugutil_p.h +++ b/tests/auto/declarative/shared/debugutil_p.h @@ -60,8 +60,8 @@ public: ~QmlDebugTestData(); - QmlEngine *engine; QmlDebugConnection *conn; + QmlEngine *engine; int exitCode; QEventLoop *loop; -- cgit v0.12 From 2d8bc0a7a87e4b3e1f3ab29e9e2c667137d9942e Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 11 Feb 2010 14:14:16 +1000 Subject: Test should use ceil() not floor() since ceil() is used for calculating with in QmlGraphicsTextPrivate::setupTextLayout(). --- tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp index eed84ea..4626fe6 100644 --- a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp +++ b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp @@ -46,7 +46,7 @@ #include #include #include -#include +#include class tst_qmlgraphicstext : public QObject @@ -212,7 +212,7 @@ void tst_qmlgraphicstext::width() QFont f; QFontMetricsF fm(f); qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); - metricWidth = floor(metricWidth); + metricWidth = qCeil(metricWidth); QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; QmlComponent textComponent(&engine); -- cgit v0.12