From 9552e13c3c269045142feb122733e9c09f27878e Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 17 Feb 2011 11:37:34 +0100 Subject: [PATCH] Pluginmanager: Test if there are tests to run, if so, then quit when done. Double testing, only enable the codeblock when tests are found to be run, also, only send the quit message if there are tests found to be run. --- src/app/main.cpp | 5 ++++- src/libs/extensionsystem/pluginmanager.cpp | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index 40b95a3c4be..471dd7bba81 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -354,8 +354,11 @@ int main(int argc, char **argv) // shutdown plugin manager on the exit QObject::connect(&app, SIGNAL(aboutToQuit()), &pluginManager, SLOT(shutdown())); +#ifdef WITH_TESTS // Do this after the event loop has started - // QTimer::singleShot(100, &pluginManager, SLOT(startTests())); + if(pluginManager.runningTests()) + QTimer::singleShot(100, &pluginManager, SLOT(startTests())); +#endif return app.exec(); } diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp index c0d2f6a43bb..42c4d680289 100644 --- a/src/libs/extensionsystem/pluginmanager.cpp +++ b/src/libs/extensionsystem/pluginmanager.cpp @@ -641,6 +641,8 @@ void PluginManager::startTests() } QTest::qExec(pluginSpec->plugin(), methods); } + if(!d->testSpecs.isEmpty()) + QTimer::singleShot(1, QCoreApplication::instance(), SLOT(quit())); #endif }