summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicsview
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-08-18 06:34:18 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-08-18 06:34:18 (GMT)
commitfd6740b6ade6e7f8e51a9cc558b723e7fae15ccf (patch)
treeaa2ba4ce64d047d73c29ab0616e8a89d352c3abd /tests/auto/qgraphicsview
parentd24029e3d4639f1300e7a68858936911df969f69 (diff)
parent572e165dcb8cc8fcdfaa4ab9bdab050f6a6cc173 (diff)
downloadQt-fd6740b6ade6e7f8e51a9cc558b723e7fae15ccf.zip
Qt-fd6740b6ade6e7f8e51a9cc558b723e7fae15ccf.tar.gz
Qt-fd6740b6ade6e7f8e51a9cc558b723e7fae15ccf.tar.bz2
Merge commit 'qt/master'
Conflicts: doc/src/examples.qdoc doc/src/plugins-howto.qdoc doc/src/topics.qdoc examples/phonon/musicplayer/mainwindow.cpp src/3rdparty/freetype/src/base/ftobjs.c src/corelib/global/qglobal.h src/corelib/tools/qalgorithms.h src/corelib/tools/qshareddata.cpp src/corelib/tools/qsharedpointer.cpp src/corelib/tools/tools.pri src/corelib/xml/qxmlstream.h src/gui/painting/painting.pri src/gui/widgets/qdatetimeedit.cpp tests/auto/qdesktopservices/qdesktopservices.pro tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp tests/auto/qtextcodec/test/test.pro
Diffstat (limited to 'tests/auto/qgraphicsview')
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index 803898a..364def4 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -216,6 +216,7 @@ private slots:
void task239047_fitInViewSmallViewport();
void task245469_itemsAtPointWithClip();
void task253415_reconnectUpdateSceneOnSceneChanged();
+ void task255529_transformationAnchorMouseAndViewportMargins();
};
void tst_QGraphicsView::initTestCase()
@@ -3627,5 +3628,41 @@ void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged()
QVERIFY(wasConnected2);
}
+void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins()
+{
+ QGraphicsScene scene(-100, -100, 200, 200);
+ scene.addRect(QRectF(-50, -50, 100, 100), QPen(Qt::black), QBrush(Qt::blue));
+
+ class VpGraphicsView: public QGraphicsView
+ {
+ public:
+ VpGraphicsView(QGraphicsScene *scene)
+ : QGraphicsView(scene)
+ {
+ setViewportMargins(8, 16, 12, 20);
+ setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
+ setMouseTracking(true);
+ }
+ };
+
+ VpGraphicsView view(&scene);
+ view.show();
+ QPoint mouseViewPos(20, 20);
+ sendMouseMove(view.viewport(), mouseViewPos);
+ QTest::qWait(125);
+
+ QPointF mouseScenePos = view.mapToScene(mouseViewPos);
+ view.setTransform(QTransform().scale(5, 5));
+ QTest::qWait(125);
+ view.setTransform(QTransform().rotate(5, Qt::ZAxis), true);
+ QTest::qWait(125);
+
+ QPointF newMouseScenePos = view.mapToScene(mouseViewPos);
+ qreal slack = 3;
+ QVERIFY(qAbs(newMouseScenePos.x() - mouseScenePos.x()) < slack);
+ QVERIFY(qAbs(newMouseScenePos.y() - mouseScenePos.y()) < slack);
+}
+
+
QTEST_MAIN(tst_QGraphicsView)
#include "tst_qgraphicsview.moc"