summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@trolltech.com>2009-03-03 16:08:30 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-04-06 11:49:40 (GMT)
commitd74f1a91b05b943c1a8ae7847de6ee50b2093b89 (patch)
treecb3e96ad861063e4912d9b20555fc6c44fcef59f /tests/benchmarks
parentb67dffcccea9166918ac93c281d87fd5eb3baf84 (diff)
downloadQt-d74f1a91b05b943c1a8ae7847de6ee50b2093b89.zip
Qt-d74f1a91b05b943c1a8ae7847de6ee50b2093b89.tar.gz
Qt-d74f1a91b05b943c1a8ae7847de6ee50b2093b89.tar.bz2
Fixes: Be a bit more smarter when calling setGeometry from itemChange
RevBy: bnilsen AutoTest: Bench Details : if we come from setPosHelper (so itemChange) we don't need to do all the stuff regarding the size in setGeometry because the size doesn't change. I remove two calls to fullUpdateHelper and update() because prepareGeometryChange already call updateHelper and setPosHelper call fullUpdaterHelper too so we don't need to call them inside setGeometry. We can only call prepareGeometryChange only if we don't come from setPos.
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/qgraphicswidget/qgraphicswidget.pro6
-rw-r--r--tests/benchmarks/qgraphicswidget/tst_qgraphicswidget.cpp60
2 files changed, 66 insertions, 0 deletions
diff --git a/tests/benchmarks/qgraphicswidget/qgraphicswidget.pro b/tests/benchmarks/qgraphicswidget/qgraphicswidget.pro
new file mode 100644
index 0000000..f1ec54e
--- /dev/null
+++ b/tests/benchmarks/qgraphicswidget/qgraphicswidget.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qgraphicswidget
+TEMPLATE = app
+# Input
+SOURCES += tst_qgraphicswidget.cpp
diff --git a/tests/benchmarks/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/benchmarks/qgraphicswidget/tst_qgraphicswidget.cpp
new file mode 100644
index 0000000..97837e2
--- /dev/null
+++ b/tests/benchmarks/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QGraphicsItem>
+#include <QGraphicsScene>
+#include <QGraphicsView>
+#include <QGraphicsWidget>
+//TESTED_FILES=
+
+class tst_QGraphicsWidget : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QGraphicsWidget();
+ virtual ~tst_QGraphicsWidget();
+
+public slots:
+ void init();
+ void cleanup();
+
+private slots:
+ void move();
+};
+
+tst_QGraphicsWidget::tst_QGraphicsWidget()
+{
+}
+
+tst_QGraphicsWidget::~tst_QGraphicsWidget()
+{
+}
+
+void tst_QGraphicsWidget::init()
+{
+}
+
+void tst_QGraphicsWidget::cleanup()
+{
+}
+
+void tst_QGraphicsWidget::move()
+{
+ QGraphicsScene scene;
+ QGraphicsWidget *widget = new QGraphicsWidget();
+ scene.addItem(widget);
+ QGraphicsView view(&scene);
+ view.show();
+ QBENCHMARK {
+ widget->setPos(qrand(),qrand());
+ }
+}
+
+QTEST_MAIN(tst_QGraphicsWidget)
+#include "tst_qgraphicswidget.moc"