Changeset 846 for trunk/src/testlib/qtestcase.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/testlib/qtestcase.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 55 55 #include <QtCore/qprocess.h> 56 56 #include <QtCore/qdebug.h> 57 #include <QtCore/qlibraryinfo.h>58 57 59 58 #include "QtTest/private/qtestlog_p.h" … … 300 299 \relates QTest 301 300 302 Implements a main() function that instantiates a QApplication object and301 Implements a main() function that instantiates application object and 303 302 the \a TestClass, and executes all tests in the order they were defined. 304 303 Use this macro to build stand-alone executables. 304 305 306 307 305 308 306 309 \bold {Note:} On platforms that have keypad navigation enabled by default (eg: Symbian), … … 757 760 the sequence by calling press(), move(), release() and stationary(), and let the 758 761 instance run out of scope to commit the sequence to the event system. 762 763 764 759 765 */ 760 766 … … 847 853 static int eventDelay = -1; 848 854 static int keyVerbose = -1; 855 856 857 849 858 850 859 void filter_unprintable(char *str) … … 873 882 874 883 return res; 884 885 886 887 888 889 890 891 892 893 894 895 896 875 897 } 876 898 … … 977 999 " -maxwarnings n : Sets the maximum amount of messages to output.\n" 978 1000 " 0 means unlimited, default: 2000\n" 1001 1002 1003 979 1004 "\n" 980 1005 " Benchmark related options:\n" … … 990 1015 " -median n : Sets the number of median iterations.\n" 991 1016 " -vb : Print out verbose benchmarking information.\n" 992 #if !defined(QT_NO_PROCESS) && !defined(QT_NO_SETTINGS)993 " -chart : Create chart based on the benchmark result.\n"994 #endif995 1017 "\n" 996 1018 " -help : This help\n"; … … 1057 1079 QTestLog::setMaxWarnings(qToInt(argv[++i])); 1058 1080 } 1081 1082 1083 1084 1059 1085 } else if (strcmp(argv[i], "-keyevent-verbose") == 0) { 1060 1086 QTest::keyVerbose = 1; … … 1106 1132 } else if (strcmp(argv[i], "-vb") == 0) { 1107 1133 QBenchmarkGlobalData::current->verboseOutput = true; 1108 #if !defined(QT_NO_PROCESS) && !defined(QT_NO_SETTINGS)1109 1134 } else if (strcmp(argv[i], "-chart") == 0) { 1110 QBenchmarkGlobalData::current->createChart = true; 1111 QTestLog::setLogMode(QTestLog::XML); 1112 QTestLog::redirectOutput("results.xml"); 1113 #endif 1135 fprintf(stderr, "Warning: `-chart' option is not available\n"); 1114 1136 } else if (strcmp(argv[i], "-qws") == 0) { 1115 1137 // do nothing … … 1204 1226 do { 1205 1227 QTestResult::setCurrentTestLocation(QTestResult::InitFunc); 1206 QMetaObject::invokeMethod(QTest::currentTestObject, "init");1228 "); 1207 1229 if (QTestResult::skipCurrentTest()) 1208 1230 break; … … 1224 1246 1225 1247 QTestResult::setCurrentTestLocation(QTestResult::CleanupFunc); 1226 QMetaObject::invokeMethod(QTest::currentTestObject, "cleanup");1248 "); 1227 1249 QTestResult::setCurrentTestLocation(QTestResult::NoWhere); 1228 1250 … … 1291 1313 if (curGlobalDataIndex == 0) { 1292 1314 QTestResult::setCurrentTestLocation(QTestResult::DataFunc); 1293 QTest::qt_snprintf(member, 512, "%s_data", slot); 1294 QMetaObject::invokeMethod(QTest::currentTestObject, member, Qt::DirectConnection); 1315 QTest::qt_snprintf(member, 512, "%s_data()", slot); 1316 invokeMethod(QTest::currentTestObject, member); 1317 1295 1318 // if we encounter a SkipAll in the _data slot, we skip the whole 1296 1319 // testfunction, no matter how much global data exists … … 1457 1480 QTestResult::setCurrentTestLocation(QTestResult::DataFunc); 1458 1481 QTestTable::globalTestTable(); 1459 QMetaObject::invokeMethod(testObject, "initTestCase_data", Qt::DirectConnection);1482 ); 1460 1483 1461 1484 if (!QTestResult::skipCurrentTest() && !QTest::currentTestFailed()) { 1462 1485 QTestResult::setCurrentTestLocation(QTestResult::InitFunc); 1463 QMetaObject::invokeMethod(testObject, "initTestCase");1486 "); 1464 1487 1465 1488 // finishedCurrentTestFunction() resets QTestResult::testFailed(), so use a local copy. … … 1489 1512 QTestResult::setSkipCurrentTest(false); 1490 1513 QTestResult::setCurrentTestFunction("cleanupTestCase"); 1491 QMetaObject::invokeMethod(testObject, "cleanupTestCase");1514 "); 1492 1515 } 1493 1516 QTestResult::finishedCurrentTestFunction(); … … 1542 1565 // Don't overwrite any non-default handlers 1543 1566 // however, we need to replace the default QWS handlers 1544 if (oldact.sa_flags & SA_SIGINFO || oldact.sa_handler != SIG_DFL) { 1567 if ( 1568 #ifdef SA_SIGINFO 1569 oldact.sa_flags & SA_SIGINFO || 1570 #endif 1571 oldact.sa_handler != SIG_DFL) { 1545 1572 sigaction(fatalSignals[i], &oldact, 0); 1546 1573 } else … … 1682 1709 { 1683 1710 #if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) 1684 FatalSignalHandler handler; 1711 QScopedPointer<FatalSignalHandler> handler; 1712 if (!noCrashHandler) 1713 handler.reset(new FatalSignalHandler); 1685 1714 #endif 1686 1715 qInvokeTestMethods(testObject); … … 1712 1741 IOPMAssertionRelease(powerID); 1713 1742 } 1714 #endif1715 1716 1717 #if !defined(QT_NO_PROCESS) && !defined(QT_NO_SETTINGS)1718 if (QBenchmarkGlobalData::current->createChart) {1719 QString chartLocation = QLibraryInfo::location(QLibraryInfo::BinariesPath);1720 #ifdef Q_OS_WIN1721 chartLocation += QLatin1String("/../tools/qtestlib/chart/release/chart.exe");1722 #else1723 chartLocation += QLatin1String("/../tools/qtestlib/chart/chart");1724 #endif1725 if (QFile::exists(chartLocation)) {1726 QProcess p;1727 p.setProcessChannelMode(QProcess::ForwardedChannels);1728 p.start(chartLocation, QStringList() << QLatin1String("results.xml"));1729 p.waitForFinished(-1);1730 } else {1731 qDebug() << QLatin1String("Could not find the chart tool in ") + chartLocation + QLatin1String(", please make sure it is compiled.");1732 }1733 }1734 1743 #endif 1735 1744
Note:
See TracChangeset
for help on using the changeset viewer.