summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-06-25 08:05:39 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-06-25 08:05:39 +0200
commitb540b304a39739ce1d630eb7a93b91926d25cbde (patch)
treec57b301bd29feb0aadb328f1ffa87f5a095ce737 /tests
parentb2f450146055360e6a25e80bc91753dd4d766bb1 (diff)
downloadqtsvg-b540b304a39739ce1d630eb7a93b91926d25cbde.tar.gz
Android: Fix QSVGPlugin test
Assets have to be included in the resources in order to be accessible when testing on a remote device. Task-number: QTBUG-73625 Change-Id: I80332b6492bffc01c0157918b9e6abbc2b87a43b Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qsvgplugin/qsvgplugin.pro1
-rw-r--r--tests/auto/qsvgplugin/tst_qsvgplugin.cpp33
2 files changed, 17 insertions, 17 deletions
diff --git a/tests/auto/qsvgplugin/qsvgplugin.pro b/tests/auto/qsvgplugin/qsvgplugin.pro
index 3fec52e..657b511 100644
--- a/tests/auto/qsvgplugin/qsvgplugin.pro
+++ b/tests/auto/qsvgplugin/qsvgplugin.pro
@@ -5,4 +5,3 @@ QT += svg testlib widgets gui-private
SOURCES += tst_qsvgplugin.cpp
RESOURCES += resources.qrc
-DEFINES += SRCDIR=\\\"$$PWD/\\\"
diff --git a/tests/auto/qsvgplugin/tst_qsvgplugin.cpp b/tests/auto/qsvgplugin/tst_qsvgplugin.cpp
index da49b75..e1f84f3 100644
--- a/tests/auto/qsvgplugin/tst_qsvgplugin.cpp
+++ b/tests/auto/qsvgplugin/tst_qsvgplugin.cpp
@@ -79,18 +79,18 @@ void tst_QSvgPlugin::checkSize_data()
QTest::addColumn<int>("imageHeight");
QTest::addColumn<int>("imageWidth");
- QTest::newRow("square") << SRCDIR "square.svg" << 50 << 50;
- QTest::newRow("square_size") << SRCDIR "square_size.svg" << 200 << 200;
- QTest::newRow("square_size_viewbox") << SRCDIR "square_size_viewbox.svg" << 200 << 200;
- QTest::newRow("square_viewbox") << SRCDIR "square_viewbox.svg" << 100 << 100;
- QTest::newRow("tall") << SRCDIR "tall.svg" << 50 << 25;
- QTest::newRow("tall_size") << SRCDIR "tall_size.svg" << 200 << 100;
- QTest::newRow("tall_size_viewbox") << SRCDIR "tall_size_viewbox.svg" << 200 << 100;
- QTest::newRow("tall_viewbox") << SRCDIR "tall_viewbox.svg" << 100 << 50;
- QTest::newRow("wide") << SRCDIR "wide.svg" << 25 << 50;
- QTest::newRow("wide_size") << SRCDIR "wide_size.svg" << 100 << 200;
- QTest::newRow("wide_size_viewbox") << SRCDIR "wide_size_viewbox.svg" << 100 << 200;
- QTest::newRow("wide_viewbox") << SRCDIR "wide_viewbox.svg" << 50 << 100;
+ QTest::newRow("square") << QFINDTESTDATA("square.svg") << 50 << 50;
+ QTest::newRow("square_size") << QFINDTESTDATA("square_size.svg") << 200 << 200;
+ QTest::newRow("square_size_viewbox") << QFINDTESTDATA("square_size_viewbox.svg") << 200 << 200;
+ QTest::newRow("square_viewbox") << QFINDTESTDATA("square_viewbox.svg") << 100 << 100;
+ QTest::newRow("tall") << QFINDTESTDATA("tall.svg") << 50 << 25;
+ QTest::newRow("tall_size") << QFINDTESTDATA("tall_size.svg") << 200 << 100;
+ QTest::newRow("tall_size_viewbox") << QFINDTESTDATA("tall_size_viewbox.svg") << 200 << 100;
+ QTest::newRow("tall_viewbox") << QFINDTESTDATA("tall_viewbox.svg") << 100 << 50;
+ QTest::newRow("wide") << QFINDTESTDATA("wide.svg") << 25 << 50;
+ QTest::newRow("wide_size") << QFINDTESTDATA("wide_size.svg") << 100 << 200;
+ QTest::newRow("wide_size_viewbox") << QFINDTESTDATA("wide_size_viewbox.svg") << 100 << 200;
+ QTest::newRow("wide_viewbox") << QFINDTESTDATA("wide_viewbox.svg") << 50 << 100;
}
void tst_QSvgPlugin::checkSize()
@@ -116,7 +116,8 @@ void tst_QSvgPlugin::checkSize()
void tst_QSvgPlugin::checkImageInclude()
{
- const QString filename(SRCDIR "imageInclude.svg");
+ const QString filename(QFINDTESTDATA("imageInclude.svg"));
+ const QString path = filename.left(filename.size() - strlen("imageInclude.svg"));
QFile file(filename);
file.open(QIODevice::ReadOnly);
@@ -132,9 +133,9 @@ void tst_QSvgPlugin::checkImageInclude()
file.close();
QCOMPARE(logMessages.size(), 8);
- QCOMPARE(logMessages.at(0), QString("Could not create image from \"%1notExisting.svg\"").arg(SRCDIR));
- QCOMPARE(logMessages.at(1), QString("Could not create image from \"%1./notExisting.svg\"").arg(SRCDIR));
- QCOMPARE(logMessages.at(2), QString("Could not create image from \"%1../notExisting.svg\"").arg(SRCDIR));
+ QCOMPARE(logMessages.at(0), QString("Could not create image from \"%1notExisting.svg\"").arg(path));
+ QCOMPARE(logMessages.at(1), QString("Could not create image from \"%1./notExisting.svg\"").arg(path));
+ QCOMPARE(logMessages.at(2), QString("Could not create image from \"%1../notExisting.svg\"").arg(path));
QCOMPARE(logMessages.at(3), QString("Could not create image from \"%1notExisting.svg\"").arg(QDir::rootPath()));
QCOMPARE(logMessages.at(4), QLatin1String("Could not create image from \":/notExisting.svg\""));
QCOMPARE(logMessages.at(5), QLatin1String("Could not create image from \"qrc:///notExisting.svg\""));