summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlibrary
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-06-12 13:01:49 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-19 09:33:45 +0200
commitb6505dcee680ec6894c3e08e954e970dc4a3b965 (patch)
tree448f61cbd39b990524da50d7a3764b5047469ea4 /tests/auto/qlibrary
parentf9a22b03d53e324049044241cb82438e5f33e777 (diff)
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.pro3
-rw-r--r--tests/auto/qlibrary/tst_qlibrary.cpp20
2 files changed, 19 insertions, 4 deletions
diff --git a/tests/auto/qlibrary/tst/tst.pro b/tests/auto/qlibrary/tst/tst.pro
index 1ce70cbd39..e66e859f8b 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 3742744d8a..fe2bcd0f1e 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 );
}