From 4de1d0cb2890b509e8b11a00d251bf3a5d337cba Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 13 Jan 2015 13:33:10 +0100 Subject: Android: Fix some QGraphicsScene tests 1. Use qrc for test data so that it can be found on all platforms. 2. Skip a test which does not work on platforms where show() implies showMaximized(), as it depends on the window size being 150x150. 3. Skip test for hover event which depends on having a valid mouse cursor position. 4. Skip a couple of tests that fail on some Android devices. It's not worth spending a lot of time investigating this at the moment. Change-Id: Icb2b7f1d82981546a2154a76535b95606d7f40da Reviewed-by: BogDan Vatra --- .../graphicsview/qgraphicsscene/qgraphicsscene.pro | 2 ++ .../graphicsview/qgraphicsscene/testdata.qrc | 32 ++++++++++++++++++++++ .../qgraphicsscene/tst_qgraphicsscene.cpp | 18 +++++++++--- 3 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 tests/auto/widgets/graphicsview/qgraphicsscene/testdata.qrc diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro index 1a775d8b16..986ba019b4 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro @@ -17,3 +17,5 @@ wince* { DEPLOYMENT += rootFiles renderFiles DEFINES += SRCDIR=\\\".\\\" } + +RESOURCES += testdata.qrc diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/testdata.qrc b/tests/auto/widgets/graphicsview/qgraphicsscene/testdata.qrc new file mode 100644 index 0000000000..07a0579cdc --- /dev/null +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/testdata.qrc @@ -0,0 +1,32 @@ + + + testData/render/all-all-45-deg-left.png + testData/render/all-all-45-deg-right.png + testData/render/all-all-scale-2x.png + testData/render/all-all-translate-0-50.png + testData/render/all-all-translate-50-0.png + testData/render/all-all-untransformed-clip-ellipse.png + testData/render/all-all-untransformed-clip-rect.png + testData/render/all-all-untransformed.png + testData/render/all-bottomleft-untransformed.png + testData/render/all-bottomright-untransformed.png + testData/render/all-topleft-untransformed.png + testData/render/all-topright-untransformed.png + testData/render/bottom-bottomright-untransformed.png + testData/render/bottom-topleft-untransformed.png + testData/render/bottomleft-all-untransformed.png + testData/render/bottomleft-topleft-untransformed.png + testData/render/bottomright-all-untransformed.png + testData/render/bottomright-topleft-untransformed.png + testData/render/left-bottomright-untransformed.png + testData/render/left-topleft-untransformed.png + testData/render/right-bottomright-untransformed.png + testData/render/right-topleft-untransformed.png + testData/render/top-bottomright-untransformed.png + testData/render/top-topleft-untransformed.png + testData/render/topleft-all-untransformed.png + testData/render/topleft-topleft-untransformed.png + testData/render/topright-all-untransformed.png + testData/render/topright-topleft-untransformed.png + + diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index f494e4474c..69ea64e505 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -1255,7 +1255,7 @@ void tst_QGraphicsScene::addText() void tst_QGraphicsScene::removeItem() { -#if defined(Q_OS_WINCE) && !defined(GWES_ICONCURS) +#if (defined(Q_OS_WINCE) && !defined(GWES_ICONCURS)) || defined(Q_OS_ANDROID) QSKIP("No mouse cursor support"); #endif QGraphicsScene scene; @@ -2629,9 +2629,7 @@ void tst_QGraphicsScene::render() scene.render(&painter, targetRect, sourceRect, aspectRatioMode); painter.end(); - const QString renderPath = QLatin1String(SRCDIR) + "/testData/render"; - QString fileName = renderPath + QLatin1Char('/') + QLatin1String(QTest::currentDataTag()) - + QLatin1String(".png"); + QString fileName = QFINDTESTDATA(QString("/testData/render/%1.png").arg(QTest::currentDataTag())); QImage original(fileName); QVERIFY(!original.isNull()); @@ -2682,6 +2680,10 @@ void tst_QGraphicsScene::render() void tst_QGraphicsScene::renderItemsWithNegativeWidthOrHeight() { +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QSKIP("Test only works on platforms with resizable windows"); +#endif + QGraphicsScene scene(0, 0, 150, 150); // Add item with negative width. @@ -2757,6 +2759,10 @@ protected: void tst_QGraphicsScene::contextMenuEvent_ItemIgnoresTransformations() { +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QSKIP("Test fails on some Android devices (QTBUG-44430)"); +#endif + QGraphicsScene scene(0, 0, 200, 200); ContextMenuItem *item = new ContextMenuItem; item->setFlag(QGraphicsItem::ItemIgnoresTransformations); @@ -4026,6 +4032,10 @@ void tst_QGraphicsScene::polishItems2() void tst_QGraphicsScene::isActive() { +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QSKIP("Fails on Android (QTBUG-44430)"); +#endif + QGraphicsScene scene1; QVERIFY(!scene1.isActive()); QGraphicsScene scene2; -- cgit v1.2.3