mmsharing/mmshapp/tsrc/ut_mmshapp/src/main.cpp
changeset 37 e9675fb210bd
parent 22 496ad160a278
equal deleted inserted replaced
34:01f0bb65bcf1 37:e9675fb210bd
    16 */
    16 */
    17 
    17 
    18 #include <QtTest/QtTest>
    18 #include <QtTest/QtTest>
    19 
    19 
    20 #include "ut_lcapplication.h"
    20 #include "ut_lcapplication.h"
    21 #include "testresultxmlparser.h"
    21 #include "testrunner.h"
    22 
    22 
    23 
    23 
    24 int main(int argc, char *argv[]) 
    24 int main(int argc, char *argv[]) 
    25 {
    25 {
    26     bool promptOnExit(true);
    26     printf("Running tests...\n");
    27     for (int i=0; i<argc; i++) {
    27             
    28         if (QString(argv[i]) == "-noprompt")
    28     QApplication app(argc, argv);
    29             promptOnExit = false;
    29     QStringList args = app.arguments();
       
    30     QString combinedOutputFileName;
       
    31     for ( int i = 0; i < args.count(); i++ ){
       
    32         QString arg = args.at(i);
       
    33         if ( arg == QString("-o") && i + 1 < args.count() ){
       
    34             i++;
       
    35             combinedOutputFileName = args.at(i);
       
    36         }
    30     }
    37     }
    31     printf("Running tests...\n");
       
    32     
    38     
    33     QApplication app(argc, argv);
    39     TestRunner testRunner("LcApplication", combinedOutputFileName);
    34     TestResultXmlParser parser;
       
    35     
    40     
    36     UT_LcApplication ut_lcApplication;
    41     UT_LcApplication ut_lcApplication;
    37     QString resultFileName = "c:/ut_lcapplication.xml";
    42     testRunner.runTests(ut_lcApplication);
    38     QStringList args_lcApplication( "ut_lcapplication");
    43     
    39     args_lcApplication << "-xml" << "-o" << resultFileName;
    44     testRunner.printResults();
    40     QTest::qExec(&ut_lcApplication, args_lcApplication);
       
    41     parser.parseAndPrintResults(resultFileName,true); 
       
    42 
    45 
    43     if (promptOnExit) {
       
    44         printf("Press any key...\n");
       
    45         getchar(); 
       
    46     }
       
    47     return 0;   
    46     return 0;   
    48 }
    47 }