messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/src/testunidatamodelvcalplugin.cpp
changeset 51 3507212d340e
parent 48 4f501b74aeb1
equal deleted inserted replaced
49:2a272ef608c4 51:3507212d340e
    39 
    39 
    40 const TUid KBioUidValueUid =
    40 const TUid KBioUidValueUid =
    41 {KBioUidValue};
    41 {KBioUidValue};
    42 
    42 
    43 
    43 
    44 
       
    45 
       
    46 //out put directory for test results.
       
    47 QString OUTPUTDIRECTORY = "c:/logs/TestUniDataModelVCalPlugin";
       
    48 //o/p directory for data to be written on temp file.
       
    49 QString TEMPDIR = "c:/logs/TestUniDataModelVCalPlugin/testdata";
       
    50 //test result O/P file name.
       
    51 QString RESULTFILE = "c:/logs/TestUniDataModelVCalPlugin/result_%1.txt";
       
    52 // folder named UID3 of TestUniDataModelVCalPlugin inside private folder.
       
    53 const QString PRIVATE_DIR("C:/private/Ed034a47");
       
    54 
       
    55 //factory method to create objects.
    44 //factory method to create objects.
    56 QObject* getObject(QString className)
    45 QObject* getObject(QString className)
    57 {
    46 {
    58     if(className == "TestUniDataModelVCalPlugin" )
    47     if(className == "TestUniDataModelVCalPlugin" )
    59     {
    48     {
    63 	{
    52 	{
    64 		return 0;
    53 		return 0;
    65 	}
    54 	}
    66 }
    55 }
    67 
    56 
    68 //creating o/p directory.
       
    69 void createOutPutDirectory()
       
    70     {
       
    71     QDir dir;
       
    72     //o/p dir
       
    73     dir.mkdir(OUTPUTDIRECTORY);
       
    74     //tmp dir
       
    75     dir.mkdir(TEMPDIR);
       
    76     // dir inside private folder.
       
    77     dir.mkdir(PRIVATE_DIR);
       
    78     }
       
    79 
       
    80 //main entry point
    57 //main entry point
    81 int main(int argc, char *argv[])
    58 int main(int argc, char *argv[])
    82     { 
    59     { 
    83     int ret = -1;
    60     int ret = -1;
    84     QCoreApplication app(argc, argv);    
    61 	QCoreApplication app(argc, argv);
    85     
    62 	
    86     //creating output directory.
    63 	//the configuration file.
    87     createOutPutDirectory();
    64 	QFile data("c:/TestUniDataModelVCalPlugin.cfg");
    88     
       
    89     //the configuration file.
       
    90     QFile data("c:/TestUniDataModelVCalPlugin.cfg");
       
    91 
       
    92     if (data.open(QFile::ReadOnly)) 
    65     if (data.open(QFile::ReadOnly)) 
    93         {
    66         {
    94         QTextStream in(&data);
    67 		QTextStream in(&data);
    95         while(!in.atEnd())
    68 		while(!in.atEnd())
    96             {
    69 			{
    97             QStringList args;
    70 			QString name = in.readLine();
    98             QString appName = argv[0];
    71 			QObject* tc = getObject(name);
    99             args << appName;
    72 			
   100 
    73 			if(tc)
   101             QString option  = "-o";
    74 				{
   102             args << option;
    75 				ret =  QTest::qExec(tc, argc, argv);
   103 
    76 				delete tc;
   104             QString outFile = RESULTFILE;
    77 				}
   105             QString name = in.readLine();
    78 			}
   106             outFile = outFile.arg(name);
    79         }
   107             args << outFile;
    80 	return ret;
   108 
    81 
   109             QObject* tc = getObject(name);
       
   110 
       
   111             if(tc)
       
   112                 {
       
   113 
       
   114                 ret =  QTest::qExec(tc, args); 
       
   115                 delete tc;
       
   116                 }
       
   117             }
       
   118         }    
       
   119     data.close();
       
   120     return ret;
       
   121     }
    82     }
   122 
    83 
   123 
    84 
   124 
    85 
   125 
    86