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.
This commit is contained in:
Bill King
2011-02-17 11:37:34 +01:00
parent 6d00ff37f3
commit 9552e13c3c
2 changed files with 6 additions and 1 deletions

View 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();
}

View 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
}