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>
This commit is contained in:
parent
7714ef7406
commit
a847c2cb61
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user