From 35f6b003341f31172b3a0a7fab8902350b9ba6c0 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Wed, 25 Sep 2013 16:11:58 +0200 Subject: move loading of testability driver from QApplication to QGuiApplication This is useful without QWidget too. Change-Id: Ic7857e52e4a8f57c1205615a1f30323b486814af Reviewed-by: Richard J. Moore Reviewed-by: Friedemann Kleint Reviewed-by: Alberto Mardegan Reviewed-by: Shawn Rutledge --- src/gui/kernel/qguiapplication.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/gui') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 8ccff4321d..91e4833812 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -96,6 +96,10 @@ #include #endif +#ifndef QT_NO_LIBRARY +#include +#endif + #if defined(Q_OS_MAC) # include "private/qcore_mac_p.h" #elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) @@ -1180,6 +1184,7 @@ void QGuiApplicationPrivate::init() QCoreApplicationPrivate::is_app_running = false; // Starting up. bool doGrabUnderDebugger = false; + bool loadTestability = false; QList pluginList; // Get command line params #ifndef QT_NO_SESSIONMANAGER @@ -1230,6 +1235,8 @@ void QGuiApplicationPrivate::init() is_session_restored = true; } #endif + } else if (arg == "-testability") { + loadTestability = true; } else { argv[j++] = argv[i]; } @@ -1287,6 +1294,22 @@ void QGuiApplicationPrivate::init() session_manager = new QSessionManager(q, session_id, session_key); #endif +#ifndef QT_NO_LIBRARY + if (loadTestability) { + QLibrary testLib(QStringLiteral("qttestability")); + if (testLib.load()) { + typedef void (*TasInitialize)(void); + TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init"); + if (initFunction) { + initFunction(); + } else { + qCritical() << "Library qttestability resolve failed!"; + } + } else { + qCritical() << "Library qttestability load failed:" << testLib.errorString(); + } + } +#endif // QT_NO_LIBRARY } extern void qt_cleanupFontDatabase(); -- cgit v1.2.3