src/testlib/qtestcase.cpp
branchRCL_3
changeset 7 3f74d0d4af4c
parent 4 3b1da2848fc7
equal deleted inserted replaced
6:dee5afe5301f 7:3f74d0d4af4c
   962          " options:\n"
   962          " options:\n"
   963          " -functions : Returns a list of current testfunctions\n"
   963          " -functions : Returns a list of current testfunctions\n"
   964          " -xunitxml  : Outputs results as XML XUnit document\n"
   964          " -xunitxml  : Outputs results as XML XUnit document\n"
   965          " -xml       : Outputs results as XML document\n"
   965          " -xml       : Outputs results as XML document\n"
   966          " -lightxml  : Outputs results as stream of XML tags\n"
   966          " -lightxml  : Outputs results as stream of XML tags\n"
   967          " -flush     : Flushes the resutls\n"
   967          " -flush     : Flushes the results\n"
   968          " -o filename: Writes all output into a file\n"
   968          " -o filename: Writes all output into a file\n"
   969          " -silent    : Only outputs warnings and failures\n"
   969          " -silent    : Only outputs warnings and failures\n"
   970          " -v1        : Print enter messages for each testfunction\n"
   970          " -v1        : Print enter messages for each testfunction\n"
   971          " -v2        : Also print out each QVERIFY/QCOMPARE/QTEST\n"
   971          " -v2        : Also print out each QVERIFY/QCOMPARE/QTEST\n"
   972          " -vs        : Print every signal emitted\n"
   972          " -vs        : Print every signal emitted\n"
  1111             QTestLog::setLogMode(QTestLog::XML);
  1111             QTestLog::setLogMode(QTestLog::XML);
  1112             QTestLog::redirectOutput("results.xml");
  1112             QTestLog::redirectOutput("results.xml");
  1113 #endif
  1113 #endif
  1114         } else if (strcmp(argv[i], "-qws") == 0) {
  1114         } else if (strcmp(argv[i], "-qws") == 0) {
  1115             // do nothing
  1115             // do nothing
       
  1116         } else if (strcmp(argv[i], "-graphicssystem") == 0) {
       
  1117             // do nothing
       
  1118             if (i + 1 >= argc) {
       
  1119                 printf("-graphicssystem needs an extra parameter specifying the graphics system\n");
       
  1120                 exit(1);
       
  1121             } else {
       
  1122                 ++i;
       
  1123             }
  1116         } else if (argv[i][0] == '-') {
  1124         } else if (argv[i][0] == '-') {
  1117             printf("Unknown option: '%s'\n\n%s", argv[i], testOptions);
  1125             printf("Unknown option: '%s'\n\n%s", argv[i], testOptions);
  1118             exit(1);
  1126             exit(1);
  1119         } else {
  1127         } else {
  1120             int colon = -1;
  1128             int colon = -1;
  1296         if (!QTestResult::skipCurrentTest()) {
  1304         if (!QTestResult::skipCurrentTest()) {
  1297             int curDataIndex = 0;
  1305             int curDataIndex = 0;
  1298             const int dataCount = table.dataCount();
  1306             const int dataCount = table.dataCount();
  1299             QTestResult::setSkipCurrentTest(false);
  1307             QTestResult::setSkipCurrentTest(false);
  1300 
  1308 
       
  1309             // Data tag requested but none available?
       
  1310             if (data && !dataCount) {
       
  1311                 // Let empty data tag through.
       
  1312                 if (!*data)
       
  1313                     data = 0;
       
  1314                 else {
       
  1315                     printf("Unknown testdata for function %s: '%s'\n", slotName, data);
       
  1316                     printf("Function has no testdata.\n");
       
  1317                     return false;
       
  1318                 }
       
  1319             }
       
  1320 
  1301             /* For each entry in the data table, do: */
  1321             /* For each entry in the data table, do: */
  1302             do {
  1322             do {
  1303                 if (!data || !qstrcmp(data, table.testData(curDataIndex)->dataTag())) {
  1323                 if (!data || !qstrcmp(data, table.testData(curDataIndex)->dataTag())) {
  1304                     foundFunction = true;
  1324                     foundFunction = true;
  1305                     QTestDataSetter s(table.isEmpty() ? static_cast<QTestData *>(0)
  1325                     QTestDataSetter s(curDataIndex >= dataCount ? static_cast<QTestData *>(0)
  1306                                                       : table.testData(curDataIndex));
  1326                                                       : table.testData(curDataIndex));
  1307 
  1327 
  1308                     qInvokeTestMethodDataEntry(slot);
  1328                     qInvokeTestMethodDataEntry(slot);
  1309 
  1329 
  1310                     if (QTestResult::skipCurrentTest())
  1330                     if (QTestResult::skipCurrentTest())