Changeset 556 for branches/vendor/nokia/qt/current/src/testlib
- Timestamp:
- Feb 10, 2010, 12:52:55 AM (16 years ago)
- Location:
- branches/vendor/nokia/qt/current/src/testlib
- Files:
-
- 21 added
- 42 edited
-
3rdparty/cycle_p.h (modified) (3 diffs)
-
qabstracttestlogger.cpp (modified) (6 diffs)
-
qabstracttestlogger_p.h (modified) (4 diffs)
-
qasciikey.cpp (modified) (3 diffs)
-
qbenchmark.cpp (modified) (8 diffs)
-
qbenchmark.h (modified) (5 diffs)
-
qbenchmark_p.h (modified) (6 diffs)
-
qbenchmarkevent.cpp (modified) (3 diffs)
-
qbenchmarkevent_p.h (modified) (3 diffs)
-
qbenchmarkmeasurement.cpp (modified) (3 diffs)
-
qbenchmarkmeasurement_p.h (modified) (3 diffs)
-
qbenchmarkvalgrind.cpp (modified) (9 diffs)
-
qbenchmarkvalgrind_p.h (modified) (3 diffs)
-
qplaintestlogger.cpp (modified) (15 diffs)
-
qplaintestlogger_p.h (modified) (3 diffs)
-
qsignaldumper.cpp (modified) (7 diffs)
-
qsignaldumper_p.h (modified) (3 diffs)
-
qsignalspy.h (modified) (3 diffs)
-
qsignalspy.qdoc (added)
-
qtest.h (modified) (9 diffs)
-
qtest_global.h (modified) (5 diffs)
-
qtest_gui.h (modified) (4 diffs)
-
qtestaccessible.h (modified) (3 diffs)
-
qtestassert.h (modified) (3 diffs)
-
qtestbasicstreamer.cpp (added)
-
qtestbasicstreamer.h (added)
-
qtestcase.cpp (modified) (40 diffs)
-
qtestcase.h (modified) (9 diffs)
-
qtestcoreelement.h (added)
-
qtestcorelist.h (added)
-
qtestdata.cpp (modified) (3 diffs)
-
qtestdata.h (modified) (3 diffs)
-
qtestelement.cpp (added)
-
qtestelement.h (added)
-
qtestelementattribute.cpp (added)
-
qtestelementattribute.h (added)
-
qtestevent.h (modified) (8 diffs)
-
qtestevent.qdoc (added)
-
qtesteventloop.h (modified) (3 diffs)
-
qtestfilelogger.cpp (added)
-
qtestfilelogger.h (added)
-
qtestkeyboard.h (modified) (3 diffs)
-
qtestlightxmlstreamer.cpp (added)
-
qtestlightxmlstreamer.h (added)
-
qtestlog.cpp (modified) (11 diffs)
-
qtestlog_p.h (modified) (5 diffs)
-
qtestlogger.cpp (added)
-
qtestlogger_p.h (added)
-
qtestmouse.h (modified) (4 diffs)
-
qtestresult.cpp (modified) (4 diffs)
-
qtestresult_p.h (modified) (3 diffs)
-
qtestspontaneevent.h (modified) (4 diffs)
-
qtestsystem.h (modified) (5 diffs)
-
qtesttable.cpp (modified) (3 diffs)
-
qtesttable_p.h (modified) (3 diffs)
-
qtesttouch.h (added)
-
qtestxmlstreamer.cpp (added)
-
qtestxmlstreamer.h (added)
-
qtestxunitstreamer.cpp (added)
-
qtestxunitstreamer.h (added)
-
qxmltestlogger.cpp (modified) (13 diffs)
-
qxmltestlogger_p.h (modified) (4 diffs)
-
testlib.pro (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/vendor/nokia/qt/current/src/testlib/3rdparty/cycle_p.h
r2 r556 191 191 192 192 /* Visual C++ -- thanks to Morten Nissov for his help with this */ 193 193 194 #if _MSC_VER >= 1200 && (_M_IX86 >= 500 || (defined(_WIN32_WCE) && defined(_X86_))) && !defined(HAVE_TICK_COUNTER) 194 195 #include <windows.h> … … 216 217 #define TIME_MIN 5000.0 /* unreliable pentium IV cycle counter */ 217 218 #endif 219 218 220 219 221 #if _MSC_VER >= 1400 && defined(_WIN32_WCE) && !defined(HAVE_TICK_COUNTER) … … 492 494 #endif 493 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 494 513 #endif // QBENCHLIB_CYCLE_H -
branches/vendor/nokia/qt/current/src/testlib/qabstracttestlogger.cpp
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 44 44 #include "QtTest/qtestassert.h" 45 45 46 47 46 48 #include <stdio.h> 47 49 #include <stdlib.h> 50 48 51 49 52 #ifndef Q_OS_WIN … … 78 81 } 79 82 83 80 84 void QAbstractTestLogger::startLogging() 81 85 { … … 106 110 } 107 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 108 158 QT_END_NAMESPACE -
branches/vendor/nokia/qt/current/src/testlib/qabstracttestlogger_p.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 100 100 }; 101 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 102 170 QT_END_NAMESPACE 103 171 -
branches/vendor/nokia/qt/current/src/testlib/qasciikey.cpp
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
branches/vendor/nokia/qt/current/src/testlib/qbenchmark.cpp
r2 r556 1 2 1 /**************************************************************************** 3 2 ** 4 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 5 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 6 6 ** 7 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 22 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 23 23 ** 24 ** In addition, as a special exception, Nokia gives you certain 25 ** additional rights. These rights are described in the Nokia Qt LGPL 26 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 27 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 28 27 ** 29 28 ** GNU General Public License Usage … … 35 34 ** met: http://www.gnu.org/copyleft/gpl.html. 36 35 ** 37 ** If you are unsure which license is appropriate for your use, please38 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 39 38 ** $QT_END_LICENSE$ 40 39 ** … … 118 117 119 118 QBenchmarkTestMethodData::QBenchmarkTestMethodData() 120 :resultAccepted(false), iterationCount(-1)119 :resultAccepted(false), iterationCount(-1) 121 120 { 122 121 … … 159 158 accepted = true; 160 159 160 161 162 163 164 161 165 // Test the result directly without calling the measurer if the minimum time 162 166 // has been specifed on the command line with -minimumvalue. … … 176 180 } 177 181 178 /*! \internal 182 /*! 183 \class QTest::QBenchmarkIterationController 184 \internal 185 179 186 The QBenchmarkIterationController class is used by the QBENCHMARK macro to 180 187 drive the benchmarking loop. It is repsonsible for starting and stopping 181 188 the timing measurements as well as calling the result reporting functions. 182 189 */ 190 191 192 193 194 195 196 197 198 199 200 183 201 QTest::QBenchmarkIterationController::QBenchmarkIterationController() 184 202 { 203 185 204 QTest::beginBenchmarkMeasurement(); 186 i = 0; 187 } 205 } 206 188 207 /*! \internal 189 208 */ … … 197 216 bool QTest::QBenchmarkIterationController::isDone() 198 217 { 218 219 199 220 return i >= QTest::iterationCount(); 200 221 } … … 220 241 QBenchmarkTestMethodData::current->adjustIterationCount(count); 221 242 } 243 222 244 /*! \internal 223 245 */ -
branches/vendor/nokia/qt/current/src/testlib/qbenchmark.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 65 65 { 66 66 public: 67 67 68 QBenchmarkIterationController(); 69 68 70 ~QBenchmarkIterationController(); 69 71 bool isDone(); … … 75 77 76 78 #define QBENCHMARK \ 77 for (QTest::QBenchmarkIterationController __iteration_controller; __iteration_controller.isDone() == false; __iteration_controller.next()) 79 for (QTest::QBenchmarkIterationController __iteration_controller; \ 80 __iteration_controller.isDone() == false; __iteration_controller.next()) 81 82 #define QBENCHMARK_ONCE \ 83 for (QTest::QBenchmarkIterationController __iteration_controller(QTest::QBenchmarkIterationController::RunOnce); \ 84 __iteration_controller.isDone() == false; __iteration_controller.next()) 78 85 79 86 QT_END_NAMESPACE -
branches/vendor/nokia/qt/current/src/testlib/qbenchmark_p.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 56 56 #include <QtCore/qglobal.h> 57 57 58 #if defined(Q_OS_LINUX) && !defined(QT_NO_PROCESS)58 #if ) && !defined(QT_NO_PROCESS) 59 59 #define QTESTLIB_USE_VALGRIND 60 60 #else … … 82 82 QString toString() const 83 83 { 84 QString s = QString (QLatin1String("%1,%2,%3")).arg(slotName).arg(tag).arg(checkpointIndex);84 QString s = QString).arg(slotName).arg(tag).arg(checkpointIndex); 85 85 return s; 86 86 } … … 172 172 QBenchmarkResult result; 173 173 bool resultAccepted; 174 174 175 int iterationCount; 175 176 }; -
branches/vendor/nokia/qt/current/src/testlib/qbenchmarkevent.cpp
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
branches/vendor/nokia/qt/current/src/testlib/qbenchmarkevent_p.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
branches/vendor/nokia/qt/current/src/testlib/qbenchmarkmeasurement.cpp
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
branches/vendor/nokia/qt/current/src/testlib/qbenchmarkmeasurement_p.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
branches/vendor/nokia/qt/current/src/testlib/qbenchmarkvalgrind.cpp
r2 r556 1 2 1 /**************************************************************************** 3 2 ** 4 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 5 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 6 6 ** 7 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 22 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 23 23 ** 24 ** In addition, as a special exception, Nokia gives you certain 25 ** additional rights. These rights are described in the Nokia Qt LGPL 26 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 27 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 28 27 ** 29 28 ** GNU General Public License Usage … … 35 34 ** met: http://www.gnu.org/copyleft/gpl.html. 36 35 ** 37 ** If you are unsure which license is appropriate for your use, please38 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 39 38 ** $QT_END_LICENSE$ 40 39 ** … … 52 51 #include <QtCore/qset.h> 53 52 #include "3rdparty/callgrind_p.h" 53 54 54 55 55 56 // Returns true iff a sufficiently recent valgrind is available. … … 114 115 const QString line(QLatin1String(file.readLine())); 115 116 if (rxValue.indexIn(line) != -1) { 116 Q_ASSERT(rxValue. numCaptures() == 1);117 Q_ASSERT(rxValue.() == 1); 117 118 bool ok; 118 119 val = rxValue.cap(1).toLongLong(&ok); … … 133 134 Q_ASSERT(!base.isEmpty()); 134 135 135 nameFilters << QString (QLatin1String("%1.*")).arg(base);136 nameFilters << QString).arg(base); 136 137 QFileInfoList fiList = QDir().entryInfoList(nameFilters, QDir::Files | QDir::Readable); 137 138 Q_ASSERT(!fiList.empty()); 138 139 int hiSuffix = -1; 139 140 QFileInfo lastFileInfo; 140 const QString pattern = QString (QLatin1String("%1.(\\d+)")).arg(base);141 const QString pattern = QString).arg(base); 141 142 const QRegExp rx(pattern); 142 143 foreach (QFileInfo fileInfo, fiList) { … … 168 169 Q_ASSERT(!base.isEmpty()); 169 170 nameFilters 170 << QString(QLatin1String("%1")).arg(base)// overall summary171 << QString (QLatin1String("%1.*")).arg(base); // individual dumps171 << // overall summary 172 << QString).arg(base); // individual dumps 172 173 QFileInfoList fiList = QDir().entryInfoList(nameFilters, QDir::Files | QDir::Readable); 173 174 foreach (QFileInfo fileInfo, fiList) { … … 180 181 QString QBenchmarkValgrindUtils::outFileBase(qint64 pid) 181 182 { 182 return QString (QLatin1String("callgrind.out.%1")).arg(183 return QString).arg( 183 184 pid != -1 ? pid : QCoreApplication::applicationPid()); 184 185 } … … 273 274 } 274 275 276 277 275 278 #endif // QTESTLIB_USE_VALGRIND -
branches/vendor/nokia/qt/current/src/testlib/qbenchmarkvalgrind_p.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
branches/vendor/nokia/qt/current/src/testlib/qplaintestlogger.cpp
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 53 53 #ifdef Q_OS_WIN 54 54 #include "windows.h" 55 56 57 58 55 59 #endif 56 60 … … 126 130 static const char *messageType2String(QAbstractTestLogger::MessageTypes type) 127 131 { 132 128 133 static bool colored = (!qgetenv("QTEST_COLORED").isEmpty()); 134 135 136 129 137 switch (type) { 130 138 case QAbstractTestLogger::Skip: … … 149 157 { 150 158 #if defined(Q_OS_WINCE) 151 int length = strlen(str); 152 for (int pos = 0; pos < length; pos +=255) { 153 QString uniText = QString::fromLatin1(str + pos, 255); 154 OutputDebugStringW((const LPCWSTR) uniText.utf16()); 155 } 159 QString strUtf16 = QString::fromLatin1(str); 160 const int maxOutputLength = 255; 161 do { 162 QString tmp = strUtf16.left(maxOutputLength); 163 OutputDebugString((wchar_t*)tmp.utf16()); 164 strUtf16.remove(0, maxOutputLength); 165 } while (!strUtf16.isEmpty()); 156 166 if (QTestLog::outputFileName()) 157 167 #elif defined(Q_OS_WIN) … … 160 170 OutputDebugStringA(str); 161 171 LeaveCriticalSection(&outputCriticalSection); 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 162 192 #endif 163 193 QAbstractTestLogger::outputString(str); … … 169 199 QTEST_ASSERT(msg); 170 200 171 char buf[1024];201 ; 172 202 173 203 const char *fn = QTestResult::currentTestFunction() ? QTestResult::currentTestFunction() … … 179 209 const char *filler = (tag[0] && gtag[0]) ? ":" : ""; 180 210 if (file) { 181 QTest::qt_ snprintf(buf, sizeof(buf), "%s: %s::%s(%s%s%s)%s%s\n"211 QTest::qt_, "%s: %s::%s(%s%s%s)%s%s\n" 182 212 #ifdef Q_OS_WIN 183 213 "%s(%d) : failure location\n" … … 188 218 msg[0] ? " " : "", msg, file, line); 189 219 } else { 190 QTest::qt_ snprintf(buf, sizeof(buf), "%s: %s::%s(%s%s%s)%s%s\n",220 QTest::qt_, "%s: %s::%s(%s%s%s)%s%s\n", 191 221 type, QTestResult::currentTestObjectName(), fn, gtag, filler, tag, 192 222 msg[0] ? " " : "", msg); 193 223 } 194 memcpy(buf, type, strlen(type)); 195 outputMessage(buf); 224 // In colored mode, printf above stripped our nonprintable control characters. 225 // Put them back. 226 memcpy(buf.data(), type, strlen(type)); 227 outputMessage(buf.data()); 196 228 } 197 229 … … 204 236 int digits = 0; 205 237 qreal divisor = 1; 206 238 207 239 while (num / divisor >= 1) { 208 240 divisor *= 10; … … 217 249 { 218 250 if (number < T(0)) 219 return Q String(QLatin1String("NAN"));251 return Q); 220 252 if (number == T(0)) 221 return Q String(QLatin1String("0"));253 return Q); 222 254 223 255 QString beforeDecimalPoint = QString::number(qint64(number), 'f', 0); 224 256 QString afterDecimalPoint = QString::number(number, 'f', 20); 225 257 afterDecimalPoint.remove(0, beforeDecimalPoint.count() + 1); 226 258 227 259 int beforeUse = qMin(beforeDecimalPoint.count(), significantDigits); 228 260 int beforeRemove = beforeDecimalPoint.count() - beforeUse; 229 261 230 262 // Replace insignificant digits before the decimal point with zeros. 231 263 beforeDecimalPoint.chop(beforeRemove); … … 265 297 if (afterUse > 0) 266 298 print.append(decimalPoint); 267 299 268 300 print += afterDecimalPoint; 269 301 270 302 271 303 return print; 272 304 } … … 289 321 QTest::qt_snprintf( 290 322 buf1, sizeof(buf1), "%s: %s::%s", 291 bmtag, 323 bmtag, 292 324 QTestResult::currentTestObjectName(), 293 325 result.context.slotName.toAscii().data()); … … 300 332 QTest::qt_snprintf(bufTag, sizeof(bufTag), ":\"%s\"", tag.data()); 301 333 } 302 334 303 335 304 336 char fillFormat[8]; -
branches/vendor/nokia/qt/current/src/testlib/qplaintestlogger_p.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
branches/vendor/nokia/qt/current/src/testlib/qsignaldumper.cpp
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 88 88 str += "Signal: "; 89 89 str += mo->className(); 90 str += "(";90 str += ; 91 91 92 92 QString objname = caller->objectName(); … … 115 115 } else if (typeId != QMetaType::Void) { 116 116 str.append(arg) 117 .append( "(")117 .append() 118 118 .append(QVariant(typeId, argv[i + 1]).toString().toLocal8Bit()) 119 .append( ")");119 .append(); 120 120 } 121 121 str.append(", "); … … 123 123 if (str.endsWith(", ")) 124 124 str.chop(2); 125 str.append( ")");125 str.append(); 126 126 qPrintMessage(str); 127 127 } … … 144 144 str += "Slot: "; 145 145 str += mo->className(); 146 str += "(";146 str += ; 147 147 148 148 QString objname = caller->objectName(); -
branches/vendor/nokia/qt/current/src/testlib/qsignaldumper_p.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
branches/vendor/nokia/qt/current/src/testlib/qsignalspy.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
branches/vendor/nokia/qt/current/src/testlib/qtest.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 54 54 #include <QtCore/qdatetime.h> 55 55 #include <QtCore/qobject.h> 56 56 57 #include <QtCore/qurl.h> 57 58 … … 88 89 { 89 90 return time.isValid() 90 ? qstrdup(time.toString(QLatin1String("hh:mm:ss.zzz")).toLatin1() )91 ? qstrdup(time.toString(QLatin1String("hh:mm:ss.zzz")).toLatin1()) 91 92 : qstrdup("Invalid QTime"); 92 93 } … … 95 96 { 96 97 return date.isValid() 97 ? qstrdup(date.toString(QLatin1String("yyyy/MM/dd")).toLatin1() )98 ? qstrdup(date.toString(QLatin1String("yyyy/MM/dd")).toLatin1()) 98 99 : qstrdup("Invalid QDate"); 99 100 } … … 103 104 return dateTime.isValid() 104 105 ? qstrdup((dateTime.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz")) + 105 (dateTime.timeSpec() == Qt::LocalTime ? QLatin1String("[local time]") : QLatin1String("[UTC]"))).toLatin1() )106 (dateTime.timeSpec() == Qt::LocalTime ? QLatin1String("[local time]") : QLatin1String("[UTC]"))).toLatin1()) 106 107 : qstrdup("Invalid QDateTime"); 107 108 } … … 145 146 { 146 147 return qstrdup(uri.toEncoded().constData()); 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 147 172 } 148 173 … … 227 252 #include <QtTest/qtest_gui.h> 228 253 254 255 256 257 258 259 229 260 #define QTEST_MAIN(TestObject) \ 230 261 int main(int argc, char *argv[]) \ 231 262 { \ 232 263 QApplication app(argc, argv); \ 264 233 265 TestObject tc; \ 234 266 return QTest::qExec(&tc, argc, argv); \ -
branches/vendor/nokia/qt/current/src/testlib/qtest_global.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 53 53 #ifdef QTEST_EMBED 54 54 # define Q_TESTLIB_EXPORT 55 #elif !defined(QT_SHARED) 55 #elif !defined(QT_SHARED) 56 56 # define Q_TESTLIB_EXPORT 57 57 #else … … 63 63 #endif 64 64 65 #if (defined (Q_CC_MSVC) && _MSC_VER < 1310) || defined (Q_CC_SUN) || defined (Q_CC_XLC) || (defined (Q_CC_GNU) && (__GNUC__ - 0 < 3)) 65 #if (defined (Q_CC_MSVC) && _MSC_VER < 1310) || defined (Q_CC_SUN) || defined (Q_CC_XLC) || (defined (Q_CC_GNU) && (__GNUC__ - 0 < 3)) 66 66 # define QTEST_NO_SPECIALIZATIONS 67 67 #endif 68 68 69 69 70 #if (defined Q_CC_HPACC) && (defined __ia64) -
branches/vendor/nokia/qt/current/src/testlib/qtest_gui.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 43 43 #define QTEST_GUI_H 44 44 45 46 47 48 49 50 51 52 45 53 #include <QtTest/qtestassert.h> 46 54 #include <QtTest/qtest.h> 47 55 #include <QtTest/qtestevent.h> 48 56 #include <QtTest/qtestmouse.h> 57 49 58 #include <QtTest/qtestkeyboard.h> 50 59 -
branches/vendor/nokia/qt/current/src/testlib/qtestaccessible.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
branches/vendor/nokia/qt/current/src/testlib/qtestassert.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
branches/vendor/nokia/qt/current/src/testlib/qtestcase.cpp
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 55 55 #include <QtCore/qprocess.h> 56 56 #include <QtCore/qdebug.h> 57 57 58 58 59 #include "QtTest/private/qtestlog_p.h" … … 72 73 #endif 73 74 #ifdef Q_OS_UNIX 75 76 74 77 #include <time.h> 75 78 #endif … … 301 304 Use this macro to build stand-alone executables. 302 305 306 307 308 309 310 303 311 Example: 304 312 \snippet doc/src/snippets/code/src_qtestlib_qtestcase.cpp 11 305 313 306 \sa QTEST_APPLESS_MAIN(), QTest::qExec() 314 \sa QTEST_APPLESS_MAIN(), QTest::qExec() 307 315 */ 308 316 … … 348 356 {Chapter 5: Writing a Benchmark}{Writing a Benchmark} 349 357 */ 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 350 381 351 382 /*! \enum QTest::SkipMode … … 401 432 \overload 402 433 403 Simulates clicking of \a key with an optional \a modifier on a \a widget. If \a delay is larger than 0, the test will wait for \a delay milliseconds. 434 Simulates clicking of \a key with an optional \a modifier on a \a widget. 435 If \a delay is larger than 0, the test will wait for \a delay milliseconds. 404 436 405 437 Example: … … 414 446 /*! \fn void QTest::keyClick(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) 415 447 416 Simulates clicking of \a key with an optional \a modifier on a \a widget. If \a delay is larger than 0, the test will wait for \a delay milliseconds. 448 Simulates clicking of \a key with an optional \a modifier on a \a widget. 449 If \a delay is larger than 0, the test will wait for \a delay milliseconds. 417 450 418 451 Examples: … … 429 462 /*! \fn void QTest::keyEvent(KeyAction action, QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) 430 463 431 Sends a Qt key event to \a widget with the given \a key and an associated \a action. Optionally, a keyboard \a modifier can be specified, as well as a \a delay (in milliseconds) of the test before sending the event. 464 Sends a Qt key event to \a widget with the given \a key and an associated \a action. 465 Optionally, a keyboard \a modifier can be specified, as well as a \a delay 466 (in milliseconds) of the test before sending the event. 432 467 */ 433 468 … … 436 471 \overload 437 472 438 Sends a Qt key event to \a widget with the given key \a ascii and an associated \a action. Optionally, a keyboard \a modifier can be specified, as well as a \a delay (in milliseconds) of the test before sending the event. 473 Sends a Qt key event to \a widget with the given key \a ascii and an associated \a action. 474 Optionally, a keyboard \a modifier can be specified, as well as a \a delay 475 (in milliseconds) of the test before sending the event. 439 476 440 477 */ … … 442 479 /*! \fn void QTest::keyPress(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) 443 480 444 Simulates pressing a \a key with an optional \a modifier on a \a widget. If \a delay is larger than 0, the test will wait for \a delay milliseconds. 481 Simulates pressing a \a key with an optional \a modifier on a \a widget. If \a delay 482 is larger than 0, the test will wait for \a delay milliseconds. 445 483 446 484 \bold {Note:} At some point you should release the key using \l keyRelease(). … … 453 491 \overload 454 492 455 Simulates pressing a \a key with an optional \a modifier on a \a widget. If \a delay is larger than 0, the test will wait for \a delay milliseconds. 493 Simulates pressing a \a key with an optional \a modifier on a \a widget. 494 If \a delay is larger than 0, the test will wait for \a delay milliseconds. 456 495 457 496 \bold {Note:} At some point you should release the key using \l keyRelease(). … … 462 501 /*! \fn void QTest::keyRelease(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1) 463 502 464 Simulates releasing a \a key with an optional \a modifier on a \a widget. If \a delay is larger than 0, the test will wait for \a delay milliseconds. 503 Simulates releasing a \a key with an optional \a modifier on a \a widget. 504 If \a delay is larger than 0, the test will wait for \a delay milliseconds. 465 505 466 506 \sa QTest::keyPress(), QTest::keyClick() … … 471 511 \overload 472 512 473 Simulates releasing a \a key with an optional \a modifier on a \a widget. If \a delay is larger than 0, the test will wait for \a delay milliseconds. 513 Simulates releasing a \a key with an optional \a modifier on a \a widget. 514 If \a delay is larger than 0, the test will wait for \a delay milliseconds. 474 515 475 516 \sa QTest::keyClick() … … 673 714 */ 674 715 716 717 718 719 720 721 722 675 723 /*! \fn void QTest::qWait(int ms) 676 724 … … 687 735 */ 688 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 689 826 namespace QTest 690 827 { 691 828 static QObject *currentTestObject = 0; 692 829 693 st ruct TestFunction {830 struct TestFunction { 694 831 TestFunction():function(0), data(0) {} 695 832 ~TestFunction() { delete [] data; } 696 833 int function; 697 834 char *data; 698 } testFuncs[512];835 } ; 699 836 700 837 /** … … 711 848 static int keyVerbose = -1; 712 849 713 /*! \internal 714 */ 715 int qt_snprintf(char *str, int size, const char *format, ...) 716 { 717 va_list ap; 718 int res = 0; 719 720 va_start(ap, format); 721 qvsnprintf(str, size, format, ap); 722 va_end(ap); 723 str[size - 1] = '\0'; 724 850 void filter_unprintable(char *str) 851 { 725 852 char *idx = str; 726 853 while (*idx) { … … 729 856 ++idx; 730 857 } 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 731 874 return res; 732 875 } … … 819 962 " options:\n" 820 963 " -functions : Returns a list of current testfunctions\n" 964 821 965 " -xml : Outputs results as XML document\n" 822 966 " -lightxml : Outputs results as stream of XML tags\n" 967 823 968 " -o filename: Writes all output into a file\n" 824 969 " -silent : Only outputs warnings and failures\n" … … 845 990 " -median n : Sets the number of median iterations.\n" 846 991 " -vb : Print out verbose benchmarking information.\n" 847 #ifndef QT_NO_PROCESS 848 // Will be enabled when tools are integrated. 849 // " -chart : Runs the chart generator after the test. No output is printed to the console\n" 992 #if !defined(QT_NO_PROCESS) && !defined(QT_NO_SETTINGS) 993 " -chart : Create chart based on the benchmark result.\n" 850 994 #endif 851 995 "\n" … … 862 1006 qPrintTestSlots(); 863 1007 exit(0); 1008 1009 864 1010 } else if (strcmp(argv[i], "-xml") == 0) { 865 1011 QTestLog::setLogMode(QTestLog::XML); 866 1012 } else if (strcmp(argv[i], "-lightxml") == 0) { 867 1013 QTestLog::setLogMode(QTestLog::LightXML); 1014 1015 868 1016 } else if (strcmp(argv[i], "-silent") == 0) { 869 1017 QTestLog::setVerboseLevel(-1); … … 958 1106 } else if (strcmp(argv[i], "-vb") == 0) { 959 1107 QBenchmarkGlobalData::current->verboseOutput = true; 960 #if ndef QT_NO_PROCESS1108 #if 961 1109 } else if (strcmp(argv[i], "-chart") == 0) { 962 1110 QBenchmarkGlobalData::current->createChart = true; … … 992 1140 } 993 1141 ++QTest::lastTestFuncIdx; 1142 1143 1144 1145 1146 994 1147 QTest::testFuncs[QTest::lastTestFuncIdx].function = idx; 995 1148 QTest::testFuncs[QTest::lastTestFuncIdx].data = data; … … 1007 1160 if (count == 1) 1008 1161 return container.at(0); 1009 1162 1010 1163 QList<QBenchmarkResult> containerCopy = container; 1011 1164 qSort(containerCopy); … … 1057 1210 ? QTestResult::currentDataTag() : ""); 1058 1211 1059 invokeOk = QMetaObject::invokeMethod(QTest::currentTestObject, slot, 1212 invokeOk = QMetaObject::invokeMethod(QTest::currentTestObject, slot, 1060 1213 Qt::DirectConnection); 1061 1214 if (!invokeOk) … … 1078 1231 results.append(QBenchmarkTestMethodData::current->result); 1079 1232 1080 if (QBenchmarkTestMethodData::current->isBenchmark() && 1233 if (QBenchmarkTestMethodData::current->isBenchmark() && 1081 1234 QBenchmarkGlobalData::current->verboseOutput) { 1082 1235 if (i == -1) { … … 1209 1362 /*! 1210 1363 \fn char* QTest::toHexRepresentation(const char *ba, int length) 1211 1364 1212 1365 Returns a pointer to a string that is the string \a ba represented 1213 1366 as a space-separated sequence of hex characters. If the input is … … 1215 1368 the returned string as an ellipsis at the end. 1216 1369 1217 \a length is the length of the string \a ba. 1370 \a length is the length of the string \a ba. 1218 1371 */ 1219 1372 char *toHexRepresentation(const char *ba, int length) … … 1274 1427 } 1275 1428 1276 static void qInvokeTestMethods(QObject *testObject) 1277 { 1278 const QMetaObject *metaObject = testObject->metaObject(); 1279 QTEST_ASSERT(metaObject); 1280 1281 QTestLog::startLogging(); 1282 1283 QTestResult::setCurrentTestFunction("initTestCase"); 1284 QTestResult::setCurrentTestLocation(QTestResult::DataFunc); 1285 QTestTable::globalTestTable(); 1286 QMetaObject::invokeMethod(testObject, "initTestCase_data", Qt::DirectConnection); 1287 1288 if (!QTestResult::skipCurrentTest() && !QTest::currentTestFailed()) { 1289 QTestResult::setCurrentTestLocation(QTestResult::InitFunc); 1290 QMetaObject::invokeMethod(testObject, "initTestCase"); 1291 1292 // finishedCurrentTestFunction() resets QTestResult::testFailed(), so use a local copy. 1293 const bool previousFailed = QTestResult::testFailed(); 1294 QTestResult::finishedCurrentTestFunction(); 1295 1296 if(!QTestResult::skipCurrentTest() && !previousFailed) { 1297 1298 if (lastTestFuncIdx >= 0) { 1299 for (int i = 0; i <= lastTestFuncIdx; ++i) { 1300 if (!qInvokeTestMethod(metaObject->method(testFuncs[i].function).signature(), 1301 testFuncs[i].data)) 1302 break; 1303 } 1304 } else { 1305 int methodCount = metaObject->methodCount(); 1306 for (int i = 0; i < methodCount; ++i) { 1307 QMetaMethod slotMethod = metaObject->method(i); 1308 if (!isValidSlot(slotMethod)) 1309 continue; 1310 if (!qInvokeTestMethod(slotMethod.signature())) 1311 break; 1312 } 1313 } 1314 } 1315 1316 QTestResult::setSkipCurrentTest(false); 1317 QTestResult::setCurrentTestFunction("cleanupTestCase"); 1318 QMetaObject::invokeMethod(testObject, "cleanupTestCase"); 1319 } 1320 QTestResult::finishedCurrentTestFunction(); 1321 QTestResult::setCurrentTestFunction(0); 1322 QTestTable::clearGlobalTestTable(); 1323 1324 QTestLog::stopLogging(); 1325 } 1429 static void qInvokeTestMethods(QObject *testObject) 1430 { 1431 const QMetaObject *metaObject = testObject->metaObject(); 1432 QTEST_ASSERT(metaObject); 1433 1434 QTestLog::startLogging(); 1435 1436 QTestResult::setCurrentTestFunction("initTestCase"); 1437 QTestResult::setCurrentTestLocation(QTestResult::DataFunc); 1438 QTestTable::globalTestTable(); 1439 QMetaObject::invokeMethod(testObject, "initTestCase_data", Qt::DirectConnection); 1440 1441 if (!QTestResult::skipCurrentTest() && !QTest::currentTestFailed()) { 1442 QTestResult::setCurrentTestLocation(QTestResult::InitFunc); 1443 QMetaObject::invokeMethod(testObject, "initTestCase"); 1444 1445 // finishedCurrentTestFunction() resets QTestResult::testFailed(), so use a local copy. 1446 const bool previousFailed = QTestResult::testFailed(); 1447 QTestResult::finishedCurrentTestFunction(); 1448 1449 if(!QTestResult::skipCurrentTest() && !previousFailed) { 1450 1451 if (lastTestFuncIdx >= 0) { 1452 for (int i = 0; i <= lastTestFuncIdx; ++i) { 1453 if (!qInvokeTestMethod(metaObject->method(testFuncs[i].function).signature(), 1454 testFuncs[i].data)) 1455 break; 1456 } 1457 } else { 1458 int methodCount = metaObject->methodCount(); 1459 for (int i = 0; i < methodCount; ++i) { 1460 QMetaMethod slotMethod = metaObject->method(i); 1461 if (!isValidSlot(slotMethod)) 1462 continue; 1463 if (!qInvokeTestMethod(slotMethod.signature())) 1464 break; 1465 } 1466 } 1467 } 1468 1469 QTestResult::setSkipCurrentTest(false); 1470 QTestResult::setCurrentTestFunction("cleanupTestCase"); 1471 QMetaObject::invokeMethod(testObject, "cleanupTestCase"); 1472 } 1473 QTestResult::finishedCurrentTestFunction(); 1474 QTestResult::setCurrentTestFunction(0); 1475 QTestTable::clearGlobalTestTable(); 1476 1477 QTestLog::stopLogging(); 1478 } 1479 1480 #if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) 1481 class FatalSignalHandler 1482 { 1483 public: 1484 FatalSignalHandler(); 1485 ~FatalSignalHandler(); 1486 1487 private: 1488 static void signal(int); 1489 sigset_t handledSignals; 1490 }; 1491 1492 void FatalSignalHandler::signal(int signum) 1493 { 1494 qFatal("Received signal %d", signum); 1495 } 1496 1497 FatalSignalHandler::FatalSignalHandler() 1498 { 1499 sigemptyset(&handledSignals); 1500 1501 const int fatalSignals[] = { 1502 SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGFPE, SIGSEGV, SIGPIPE, SIGTERM, 0 }; 1503 1504 struct sigaction act; 1505 memset(&act, 0, sizeof(act)); 1506 act.sa_handler = FatalSignalHandler::signal; 1507 1508 // Remove the handler after it is invoked. 1509 act.sa_flags = SA_RESETHAND; 1510 1511 // Block all fatal signals in our signal handler so we don't try to close 1512 // the testlog twice. 1513 sigemptyset(&act.sa_mask); 1514 for (int i = 0; fatalSignals[i]; ++i) 1515 sigaddset(&act.sa_mask, fatalSignals[i]); 1516 1517 struct sigaction oldact; 1518 1519 for (int i = 0; fatalSignals[i]; ++i) { 1520 sigaction(fatalSignals[i], &act, &oldact); 1521 #ifndef Q_WS_QWS 1522 // Don't overwrite any non-default handlers 1523 // however, we need to replace the default QWS handlers 1524 if (oldact.sa_flags & SA_SIGINFO || oldact.sa_handler != SIG_DFL) { 1525 sigaction(fatalSignals[i], &oldact, 0); 1526 } else 1527 #endif 1528 { 1529 sigaddset(&handledSignals, fatalSignals[i]); 1530 } 1531 } 1532 } 1533 1534 1535 FatalSignalHandler::~FatalSignalHandler() 1536 { 1537 // Unregister any of our remaining signal handlers 1538 struct sigaction act; 1539 memset(&act, 0, sizeof(act)); 1540 act.sa_handler = SIG_DFL; 1541 1542 struct sigaction oldact; 1543 1544 for (int i = 1; i < 32; ++i) { 1545 if (!sigismember(&handledSignals, i)) 1546 continue; 1547 sigaction(i, &act, &oldact); 1548 1549 // If someone overwrote it in the mean time, put it back 1550 if (oldact.sa_handler != FatalSignalHandler::signal) 1551 sigaction(i, &oldact, 0); 1552 } 1553 } 1554 1555 #endif 1556 1326 1557 1327 1558 } // namespace … … 1400 1631 #endif 1401 1632 1633 1634 1635 1636 1637 1638 1639 1640 1402 1641 QTestResult::reset(); 1403 1642 … … 1419 1658 QBenchmarkValgrindUtils::cleanup(); 1420 1659 1421 } else { 1422 #endif 1423 1660 } else 1661 #endif 1662 { 1663 #if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) 1664 FatalSignalHandler handler; 1665 #endif 1424 1666 qInvokeTestMethods(testObject); 1425 1426 #ifdef QTESTLIB_USE_VALGRIND1427 1667 } 1428 #endif 1429 1430 #ifndef QT_NO_EXCEPTIONS 1668 1669 #ifndef QT_NO_EXCEPTIONS 1431 1670 } catch (...) { 1432 1671 QTestResult::addFailure("Caught unhandled exception", __FILE__, __LINE__); … … 1442 1681 } 1443 1682 #endif 1444 #ifdef Q_OS_WIN 1445 // rethrow exception to make debugging easier 1683 // Rethrow exception to make debugging easier. 1446 1684 throw; 1447 #endif 1448 return -1; 1685 return 1; 1449 1686 } 1450 #endif1687 endif 1451 1688 1452 1689 currentTestObject = 0; … … 1458 1695 1459 1696 1460 #if ndef QT_NO_PROCESS1697 #if 1461 1698 if (QBenchmarkGlobalData::current->createChart) { 1462 1463 #define XSTR(s) STR(s) 1464 #define STR(s) #s 1699 QString chartLocation = QLibraryInfo::location(QLibraryInfo::BinariesPath); 1465 1700 #ifdef Q_OS_WIN 1466 const char * path = XSTR(QBENCHLIB_BASE) "/tools/generatereport/generatereport.exe";1701 ; 1467 1702 #else 1468 const char * path = XSTR(QBENCHLIB_BASE) "/tools/generatereport/generatereport"; 1469 #endif 1470 #undef XSTR 1471 #undef STR 1472 1473 if (QFile::exists(QLatin1String(path))) { 1703 chartLocation += QLatin1String("/../tools/qtestlib/chart/chart"); 1704 #endif 1705 if (QFile::exists(chartLocation)) { 1474 1706 QProcess p; 1475 1707 p.setProcessChannelMode(QProcess::ForwardedChannels); 1476 p.start( QLatin1String(path), QStringList() << QLatin1String("results.xml"));1708 p.start(, QStringList() << QLatin1String("results.xml")); 1477 1709 p.waitForFinished(-1); 1478 1710 } else { 1479 q Warning("Could not find %s, please make sure it is compiled.", path);1711 q); 1480 1712 } 1481 1713 } 1482 1714 #endif 1483 1715 1484 #if defined(QTEST_NOEXITCODE) || (defined(QT_BUILD_INTERNAL) && !defined(QTEST_FORCE_EXITCODE))1716 #if defined(QTEST_NOEXITCODE) 1485 1717 return 0; 1486 1718 #else … … 1756 1988 */ 1757 1989 template <> 1758 bool QTest::qCompare<float>(float const &t1, float const &t2, const char *actual, const char *expected,1990 bool QTest::qCompare<float>(float const &t1, float const &t2, const char *actual, const char *expected, 1759 1991 const char *file, int line) 1760 1992 { … … 1769 2001 */ 1770 2002 template <> 1771 bool QTest::qCompare<double>(double const &t1, double const &t2, const char *actual, const char *expected,2003 bool QTest::qCompare<double>(double const &t1, double const &t2, const char *actual, const char *expected, 1772 2004 const char *file, int line) 1773 2005 { … … 1779 2011 1780 2012 #define COMPARE_IMPL2(TYPE, FORMAT) \ 1781 template <> char *QTest::toString<TYPE >(const TYPE &t) \2013 template <> char *QTest::toString<TYPE >(const TYPE &t) \ 1782 2014 { \ 1783 2015 char *msg = new char[128]; \ … … 1801 2033 COMPARE_IMPL2(bool, %d) 1802 2034 COMPARE_IMPL2(char, %c) 1803 COMPARE_IMPL2(float, %g) ;1804 COMPARE_IMPL2(double, %lg) ;2035 COMPARE_IMPL2(float, %g) 2036 COMPARE_IMPL2(double, %lg) 1805 2037 1806 2038 /*! \internal … … 1911 2143 */ 1912 2144 2145 2146 2147 2148 1913 2149 /*! \fn bool QTest::qTest(const T& actual, const char *elementName, const char *actualStr, const char *expected, const char *file, int line) 1914 2150 \internal … … 1927 2163 */ 1928 2164 1929 /*! \fn int QTest::qt_snprintf(char *str, int size, const char *format, ...)1930 \internal1931 */1932 1933 2165 QT_END_NAMESPACE -
branches/vendor/nokia/qt/current/src/testlib/qtestcase.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 125 125 return 0; 126 126 } 127 127 128 128 129 Q_TESTLIB_EXPORT char *toHexRepresentation(const char *ba, int length); … … 178 179 toString<T>(t1), toString<T>(t2), actual, expected, file, line); 179 180 } 181 180 182 181 183 template <> … … 219 221 bool qCompare(T1 const &, T2 const &, const char *, const char *, const char *, int); 220 222 221 #if defined(QT_ ARCH_WINDOWSCE) && defined(QT_COORD_TYPE)223 #if defined(QT_) 222 224 template <> 223 225 inline bool qCompare<qreal, float>(qreal const &t1, float const &t2, const char *actual, … … 234 236 } 235 237 236 #elif defined(QT_COORD_TYPE) || defined(QT_ARCH_ARM) || defined(QT_NO_FPU) || defined(QT_ARCH_WINDOWSCE) 238 #elif defined(QT_COORD_TYPE) || defined(QT_ARCH_ARM) || defined(QT_NO_FPU) || defined(QT_ARCH_WINDOWSCE) 237 239 template <> 238 240 inline bool qCompare<qreal, double>(qreal const &t1, double const &t2, const char *actual, … … 290 292 } 291 293 #else /* QTEST_NO_SPECIALIZATIONS */ 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 292 316 inline bool qCompare(const char *t1, const char *t2, const char *actual, 293 317 const char *expected, const char *file, int line) … … 323 347 } 324 348 349 350 351 352 353 354 355 356 357 358 359 325 360 template <class T> 326 361 inline bool qTest(const T& actual, const char *elementName, const char *actualStr, -
branches/vendor/nokia/qt/current/src/testlib/qtestdata.cpp
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
branches/vendor/nokia/qt/current/src/testlib/qtestdata.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
branches/vendor/nokia/qt/current/src/testlib/qtestevent.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 49 49 50 50 #include <QtTest/qtest_global.h> 51 51 52 #include <QtTest/qtestkeyboard.h> 52 53 #include <QtTest/qtestmouse.h> 54 53 55 #include <QtTest/qtestsystem.h> 54 56 … … 72 74 }; 73 75 76 74 77 class QTestKeyEvent: public QTestEvent 75 78 { … … 136 139 int _delay; 137 140 }; 141 142 138 143 139 144 class QTestDelayEvent: public QTestEvent … … 160 165 { qDeleteAll(*this); QList<QTestEvent *>::clear(); } 161 166 167 162 168 inline void addKeyClick(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1) 163 169 { addKeyEvent(QTest::Click, qtKey, modifiers, msecs); } … … 195 201 inline void addMouseMove(QPoint pos = QPoint(), int delay=-1) 196 202 { append(new QTestMouseEvent(QTest::MouseMove, Qt::NoButton, 0, pos, delay)); } 203 197 204 198 205 inline void addDelay(int msecs) -
branches/vendor/nokia/qt/current/src/testlib/qtesteventloop.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
branches/vendor/nokia/qt/current/src/testlib/qtestkeyboard.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** 40 40 ****************************************************************************/ 41 41 42 #if ndef QTESTKEYBOARD_H42 #if 43 43 #define QTESTKEYBOARD_H 44 44 -
branches/vendor/nokia/qt/current/src/testlib/qtestlog.cpp
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 47 47 #include "QtTest/private/qplaintestlogger_p.h" 48 48 #include "QtTest/private/qxmltestlogger_p.h" 49 50 49 #include <QtCore/qatomic.h> 51 50 #include <QtCore/qbytearray.h> … … 54 53 #include <string.h> 55 54 #include <limits.h> 55 56 57 56 58 57 59 QT_BEGIN_NAMESPACE … … 84 86 85 87 static QTestLog::LogMode logMode = QTestLog::Plain; 88 86 89 static int verbosity = 0; 87 90 static int maxWarnings = 2002; … … 137 140 if (!counter.deref()) { 138 141 QTest::testLogger->addMessage(QAbstractTestLogger::QSystem, 139 "Maximum amount of warnings exceeded. ");142 "Maximum amount of warnings exceeded."); 140 143 return; 141 144 } … … 271 274 272 275 switch (QTest::logMode) { 273 case QTestLog::Plain: 274 QTest::testLogger = new QPlainTestLogger(); 275 break; 276 case QTestLog::XML: 277 QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Complete); 278 break; 279 case QTestLog::LightXML: 280 QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Light); 281 } 276 case QTestLog::Plain: 277 QTest::testLogger = new QPlainTestLogger; 278 break; 279 case QTestLog::XML:{ 280 if(QTest::flushMode == QTestLog::FLushOn) 281 QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Complete); 282 else 283 QTest::testLogger = new QTestLogger(QTestLogger::TLF_XML); 284 break; 285 }case QTestLog::LightXML:{ 286 if(QTest::flushMode == QTestLog::FLushOn) 287 QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Light); 288 else 289 QTest::testLogger = new QTestLogger(QTestLogger::TLF_LightXml); 290 break; 291 }case QTestLog::XunitXML: 292 QTest::testLogger = new QTestLogger(QTestLogger::TLF_XunitXml); 293 } 282 294 283 295 QTest::testLogger->startLogging(); … … 298 310 void QTestLog::warn(const char *msg) 299 311 { 312 300 313 QTEST_ASSERT(msg); 301 314 … … 308 321 309 322 if (QTest::testLogger) 310 QTest::testLogger->addMessage(QAbstractTestLogger::Info, msg, file, line);323 QTest::testLogger->addMessage(QAbstractTestLogger::Info, msg, file, line); 311 324 } 312 325 … … 362 375 } 363 376 377 378 379 380 381 364 382 QT_END_NAMESPACE -
branches/vendor/nokia/qt/current/src/testlib/qtestlog_p.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 63 63 { 64 64 public: 65 enum LogMode { Plain = 0, XML, LightXML }; 65 enum LogMode { Plain = 0, XML, LightXML, XunitXML }; 66 enum FlushMode { NoFlush = 0, FLushOn }; 66 67 67 68 static void enterTestFunction(const char* function); … … 96 97 static void setMaxWarnings(int max); 97 98 99 100 98 101 private: 99 102 QTestLog(); -
branches/vendor/nokia/qt/current/src/testlib/qtestmouse.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** 40 40 ****************************************************************************/ 41 41 42 #if ndef QTESTMOUSE_H42 #if 43 43 #define QTESTMOUSE_H 44 44 … … 114 114 } 115 115 QSpontaneKeyEvent::setSpontaneous(&me); 116 if (!qApp->notify(widget, &me)) 117 QTest::qWarn("Mouse event not accepted by receiving widget"); 116 if (!qApp->notify(widget, &me)) { 117 static const char *mouseActionNames[] = 118 { "MousePress", "MouseRelease", "MouseClick", "MouseDClick", "MouseMove" }; 119 QString warning = QString::fromLatin1("Mouse event \"%1\" not accepted by receiving widget"); 120 QTest::qWarn(warning.arg(QString::fromLatin1(mouseActionNames[static_cast<int>(action)])).toAscii().data()); 121 } 118 122 119 123 } -
branches/vendor/nokia/qt/current/src/testlib/qtestresult.cpp
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 69 69 static const char *expectFailComment = 0; 70 70 static int expectFailMode = 0; 71 } ;71 } 72 72 73 73 void QTestResult::reset() -
branches/vendor/nokia/qt/current/src/testlib/qtestresult_p.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
branches/vendor/nokia/qt/current/src/testlib/qtestspontaneevent.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 75 75 { 76 76 public: 77 void setSpontaneous() { spont = 1; } ;78 bool spontaneous() { return spont; } ;79 virtual void dummyFunc() { };77 void setSpontaneous() { spont = 1; } 78 bool spontaneous() { return spont; } 79 virtual void dummyFunc() { 80 80 virtual ~QSpontaneKeyEvent() {} 81 81 -
branches/vendor/nokia/qt/current/src/testlib/qtestsystem.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 53 53 QT_MODULE(Test) 54 54 55 56 57 58 59 55 60 namespace QTest 56 61 { … … 66 71 } while (timer.elapsed() < ms); 67 72 } 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 68 89 } 69 90 -
branches/vendor/nokia/qt/current/src/testlib/qtesttable.cpp
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
branches/vendor/nokia/qt/current/src/testlib/qtesttable_p.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
branches/vendor/nokia/qt/current/src/testlib/qxmltestlogger.cpp
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 47 47 #include "QtTest/private/qtestresult_p.h" 48 48 #include "QtTest/private/qbenchmark_p.h" 49 49 50 50 51 QT_BEGIN_NAMESPACE … … 91 92 92 93 93 QXmlTestLogger::QXmlTestLogger(XmlMode mode ) :94 xmlmode(mode)94 QXmlTestLogger::QXmlTestLogger(XmlMode mode ) 95 xmlmode(mode) 95 96 { 96 97 … … 99 100 QXmlTestLogger::~QXmlTestLogger() 100 101 { 101 102 } 103 102 } 104 103 105 104 void QXmlTestLogger::startLogging() 106 105 { 107 106 QAbstractTestLogger::startLogging(); 108 char buf[1024];107 ; 109 108 110 109 if (xmlmode == QXmlTestLogger::Complete) { 111 QTest::qt_snprintf(buf, sizeof(buf), 110 QTestCharBuffer quotedTc; 111 xmlQuote("edTc, QTestResult::currentTestObjectName()); 112 QTest::qt_asprintf(&buf, 112 113 "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" 113 "<TestCase name=\"%s\">\n", QTestResult::currentTestObjectName());114 outputString(buf );115 } 116 117 QTest::qt_ snprintf(buf, sizeof(buf),114 "<TestCase name=\"%s\">\n", ()); 115 outputString(buf); 116 } 117 118 QTest::qt_, 118 119 "<Environment>\n" 119 120 " <QtVersion>%s</QtVersion>\n" 120 121 " <QTestVersion>"QTEST_VERSION_STR"</QTestVersion>\n" 121 122 "</Environment>\n", qVersion()); 122 outputString(buf );123 outputString(buf); 123 124 } 124 125 … … 134 135 void QXmlTestLogger::enterTestFunction(const char *function) 135 136 { 136 char buf[1024]; 137 QTest::qt_snprintf(buf, sizeof(buf), "<TestFunction name=\"%s\">\n", function); 138 outputString(buf); 137 QTestCharBuffer buf; 138 QTestCharBuffer quotedFunction; 139 xmlQuote("edFunction, function); 140 QTest::qt_asprintf(&buf, "<TestFunction name=\"%s\">\n", quotedFunction.constData()); 141 outputString(buf.constData()); 139 142 } 140 143 … … 159 162 else 160 163 return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" 161 " <DataTag><![CDATA[%s%s%s%s]]></DataTag>\n"162 "</Incident>\n";164 " <DataTag><![CDATA[%s%s%s%s]]></DataTag>\n" 165 "</Incident>\n"; 163 166 } else { 164 167 if (noTag) 165 168 return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" 166 " <Description><![CDATA[%s%s%s%s]]></Description>\n"167 "</Incident>\n";169 " <Description><![CDATA[%s%s%s%s]]></Description>\n" 170 "</Incident>\n"; 168 171 else 169 172 return "<Incident type=\"%s\" file=\"%s\" line=\"%d\">\n" 170 " <DataTag><![CDATA[%s%s%s]]></DataTag>\n"171 " <Description><![CDATA[%s]]></Description>\n"172 "</Incident>\n";173 " <DataTag><![CDATA[%s%s%s]]></DataTag>\n" 174 " <Description><![CDATA[%s]]></Description>\n" 175 "</Incident>\n"; 173 176 } 174 177 } … … 186 189 else 187 190 return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" 188 " <DataTag><![CDATA[%s%s%s%s]]></DataTag>\n"189 "</Message>\n";191 " <DataTag><![CDATA[%s%s%s%s]]></DataTag>\n" 192 "</Message>\n"; 190 193 } else { 191 194 if (noTag) 192 195 return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" 193 " <Description><![CDATA[%s%s%s%s]]></Description>\n"194 "</Message>\n";196 " <Description><![CDATA[%s%s%s%s]]></Description>\n" 197 "</Message>\n"; 195 198 else 196 199 return "<Message type=\"%s\" file=\"%s\" line=\"%d\">\n" 197 " <DataTag><![CDATA[%s%s%s]]></DataTag>\n"198 " <Description><![CDATA[%s]]></Description>\n"199 "</Message>\n";200 " <DataTag><![CDATA[%s%s%s]]></DataTag>\n" 201 " <Description><![CDATA[%s]]></Description>\n" 202 "</Message>\n"; 200 203 } 201 204 } … … 204 207 205 208 void QXmlTestLogger::addIncident(IncidentTypes type, const char *description, 206 const char *file, int line)207 { 208 char buf[1536];209 const char *file, int line) 210 { 211 ; 209 212 const char *tag = QTestResult::currentDataTag(); 210 213 const char *gtag = QTestResult::currentGlobalDataTag(); … … 212 215 const bool notag = QTest::isEmpty(tag) && QTest::isEmpty(gtag); 213 216 214 QTest::qt_snprintf(buf, sizeof(buf), 217 QTestCharBuffer quotedFile; 218 QTestCharBuffer cdataGtag; 219 QTestCharBuffer cdataTag; 220 QTestCharBuffer cdataDescription; 221 222 xmlQuote("edFile, file); 223 xmlCdata(&cdataGtag, gtag); 224 xmlCdata(&cdataTag, tag); 225 xmlCdata(&cdataDescription, description); 226 227 QTest::qt_asprintf(&buf, 215 228 QTest::incidentFormatString(QTest::isEmpty(description), notag), 216 229 QTest::xmlIncidentType2String(type), 217 file ? file : "", line,218 gtag ? gtag : "",230 , line, 231 , 219 232 filler, 220 tag ? tag : "",221 description ? description : "");222 223 outputString(buf );233 , 234 ); 235 236 outputString(buf); 224 237 } 225 238 226 239 void QXmlTestLogger::addBenchmarkResult(const QBenchmarkResult &result) 227 240 { 228 char buf[1536]; 229 QTest::qt_snprintf( 230 buf, sizeof(buf), 241 QTestCharBuffer buf; 242 QTestCharBuffer quotedMetric; 243 QTestCharBuffer quotedTag; 244 245 xmlQuote("edMetric, 246 QBenchmarkGlobalData::current->measurer->metricText().toAscii().constData()); 247 xmlQuote("edTag, result.context.tag.toAscii().constData()); 248 249 QTest::qt_asprintf( 250 &buf, 231 251 QTest::benchmarkResultFormatString(), 232 QBenchmarkGlobalData::current->measurer->metricText().toAscii().data(),233 result.context.tag.toAscii().data(),252 ata(), 253 ata(), 234 254 QByteArray::number(result.value).constData(), //no 64-bit qt_snprintf support 235 result.iterations); 236 outputString(buf );255 result.iterations); 256 outputString(buf); 237 257 } 238 258 … … 240 260 const char *file, int line) 241 261 { 242 char buf[1536]; 243 char msgbuf[1024]; 262 QTestCharBuffer buf; 244 263 const char *tag = QTestResult::currentDataTag(); 245 264 const char *gtag = QTestResult::currentGlobalDataTag(); … … 247 266 const bool notag = QTest::isEmpty(tag) && QTest::isEmpty(gtag); 248 267 249 QTest::qt_snprintf(msgbuf, sizeof(msgbuf), "%s", 250 message ? message : ""); 251 252 QTest::qt_snprintf(buf, sizeof(buf), 268 QTestCharBuffer quotedFile; 269 QTestCharBuffer cdataGtag; 270 QTestCharBuffer cdataTag; 271 QTestCharBuffer cdataDescription; 272 273 xmlQuote("edFile, file); 274 xmlCdata(&cdataGtag, gtag); 275 xmlCdata(&cdataTag, tag); 276 xmlCdata(&cdataDescription, message); 277 278 QTest::qt_asprintf(&buf, 253 279 QTest::messageFormatString(QTest::isEmpty(message), notag), 254 280 QTest::xmlMessageType2String(type), 255 file ? file : "", line,256 gtag ? gtag : "",281 , line, 282 , 257 283 filler, 258 tag ? tag : "", 259 msgbuf); 260 261 outputString(buf); 284 cdataTag.constData(), 285 cdataDescription.constData()); 286 287 outputString(buf.constData()); 288 } 289 290 /* 291 Copy up to n characters from the src string into dest, escaping any special 292 XML characters as necessary so that dest is suitable for use in an XML 293 quoted attribute string. 294 */ 295 int QXmlTestLogger::xmlQuote(QTestCharBuffer* destBuf, char const* src, size_t n) 296 { 297 if (n == 0) return 0; 298 299 char *dest = destBuf->data(); 300 *dest = 0; 301 if (!src) return 0; 302 303 char* begin = dest; 304 char* end = dest + n; 305 306 while (dest < end) { 307 switch (*src) { 308 309 #define MAP_ENTITY(chr, ent) \ 310 case chr: \ 311 if (dest + sizeof(ent) < end) { \ 312 strcpy(dest, ent); \ 313 dest += sizeof(ent) - 1; \ 314 } \ 315 else { \ 316 *dest = 0; \ 317 return (dest+sizeof(ent)-begin); \ 318 } \ 319 ++src; \ 320 break; 321 322 MAP_ENTITY('>', ">"); 323 MAP_ENTITY('<', "<"); 324 MAP_ENTITY('\'', "'"); 325 MAP_ENTITY('"', """); 326 MAP_ENTITY('&', "&"); 327 328 // not strictly necessary, but allows handling of comments without 329 // having to explicitly look for `--' 330 MAP_ENTITY('-', "-"); 331 332 #undef MAP_ENTITY 333 334 case 0: 335 *dest = 0; 336 return (dest-begin); 337 338 default: 339 *dest = *src; 340 ++dest; 341 ++src; 342 break; 343 } 344 } 345 346 // If we get here, dest was completely filled (dest == end) 347 *(dest-1) = 0; 348 return (dest-begin); 349 } 350 351 /* 352 Copy up to n characters from the src string into dest, escaping any 353 special strings such that dest is suitable for use in an XML CDATA section. 354 */ 355 int QXmlTestLogger::xmlCdata(QTestCharBuffer *destBuf, char const* src, size_t n) 356 { 357 if (!n) return 0; 358 359 char *dest = destBuf->data(); 360 361 if (!src || n == 1) { 362 *dest = 0; 363 return 0; 364 } 365 366 static char const CDATA_END[] = "]]>"; 367 static char const CDATA_END_ESCAPED[] = "]]]><![CDATA[]>"; 368 369 char* begin = dest; 370 char* end = dest + n; 371 while (dest < end) { 372 if (!*src) { 373 *dest = 0; 374 return (dest-begin); 375 } 376 377 if (!strncmp(src, CDATA_END, sizeof(CDATA_END)-1)) { 378 if (dest + sizeof(CDATA_END_ESCAPED) < end) { 379 strcpy(dest, CDATA_END_ESCAPED); 380 src += sizeof(CDATA_END)-1; 381 dest += sizeof(CDATA_END_ESCAPED) - 1; 382 } 383 else { 384 *dest = 0; 385 return (dest+sizeof(CDATA_END_ESCAPED)-begin); 386 } 387 continue; 388 } 389 390 *dest = *src; 391 ++src; 392 ++dest; 393 } 394 395 // If we get here, dest was completely filled (dest == end) 396 *(dest-1) = 0; 397 return (dest-begin); 398 } 399 400 typedef int (*StringFormatFunction)(QTestCharBuffer*,char const*,size_t); 401 402 /* 403 A wrapper for string functions written to work with a fixed size buffer so they can be called 404 with a dynamically allocated buffer. 405 */ 406 int allocateStringFn(QTestCharBuffer* str, char const* src, StringFormatFunction func) 407 { 408 static const int MAXSIZE = 1024*1024*2; 409 410 int size = str->size(); 411 412 int res = 0; 413 414 for (;;) { 415 res = func(str, src, size); 416 str->data()[size - 1] = '\0'; 417 if (res < size) { 418 // We succeeded or fatally failed 419 break; 420 } 421 // buffer wasn't big enough, try again 422 size *= 2; 423 if (size > MAXSIZE) { 424 break; 425 } 426 if (!str->reset(size)) 427 break; // ran out of memory - bye 428 } 429 430 return res; 431 } 432 433 int QXmlTestLogger::xmlQuote(QTestCharBuffer* str, char const* src) 434 { 435 return allocateStringFn(str, src, QXmlTestLogger::xmlQuote); 436 } 437 438 int QXmlTestLogger::xmlCdata(QTestCharBuffer* str, char const* src) 439 { 440 return allocateStringFn(str, src, QXmlTestLogger::xmlCdata); 262 441 } 263 442 -
branches/vendor/nokia/qt/current/src/testlib/qxmltestlogger_p.h
r2 r556 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtTest module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 80 80 const char *file = 0, int line = 0); 81 81 82 83 84 85 86 82 87 private: 83 88 XmlMode xmlmode; -
branches/vendor/nokia/qt/current/src/testlib/testlib.pro
r2 r556 1 TARGET = QtTest1 TARGET = QtTest 2 2 QPRO_PWD = $$PWD 3 QT = core3 QT = core 4 4 INCLUDEPATH += . 5 6 unix:!embedded { 7 QMAKE_PKGCONFIG_DESCRIPTION = Qt Unit Testing Library 8 QMAKE_PKGCONFIG_REQUIRES = QtCore 9 } 5 unix:!embedded:QMAKE_PKGCONFIG_DESCRIPTION = Qt \ 6 Unit \ 7 Testing \ 8 Library 10 9 11 10 # Input 12 HEADERS = qtest_global.h qtestcase.h qtestdata.h qtesteventloop.h 13 SOURCES = qtestcase.cpp qtestlog.cpp qtesttable.cpp qtestdata.cpp qtestresult.cpp qasciikey.cpp qplaintestlogger.cpp qxmltestlogger.cpp qsignaldumper.cpp qabstracttestlogger.cpp qbenchmark.cpp qbenchmarkmeasurement.cpp qbenchmarkvalgrind.cpp qbenchmarkevent.cpp 14 15 DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII QTESTLIB_MAKEDLL QT_NO_DATASTREAM 16 17 wince*:{ 18 LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib 19 } 20 21 mac { 22 LIBS += -framework IOKit -framework Security 23 } 24 11 HEADERS = qbenchmark.h \ 12 qsignalspy.h \ 13 qtestaccessible.h \ 14 qtestassert.h \ 15 qtestbasicstreamer.h \ 16 qtestcase.h \ 17 qtestcoreelement.h \ 18 qtestcorelist.h \ 19 qtestdata.h \ 20 qtestelementattribute.h \ 21 qtestelement.h \ 22 qtestevent.h \ 23 qtesteventloop.h \ 24 qtestfilelogger.h \ 25 qtest_global.h \ 26 qtest_gui.h \ 27 qtest.h \ 28 qtestkeyboard.h \ 29 qtestlightxmlstreamer.h \ 30 qtestmouse.h \ 31 qtestspontaneevent.h \ 32 qtestsystem.h \ 33 qtesttouch.h \ 34 qtestxmlstreamer.h \ 35 qtestxunitstreamer.h 36 SOURCES = qtestcase.cpp \ 37 qtestlog.cpp \ 38 qtesttable.cpp \ 39 qtestdata.cpp \ 40 qtestresult.cpp \ 41 qasciikey.cpp \ 42 qplaintestlogger.cpp \ 43 qxmltestlogger.cpp \ 44 qsignaldumper.cpp \ 45 qabstracttestlogger.cpp \ 46 qbenchmark.cpp \ 47 qbenchmarkmeasurement.cpp \ 48 qbenchmarkvalgrind.cpp \ 49 qbenchmarkevent.cpp \ 50 qtestelement.cpp \ 51 qtestelementattribute.cpp \ 52 qtestbasicstreamer.cpp \ 53 qtestxunitstreamer.cpp \ 54 qtestxmlstreamer.cpp \ 55 qtestlightxmlstreamer.cpp \ 56 qtestlogger.cpp \ 57 qtestfilelogger.cpp 58 DEFINES *= QT_NO_CAST_TO_ASCII \ 59 QT_NO_CAST_FROM_ASCII \ 60 QTESTLIB_MAKEDLL \ 61 QT_NO_DATASTREAM 62 embedded:QMAKE_CXXFLAGS += -fno-rtti 63 wince*::LIBS += libcmt.lib \ 64 corelibc.lib \ 65 ole32.lib \ 66 oleaut32.lib \ 67 uuid.lib \ 68 commctrl.lib \ 69 coredll.lib \ 70 winsock.lib 71 mac:LIBS += -framework IOKit \ 72 -framework ApplicationServices \ 73 -framework Security 25 74 include(../qbase.pri) 26 75 QMAKE_TARGET_PRODUCT = QTestLib 27 QMAKE_TARGET_DESCRIPTION = Qt Unit Testing Library 76 QMAKE_TARGET_DESCRIPTION = Qt \ 77 Unit \ 78 Testing \ 79 Library 80 symbian:TARGET.UID3=0x2001B2DF
Note:
See TracChangeset
for help on using the changeset viewer.
