Skip to content

Commit

Permalink
Android: Fix some QGraphicsScene tests
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Eskil Abrahamsen Blomfeldt authored and Tony Sarajärvi committed Jan 20, 2016
1 parent a63a506 commit 4de1d0c
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ wince* {
DEPLOYMENT += rootFiles renderFiles
DEFINES += SRCDIR=\\\".\\\"
}

RESOURCES += testdata.qrc
32 changes: 32 additions & 0 deletions tests/auto/widgets/graphicsview/qgraphicsscene/testdata.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<RCC>
<qresource prefix="/">
<file>testData/render/all-all-45-deg-left.png</file>
<file>testData/render/all-all-45-deg-right.png</file>
<file>testData/render/all-all-scale-2x.png</file>
<file>testData/render/all-all-translate-0-50.png</file>
<file>testData/render/all-all-translate-50-0.png</file>
<file>testData/render/all-all-untransformed-clip-ellipse.png</file>
<file>testData/render/all-all-untransformed-clip-rect.png</file>
<file>testData/render/all-all-untransformed.png</file>
<file>testData/render/all-bottomleft-untransformed.png</file>
<file>testData/render/all-bottomright-untransformed.png</file>
<file>testData/render/all-topleft-untransformed.png</file>
<file>testData/render/all-topright-untransformed.png</file>
<file>testData/render/bottom-bottomright-untransformed.png</file>
<file>testData/render/bottom-topleft-untransformed.png</file>
<file>testData/render/bottomleft-all-untransformed.png</file>
<file>testData/render/bottomleft-topleft-untransformed.png</file>
<file>testData/render/bottomright-all-untransformed.png</file>
<file>testData/render/bottomright-topleft-untransformed.png</file>
<file>testData/render/left-bottomright-untransformed.png</file>
<file>testData/render/left-topleft-untransformed.png</file>
<file>testData/render/right-bottomright-untransformed.png</file>
<file>testData/render/right-topleft-untransformed.png</file>
<file>testData/render/top-bottomright-untransformed.png</file>
<file>testData/render/top-topleft-untransformed.png</file>
<file>testData/render/topleft-all-untransformed.png</file>
<file>testData/render/topleft-topleft-untransformed.png</file>
<file>testData/render/topright-all-untransformed.png</file>
<file>testData/render/topright-topleft-untransformed.png</file>
</qresource>
</RCC>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -2757,6 +2759,10 @@ class ContextMenuItem : public QGraphicsRectItem

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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4de1d0c

Please sign in to comment.