diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2012-06-12 11:01:49 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-19 07:33:45 (GMT) |
commit | b6505dcee680ec6894c3e08e954e970dc4a3b965 (patch) | |
tree | 448f61cbd39b990524da50d7a3764b5047469ea4 /tests/auto/qlibrary | |
parent | f9a22b03d53e324049044241cb82438e5f33e777 (diff) | |
download | Qt-b6505dcee680ec6894c3e08e954e970dc4a3b965.zip Qt-b6505dcee680ec6894c3e08e954e970dc4a3b965.tar.gz Qt-b6505dcee680ec6894c3e08e954e970dc4a3b965.tar.bz2 |
Fix QLibrary test.
- Use correct working directory.
Task-number: QTQAINFRA-428
Change-Id: I31fdc941fe21e2efa29d742a5b8cd89f2214e81c
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/qlibrary')
-rw-r--r-- | tests/auto/qlibrary/tst/tst.pro | 3 | ||||
-rw-r--r-- | tests/auto/qlibrary/tst_qlibrary.cpp | 20 |
2 files changed, 19 insertions, 4 deletions
diff --git a/tests/auto/qlibrary/tst/tst.pro b/tests/auto/qlibrary/tst/tst.pro index 1ce70cb..e66e859 100644 --- a/tests/auto/qlibrary/tst/tst.pro +++ b/tests/auto/qlibrary/tst/tst.pro @@ -2,6 +2,7 @@ load(qttest_p4) SOURCES += ../tst_qlibrary.cpp TARGET = ../tst_qlibrary QT = core +CONFIG -= app_bundle win32 { CONFIG(debug, debug|release) { @@ -30,5 +31,3 @@ wince*: { } else { DEFINES += SRCDIR=\\\"$$PWD/../\\\" } - -win32:CONFIG+=insignificant_test # QTQAINFRA-428 diff --git a/tests/auto/qlibrary/tst_qlibrary.cpp b/tests/auto/qlibrary/tst_qlibrary.cpp index 3742744..fe2bcd0 100644 --- a/tests/auto/qlibrary/tst_qlibrary.cpp +++ b/tests/auto/qlibrary/tst_qlibrary.cpp @@ -165,6 +165,15 @@ tst_QLibrary::tst_QLibrary() int argc = 1; app = new QCoreApplication(argc,&argv); #endif +#ifdef Q_OS_WIN + // cd up from debug/release paths + QString directory = QDir::currentPath(); + if (directory.endsWith(QLatin1String("debug"), Qt::CaseInsensitive) + || directory.endsWith(QLatin1String("release"), Qt::CaseInsensitive)) { + directory.truncate(directory.lastIndexOf(QLatin1Char('/'))); + QDir::setCurrent(directory); + } +#endif } tst_QLibrary::~tst_QLibrary() @@ -241,6 +250,13 @@ void tst_QLibrary::load_data() # endif // Q_OS_UNIX } +static inline QByteArray msgCannotLoad(const QString &lib, const QString &why) +{ + const QString result = QString::fromLatin1("Cannot load %1 (in %2): %3") + .arg(lib, QDir::currentPath(), why); + return result.toLatin1(); +} + void tst_QLibrary::load() { QFETCH( QString, lib ); @@ -249,8 +265,8 @@ void tst_QLibrary::load() QLibrary library( lib ); bool ok = library.load(); if ( result ) { - QVERIFY( ok ); - QVERIFY(library.unload()); + QVERIFY2(ok, msgCannotLoad(lib, library.errorString())); + QVERIFY(library.unload()); } else { QVERIFY( !ok ); } |