OSDN Git Service

Pluginmanager: Test if there are tests to run, if so, then quit when done.
authorBill King <bill.king@nokia.com>
Thu, 17 Feb 2011 10:37:34 +0000 (11:37 +0100)
committerBill King <bill.king@nokia.com>
Thu, 17 Feb 2011 10:37:34 +0000 (11:37 +0100)
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
src/libs/extensionsystem/pluginmanager.cpp

index 40b95a3..471dd7b 100644 (file)
@@ -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();
 }
index c0d2f6a..42c4d68 100644 (file)
@@ -641,6 +641,8 @@ void PluginManager::startTests()
         }
         QTest::qExec(pluginSpec->plugin(), methods);
     }
+    if(!d->testSpecs.isEmpty())
+        QTimer::singleShot(1, QCoreApplication::instance(), SLOT(quit()));
 #endif
 }