Prepare tst_qnearfieldmanager for configurations with builtin_testdata

We have to add relevant test data to TESTDATA and use them from the
created qrc file.

Change-Id: I72ed86e09caf518f3f1b830ab4fec104a81313e6
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This commit is contained in:
Oliver Wolff 2018-11-30 10:58:06 +01:00
parent 35f72acc47
commit 65bea2ce74
2 changed files with 9 additions and 0 deletions

View File

@ -201,7 +201,11 @@ void TagActivator::initialize()
if (!tagMap.isEmpty())
return;
#ifndef BUILTIN_TESTDATA
QDirIterator nfcTargets(QDir::currentPath(), QStringList(QStringLiteral("*.nfc")), QDir::Files);
#else
QDirIterator nfcTargets(":/nfcdata", QStringList(QStringLiteral("*.nfc")), QDir::Files);
#endif
while (nfcTargets.hasNext()) {
const QString targetFilename = nfcTargets.next();

View File

@ -22,3 +22,8 @@ SOURCES += \
targetemulator.cpp
DEFINES += SRCDIR=\\\"$$PWD/../nfcdata\\\"
TESTDATA += "$$PWD/../nfcdata/Qt Labs Website Tag Type1.nfc" \
"$$PWD/../nfcdata/Qt Website Tag Type1.nfc"
builtin_testdata: DEFINES += BUILTIN_TESTDATA