summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/graphicsview
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2019-11-14 13:03:46 +0100
committerLeander Beernaert <leander.beernaert@qt.io>2019-11-19 13:53:21 +0100
commit26e876912435bdafbca2b425af43824d7ec5b876 (patch)
treeb7ee83cdd9de18ce5970bab0bb217a972d3d2445 /tests/auto/widgets/graphicsview
parent7a6c6da2ebbfef33f7284ce5c96aa0c3acabc6bc (diff)
parentbac999f38ca10147832846f6d7df1e4a051d3760 (diff)
Merge remote-tracking branch 'origin/dev' into wip/cmake
Diffstat (limited to 'tests/auto/widgets/graphicsview')
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp6
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp11
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp17
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp17
7 files changed, 52 insertions, 5 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
index 973a73a4a9..eaad5e478d 100644
--- a/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
@@ -166,7 +166,7 @@ void tst_QGraphicsEffectSource::initTestCase()
scene->addItem(item);
view = new QGraphicsView(scene);
view->show();
- QVERIFY(QTest::qWaitForWindowActive(view));
+ QVERIFY(QTest::qWaitForWindowExposed(view));
}
void tst_QGraphicsEffectSource::cleanupTestCase()
diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index 2f0c43552f..ad17c2a557 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -1826,7 +1826,7 @@ void tst_QGraphicsGridLayout::removeLayout()
QGraphicsView view(&scene);
view.show();
- QVERIFY(QTest::qWaitForWindowActive(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QRectF r1 = textEdit->geometry();
QRectF r2 = pushButton->geometry();
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 6d415952c9..0fb95b9f34 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -450,7 +450,9 @@ private slots:
void modality_keyEvents();
void itemIsInFront();
void scenePosChange();
+#if QT_CONFIG(shortcut)
void textItem_shortcuts();
+#endif
void scroll();
void focusHandling_data();
void focusHandling();
@@ -10813,6 +10815,8 @@ void tst_QGraphicsItem::scenePosChange()
QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0);
}
+#if QT_CONFIG(shortcut)
+
void tst_QGraphicsItem::textItem_shortcuts()
{
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
@@ -10852,6 +10856,8 @@ void tst_QGraphicsItem::textItem_shortcuts()
QTRY_COMPARE(item->textCursor().selectedText(), item->toPlainText());
}
+#endif // QT_CONFIG(shortcut)
+
void tst_QGraphicsItem::scroll()
{
// Create two overlapping rectangles in the scene:
diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index 9369470ce5..1c8faa6b38 100644
--- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
@@ -1518,7 +1518,7 @@ void tst_QGraphicsLinearLayout::removeLayout()
QGraphicsView view(&scene);
view.show();
- QVERIFY(QTest::qWaitForWindowActive(&view));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QRectF r1 = textEdit->geometry();
QRectF r2 = pushButton->geometry();
diff --git a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
index 78fe448bdb..2822279190 100644
--- a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
@@ -152,10 +152,21 @@ void tst_QGraphicsPixmapItem::contains_data()
// public bool contains(QPointF const& point) const
void tst_QGraphicsPixmapItem::contains()
{
+ if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
+ QSKIP("Wayland: This fails. Figure out why.");
+
QFETCH(QPixmap, pixmap);
QFETCH(QPointF, point);
QFETCH(bool, contains);
+ // At the time of writing, by default pixmaps will have:
+ // - The same pixel format of the primary screen (which is platform dependent and may contain alpha)
+ // - Uninitialized pixels, potentially including an alpha channel
+ // - A ShapeMode of Mask (which mean it will use the alpha channel as a mask for contains())
+ // This means that in order to prevent undefined behavior in this test, we either need to set
+ // the shapeMode to something else, or set the pixels of the pixmap.
+ pixmap.fill(); // Filling the pixmap to be on the safe side.
+
SubQGraphicsPixmapItem item(pixmap);
QCOMPARE(item.contains(point), contains);
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index 950f3ef670..cfbe1f96ee 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -3078,6 +3078,9 @@ void tst_QGraphicsScene::tabFocus_emptyScene()
void tst_QGraphicsScene::tabFocus_sceneWithFocusableItems()
{
+ if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
+ QSKIP("Window activation is not supported");
+
QGraphicsScene scene;
QGraphicsTextItem *item = scene.addText("Qt rocks!");
item->setTabChangesFocus(true);
@@ -3218,6 +3221,9 @@ protected:
void tst_QGraphicsScene::tabFocus_sceneWithFocusWidgets()
{
+ if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
+ QSKIP("Window activation is not supported");
+
QGraphicsScene scene;
FocusWidget *widget1 = new FocusWidget;
@@ -3287,6 +3293,9 @@ void tst_QGraphicsScene::tabFocus_sceneWithFocusWidgets()
void tst_QGraphicsScene::tabFocus_sceneWithNestedFocusWidgets()
{
+ if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
+ QSKIP("Window activation is not supported");
+
QGraphicsScene scene;
FocusWidget *widget1 = new FocusWidget;
@@ -3738,8 +3747,6 @@ void tst_QGraphicsScene::changedSignal()
QCoreApplication::processEvents();
QCOMPARE(cl.changes.size(), 2);
QCOMPARE(cl.changes.at(1).size(), 2);
- QCOMPARE(cl.changes.at(1).first(), QRectF(0, 0, 10, 10));
- QCOMPARE(cl.changes.at(1).last(), QRectF(20, 0, 10, 10));
QCOMPARE(scene.sceneRect(), QRectF(0, 0, 30, 10));
}
@@ -3811,6 +3818,9 @@ public:
void tst_QGraphicsScene::inputMethod()
{
+ if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
+ QSKIP("Wayland: This fails. Figure out why.");
+
PlatformInputContext inputContext;
QInputMethodPrivate *inputMethodPrivate =
QInputMethodPrivate::get(QGuiApplication::inputMethod());
@@ -4054,6 +4064,9 @@ void tst_QGraphicsScene::polishItems2()
void tst_QGraphicsScene::isActive()
{
+ if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
+ QSKIP("Window activation is not supported");
+
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QSKIP("Fails on Android (QTBUG-44430)");
#endif
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index e21b1b889a..cf8066c7a3 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -418,6 +418,9 @@ void tst_QGraphicsView::alignment()
void tst_QGraphicsView::interactive()
{
+ if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
+ QSKIP("Window activation is not supported");
+
TestItem *item = new TestItem;
item->setFlags(QGraphicsItem::ItemIsMovable);
QCOMPARE(item->events.size(), 0);
@@ -3297,6 +3300,9 @@ void tst_QGraphicsView::task186827_deleteReplayedItem()
void tst_QGraphicsView::task207546_focusCrash()
{
+ if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
+ QSKIP("Window activation is not supported");
+
class _Widget : public QWidget
{
public:
@@ -3641,6 +3647,8 @@ void tst_QGraphicsView::moveItemWhileScrolling()
int a = adjustForAntialiasing ? 2 : 1;
expectedRegion += QRect(40, 50, 10, 10).adjusted(-a, -a, a, a);
expectedRegion += QRect(40, 60, 10, 10).adjusted(-a, -a, a, a);
+ if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
+ QSKIP("Wayland: This fails. Figure out why.");
COMPARE_REGIONS(view.lastPaintedRegion, expectedRegion);
}
@@ -4394,6 +4402,9 @@ void tst_QGraphicsView::inputMethodSensitivity()
void tst_QGraphicsView::inputContextReset()
{
+ if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation))
+ QSKIP("Window activation is not supported");
+
PlatformInputContext inputContext;
QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
inputMethodPrivate->testContext = &inputContext;
@@ -4652,6 +4663,9 @@ void tst_QGraphicsView::QTBUG_4151_clipAndIgnore_data()
void tst_QGraphicsView::QTBUG_4151_clipAndIgnore()
{
+ if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
+ QSKIP("Wayland: This fails. Figure out why.");
+
QFETCH(bool, clip);
QFETCH(bool, ignoreTransformations);
QFETCH(int, numItems);
@@ -4834,6 +4848,9 @@ QRectF IMItem::mf(1.5, 1.6, 10, 10);
void tst_QGraphicsView::QTBUG_16063_microFocusRect()
{
+ if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))
+ QSKIP("Wayland: This fails. Figure out why.");
+
QGraphicsScene scene;
IMItem *item = new IMItem();
scene.addItem(item);