mmsharing/livecommsui/lcui/tsrc/ut_lcui/src/main.cpp
changeset 37 e9675fb210bd
parent 29 36d7ded3ca23
equal deleted inserted replaced
34:01f0bb65bcf1 37:e9675fb210bd
    19 #include "ut_lcviewmanager.h"
    19 #include "ut_lcviewmanager.h"
    20 #include "ut_lcuicomponentrepository.h"
    20 #include "ut_lcuicomponentrepository.h"
    21 #include "ut_lcview.h"
    21 #include "ut_lcview.h"
    22 #include "ut_lceffecthandler.h"
    22 #include "ut_lceffecthandler.h"
    23 #include "ut_lcvideowidget.h"
    23 #include "ut_lcvideowidget.h"
    24 #include "testresultxmlparser.h"
    24 #include "testrunner.h"
    25 #include <qapplication.h>
    25 #include <qapplication.h>
    26 #include <QtTest/QtTest>
    26 #include <QtTest/QtTest>
    27 #include <stdio.h>
    27 #include <stdio.h>
    28 
    28 
    29 #include <QFile>
    29 #include <QFile>
    30 #include <QTextStream>
    30 #include <QTextStream>
    31 
    31 
    32 #define UT_ARGS( args, file )\
       
    33     QStringList args( "ut_lcui");\
       
    34     args << "-silent" << "-xml" << "-o" << file
       
    35 
       
    36 int main(int argc, char *argv[]) 
    32 int main(int argc, char *argv[]) 
    37 {
    33 {
    38     bool promptOnExit(true);
    34     printf("Running tests...\n");
    39     for (int i=0; i<argc; i++) {
    35             
    40         if (QString(argv[i]) == "-noprompt")
    36     QApplication app(argc, argv);
    41             promptOnExit = false;
    37     QStringList args = app.arguments();
       
    38     QString combinedOutputFileName;
       
    39     for ( int i = 0; i < args.count(); i++ ){
       
    40         QString arg = args.at(i);
       
    41         if ( arg == QString("-o") && i + 1 < args.count() ){
       
    42             i++;
       
    43             combinedOutputFileName = args.at(i);
       
    44         }
    42     }
    45     }
    43     printf("Running tests...\n");
    46     
    44     QApplication app(argc, argv);
    47     TestRunner testRunner("LcUi", combinedOutputFileName);
    45     TestResultXmlParser parser;
       
    46     
    48     
    47     UT_LcUiViewManager ut_lcViewManager;
    49     UT_LcUiViewManager ut_lcViewManager;
    48     QString resultFileName = "c:/ut_lcui_LcViewManager.xml";
    50     testRunner.runTests(ut_lcViewManager);
    49     UT_ARGS( args_lcViewManager, resultFileName );
    51    
    50     QTest::qExec( &ut_lcViewManager, args_lcViewManager );
       
    51     parser.parseAndPrintResults(resultFileName);
       
    52     
       
    53     UT_LcUiComponentRepository ut_lcUiComponentRepository;
    52     UT_LcUiComponentRepository ut_lcUiComponentRepository;
    54     resultFileName = "c:/ut_lcui_LcUiComponentRepository.xml";
    53     testRunner.runTests(ut_lcUiComponentRepository);
    55     UT_ARGS( args_lcUiComponentRepository, resultFileName );
       
    56     QTest::qExec( &ut_lcUiComponentRepository, args_lcUiComponentRepository );
       
    57     parser.parseAndPrintResults(resultFileName);
       
    58  
    54  
    59     UT_LcView ut_lcView;
    55     UT_LcView ut_lcView;
    60     resultFileName = "c:/ut_lcui_LcView.xml";
    56     testRunner.runTests(ut_lcView);
    61     UT_ARGS( args_lcView, resultFileName ); 
       
    62     QTest::qExec( &ut_lcView, args_lcView );
       
    63     parser.parseAndPrintResults(resultFileName);
       
    64     
    57     
    65     UT_LcEffectHandler ut_effectHandler;
    58     UT_LcEffectHandler ut_effectHandler;
    66     resultFileName = "c:/ut_lcui_LcEffectHandler.xml";
    59     testRunner.runTests(ut_effectHandler);
    67     UT_ARGS( args_lcEffectHandler, resultFileName ); 
       
    68     QTest::qExec( &ut_effectHandler, args_lcEffectHandler );
       
    69     parser.parseAndPrintResults(resultFileName);
       
    70     
    60     
    71     UT_LcVideoWidget ut_videoWidget;
    61     UT_LcVideoWidget ut_videoWidget;
    72     resultFileName = "c:/ut_lcui_LcVideoWidget.xml";
    62     testRunner.runTests(ut_videoWidget);
    73     UT_ARGS( args_lcVideoWidget, resultFileName ); 
       
    74     QTest::qExec( &ut_videoWidget, args_lcVideoWidget );
       
    75     parser.parseAndPrintResults(resultFileName);
       
    76   
    63   
    77     if (promptOnExit) {
    64     testRunner.printResults();
    78         printf("Press any key...\n");
    65     
    79         getchar(); 
       
    80     }
       
    81     return 0;
    66     return 0;
    82 }
    67 }
    83 
    68 
    84 
    69 
    85 
    70