summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@trolltech.com>2009-03-03 16:08:30 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2009-04-15 10:16:48 (GMT)
commitb1b5f92c18774904bb0d840cdc2f740cdccef883 (patch)
treeec8ad7b9822f23fed7e2e7148a14a1c493ef1e34 /tests
parent920e77d9da68643aae483838b21330d032c00058 (diff)
downloadQt-b1b5f92c18774904bb0d840cdc2f740cdccef883.zip
Qt-b1b5f92c18774904bb0d840cdc2f740cdccef883.tar.gz
Qt-b1b5f92c18774904bb0d840cdc2f740cdccef883.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. (cherry picked from commit d74f1a91b05b943c1a8ae7847de6ee50b2093b89)
Diffstat (limited to 'tests')
-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"