Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/testlib/qtestcase.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    5555#include <QtCore/qprocess.h>
    5656#include <QtCore/qdebug.h>
    57 #include <QtCore/qlibraryinfo.h>
    5857
    5958#include "QtTest/private/qtestlog_p.h"
     
    300299    \relates QTest
    301300
    302     Implements a main() function that instantiates a QApplication object and
     301    Implements a main() function that instantiates application object and
    303302    the \a TestClass, and executes all tests in the order they were defined.
    304303    Use this macro to build stand-alone executables.
     304
     305
     306
     307
    305308
    306309    \bold {Note:} On platforms that have keypad navigation enabled by default (eg: Symbian),
     
    757760    the sequence by calling press(), move(), release() and stationary(), and let the
    758761    instance run out of scope to commit the sequence to the event system.
     762
     763
     764
    759765*/
    760766
     
    847853    static int eventDelay = -1;
    848854    static int keyVerbose = -1;
     855
     856
     857
    849858
    850859void filter_unprintable(char *str)
     
    873882
    874883    return res;
     884
     885
     886
     887
     888
     889
     890
     891
     892
     893
     894
     895
     896
    875897}
    876898
     
    977999         " -maxwarnings n    : Sets the maximum amount of messages to output.\n"
    9781000         "                     0 means unlimited, default: 2000\n"
     1001
     1002
     1003
    9791004         "\n"
    9801005         " Benchmark related options:\n"
     
    9901015        " -median  n      : Sets the number of median iterations.\n"
    9911016        " -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 #endif
    9951017         "\n"
    9961018        " -help      : This help\n";
     
    10571079                QTestLog::setMaxWarnings(qToInt(argv[++i]));
    10581080            }
     1081
     1082
     1083
     1084
    10591085        } else if (strcmp(argv[i], "-keyevent-verbose") == 0) {
    10601086            QTest::keyVerbose = 1;
     
    11061132        } else if (strcmp(argv[i], "-vb") == 0) {
    11071133            QBenchmarkGlobalData::current->verboseOutput = true;
    1108 #if !defined(QT_NO_PROCESS) && !defined(QT_NO_SETTINGS)
    11091134        } 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");
    11141136        } else if (strcmp(argv[i], "-qws") == 0) {
    11151137            // do nothing
     
    12041226        do {
    12051227            QTestResult::setCurrentTestLocation(QTestResult::InitFunc);
    1206             QMetaObject::invokeMethod(QTest::currentTestObject, "init");
     1228            ");
    12071229            if (QTestResult::skipCurrentTest())
    12081230                break;
     
    12241246
    12251247            QTestResult::setCurrentTestLocation(QTestResult::CleanupFunc);
    1226             QMetaObject::invokeMethod(QTest::currentTestObject, "cleanup");
     1248            ");
    12271249            QTestResult::setCurrentTestLocation(QTestResult::NoWhere);
    12281250
     
    12911313        if (curGlobalDataIndex == 0) {
    12921314            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
    12951318            // if we encounter a SkipAll in the _data slot, we skip the whole
    12961319            // testfunction, no matter how much global data exists
     
    14571480    QTestResult::setCurrentTestLocation(QTestResult::DataFunc);
    14581481    QTestTable::globalTestTable();
    1459     QMetaObject::invokeMethod(testObject, "initTestCase_data", Qt::DirectConnection);
     1482    );
    14601483
    14611484    if (!QTestResult::skipCurrentTest() && !QTest::currentTestFailed()) {
    14621485        QTestResult::setCurrentTestLocation(QTestResult::InitFunc);
    1463         QMetaObject::invokeMethod(testObject, "initTestCase");
     1486        ");
    14641487
    14651488        // finishedCurrentTestFunction() resets QTestResult::testFailed(), so use a local copy.
     
    14891512        QTestResult::setSkipCurrentTest(false);
    14901513        QTestResult::setCurrentTestFunction("cleanupTestCase");
    1491         QMetaObject::invokeMethod(testObject, "cleanupTestCase");
     1514        ");
    14921515    }
    14931516    QTestResult::finishedCurrentTestFunction();
     
    15421565        // Don't overwrite any non-default handlers
    15431566        // 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) {
    15451572            sigaction(fatalSignals[i], &oldact, 0);
    15461573        } else
     
    16821709    {
    16831710#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
    1684         FatalSignalHandler handler;
     1711        QScopedPointer<FatalSignalHandler> handler;
     1712        if (!noCrashHandler)
     1713            handler.reset(new FatalSignalHandler);
    16851714#endif
    16861715        qInvokeTestMethods(testObject);
     
    17121741         IOPMAssertionRelease(powerID);
    17131742     }
    1714 #endif
    1715 
    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_WIN
    1721         chartLocation += QLatin1String("/../tools/qtestlib/chart/release/chart.exe");
    1722 #else
    1723         chartLocation += QLatin1String("/../tools/qtestlib/chart/chart");
    1724 #endif
    1725         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     }
    17341743#endif
    17351744
Note: See TracChangeset for help on using the changeset viewer.