winrt: cleanup testcases

We have to make sure that the plugins to be tested are located inside
the virtual sandbox / relative to the application binary. Launching via
winrtrunner, a test can find those plugins then. It is not possible to
those via TESTDATA and extract them to temp, as LoadPackagedLibrary only
loads inside the sandbox.

Unfortunately this also implies that running those tests inside Visual
Studio will fail, as Visual Studio copies the virtual sandbox to another
location missing the plugins. For automated testing this should not
matter though.

Change-Id: I70f5ef2d56b3cf526b731fd885f12583c8f6e103
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
This commit is contained in:
Maurice Kalinowski 2016-01-20 15:04:28 +01:00
parent 7c797b4905
commit 2515e1eb3d
8 changed files with 28 additions and 2 deletions

View File

@ -5,6 +5,7 @@ HEADERS = plugin1.h
SOURCES = plugin1.cpp
TARGET = $$qtLibraryTarget(plugin1)
DESTDIR = ../bin
winrt:include(../winrt.pri)
# This is testdata for the tst_qpluginloader test.
target.path = $$[QT_INSTALL_TESTS]/tst_qfactoryloader/bin

View File

@ -5,6 +5,7 @@ HEADERS = plugin2.h
SOURCES = plugin2.cpp
TARGET = $$qtLibraryTarget(plugin2)
DESTDIR = ../bin
winrt:include(../winrt.pri)
# This is testdata for the tst_qpluginloader test.
target.path = $$[QT_INSTALL_TESTS]/tst_qfactoryloader/bin

View File

@ -0,0 +1,9 @@
# We cannot use TESTDATA as plugins have to reside physically
# inside the package directory
winrt {
CONFIG(debug, debug|release) {
DESTDIR = ../debug/bin
} else {
DESTDIR = ../release/bin
}
}

View File

@ -139,9 +139,11 @@ typedef int (*VersionFunction)(void);
void tst_QLibrary::initTestCase()
{
#ifndef Q_OS_WINRT
// chdir to our testdata directory, and use relative paths in some tests.
QString testdatadir = QFileInfo(QFINDTESTDATA("library_path")).absolutePath();
QVERIFY2(QDir::setCurrent(testdatadir), qPrintable("Could not chdir to " + testdatadir));
#endif
}
void tst_QLibrary::version_data()
@ -417,7 +419,7 @@ void tst_QLibrary::loadHints_data()
QString appDir = QCoreApplication::applicationDirPath();
lh |= QLibrary::ResolveAllSymbolsHint;
# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
# if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
QTest::newRow( "ok01 (with suffix)" ) << appDir + "/mylib.dll" << int(lh) << true;
QTest::newRow( "ok02 (with non-standard suffix)" ) << appDir + "/mylib.dl2" << int(lh) << true;
QTest::newRow( "ok03 (with many dots)" ) << appDir + "/system.qt.test.mylib.dll" << int(lh) << true;
@ -469,7 +471,7 @@ void tst_QLibrary::fileName_data()
QTest::newRow( "ok02" ) << sys_qualifiedLibraryName(QLatin1String("mylib"))
<< sys_qualifiedLibraryName(QLatin1String("mylib"));
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
#ifndef Q_OS_WINCE
QTest::newRow( "ok03" ) << "user32"
<< "USER32.dll";

View File

@ -4,6 +4,7 @@ CONFIG -= staticlib
SOURCES = mylib.c
TARGET = tst_qpluginloaderlib
DESTDIR = ../bin
winrt:include(../winrt.pri)
QT = core
win32-msvc: DEFINES += WIN32_MSVC

View File

@ -6,6 +6,7 @@ SOURCES = theplugin.cpp
#TARGET = $$qtLibraryTarget(theplugin)
TARGET = theplugin
DESTDIR = ../bin
winrt:include(../winrt.pri)
QT = core
# This is testdata for the tst_qpluginloader test.

View File

@ -0,0 +1,9 @@
# We cannot use TESTDATA as plugins have to reside physically
# inside the package directory
winrt {
CONFIG(debug, debug|release) {
DESTDIR = ../debug/bin
} else {
DESTDIR = ../release/bin
}
}

View File

@ -94,9 +94,11 @@ void tst_QUuid::initTestCase()
//"{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}";
uuidB = QUuid(0x1ab6e93a, 0xb1cb, 0x4a87, 0xba, 0x47, 0xec, 0x7e, 0x99, 0x03, 0x9a, 0x7b);
#ifndef QT_NO_PROCESS
// chdir to the directory containing our testdata, then refer to it with relative paths
QString testdata_dir = QFileInfo(QFINDTESTDATA("testProcessUniqueness")).absolutePath();
QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
#endif
//"{3d813cbb-47fb-32ba-91df-831e1593ac29}"; http://www.rfc-editor.org/errata_search.php?rfc=4122&eid=1352
uuidC = QUuid(0x3d813cbb, 0x47fb, 0x32ba, 0x91, 0xdf, 0x83, 0x1e, 0x15, 0x93, 0xac, 0x29);