winrt: Fix usage of testdata

testdata needs to be deployed to temp and current directory
needs to be set to that directory for the test to succeed.

Change-Id: I2dd023af9073d90afbb4ad60fcfb50bb1af4e159
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
This commit is contained in:
Maurice Kalinowski 2016-02-16 08:50:55 +01:00
parent 6c7c34f219
commit 8b0dc80294

View File

@ -58,6 +58,7 @@ private slots:
private:
int languageChangeEventCounter;
QSharedPointer<QTemporaryDir> dataDir;
};
tst_QTranslator::tst_QTranslator()
@ -90,8 +91,16 @@ void tst_QTranslator::initTestCase()
// chdir into the directory containing our testdata,
// to make the code simpler (load testdata via relative paths)
#ifdef Q_OS_WINRT
// ### TODO: Use this for all platforms in 5.7
dataDir = QEXTRACTTESTDATA(QStringLiteral("/"));
QVERIFY2(!dataDir.isNull(), qPrintable("Could not extract test data"));
QVERIFY2(QDir::setCurrent(dataDir->path()), qPrintable("Could not chdir to " + dataDir->path()));
#else // !Q_OS_WINRT
QString testdata_dir = QFileInfo(QFINDTESTDATA("hellotr_la.qm")).absolutePath();
QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
#endif // !Q_OS_WINRT
}
bool tst_QTranslator::eventFilter(QObject *, QEvent *event)