diff --git a/src/main.cc b/src/main.cc index fc5f58d2c0bba53c0c5e8895530dfaaa56485d6a..363658493258fda1fdf2ca18c563c8166293fcda 100644 --- a/src/main.cc +++ b/src/main.cc @@ -112,8 +112,8 @@ int main(int argc, char *argv[]) bool quietWindowsAsserts = false; // Don't let asserts pop dialog boxes CmdLineOpt_t rgCmdLineOptions[] = { - { "--unittest", &runUnitTests }, - { "--no-windows-assert-ui", &quietWindowsAsserts }, + { "--unittest", &runUnitTests, QString() }, + { "--no-windows-assert-ui", &quietWindowsAsserts, QString() }, // Add additional command line option flags here }; @@ -140,7 +140,7 @@ int main(int argc, char *argv[]) } // Run the test - int failures = AutoTest::run(argc-1, argv); + int failures = AutoTest::run(argc-1, argv, rgCmdLineOptions[0].optionArg); if (failures == 0) { qDebug() << "ALL TESTS PASSED"; diff --git a/src/qgcunittest/AutoTest.h b/src/qgcunittest/AutoTest.h index d130b12c15f5f5970032c89cf51d8622c35cbda2..5fcf5f857d574d70c75d16d1885a97ff9917845c 100755 --- a/src/qgcunittest/AutoTest.h +++ b/src/qgcunittest/AutoTest.h @@ -49,14 +49,16 @@ namespace AutoTest } } - inline int run(int argc, char *argv[]) + inline int run(int argc, char *argv[], QString& singleTest) { int ret = 0; foreach (QObject* test, testList()) { - qgcApp()->destroySingletonsForUnitTest(); - qgcApp()->createSingletonsForUnitTest(); - ret += QTest::qExec(test, argc, argv); + if (singleTest.isEmpty() || singleTest == test->objectName()) { + qgcApp()->destroySingletonsForUnitTest(); + qgcApp()->createSingletonsForUnitTest(); + ret += QTest::qExec(test, argc, argv); + } } return ret;