src/testlib/qtestcase.cpp
changeset 18 2f34d5167611
parent 0 1918ee327afb
child 19 fcece45ef507
equal deleted inserted replaced
3:41300fa6a67c 18:2f34d5167611
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtTest module of the Qt Toolkit.
     7 ** This file is part of the QtTest module of the Qt Toolkit.
     8 **
     8 **
  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())