summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/corelib/io/qurl/main.cpp244
-rw-r--r--tests/benchmarks/corelib/io/qurl/qurl.pro7
-rw-r--r--tests/benchmarks/declarative/binding/testtypes.cpp2
-rw-r--r--tests/benchmarks/declarative/creation/tst_creation.cpp252
-rw-r--r--tests/benchmarks/declarative/declarative.pro3
-rw-r--r--tests/benchmarks/declarative/painting/painting.pro (renamed from tests/benchmarks/declarative/painting/paintbenchmark.pro)0
-rw-r--r--tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml1
-rw-r--r--tests/benchmarks/declarative/qdeclarativecomponent/testtypes.cpp2
-rw-r--r--tests/benchmarks/declarative/qdeclarativetime/qdeclarativetime.cpp2
-rw-r--r--tests/benchmarks/declarative/script/tst_script.cpp2
-rw-r--r--tests/benchmarks/gui/painting/qregion/main.cpp50
11 files changed, 423 insertions, 142 deletions
diff --git a/tests/benchmarks/corelib/io/qurl/main.cpp b/tests/benchmarks/corelib/io/qurl/main.cpp
new file mode 100644
index 0000000..49ace64
--- /dev/null
+++ b/tests/benchmarks/corelib/io/qurl/main.cpp
@@ -0,0 +1,244 @@
+/****************************************************************************
+**
+** 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 <qurl.h>
+#include <qtest.h>
+
+class tst_qurl: public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void emptyUrl();
+ void relativeUrl();
+ void absoluteUrl();
+ void isRelative_data();
+ void isRelative();
+ void toLocalFile_data();
+ void toLocalFile();
+ void toString_data();
+ void toString();
+ void toEncoded_data();
+ void toEncoded();
+ void resolved_data();
+ void resolved();
+ void equality_data();
+ void equality();
+ void qmlPropertyWriteUseCase();
+
+private:
+ void generateFirstRunData();
+};
+
+void tst_qurl::emptyUrl()
+{
+ QBENCHMARK {
+ QUrl url;
+ }
+}
+
+void tst_qurl::relativeUrl()
+{
+ QBENCHMARK {
+ QUrl url("pics/avatar.png");
+ }
+}
+
+void tst_qurl::absoluteUrl()
+{
+ QBENCHMARK {
+ QUrl url("/tmp/avatar.png");
+ }
+}
+
+void tst_qurl::generateFirstRunData()
+{
+ QTest::addColumn<bool>("firstRun");
+
+ QTest::newRow("construction + first run") << true;
+ QTest::newRow("subsequent runs") << false;
+}
+
+void tst_qurl::isRelative_data()
+{
+ generateFirstRunData();
+}
+
+void tst_qurl::isRelative()
+{
+ QFETCH(bool, firstRun);
+ if (firstRun) {
+ QBENCHMARK {
+ QUrl url("pics/avatar.png");
+ url.isRelative();
+ }
+ } else {
+ QUrl url("pics/avatar.png");
+ QBENCHMARK {
+ url.isRelative();
+ }
+ }
+}
+
+void tst_qurl::toLocalFile_data()
+{
+ generateFirstRunData();
+}
+
+void tst_qurl::toLocalFile()
+{
+ QFETCH(bool, firstRun);
+ if (firstRun) {
+ QBENCHMARK {
+ QUrl url("/tmp/avatar.png");
+ url.toLocalFile();
+ }
+ } else {
+ QUrl url("/tmp/avatar.png");
+ QBENCHMARK {
+ url.toLocalFile();
+ }
+ }
+}
+
+void tst_qurl::toString_data()
+{
+ generateFirstRunData();
+}
+
+void tst_qurl::toString()
+{
+ QFETCH(bool, firstRun);
+ if(firstRun) {
+ QBENCHMARK {
+ QUrl url("pics/avatar.png");
+ url.toString();
+ }
+ } else {
+ QUrl url("pics/avatar.png");
+ QBENCHMARK {
+ url.toString();
+ }
+ }
+}
+
+void tst_qurl::toEncoded_data()
+{
+ generateFirstRunData();
+}
+
+void tst_qurl::toEncoded()
+{
+ QFETCH(bool, firstRun);
+ if(firstRun) {
+ QBENCHMARK {
+ QUrl url("pics/avatar.png");
+ url.toEncoded(QUrl::FormattingOption(0x100));
+ }
+ } else {
+ QUrl url("pics/avatar.png");
+ QBENCHMARK {
+ url.toEncoded(QUrl::FormattingOption(0x100));
+ }
+ }
+}
+
+void tst_qurl::resolved_data()
+{
+ generateFirstRunData();
+}
+
+void tst_qurl::resolved()
+{
+ QFETCH(bool, firstRun);
+ if(firstRun) {
+ QBENCHMARK {
+ QUrl baseUrl("/home/user/");
+ QUrl url("pics/avatar.png");
+ baseUrl.resolved(url);
+ }
+ } else {
+ QUrl baseUrl("/home/user/");
+ QUrl url("pics/avatar.png");
+ QBENCHMARK {
+ baseUrl.resolved(url);
+ }
+ }
+}
+
+void tst_qurl::equality_data()
+{
+ generateFirstRunData();
+}
+
+void tst_qurl::equality()
+{
+ QFETCH(bool, firstRun);
+ if(firstRun) {
+ QBENCHMARK {
+ QUrl url("pics/avatar.png");
+ QUrl url2("pics/avatar2.png");
+ //url == url2;
+ }
+ } else {
+ QUrl url("pics/avatar.png");
+ QUrl url2("pics/avatar2.png");
+ QBENCHMARK {
+ url == url2;
+ }
+ }
+}
+
+void tst_qurl::qmlPropertyWriteUseCase()
+{
+ QUrl base("file:///home/user/qt/demos/declarative/samegame/SamegameCore/");
+ QString str("pics/redStar.png");
+
+ QBENCHMARK {
+ QUrl u = QUrl(str);
+ if (!u.isEmpty() && u.isRelative())
+ u = base.resolved(u);
+ }
+}
+
+QTEST_MAIN(tst_qurl)
+
+#include "main.moc"
diff --git a/tests/benchmarks/corelib/io/qurl/qurl.pro b/tests/benchmarks/corelib/io/qurl/qurl.pro
new file mode 100644
index 0000000..1d2d35e
--- /dev/null
+++ b/tests/benchmarks/corelib/io/qurl/qurl.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qurl
+QT -= gui
+win32: DEFINES+= _CRT_SECURE_NO_WARNINGS
+
+SOURCES += main.cpp
diff --git a/tests/benchmarks/declarative/binding/testtypes.cpp b/tests/benchmarks/declarative/binding/testtypes.cpp
index 043c8ab..1fc9ccd 100644
--- a/tests/benchmarks/declarative/binding/testtypes.cpp
+++ b/tests/benchmarks/declarative/binding/testtypes.cpp
@@ -42,5 +42,5 @@
void registerTypes()
{
- QML_REGISTER_TYPE(Test, 1, 0, MyQmlObject, MyQmlObject);
+ qmlRegisterType<MyQmlObject>("Test", 1, 0, "MyQmlObject");
}
diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp
index 5b0004f..7aec32a 100644
--- a/tests/benchmarks/declarative/creation/tst_creation.cpp
+++ b/tests/benchmarks/declarative/creation/tst_creation.cpp
@@ -47,6 +47,7 @@
#include <QGraphicsScene>
#include <QGraphicsItem>
#include <QDeclarativeItem>
+#include <QDeclarativeContext>
#include <private/qobject_p.h>
#ifdef Q_OS_SYMBIAN
@@ -59,7 +60,7 @@ class tst_creation : public QObject
{
Q_OBJECT
public:
- tst_creation() {}
+ tst_creation();
private slots:
void qobject_cpp();
@@ -67,13 +68,11 @@ private slots:
void qobject_qmltype();
void qobject_alloc();
- void objects_qmltype_data();
- void objects_qmltype();
+ void qobject_10flat_qml();
+ void qobject_10flat_cpp();
- void qgraphicsitem();
- void qgraphicsobject();
- void qgraphicsitem14();
- void qgraphicsitem_tree14();
+ void qobject_10tree_qml();
+ void qobject_10tree_cpp();
void itemtree_notree_cpp();
void itemtree_objtree_cpp();
@@ -82,10 +81,36 @@ private slots:
void itemtree_qml();
void itemtree_scene_cpp();
+ void elements_data();
+ void elements();
+
private:
QDeclarativeEngine engine;
};
+class TestType : public QObject
+{
+Q_OBJECT
+Q_PROPERTY(QDeclarativeListProperty<QObject> resources READ resources);
+Q_CLASSINFO("DefaultProperty", "resources");
+public:
+ TestType(QObject *parent = 0)
+ : QObject(parent) {}
+
+ QDeclarativeListProperty<QObject> resources() {
+ return QDeclarativeListProperty<QObject>(this, 0, resources_append);
+ }
+
+ static void resources_append(QDeclarativeListProperty<QObject> *p, QObject *o) {
+ o->setParent(p->object);
+ }
+};
+
+tst_creation::tst_creation()
+{
+ qmlRegisterType<TestType>("Qt.test", 1, 0, "TestType");
+}
+
inline QUrl TEST_FILE(const QString &filename)
{
return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
@@ -101,7 +126,8 @@ void tst_creation::qobject_cpp()
void tst_creation::qobject_qml()
{
- QDeclarativeComponent component(&engine, TEST_FILE("qobject.qml"));
+ QDeclarativeComponent component(&engine);
+ component.setData("import Qt 4.6\nQtObject {}", QUrl());
QObject *obj = component.create();
delete obj;
@@ -111,60 +137,73 @@ void tst_creation::qobject_qml()
}
}
-void tst_creation::qobject_qmltype()
+void tst_creation::qobject_10flat_qml()
{
- QDeclarativeType *t = QDeclarativeMetaType::qmlType("Qt/QtObject", 4, 6);
+ QDeclarativeComponent component(&engine);
+ component.setData("import Qt.test 1.0\nTestType { resources: [ TestType{},TestType{},TestType{},TestType{},TestType{},TestType{},TestType{},TestType{},TestType{},TestType{} ] }", QUrl());
+ QObject *obj = component.create();
+ delete obj;
QBENCHMARK {
- QObject *obj = t->create();
+ QObject *obj = component.create();
delete obj;
}
}
-struct QObjectFakeData {
- char data[sizeof(QObjectPrivate)];
-};
-
-struct QObjectFake {
- QObjectFake();
- virtual ~QObjectFake();
-private:
- QObjectFakeData *d;
-};
-
-QObjectFake::QObjectFake()
+void tst_creation::qobject_10flat_cpp()
{
- d = new QObjectFakeData;
+ QBENCHMARK {
+ QObject *item = new TestType;
+ new TestType(item);
+ new TestType(item);
+ new TestType(item);
+ new TestType(item);
+ new TestType(item);
+ new TestType(item);
+ new TestType(item);
+ new TestType(item);
+ new TestType(item);
+ new TestType(item);
+ delete item;
+ }
}
-QObjectFake::~QObjectFake()
+void tst_creation::qobject_10tree_qml()
{
- delete d;
-}
+ QDeclarativeComponent component(&engine);
+ component.setData("import Qt.test 1.0\nTestType { TestType{ TestType { TestType{ TestType{ TestType{ TestType{ TestType{ TestType{ TestType{ TestType{ } } } } } } } } } } }", QUrl());
+
+ QObject *obj = component.create();
+ delete obj;
-void tst_creation::qobject_alloc()
-{
QBENCHMARK {
- QObjectFake *obj = new QObjectFake;
+ QObject *obj = component.create();
delete obj;
}
}
-void tst_creation::objects_qmltype_data()
+void tst_creation::qobject_10tree_cpp()
{
- QTest::addColumn<QByteArray>("type");
-
- QList<QByteArray> types = QDeclarativeMetaType::qmlTypeNames();
- foreach (QByteArray type, types)
- QTest::newRow(type.constData()) << type;
+ QBENCHMARK {
+ QObject *item = new TestType;
+ QObject *root = item;
+ item = new TestType(item);
+ item = new TestType(item);
+ item = new TestType(item);
+ item = new TestType(item);
+ item = new TestType(item);
+ item = new TestType(item);
+ item = new TestType(item);
+ item = new TestType(item);
+ item = new TestType(item);
+ item = new TestType(item);
+ delete root;
+ }
}
-void tst_creation::objects_qmltype()
+void tst_creation::qobject_qmltype()
{
- QFETCH(QByteArray, type);
- QDeclarativeType *t = QDeclarativeMetaType::qmlType(type, 4, 6);
- if (!t || !t->isCreatable())
- QSKIP("Non-creatable type", SkipSingle);
+ QDeclarativeType *t = QDeclarativeMetaType::qmlType("Qt/QtObject", 4, 6);
QBENCHMARK {
QObject *obj = t->create();
@@ -172,114 +211,32 @@ void tst_creation::objects_qmltype()
}
}
-class QGraphicsItemDummy : public QGraphicsItem
-{
-public:
- virtual QRectF boundingRect() const { return QRectF(); }
- virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) {}
+struct QObjectFakeData {
+ char data[sizeof(QObjectPrivate)];
};
-class QGraphicsObjectDummy : public QGraphicsObject
-{
-public:
- virtual QRectF boundingRect() const { return QRectF(); }
- virtual void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) {}
+struct QObjectFake {
+ QObjectFake();
+ virtual ~QObjectFake();
+private:
+ QObjectFakeData *d;
};
-void tst_creation::qgraphicsitem()
-{
- QBENCHMARK {
- QGraphicsItemDummy *i = new QGraphicsItemDummy();
- delete i;
- }
-}
-
-void tst_creation::qgraphicsobject()
+QObjectFake::QObjectFake()
{
- QBENCHMARK {
- QGraphicsObjectDummy *i = new QGraphicsObjectDummy();
- delete i;
- }
+ d = new QObjectFakeData;
}
-void tst_creation::qgraphicsitem14()
+QObjectFake::~QObjectFake()
{
- QBENCHMARK {
- QGraphicsItemDummy *i1 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i2 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i3 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i4 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i5 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i6 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i7 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i8 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i9 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i10 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i11 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i12 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i13 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i14 = new QGraphicsItemDummy();
-
- delete i1;
- delete i2;
- delete i3;
- delete i4;
- delete i5;
- delete i6;
- delete i7;
- delete i8;
- delete i9;
- delete i10;
- delete i11;
- delete i12;
- delete i13;
- delete i14;
- }
+ delete d;
}
-void tst_creation::qgraphicsitem_tree14()
+void tst_creation::qobject_alloc()
{
QBENCHMARK {
- // i1
- // +-------------------------+
- // i2 i3
- // +-----------+ +-----+-----+
- // i4 i5 i6 i7
- // +----+ +--+ +--+--+ +----+
- // i8 i9 i10 i11 i12 i13 i14
-
- QGraphicsItemDummy *i1 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i2 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i3 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i4 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i5 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i6 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i7 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i8 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i9 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i10 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i11 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i12 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i13 = new QGraphicsItemDummy();
- QGraphicsItemDummy *i14 = new QGraphicsItemDummy();
-
- i14->setParentItem(i7);
- i13->setParentItem(i7);
- i12->setParentItem(i6);
- i11->setParentItem(i6);
- i10->setParentItem(i5);
- i9->setParentItem(i4);
- i8->setParentItem(i4);
-
- i7->setParentItem(i3);
- i6->setParentItem(i3);
- i5->setParentItem(i2);
- i4->setParentItem(i2);
-
- i3->setParentItem(i1);
- i2->setParentItem(i1);
-
- delete i1;
+ QObjectFake *obj = new QObjectFake;
+ delete obj;
}
}
@@ -378,6 +335,27 @@ void tst_creation::itemtree_scene_cpp()
delete root;
}
+void tst_creation::elements_data()
+{
+ QTest::addColumn<QByteArray>("type");
+
+ QList<QByteArray> types = QDeclarativeMetaType::qmlTypeNames();
+ foreach (QByteArray type, types)
+ QTest::newRow(type.constData()) << type;
+}
+
+void tst_creation::elements()
+{
+ QFETCH(QByteArray, type);
+ QDeclarativeType *t = QDeclarativeMetaType::qmlType(type, 4, 6);
+ if (!t || !t->isCreatable())
+ QSKIP("Non-creatable type", SkipSingle);
+
+ QBENCHMARK {
+ QObject *obj = t->create();
+ delete obj;
+ }
+}
QTEST_MAIN(tst_creation)
diff --git a/tests/benchmarks/declarative/declarative.pro b/tests/benchmarks/declarative/declarative.pro
index 8c0ed42..38ea6c4 100644
--- a/tests/benchmarks/declarative/declarative.pro
+++ b/tests/benchmarks/declarative/declarative.pro
@@ -2,9 +2,10 @@ TEMPLATE = subdirs
SUBDIRS += \
binding \
creation \
+ painting \
pointers \
qdeclarativecomponent \
qdeclarativeimage \
qdeclarativemetaproperty \
script \
-# qdeclarativetime
+ qdeclarativetime
diff --git a/tests/benchmarks/declarative/painting/paintbenchmark.pro b/tests/benchmarks/declarative/painting/painting.pro
index 2f98e8b..2f98e8b 100644
--- a/tests/benchmarks/declarative/painting/paintbenchmark.pro
+++ b/tests/benchmarks/declarative/painting/painting.pro
diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml
index e48194a..b14531d 100644
--- a/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml
+++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml
@@ -1,4 +1,5 @@
import Qt 4.6
+import Qt.labs.particles 1.0
Item { id:block
property bool dying: false
diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.cpp b/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.cpp
index acdc395..7bc6ca2 100644
--- a/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.cpp
+++ b/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.cpp
@@ -42,5 +42,5 @@
void registerTypes()
{
- QML_REGISTER_TYPE(Qt.test, 4, 6, MyQmlObject, MyQmlObject);
+ qmlRegisterType<MyQmlObject>("Qt.test", 4, 6, "MyQmlObject");
}
diff --git a/tests/benchmarks/declarative/qdeclarativetime/qdeclarativetime.cpp b/tests/benchmarks/declarative/qdeclarativetime/qdeclarativetime.cpp
index a924337..20f0d93d 100644
--- a/tests/benchmarks/declarative/qdeclarativetime/qdeclarativetime.cpp
+++ b/tests/benchmarks/declarative/qdeclarativetime/qdeclarativetime.cpp
@@ -156,7 +156,7 @@ int main(int argc, char ** argv)
{
QApplication app(argc, argv);
- QML_REGISTER_TYPE(QDeclarativeTime, 1, 0, Timer, Timer);
+ qmlRegisterType<Timer>("QDeclarativeTime", 1, 0, "Timer");
uint iterations = 1024;
QString filename;
diff --git a/tests/benchmarks/declarative/script/tst_script.cpp b/tests/benchmarks/declarative/script/tst_script.cpp
index 9dd4076..8ea6dcd 100644
--- a/tests/benchmarks/declarative/script/tst_script.cpp
+++ b/tests/benchmarks/declarative/script/tst_script.cpp
@@ -144,7 +144,7 @@ int TestObject::x()
void tst_script::initTestCase()
{
- QML_REGISTER_TYPE(Qt.test, 1, 0, TestObject, TestObject);
+ qmlRegisterType<TestObject>("Qt.test", 1, 0, "TestObject");
}
diff --git a/tests/benchmarks/gui/painting/qregion/main.cpp b/tests/benchmarks/gui/painting/qregion/main.cpp
index 3d16e41..1d19854 100644
--- a/tests/benchmarks/gui/painting/qregion/main.cpp
+++ b/tests/benchmarks/gui/painting/qregion/main.cpp
@@ -49,6 +49,9 @@ class tst_qregion : public QObject
private slots:
void map_data();
void map();
+
+ void intersects_data();
+ void intersects();
};
@@ -84,6 +87,53 @@ void tst_qregion::map()
}
}
+void tst_qregion::intersects_data()
+{
+ QTest::addColumn<QRegion>("region");
+ QTest::addColumn<QRect>("rect");
+
+ QRegion region(0, 0, 100, 100);
+ QRegion complexRegion;
+ complexRegion = complexRegion.united(QRect(0, 0, 100, 100));
+ complexRegion = complexRegion.united(QRect(120, 20, 100, 100));
+
+ {
+ QRect rect(0, 0, 100, 100);
+ QTest::newRow("same -- simple") << region << rect;
+ }
+ {
+ QRect rect(10, 10, 10, 10);
+ QTest::newRow("inside -- simple") << region << rect;
+ }
+ {
+ QRect rect(110, 110, 10, 10);
+ QTest::newRow("outside -- simple") << region << rect;
+ }
+
+ {
+ QRect rect(0, 0, 100, 100);
+ QTest::newRow("same -- complex") << complexRegion << rect;
+ }
+ {
+ QRect rect(10, 10, 10, 10);
+ QTest::newRow("inside -- complex") << complexRegion << rect;
+ }
+ {
+ QRect rect(110, 110, 10, 10);
+ QTest::newRow("outside -- complex") << complexRegion << rect;
+ }
+}
+
+void tst_qregion::intersects()
+{
+ QFETCH(QRegion, region);
+ QFETCH(QRect, rect);
+
+ QBENCHMARK {
+ region.intersects(rect);
+ }
+}
+
QTEST_MAIN(tst_qregion)
#include "main.moc"