winrt: Fix tst_QGraphicsItem::cursor

By making the test independent of fixed top level widget sizes, it can
also be run on platforms, that do not support this feature.

Task-number: QTBUG-68297
Change-Id: I6945d259801360a9819b9b631d0a7497d3d27a9a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Oliver Wolff 2018-07-12 13:06:07 +02:00
parent 0870e517c2
commit f51fc53844

View File

@ -4145,14 +4145,14 @@ void tst_QGraphicsItem::ensureVisible()
#ifndef QT_NO_CURSOR #ifndef QT_NO_CURSOR
void tst_QGraphicsItem::cursor() void tst_QGraphicsItem::cursor()
{ {
#ifdef Q_OS_WINRT
QSKIP("QTest::mouseMove does not work on WinRT - QTBUG-68297");
#endif
QGraphicsScene scene; QGraphicsScene scene;
QGraphicsRectItem *item1 = scene.addRect(QRectF(0, 0, 50, 50)); QWidget topLevel;
QGraphicsRectItem *item2 = scene.addRect(QRectF(0, 0, 50, 50)); QGraphicsView view(&scene,&topLevel);
item1->setPos(-100, 0); topLevel.showMaximized();
item2->setPos(50, 0); QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
view.setFixedSize(topLevel.size());
QGraphicsRectItem *item1 = scene.addRect(QRectF(-100, 0, 50, 50));
QGraphicsRectItem *item2 = scene.addRect(QRectF(50, 0, 50, 50));
QVERIFY(!item1->hasCursor()); QVERIFY(!item1->hasCursor());
QVERIFY(!item2->hasCursor()); QVERIFY(!item2->hasCursor());
@ -4178,14 +4178,6 @@ void tst_QGraphicsItem::cursor()
item1->setCursor(Qt::IBeamCursor); item1->setCursor(Qt::IBeamCursor);
item2->setCursor(Qt::PointingHandCursor); item2->setCursor(Qt::PointingHandCursor);
QWidget topLevel;
topLevel.resize(250, 150);
QTestPrivate::centerOnScreen(&topLevel);
QGraphicsView view(&scene,&topLevel);
view.setFixedSize(200, 100);
topLevel.show();
QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
QTest::mouseMove(&view, view.rect().center()); QTest::mouseMove(&view, view.rect().center());
const Qt::CursorShape viewportShape = view.viewport()->cursor().shape(); const Qt::CursorShape viewportShape = view.viewport()->cursor().shape();