Fix compilation of QML benchmarks
authorPeter Varga <pvarga@inf.u-szeged.hu>
Fri, 31 May 2013 12:48:24 +0000 (14:48 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 6 Jun 2013 07:31:33 +0000 (09:31 +0200)
Change-Id: I2d612108ec8d69a0a9318cd26f6adcbb74f34138
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
tests/benchmarks/qml/animation/animation.pro
tests/benchmarks/qml/compilation/tst_compilation.cpp
tests/benchmarks/qml/creation/creation.pro
tests/benchmarks/qml/creation/tst_creation.cpp
tests/benchmarks/qml/holistic/testtypes.cpp
tests/benchmarks/qml/painting/paintbenchmark.cpp
tests/benchmarks/qml/pointers/pointers.pro
tests/benchmarks/qml/pointers/tst_pointers.cpp
tests/benchmarks/qml/qquickwindow/tst_qquickwindow.cpp
tests/benchmarks/qml/typeimports/tst_typeimports.cpp

index 7490c5f..adf8382 100644 (file)
@@ -1,11 +1,10 @@
+CONFIG += testcase
 TEMPLATE = app
 TARGET = tst_animation
-QT += qml
+QT += qml testlib core-private gui-private qml-private quick-private v8-private
 macx:CONFIG -= app_bundle
 
 SOURCES += tst_animation.cpp
 
 DEFINES += SRCDIR=\\\"$$PWD\\\"
-
-QT += testlib core-private gui-private qml-private quick-private v8-private
 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
index 1483966..eac3dcc 100644 (file)
@@ -120,7 +120,6 @@ void tst_compilation::jsparser()
 
     QBENCHMARK {
         QQmlJS::Engine engine;
-        QQmlJS::NodePool nodePool(file, &engine);
 
         QQmlJS::Lexer lexer(&engine);
         lexer.setCode(code, -1);
@@ -146,11 +145,14 @@ void tst_compilation::scriptparser()
     QVERIFY(f.open(QIODevice::ReadOnly));
     QByteArray data = f.readAll();
 
+    //TODO(pvarga): check preparseData
+    QByteArray preparseData;
     QUrl url = QUrl::fromLocalFile(file);
+    QString urlString = url.toString();
 
     QBENCHMARK {
         QQmlScript::Parser parser;
-        parser.parse(data, url);
+        parser.parse(data, preparseData, url, urlString);
         parser.tree();
     }
 }
index 8d26ef8..0cfac64 100644 (file)
@@ -1,11 +1,10 @@
 CONFIG += testcase
 TEMPLATE = app
 TARGET = tst_creation
+QT += core-private gui-private qml-private quick-private widgets testlib
 macx:CONFIG -= app_bundle
 
 SOURCES += tst_creation.cpp
 
 DEFINES += SRCDIR=\\\"$$PWD\\\"
-
-QT += core-private gui-private qml-private qtquick1-private widgets testlib
 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
index 4b5c1d1..b6b402a 100644 (file)
@@ -48,7 +48,6 @@
 #include <QGraphicsItem>
 #include <QQuickItem>
 #include <QQmlContext>
-#include <QtQuick1/private/qdeclarativetextinput_p.h>
 #include <private/qobject_p.h>
 
 class tst_creation : public QObject
@@ -96,7 +95,7 @@ public:
     : QObject(parent) {}
 
     QQmlListProperty<QObject> resources() {
-        return QQmlListProperty<QObject>(this, 0, resources_append);
+        return QQmlListProperty<QObject>(this, 0, resources_append, 0, 0, 0);
     }
 
     static void resources_append(QQmlListProperty<QObject> *p, QObject *o) {
@@ -107,9 +106,6 @@ public:
 tst_creation::tst_creation()
 {
     qmlRegisterType<TestType>("Qt.test", 1, 0, "TestType");
-
-    //get rid of initialization effects
-    QDeclarative1TextInput te;
 }
 
 inline QUrl TEST_FILE(const QString &filename)
@@ -321,9 +317,7 @@ void tst_creation::itemtree_qml()
 
 void tst_creation::itemtree_scene_cpp()
 {
-    QGraphicsScene scene;
     QQuickItem *root = new QQuickItem;
-    scene.addItem(root);
     QBENCHMARK {
         QQuickItem *item = new QQuickItem;
         for (int i = 0; i < 30; ++i) {
index 0a9e36d..9b1bb86 100644 (file)
@@ -82,13 +82,13 @@ void registerTypes()
     qmlRegisterType<ScarceResourceProvider>("Qt.test", 1,0, "MyScarceResourceProvider");
     qmlRegisterType<ArbitraryVariantProvider>("Qt.test", 1,0, "MyArbitraryVariantProvider");
 
-    qmlRegisterSingletonType("Qt.test",1,0,script_api);             // register (script) singleton Type for an existing uri which contains elements
-    qmlRegisterSingletonType<testQObjectApi>("Qt.test",1,0,qobject_api);            // register (qobject) for an existing uri for which another singleton Type was previously regd.  Should replace!
-    qmlRegisterSingletonType("Qt.test.scriptApi",1,0,script_api);   // register (script) singleton Type for a uri which doesn't contain elements
-    qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApi",1,0,qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements
-    qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApi",1,3,qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements, minor version set
-    qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApi",2,0,qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements, major version set
-    qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApiParented",1,0,qobject_api_engine_parent); // register (parented qobject) singleton Type for a uri which doesn't contain elements
+    qmlRegisterSingletonType("Qt.test",1,0,"Script",script_api);             // register (script) singleton Type for an existing uri which contains elements
+    qmlRegisterSingletonType<testQObjectApi>("Qt.test",1,0,"QObject",qobject_api);            // register (qobject) for an existing uri for which another singleton Type was previously regd.  Should replace!
+    qmlRegisterSingletonType("Qt.test.scriptApi",1,0,"Script",script_api);   // register (script) singleton Type for a uri which doesn't contain elements
+    qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApi",1,0,"QObject",qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements
+    qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApi",1,3,"QObject",qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements, minor version set
+    qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApi",2,0,"QObject",qobject_api); // register (qobject) singleton Type for a uri which doesn't contain elements, major version set
+    qmlRegisterSingletonType<testQObjectApi>("Qt.test.qobjectApiParented",1,0,"QObject",qobject_api_engine_parent); // register (parented qobject) singleton Type for a uri which doesn't contain elements
 }
 
 //#include "testtypes.moc"
index b991617..1fc7813 100644 (file)
@@ -180,6 +180,8 @@ void paint_RoundedRect(QPainter &p)
     }
 }
 
+// Disable this test case since this cannot be compiled with Qt5.
+#if 0
 void paint_QPixmapCachedRoundedRect(QPainter &p)
 {
     static bool first = true;
@@ -218,6 +220,7 @@ void paint_QPixmapCachedRoundedRect(QPainter &p)
         }
     }
 }
+#endif
 
 void paint_pathCacheRoundedRect(QPainter &p)
 {
@@ -312,7 +315,7 @@ struct {
     { "QStaticTextWithBackendOptimizations", &paint_QStaticText_optimizations },
     { "CachedText", &paint_QPixmapCachedText },
     { "RoundedRect", &paint_RoundedRect },
-    { "CachedRoundedRect", &paint_QPixmapCachedRoundedRect },
+    // { "CachedRoundedRect", &paint_QPixmapCachedRoundedRect },
     { "PathCacheRoundedRect", &paint_pathCacheRoundedRect },
     { "QPixmap63x63_opaque", &paint_QPixmap63x63_opaque },
     { "QPixmap64x64_opaque", &paint_QPixmap64x64_opaque },
index 1db4744..b9b44ab 100644 (file)
@@ -1,5 +1,5 @@
 CONFIG += testcase
-QT += qml testlib
+QT += core-private v8-private qml-private testlib
 TEMPLATE = app
 TARGET = tst_pointers
 macx:CONFIG -= app_bundle
index 65dda28..0c25030 100644 (file)
@@ -40,7 +40,7 @@
 ****************************************************************************/
 
 #include <qtest.h>
-#include "private/qqmlguard_p.h"
+#include <QtQml/private/qqmlguard_p.h>
 #include <QWeakPointer>
 
 class tst_pointers : public QObject
index 01ddd70..20e5fb6 100644 (file)
@@ -63,9 +63,9 @@ tst_qquickwindow::tst_qquickwindow()
 {
     window = new QQuickWindow;
     window->resize(250, 250);
-    window->setPos(100, 100);
+    window->setPosition(100, 100);
     for ( int i=0; i<8000; i++ ) {
-        QQuickRectangle *r =new QQuickRectangle(window->rootItem());
+        QQuickRectangle *r =new QQuickRectangle(window->contentItem());
         for ( int j=0; j<10; ++j ) {
             new QQuickRectangle(r);
         }
index c24e344..5871565 100644 (file)
@@ -67,7 +67,7 @@ public:
     TestType1(QObject *parent = 0) : QObject(parent) {}
 
     QQmlListProperty<QObject> resources() {
-        return QQmlListProperty<QObject>(this, 0, resources_append);
+        return QQmlListProperty<QObject>(this, 0, resources_append, 0, 0, 0);
     }
 
     static void resources_append(QQmlListProperty<QObject> *p, QObject *o) {