diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-07-10 15:06:42 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-07-16 21:43:31 +0000 |
commit | a847c2cb61dc58e35e6dbcce7067aa1ae10291fc (patch) | |
tree | 42ab83074db7e99216032f89a97c6614d18c952f /tests/auto/gui/kernel/qtouchevent | |
parent | 7714ef7406c89a3257a49567b3cda15786c032d6 (diff) |
Stabilize tst_QTouchEvent::touchBeginWithGraphicsWidget().
The test sends touch events to the root item at the top left
corner which fails if the views starts to scroll.
Make the view sufficiently large to prevent scrolling and align
at top left.
FAIL! : tst_QTouchEvent::touchBeginWithGraphicsWidget() Compared values are not the same
Actual (((root->touchBeginCounter))): 0
Expected (1) : 1
Loc: [/work/build/qt/qtbase/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp(1471)]
Change-Id: I357322ccc809ddb5cb587febf3c75cbe497e59d8
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'tests/auto/gui/kernel/qtouchevent')
-rw-r--r-- | tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp index aa1f573aa9..fd3cfd55ff 100644 --- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp +++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp @@ -170,7 +170,10 @@ public: } QRectF boundingRect() const Q_DECL_OVERRIDE { return QRectF(0, 0, 10, 10); } - void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE { } + void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE + { + painter->fillRect(QRectF(QPointF(0, 0), boundingRect().size()), Qt::yellow); + } bool sceneEvent(QEvent *event) Q_DECL_OVERRIDE { @@ -1446,6 +1449,7 @@ void tst_QTouchEvent::touchBeginWithGraphicsWidget() { QGraphicsScene scene; QGraphicsView view(&scene); + view.setWindowTitle(QTest::currentTestFunction()); QScopedPointer<tst_QTouchEventGraphicsItem> root(new tst_QTouchEventGraphicsItem); root->setAcceptTouchEvents(true); scene.addItem(root.data()); @@ -1454,10 +1458,13 @@ void tst_QTouchEvent::touchBeginWithGraphicsWidget() glassWidget->setMinimumSize(100, 100); scene.addItem(glassWidget.data()); - view.resize(200, 200); + view.setAlignment(Qt::AlignLeft | Qt::AlignTop); + const QRect availableGeometry = QGuiApplication::primaryScreen()->availableGeometry(); + view.resize(availableGeometry.size() - QSize(100, 100)); + view.move(availableGeometry.topLeft() + QPoint(50, 50)); + view.fitInView(scene.sceneRect()); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - view.fitInView(scene.sceneRect()); QTest::touchEvent(&view, touchScreenDevice) .press(0, view.mapFromScene(root->mapToScene(3,3)), view.viewport()); |