diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-02-24 02:42:00 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-02-24 02:42:00 (GMT) |
commit | 7c76abb0dc4204043bec9b6fa315f9753a7986ae (patch) | |
tree | cee303672cfd138790645e731f2d69472564d4b7 /tests/benchmarks/declarative/qmltime | |
parent | 4066e60e859853cfe3240245ba05271e79839506 (diff) | |
download | Qt-7c76abb0dc4204043bec9b6fa315f9753a7986ae.zip Qt-7c76abb0dc4204043bec9b6fa315f9753a7986ae.tar.gz Qt-7c76abb0dc4204043bec9b6fa315f9753a7986ae.tar.bz2 |
Change class prefix to from QmlXXX to QDeclarativeXXX, QmlGraphicsXXX to QDeclarativeXXX.
Diffstat (limited to 'tests/benchmarks/declarative/qmltime')
13 files changed, 0 insertions, 592 deletions
diff --git a/tests/benchmarks/declarative/qmltime/example.qml b/tests/benchmarks/declarative/qmltime/example.qml deleted file mode 100644 index 68889f0..0000000 --- a/tests/benchmarks/declarative/qmltime/example.qml +++ /dev/null @@ -1,14 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - - property string name: "Bob Smith" - - QmlTime.Timer { - component: Item { - Text { text: name } - } - } -} - diff --git a/tests/benchmarks/declarative/qmltime/qmltime.cpp b/tests/benchmarks/declarative/qmltime/qmltime.cpp deleted file mode 100644 index b791934..0000000 --- a/tests/benchmarks/declarative/qmltime/qmltime.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <QmlEngine> -#include <QmlComponent> -#include <QDebug> -#include <QApplication> -#include <QTime> -#include <QmlContext> -#include <QGraphicsScene> -#include <QGraphicsRectItem> - -class Timer : public QObject -{ - Q_OBJECT - Q_PROPERTY(QmlComponent *component READ component WRITE setComponent); - -public: - Timer(); - - QmlComponent *component() const; - void setComponent(QmlComponent *); - - static Timer *timerInstance(); - - void run(uint); - - bool willParent() const; - void setWillParent(bool p); - -private: - void runTest(QmlContext *, uint); - - QmlComponent *m_component; - static Timer *m_timer; - - bool m_willparent; - QGraphicsScene m_scene; - QGraphicsRectItem m_item; -}; -QML_DECLARE_TYPE(Timer); - -Timer *Timer::m_timer = 0; - -Timer::Timer() -: m_component(0), m_willparent(false) -{ - if (m_timer) - qWarning("Timer: Timer already registered"); - m_timer = this; - - m_scene.setItemIndexMethod(QGraphicsScene::NoIndex); - m_scene.addItem(&m_item); -} - -QmlComponent *Timer::component() const -{ - return m_component; -} - -void Timer::setComponent(QmlComponent *c) -{ - m_component = c; -} - -Timer *Timer::timerInstance() -{ - return m_timer; -} - -void Timer::run(uint iterations) -{ - QmlContext context(qmlContext(this)); - - QObject *o = m_component->create(&context); - QGraphicsObject *go = qobject_cast<QGraphicsObject *>(o); - if (m_willparent && go) - go->setParentItem(&m_item); - delete o; - - runTest(&context, iterations); -} - -bool Timer::willParent() const -{ - return m_willparent; -} - -void Timer::setWillParent(bool p) -{ - m_willparent = p; -} - -void Timer::runTest(QmlContext *context, uint iterations) -{ - QTime t; - t.start(); - for (uint ii = 0; ii < iterations; ++ii) { - QObject *o = m_component->create(context); - QGraphicsObject *go = qobject_cast<QGraphicsObject *>(o); - if (m_willparent && go) - go->setParentItem(&m_item); - delete o; - } - - int e = t.elapsed(); - - qWarning() << "Total:" << e << "ms, Per iteration:" << qreal(e) / qreal(iterations) << "ms"; - -} - -void usage(const char *name) -{ - qWarning("Usage: %s [-iterations <count>] [-parent] <qml file>", name); - exit(-1); -} - -int main(int argc, char ** argv) -{ - QApplication app(argc, argv); - - QML_REGISTER_TYPE(QmlTime, 1, 0, Timer, Timer); - - uint iterations = 1024; - QString filename; - bool willParent = false; - - for (int ii = 1; ii < argc; ++ii) { - QByteArray arg(argv[ii]); - - if (arg == "-iterations") { - if (ii + 1 < argc) { - ++ii; - QByteArray its(argv[ii]); - bool ok = false; - iterations = its.toUInt(&ok); - if (!ok) - usage(argv[0]); - } else { - usage(argv[0]); - } - } else if (arg == "-parent") { - willParent = true; - } else { - filename = QLatin1String(argv[ii]); - } - } - - if (filename.isEmpty()) -#ifdef Q_OS_SYMBIAN - filename = QLatin1String("./tests/item_creation/data.qml"); -#else - usage(argv[0]); -#endif - - QmlEngine engine; - QmlComponent component(&engine, filename); - if (component.isError()) { - qWarning() << component.errors(); - return -1; - } - - QObject *obj = component.create(); - if (!obj) { - qWarning() << component.errors(); - return -1; - } - - Timer *timer = Timer::timerInstance(); - if (!timer) { - qWarning() << "A Tester.Timer instance is required."; - return -1; - } - -#ifdef Q_OS_SYMBIAN - willParent = true; -#endif - timer->setWillParent(willParent); - - if (!timer->component()) { - qWarning() << "The timer has no component"; - return -1; - } - -#ifdef Q_OS_SYMBIAN - iterations = 1024; -#endif - - timer->run(iterations); - - return 0; -} - -#include "qmltime.moc" diff --git a/tests/benchmarks/declarative/qmltime/qmltime.pro b/tests/benchmarks/declarative/qmltime/qmltime.pro deleted file mode 100644 index 9352f3b..0000000 --- a/tests/benchmarks/declarative/qmltime/qmltime.pro +++ /dev/null @@ -1,23 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = qmltime -QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += qmltime.cpp - -symbian* { - TARGET.CAPABILITY = "All -TCB" - example.sources = example.qml - esample.path = . - tests.sources = tests/* - tests.path = tests - anshors.sources = tests/anchors/* - anchors.path = tests/anchors - item_creation.sources = tests/item_creation/* - item_creation.path = tests/item_creation - positioner_creation.sources = tests/positioner_creation/* - positioner_creation.path = tests/positioner_creation - DEPLOYMENT += example tests anchors item_creation positioner_creation -} - diff --git a/tests/benchmarks/declarative/qmltime/tests/anchors/empty.qml b/tests/benchmarks/declarative/qmltime/tests/anchors/empty.qml deleted file mode 100644 index 31c879b..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/anchors/empty.qml +++ /dev/null @@ -1,34 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - - QmlTime.Timer { - component: Component { - Item { - Item { - anchors.leftMargin: 0 - } - Item { - anchors.leftMargin: 0 - } - Item { - anchors.leftMargin: 0 - } - Item { - anchors.leftMargin: 0 - } - Item { - anchors.leftMargin: 0 - } - Item { - anchors.leftMargin: 0 - } - Item { - anchors.leftMargin: 0 - } - } - } - } -} - diff --git a/tests/benchmarks/declarative/qmltime/tests/anchors/fill.qml b/tests/benchmarks/declarative/qmltime/tests/anchors/fill.qml deleted file mode 100644 index 23fe78e..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/anchors/fill.qml +++ /dev/null @@ -1,41 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - - QmlTime.Timer { - component: Component { - Item { - Item { - anchors.fill: parent - anchors.leftMargin: 0 - } - Item { - anchors.fill: parent - anchors.leftMargin: 0 - } - Item { - anchors.fill: parent - anchors.leftMargin: 0 - } - Item { - anchors.fill: parent - anchors.leftMargin: 0 - } - Item { - anchors.fill: parent - anchors.leftMargin: 0 - } - Item { - anchors.fill: parent - anchors.leftMargin: 0 - } - Item { - anchors.fill: parent - anchors.leftMargin: 0 - } - } - } - } -} - diff --git a/tests/benchmarks/declarative/qmltime/tests/anchors/null.qml b/tests/benchmarks/declarative/qmltime/tests/anchors/null.qml deleted file mode 100644 index bc447ef..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/anchors/null.qml +++ /dev/null @@ -1,27 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - - QmlTime.Timer { - component: Component { - Item { - Item { - } - Item { - } - Item { - } - Item { - } - Item { - } - Item { - } - Item { - } - } - } - } -} - diff --git a/tests/benchmarks/declarative/qmltime/tests/item_creation/children.qml b/tests/benchmarks/declarative/qmltime/tests/item_creation/children.qml deleted file mode 100644 index 996602c..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/item_creation/children.qml +++ /dev/null @@ -1,34 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - - QmlTime.Timer { - component: Component { - Item { - children: [ - Rectangle { }, - Rectangle { }, - Item { }, - Image { }, - Text { }, - Item { }, - Item { }, - Image { }, - Image { }, - Row { }, - Image { }, - Image { }, - Column { }, - Row { }, - Text { }, - Text { }, - Text { }, - MouseArea { } - ] - - } - } - } - -} diff --git a/tests/benchmarks/declarative/qmltime/tests/item_creation/data.qml b/tests/benchmarks/declarative/qmltime/tests/item_creation/data.qml deleted file mode 100644 index 9f79c34..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/item_creation/data.qml +++ /dev/null @@ -1,34 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - - QmlTime.Timer { - component: Component { - Item { - data: [ - Rectangle { }, - Rectangle { }, - Item { }, - Image { }, - Text { }, - Item { }, - Item { }, - Image { }, - Image { }, - Row { }, - Image { }, - Image { }, - Column { }, - Row { }, - Text { }, - Text { }, - Text { }, - MouseArea { } - ] - - } - } - } - -} diff --git a/tests/benchmarks/declarative/qmltime/tests/item_creation/no_creation.qml b/tests/benchmarks/declarative/qmltime/tests/item_creation/no_creation.qml deleted file mode 100644 index f228c2a..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/item_creation/no_creation.qml +++ /dev/null @@ -1,12 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - - QmlTime.Timer { - component: Component { - Item { - } - } - } -} diff --git a/tests/benchmarks/declarative/qmltime/tests/item_creation/resources.qml b/tests/benchmarks/declarative/qmltime/tests/item_creation/resources.qml deleted file mode 100644 index 335aeb8..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/item_creation/resources.qml +++ /dev/null @@ -1,34 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - - QmlTime.Timer { - component: Component { - Item { - resources: [ - Rectangle { }, - Rectangle { }, - Item { }, - Image { }, - Text { }, - Item { }, - Item { }, - Image { }, - Image { }, - Row { }, - Image { }, - Image { }, - Column { }, - Row { }, - Text { }, - Text { }, - Text { }, - MouseArea { } - ] - - } - } - } - -} diff --git a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/no_positioner.qml b/tests/benchmarks/declarative/qmltime/tests/positioner_creation/no_positioner.qml deleted file mode 100644 index 97bad47..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/no_positioner.qml +++ /dev/null @@ -1,37 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - QmlTime.Timer { - component: Component { - Item { - Rectangle { } - Rectangle { } - Item { - Image { } - Text { } - } - - Item { - Item { - Image { } - Image { } - Item { - Image { } - Image { } - } - } - - Item { - Item { - Text { } - Text { } - } - Text { } - } - } - MouseArea { } - } - } - } -} diff --git a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/null_positioner.qml b/tests/benchmarks/declarative/qmltime/tests/positioner_creation/null_positioner.qml deleted file mode 100644 index 36dda15..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/null_positioner.qml +++ /dev/null @@ -1,34 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - QmlTime.Timer { - component: Component { - Item { - Rectangle { } - Rectangle { } - Item { - Image { } - Text { } - } - - Item { - Item { - Image { } - Image { } - Row { } - Image { } - Image { } - } - - Column { } - Row { } - Text { } - Text { } - Text { } - } - MouseArea { } - } - } - } -} diff --git a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/positioner.qml b/tests/benchmarks/declarative/qmltime/tests/positioner_creation/positioner.qml deleted file mode 100644 index 396e27d..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/positioner.qml +++ /dev/null @@ -1,37 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - QmlTime.Timer { - component: Component { - Item { - Rectangle { } - Rectangle { } - Item { - Image { } - Text { } - } - - Item { - Item { - Image { } - Image { } - Row { - Image { } - Image { } - } - } - - Column { - Row { - Text { } - Text { } - } - Text { } - } - } - MouseArea { } - } - } - } -} |