summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcase.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Long live QVersionNumber!Keith Gardner2014-08-091-0/+7
| | | | | | | | | | | | The class provides compare operators, stream operators, and hashing functions. This class aims to be compatible with (but not restricted to) the Semantic Versioning 2.0 standard (semver.org). [ChangeLog][QtCore] Added QVersionNumber class Done-with: Marc Mutz <marc.mutz@kdab.com> Change-Id: I244c8ccc002909af03987a2df052734d1a8621a9 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Merge remote-tracking branch 'origin/5.3' into devFrederik Gladhorn2014-07-101-0/+7
|\ | | | | | | Change-Id: Ia12ffdb27ecdf25c2a2bdb0eed1945387502108a
| * Support getting test data from qrcEskil Abrahamsen Blomfeldt2014-07-081-0/+7
| | | | | | | | | | | | | | | | | | | | If none of the other locations work, we can fall back to bundling the test data in qrc to make it possible to include test data on platforms that do not have any good way of deploying files to the traditional file system, like Android. Change-Id: I7779ce6be2380d551697cecfb9f76652d1fd0a38 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* | Fix QtTestlib build under QT_NO_REGULAREXPRESSIONGiuseppe D'Angelo2014-05-151-0/+2
|/ | | | | Change-Id: I4458226e814641269062990f272a40ca577bc9db Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Limit the QString pretty outputs to 256 charactersThiago Macieira2014-05-091-1/+14
| | | | | Change-Id: I88e71e517827af7d82e3a47d88d40787051ed827 Reviewed-by: Sergio Ahumada <sahumada@blackberry.com>
* Remove warnings about sleep times from QTest::qSleep()Ulf Hermann2014-05-061-16/+0
| | | | | | | | | The collected data doesn't reveal any obvious correlation between sleep times and test failures but the many warnings are a hassle for anyone reading the test results. Change-Id: I71bd0c90c20c730573693f23f4435e538b635d44 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Increase tolerance for warning about QTest::qSleep() for Windows.Friedemann Kleint2014-04-041-1/+6
| | | | | | | 50% is too strict, it clutters the logs. Change-Id: Ib391064f32e39a1192e77d872cd99b7f95a5065a Reviewed-by: Ulf Hermann <ulf.hermann@digia.com>
* Doc: Fix warning about nonexistent 'message' parameterSergio Ahumada2014-03-251-2/+2
| | | | | Change-Id: I3461f2468ef90452ae7e3830625bf3ed57d22a41 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Warn if the time taken by QTest::qSleep() is more than 50% offUlf Hermann2014-03-171-0/+11
| | | | | | | | | Like this we can find out more easily if autotests fail because of flaky timing. Change-Id: I57b10f5fc4908bed7d00990641b2ddfd4ea84a11 Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtTest: Don't crash when -callgrind is used on QTEST_APPLESS_MAINThiago Macieira2014-02-241-0/+3
| | | | | | | | | | | | | If there's no qApp, then QCoreApplication::arguments() returns an empty list (after printing a warning). That means the callgrind runner can't get the arguments it needs in order to rerun the benchmark. The crash happens because it always uses .at(0) to try and get the executable's path. Even if we get the path from somewhere else, we still need the arguments. Change-Id: I5c74af4d96fc5824b2b7fd7a89648d78393016e2 Reviewed-by: Sergio Ahumada <sahumada@blackberry.com>
* Doc: Address some "No documentation for..." warnings in QTestJason McDonald2014-02-221-14/+205
| | | | | | Task-number: QTBUG-36985 Change-Id: I811b4711edc3420911fcd706ecef2d090f41bc89 Reviewed-by: Sergio Ahumada <sahumada@blackberry.com>
* Make the printing of complex Unicode in a QString prettierThiago Macieira2014-02-161-3/+63
| | | | | | | | | | | | | | | This also has the advantage of not requiring the use of the locale codec. Quite an advantage if you're debugging the locale codec. But it's mostly so that we don't get question marks that hide the difference we were trying to locate. [ChangeLog][QtTest] QtTest now prints an escaped version of QStrings that failed to compare with QCOMPARE. That is, instead of converting non-printable characters to question marks, QtTest will print the Unicode representation of the character in question. Change-Id: I44c1ef3246b188c913dacd3ca4df02581356ea41 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add a CSV logging feature to the benchlibThiago Macieira2014-02-141-1/+7
| | | | | | | | | | | | | | | This is only useful for logging benchmarks, since it won't print test passes, failures, etc. It's useful for importing to spreadsheets to do number-crunching. [ChangeLog][QtTest]Added a CSV logging mode that is suitable for importing benchmark results into spreadsheets. This can be enabled by the -csv option on the command-line. The CSV logging mode will not print test failures, debug messages, warnings, etc. Change-Id: I245d6f86bb380645c9bc0d748cf474b3ed42cab8 Reviewed-by: Sergio Ahumada <sahumada@blackberry.com> Reviewed-by: Jason McDonald <macadder1@gmail.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-11-261-5/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the conflicts in msvc_nmake.cpp the ifdefs are extended since we need to support windows phone in the target branch while it is not there in the current stable branch (as of Qt 5.2). Conflicts: configure qmake/generators/win32/msvc_nmake.cpp src/3rdparty/angle/src/libEGL/Surface.cpp src/angle/src/common/common.pri src/corelib/global/qglobal.h src/corelib/io/qstandardpaths.cpp src/plugins/platforms/qnx/qqnxintegration.cpp src/plugins/platforms/qnx/qqnxscreeneventhandler.h src/plugins/platforms/xcb/qglxintegration.h src/widgets/kernel/win.pri tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp tools/configure/configureapp.cpp Change-Id: I00b579eefebaf61d26ab9b00046d2b5bd5958812
| * Revert "QTest: use nth_element to calculate the median"Marc Mutz2013-11-041-5/+4
| | | | | | | | | | | | | | | | | | | | This reverts commit 48586b2bac623605e9f300f8e5380e4f4b484dab. This causes problems in QtCreator without anyone being able to say why. Task-number: QTBUG-34397 Change-Id: I9ea5457724d5af8d87e0bc40e6615748daf9c04c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Add QVERIFY_EXCEPTION_THROWN macro for testing exceptions using QtTestDmitry Ashkadov2013-11-261-0/+19
| | | | | | | | | | | | | | | | | | | | New macro QVERIFY_EXCEPTION_THROWN may be used to check that some code really throws an exception of specified type. Change-Id: I7cf499c7c37a35407862bc604c6eb862c5f329d3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jason McDonald <macadder1@gmail.com>
* | Add overload of QTest::ignoreMessage() taking a QRegularExpression.Friedemann Kleint2013-11-171-0/+21
| | | | | | | | | | | | | | Make it possible to match messages by a pattern. Change-Id: I713312e86db5471755459f1ecc43e8f1ac7a95fb Reviewed-by: Jason McDonald <macadder1@gmail.com>
* | Disable error message box on WinRTMaurice Kalinowski2013-11-081-1/+3
| | | | | | | | | | | | | | | | | | While exception handling methods are not available on WinRT, the debug mode ones are. This way we can suppress error dialogs from popping up like on desktop windows. Change-Id: Id6e9666af9274d373e7d46e3f9e44892a2bd0dbc Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* | Ignore debugger arguments on WinRTMaurice Kalinowski2013-11-011-0/+4
|/ | | | | | | | | Visual Studio debuggers send an argument to specify the debugger port. This argument needs to be skipped while parsing and not to be interpreted as an option or test function. Change-Id: I24efb52fbd668a7bc3388c876f5ea0d950de1d5b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-6/+6
| | | | | | | | | | | | | | | | | Default values should have mark-up to denote that they are code. This commit changes: -"property is true" to "property is \c true". -"Returns true" to "Returns \c true". -"property is false" to "property is \c false". -"returns true" to "returns \c true". -"returns false" to "returns \c false". src/3rdparty and non-documentation instances were ignored. Task-number: QTBUG-33360 Change-Id: Ie87eaa57af947caa1230602b61c5c46292a4cf4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Expose QTest::currentAppName() and remove hard-coded argv[0] in testsTor Arne Vestbø2013-09-261-2/+10
| | | | | | | | Except where we're actually testing QCoreApplication::applicationName() and friends. Change-Id: I25514884c11f43a4f82b1f818f822dc3d79f69a3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* QTest: microoptimisationMarc Mutz2013-09-211-1/+1
| | | | | Change-Id: Ifd053870c270a2c0a0a33c8201e40aaa9a9f9041 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* WinRT: Basic global supportAndrew Knight2013-09-201-5/+7
| | | | | | | | Various global changes, primarily preprocessor flow, to support the WinRT platform. Change-Id: I3fa9cf91d5fb24019362e88fcf205e31b4f810b5 Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* QTest: use nth_element to calculate the medianMarc Mutz2013-09-131-4/+5
| | | | | | | Sorting is O(NlogN) complexity, while nth_element is linear. Change-Id: Ic6596affe183494e87abe7bdaa7c9985f5b7cd58 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Remove qSort usages from QtTestlibGiuseppe D'Angelo2013-09-111-1/+2
| | | | | | | | QtAlgorithms is getting deprecated, see http://www.mail-archive.com/development@qt-project.org/msg01603.html Change-Id: I383d13f76eceae025daab5242f433f694c0149cd Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Testlib: Add a crash handler for Windows that prints a message.Friedemann Kleint2013-07-171-0/+13
| | | | | Change-Id: I4d6559fd1b21f9f259be6a5a160361e25ea0d217 Reviewed-by: Jason McDonald <macadder1@gmail.com>
* QTestlib: Re-enable Windows error dialog when -nocrashhandler is passed.Friedemann Kleint2013-07-151-13/+9
| | | | | | | | | The error dialog is sometimes desired when trying to attach a debugger. Use the -nocrashhandler option for it, which already exists on UNIX. Change-Id: I42c9311242cdeaa81a148af9bf61875e1bc6f32c Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Utilize the new Q_OS_MACX define.Jake Petroules2013-05-091-5/+5
| | | | | | | | | | All occurrences of `#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)` have been replaced with `#if defined(Q_OS_MACX)`. Change-Id: I5055d9bd1845136beb8ed1c79a8f0f2c0897751a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add minimumtotal option to improve accuracy of short-lived benchmarks.Mirko Boehm (AWS)2013-03-191-1/+29
| | | | | | | | | | | | | | | | | Short-lived benchmarks (benchmarks that complete in a very short period of measured time) are often more affected by jitter and warm-up effects than longer running benchmarks. Since QBENCHMARK stores the median result of all accepted benchmark runs, a larger number of aggregation runs is preferable for short-lived tests, but not necessarily for longer running ones. The minimumtotal option, specified in units of the selected measurement, will make the benchmark repeat a benchmark until the total measured cost exceeds the specified threshold. The displayed median result will then tend to be more accurate. This is especially useful for data-driven benchmarks in case the data tags scale the benchmarked operation from little to large cost. Change-Id: Ib857de64aaffc77715a0000d36f0245f31d86b9a Reviewed-by: Jason McDonald <macadder1@gmail.com>
* Add support for more performance counters in QBenchlibThiago Macieira2013-03-061-0/+12
| | | | | | | | | | | | | Added support for most hardware and software counters available on Linux 3.3. The cache-based counters are missing because they need special handling. Also added an option that lists available counters. Note that the list is of counters the library knows about, not the counters that the hardware can measure. Change-Id: I9f6fb09b5460bf4ac6082081611c1d6ff806a3fa Reviewed-by: Jason McDonald <macadder1@gmail.com>
* Implement the Linux Perf Counter backend for benchlibThiago Macieira2013-03-061-1/+2
| | | | | | | | | | | | | | | | Currently, we only support one event type: counting CPU cycles with hardware counters. There are no fallbacks if this hardware counter is not available, and there is currently no way to specify other counters. Benchlib only supports reporting one event per benchmark, even though the event counter interface allows specifying more than one. Still, the hardware usually has limitations on how many events it can monitor at a time, and we'd prefer to have the counter running at 100% of the time, so this will not change. Change-Id: I79858a3ad1e696dc4b7b72c420e5a04b67cd55de Reviewed-by: Jason McDonald <macadder1@gmail.com>
* Add the skeleton Linux perf events counter for QtTestThiago Macieira2013-03-061-0/+11
| | | | | | | | Currently, it only prints "perf available" if you use the -perf option and perf is available. The implementation comes in the next commits. Change-Id: Ic6cdee70e21df25780799a4bc31ca2c2d923b9f8 Reviewed-by: Jason McDonald <macadder1@gmail.com>
* iOS: Don't use IOKit in QTestLib, it's a private framework on iOSTor Arne Vestbø2013-02-271-5/+5
| | | | | Change-Id: I271a480b79c7768942911a28c84d6bb5a8d840d3 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-02-141-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/concurrent/doc/qtconcurrent.qdocconf src/corelib/doc/qtcore.qdocconf src/corelib/global/qglobal.h src/dbus/doc/qtdbus.qdocconf src/dbus/qdbusmessage.h src/gui/doc/qtgui.qdocconf src/gui/image/qimagereader.cpp src/network/doc/qtnetwork.qdocconf src/opengl/doc/qtopengl.qdocconf src/opengl/qgl.h src/plugins/platforms/windows/qwindowswindow.cpp src/printsupport/doc/qtprintsupport.qdocconf src/sql/doc/qtsql.qdocconf src/testlib/doc/qttestlib.qdocconf src/tools/qdoc/doc/config/qt-cpp-ignore.qdocconf src/widgets/doc/qtwidgets.qdocconf src/xml/doc/qtxml.qdocconf Change-Id: Ie9a1fa2cc44bec22a0b942e817a1095ca3414629
| * Doc: Fix references to Qt TestSze Howe Koh2013-01-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QtTestLib and QTestLib don't exist. The proper name is "QtTest" (code) or "Qt Test" (English) http://qt-project.org/wiki/Spelling_Module_Names_in_Qt_Documentation http://lists.qt-project.org/pipermail/interest/2012-December/005221.html Files paths in qttestlib.qdocconf can't be changed easily however, as it breaks things. So, they're left as they are. Change-Id: Ifbc44ea858c453bedad8cd7723f847e67fc7a85a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* | Allow QtTest's QCOMPARE to work with mixed q(u)int32 and q(u)int64Jon Severinsson2013-02-111-0/+24
| | | | | | | | | | | | | | | | | | | | Change-Id: I491edcae84c149775cf3640626ccff8cbf0d69fe Reviewed-by: Jon Severinsson <jon@severinsson.net> Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Jason McDonald <macadder1@gmail.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-01-221-1/+1
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsavefile_p.h src/corelib/tools/qregularexpression.cpp src/gui/util/qvalidator.cpp src/gui/util/qvalidator.h Change-Id: I58fdf0358bd86e2fad5d9ad0556f3d3f1f535825
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | | | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | QTestLib: improve output when comparing lists fails.David Faure2013-01-221-0/+4
|/ | | | | | | | | | | | | | | | | | | | Only QStringList was handled before, now any QList is handled. A specialization for QStringList is still needed though, due to the way template matching works. Example with QList<int>. Before: FAIL! : tst_QTextCodec::threadSafety() Compared values are not the same Loc: [../tst_qtextcodec.cpp(2057)] After: FAIL! : tst_QTextCodec::threadSafety() Compared lists differ at index 0. Actual (res2.toList()): '0' Expected (mibList): '3' Loc: [../tst_qtextcodec.cpp(2057)] Change-Id: If0fdec3236ddb78a679ee549aba569ef5571c395 Reviewed-by: Jason McDonald <macadder1@gmail.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Docs: Fix referencesChristian Stenger2012-12-131-2/+3
| | | | | Change-Id: I48173186afb874d307010f4f303d0e4f97ec0287 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Fix missing code snippet in QTest doc.Christian Strømme2012-11-301-1/+1
| | | | | Change-Id: I6fb1167634b0acddfa61b92d104d98ba8a1a15cb Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Merge branch 'newdocs'Eskil Abrahamsen Blomfeldt2012-11-201-5/+4
|\ | | | | | | | | | | | | | | | | | | | | Added prepare_docs to qt_build_config.prf (it was added directly in configure in the source branch) Conflicts: configure tools/configure/configureapp.cpp Change-Id: I1337c69fc62b1c934e3e39b4409e4857440c9db8
| * Merge branch 'master' of ssh://codereview.qt-project.org/qt/qtbase into newdocsJerome Pasion2012-11-021-6/+10
| |\ | | | | | | | | | Change-Id: I7e6cee190a341901dfbf8effb54ebccb91bf7a17
| * | Doc: add landing page for Qt TestLeena Miettinen2012-11-021-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Replace "QTestLib" with "Qt Test". Some style and language edits. Remove some empty headings. Change-Id: I568b4bbde981c3ef1899c830931892c16b66b4e2 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Jason McDonald <macadder1@gmail.com>
* | | Update mac-specific code in qtestlib for Qt5Liang Qi2012-11-021-13/+8
| |/ |/| | | | | | | | | | | | | | | | | | | | | 1. Remove the code for activate application, due to Qt 5 already has this feature 2. Update the code for power setting Task-number: QTBUG-23267 Change-Id: Id257c2e10e8e750a4b68cd2995c2ac4b70f8910c Reviewed-by: Jiang Jiang <gzjjgod@gmail.com> Reviewed-by: Liang Qi <liang.qi@digia.com>
* | List possible matches when specifying invalid test function.Friedemann Kleint2012-10-291-6/+10
|/ | | | | | | | List functions matching the command line parameter instead of dumping all functions. Change-Id: Ic504587b1036f09702f47579f90406333c4efbeb Reviewed-by: Caroline Chao <caroline.chao@digia.com>
* TestLib: Fix MinGW compile warningKai Koehne2012-09-281-1/+1
| | | | | | | | | MinGW-64 defines _CrtSetReportMode, but only as a noop, resulting in a warning "statement has no effect [-Wunused-value]" Change-Id: I6e509246134dd5929b23b07abdb6d705db603793 Reviewed-by: Jonathan Liu <net147@gmail.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* QTestLib: clean up qCompare specialisation/overload mixMarc Mutz2012-09-231-6/+4
| | | | | | | | | | | | | qCompare() was both overloaded and specialised, but always as a template. This lead to the QIcon specialisation actually invoking qCompare(QFlags<void*>, ...) when specifically asking for qCompare<void*>() (detected by adding underlying-type detection to QFlags). Fix by preferring overloading and not specialising anything. Change-Id: Ie001ebb9dfb0847c6c33a3f45177a61579fd61ee Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Fix QTest::qExec crash with no command line argumentsJeremy Lainé2012-09-081-1/+2
| | | | | | | | | | | | | | | The documentation for QTest::qExec states that command line arguments are optional and gives the following example: MyTestObject test1; QTest::qExec(&test1); However, running this example leads to crash as argv[0] is accessed without testing argc. This change fixes this bug. Change-Id: I2ec016e02869d21b24bc11f1851a760036640191 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jason McDonald <macadder1@gmail.com>