aboutsummaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2012-05-08 11:05:21 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-14 03:03:44 +0200
commit91bac7643928dcc1a0967abd30559b2c84b58025 (patch)
treecc93edc7ab837e18de7027a24bbdde9a89eff87a /tests/benchmarks
parent73dffd7b38045e50d3dc568251bfe5d79aa84e0f (diff)
Text benchmarks
Benchmarks to compare the cost of creating 42 text items in a grid vs. using a single text item with 42 lines and laying them out using onLineLaidOut. Change-Id: I4c11e23a3fd04bb8b52b5566fb120d336614c98b Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/qml/qmltime/linelaidout.qml62
-rw-r--r--tests/benchmarks/qml/qmltime/textingrid.qml73
2 files changed, 135 insertions, 0 deletions
diff --git a/tests/benchmarks/qml/qmltime/linelaidout.qml b/tests/benchmarks/qml/qmltime/linelaidout.qml
new file mode 100644
index 0000000000..d0e356077c
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/linelaidout.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Text {
+ width: 480
+ height: width
+ text: "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42"
+ color: "blue"
+ font.pixelSize: 15
+ font.bold: true
+
+ onLineLaidOut: {
+ line.x = (line.number % 7) * 70
+ line.y = Math.floor(line.number / 7.0) * 70
+ }
+ }
+ }
+}
diff --git a/tests/benchmarks/qml/qmltime/textingrid.qml b/tests/benchmarks/qml/qmltime/textingrid.qml
new file mode 100644
index 0000000000..7c4de346d1
--- /dev/null
+++ b/tests/benchmarks/qml/qmltime/textingrid.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QmlTime 1.0 as QmlTime
+
+Item {
+
+ QmlTime.Timer {
+ component: Grid {
+ width: 480
+ height: width
+
+ id: grid
+ columns: 7
+ rows: 6
+
+ Repeater {
+ model: 42
+ Text {
+ width: grid.width / grid.columns; height: width
+ color: "blue"
+ text: index
+ font.pixelSize: 15
+ font.bold: true
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+
+ }
+ }
+
+ }
+ }
+}
+