summaryrefslogtreecommitdiffstats
path: root/src/testlib
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.14' into 5.15Liang Qi2019-12-161-2/+2
|\ | | | | | | | | | | | | | | Conflicts: src/network/ssl/qsslsocket.cpp src/widgets/kernel/qapplication.cpp Change-Id: Ib7421cc2df59d0969f89b3fbd65a17ea76ffef3b
| * Doc: Fix qdoc compilation errors qtbaseNico Vertriest2019-12-121-2/+2
| | | | | | | | | | | | Task-number: QTBUG-79824 Change-Id: I6557de598de1931fc30556951d35783d02b83abe Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | Replace usages of QVariant::value by qvariant_castOlivier Goffart2019-12-151-1/+1
| | | | | | | | | | | | | | This is done automatically with a clazy check Change-Id: I3b59511d3d36d416c8eda74858ead611d327b116 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-12-121-1/+1
|\| | | | | | | Change-Id: I69238f23882deebeaad46e4fdcf899ab22cc2b8f
| * QTest::toString(QBitArray): fix Mismatched free() / delete / delete []Thiago Macieira2019-12-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ==8015== Mismatched free() / delete / delete [] ==8015== at 0x483958B: operator delete[](void*) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==8015== by 0x48752D6: QTestResult::compare(bool, char const*, char*, char*, char const*, char const*, char const*, int) (qtestresult.cpp:356) ==8015== Address 0x602eb30 is 0 bytes inside a block of size 12 alloc'd ==8015== at 0x483777F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==8015== by 0x44AAE2: char* QTest::toString<QBitArray>(QBitArray const&) (qtest.h:98) ==8015== by 0x44D212: bool QTest::qCompare<QBitArray>(QBitArray const&, QBitArray const&, char const*, char const*, char const*, int) (qtestcase.h:352) Change-Id: Ia2aa807ffa8a4c798425fffd15dabfebfd63fdbd Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Liang Qi2019-12-102-2/+55
|\| | | | | | | | | | | | | Conflicts: tests/auto/network/kernel/qnetworkinterface/BLACKLIST Change-Id: I1e8866c63b54bcd95fc2a044276ee15b7f60e79a
| * Doc: Update info about building testsLeena Miettinen2019-12-062-2/+55
| | | | | | | | | | | | | | Task-number: QTBUG-63987 Change-Id: I4b6e8f35afc9d3ca10b393a0305bbb51bf81ec26 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-11-086-50/+749
|\| | | | | | | Change-Id: I963b5f48b5d6f3500ca379fbd7f1a4290b570175
| * Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-11-066-50/+749
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf mkspecs/features/mac/default_post.prf src/corelib/tools/qsimd_p.h src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm util/qfloat16-tables/gen_qfloat16_tables.cpp Change-Id: If48fa8a3bc3c983706b609a6d3822cb67c1352a4
| | * Doc: Add guidelines for writing Qt testsLeena Miettinen2019-11-013-6/+556
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on https://wiki.qt.io/Writing_Unit_Tests. Some of the guidelines will be added to the documentation of a particular class, function, or macro. Task-number: QTBUG-18368 Task-number: QTBUG-63987 Change-Id: Ied267edc71e370a07f5124ba05432799f595dda6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| | * Doc: Add best-practice-info for using QVERIFY() and QCOMPARE()Leena Miettinen2019-11-012-28/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | From https://wiki.qt.io/Writing_Unit_Tests Task-number: QTBUG-63987 Change-Id: I7229ac0712d1207c0c9ebdac868c33bb35dcb0f0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
| | * Doc: Update info about QSKIP()Leena Miettinen2019-10-311-15/+44
| | | | | | | | | | | | | | | | | | | | | | | | Add a section about using QEXPECT_FAIL() to skip known bugs. Change-Id: Icf258b6e20add3b68d62e404fd9ac0db70420bf2 From: https://wiki.qt.io/Writing_Unit_Tests Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| | * Doc: Add best-practices-info about creating benchmarksLeena Miettinen2019-10-301-1/+26
| | | | | | | | | | | | | | | | | | | | | From https://wiki.qt.io/Writing_Unit_Tests Change-Id: Idc0bafb32690f443e1f49cd4f8efb653d3aa46a4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| | * Doc: Add best-practices-info about initialization and clean-upLeena Miettinen2019-10-301-0/+14
| | | | | | | | | | | | | | | | | | | | | From https://wiki.qt.io/Writing_Unit_Tests Change-Id: I20027066640ca797a2330f6daa81468f03921a69 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-301-2/+2
|\| | | | | | | | | | | Change-Id: Ib4df563fc7b1f7c40f425e0e71180d9517a672be
| * | QTestLib: basic WebAssembly supportMorten Johan Sørvig2019-10-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Disable the crash signal handler. This makes it possible to run auto-tests in the browser. Long-running tests may cause the browser to interrupt or display the “a web page is slowing down your computer” message, or not produce any console output while the test is running. Change-Id: Ifd53b744bd3652abfb466b78992ce2371eca2536 Task-number: QTBUG-68504 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* | | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-254-29/+127
|\| | | | | | | | | | | Change-Id: Iebedaa967a263854f18cd403ce007d7965f26d2b
| * | Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-10-244-29/+127
| |\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qstandardpaths_unix.cpp src/corelib/tools/qsharedpointer_impl.h tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp Change-Id: Iae95c5778dc091058f16f6db76f04a0178a9e809
| | * Doc: Replace \b {Note:} with \noteLeena Miettinen2019-10-212-15/+13
| | | | | | | | | | | | | | | Change-Id: I1f6947acec4494c151317e1faf79720dad0da6bb Reviewed-by: Martin Smith <martin.smith@qt.io>
| | * Doc: Describe using QVERIFY to verify validity of QSignalSpyLeena Miettinen2019-10-141-2/+14
| | | | | | | | | | | | | | | | | | | | | From https://wiki.qt.io/Writing_Unit_Tests Change-Id: I3186efe30cde465766800aee1f0a530fb80907fb Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| | * Doc: Describe initTestCase_data() function and QFETCH_GLOBAL macroLeena Miettinen2019-10-113-12/+100
| | | | | | | | | | | | | | | | | | Fixes: QTBUG-24342 Change-Id: I8f8f3726c5d31e34af9bfe054572c08fc07e01e0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-011-2/+5
|\| | | | | | | | | | | Change-Id: I77ba01f09b3dbcaf13cb265a70d9da661c32a61f
| * | Merge remote-tracking branch 'origin/5.13' into 5.14Liang Qi2019-09-301-2/+5
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qrandom.cpp src/corelib/io/qfileinfo.cpp src/corelib/kernel/qeventdispatcher_win.cpp src/corelib/kernel/qeventdispatcher_win_p.h src/gui/text/qfontdatabase.cpp src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm src/plugins/platforms/windows/qwindowsglcontext.cpp src/testlib/qtestcase.cpp Done-With: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Done-With: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I4893212471aa24be804c989a581810e2f714545c
| | * Do not pass nullptr as '%s'Allan Sandfeld Jensen2019-09-231-2/+5
| | | | | | | | | | | | | | | | | | | | | Fixes GCC 9 warning. Change-Id: I2a21d863267b444a29697aa026c21b47e3ac8382 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | Short live QtPrivate::{condition_variable,mutex}!Marc Mutz2019-09-271-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a temporary measure to work around an implementation bug on Integrity: For all other platforms, QtPrivate::condition_variable is just std::condition_variable. On Integrity, it's a class that wraps QWaitCondition to provide the interface of std::condition_variable. This allows the use of std::condition_variable across Qt without running into the Integrity issue. Once we can depend on an more modern Integrity toolchain, removing QtPrivate::condition_variable is a simple mechanical change: s/QtPrivate::condition_variable/std::condition_variable/g; s/QtPrivate::mutex/std::mutex/g; Task-number: QTBUG-78450 Change-Id: I293a99d1cdc48691817b926aa51ecd84556e5e90 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | QTestLib: modernize and stream-line WatchDogMarc Mutz2019-09-171-27/+57
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... by porting from (QWaitCondition,QMutex) to std::{condition_variable, mutex} and making the code more accessible by introducing explicit states. This patch was originally starting out to just replace QWaitCondition with std::condition_variable, which is faster and more compact, and the patch still does that, too. The focus, however, has shifted towards improving the accessibility of the code, in particular its states and the transitions between them. Due to the way QWaitCondition prevents spurious wakeups, this code could use its QWaitCondition as a semaphore, e.g. where it was calling wait() in the ctor to be released only when the thread it started has entered run(). That makes the code unnecessarily hard to follow. Fix by introducing an enum Expectation which tells what the watch-dog is currently waiting for, and unmistakably determines the state the watch-dog is in: ThreadStart, TestFunctionStart, ... The timeout value is now selected based on the Expectation value, so the timeout is no longer serving as the implicit state, either. Also port the defaultTimeout() function to return a std::chrono::milliseconds directly. Elsewhere in Qt, we guard against lack of <chrono>, so this unguarded use will also serve as a guide to see whether all supported platforms now, eight Qt releases after we formally require C++11 for Qt usage, provide it. Without <chrono>, there's no timed waiting in the standard library. Change-Id: If97b601c4090a2a2926fa58c903cfe3ec2656324 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-08-161-1/+1
|\| | | | | | | Change-Id: Ia3645f92b9debf3e1fe2d972300c7d0dbd649268
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-08-151-1/+1
| |\ | | | | | | | | | Change-Id: Id7954ada1f8658d3b1da5e8241a09f2d201a7c56
| | * Bound the scope of QTRY_LOOP_IMPL()'s local variableEdward Welbourne2019-08-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QTRY_IMPL() exercises QTRY_LOOP_IMPL() twice, once directly, the second time via QTRY_TIMEOUT_DEBUG_IMPL(); and QTRY_LOOP_IMPL() deliberately doesn't bound its scope (e.g. with the canonical do{...}while(0) trick) so that the latter can access its local variable. Unfortunately, this means the local's declaration in the second use of QTRY_LOOP_IMPL() shadows the first. So enclose the first in braces to bound the scope. Fixes: QTBUG-77297 Change-Id: I849bfe0b8abfb517ed3e783abf86c602163db137 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | QTestLib: Introduce initMain() to run in main before qApp existsFriedemann Kleint2019-08-132-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running Qt autotests on a developer machine with a high resolution, failures occur due to either some widget becoming too small, some rounding fuzz appearing when Qt High DPI scaling is active, or some test taking screenshots failing to deal with device pixel ratios != 1 in the obtained pixmaps. It is not feasible to adapt all tests to pass on high resolution monitors in both modes (Qt High DPI scaling enabled/disabled). It should be possible to specify the High DPI setting per test. Previously, it was not possible to set the Qt High DPI scaling attributes since they must be applied before QApplication instantiation. Enable this by checking for the presence of a static void initMain() function on the test object and invoking it before QApplication instantiation. Prototypically use it in tst_qtimer and to turn off High DPI scaling for tst_QGL. [ChangeLog][QtTestLib] It is now possible to perform static initialization before QApplication instantiation by implementing a initMain() function in the test class. Change-Id: Idec0134b189710a14c41a451fa8445bc0c5b1cf3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Introduce QSignalSpy constructor allows to spy on a meta methodVitaly Fanaskov2019-08-133-0/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | This functionality is especially convenient if meta-object system is heavily used in a test. For example, if you need to test a bunch of signals based on their names and/or argument types. Change-Id: I09a4ecbbd3d0859b5fd466d9dde7679804eb7614 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | | QSignalSpy: Extract object validation to a separate methodVitaly Fanaskov2019-08-131-6/+12
| | | | | | | | | | | | | | | Change-Id: I167a01257cfdb679cb81861bfae26d8fa40f8c27 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | | QSignalSpy: Extract meta signal validation to the separate methodVitaly Fanaskov2019-08-131-5/+12
| | | | | | | | | | | | | | | Change-Id: I37a74ea4487a437646815d3117ec8b0fd7073205 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | | QSignalSpy: Extract connection functionality into a separate methodVitaly Fanaskov2019-08-131-10/+16
| | | | | | | | | | | | | | | Change-Id: Ie6406c79b070cba715250711578cd3d80c089559 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | | QTest: add toString(QBitArray)Thiago Macieira2019-08-051-0/+11
| | | | | | | | | | | | | | | Change-Id: Ife213d861bb14c1787e1fffd15b70598cda8baf3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | QTestLib: Speed up QCOMPARE for QStringFriedemann Kleint2019-08-014-0/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add overloads for qCompare() for QStringView making use of the fast formatting helper introduced by 94aa350621e8a5c4ad3b438c10fc1c0a9ed3bc8a for int. Speeds up the bug report example by a factor of 3..4. Task-number: QTBUG-38890 Change-Id: Icc706618b2f1d23b37d354a04d4e1d1cc4b5aee3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | QTestLib: Fix various clang warningsFriedemann Kleint2019-07-298-36/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Fix else after return/break - Fix use of int as boolean literal - Use range-based for in some cases - Avoid copies by using const-ref - Remove unnecessary null-check before delete Task-number: QTBUG-69413 Change-Id: I69f46e6deaa55ef70a8b3a61e6539c79a64aaa23 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Port from QStringViewLiteral to u""Marc Mutz2019-07-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Now that all our supported compilers know char16_t, we no longer need QStringViewLiteral, whose only purpose in life was to turn u"" into L"" for MSVC < 2015. Change-Id: I25a094fe7992d9d5dbeb4a524d9e99e043dcb8ce Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | | QTestLib: Fix class declarations/structureFriedemann Kleint2019-07-1110-34/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove virtual from functions declared as override - Use " = default" for trivial constructors/destructors - Remove all special functions from QTestLog Apply Fixits by Qt Creator with some amendments. Task-number: QTBUG-69413 Change-Id: I812b8116e5b4c927e4e5cee44e63bc705385d866 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | | QTestLib: Introduce nullptrFriedemann Kleint2019-07-1112-62/+59
| | | | | | | | | | | | | | | | | | | | | | | | Apply Fixits by Qt Creator with some amendments. Task-number: QTBUG-69413 Change-Id: I620e40a277dc2b20b0ec26fc32577e66b0456bb3 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | | QTestLib: Use member initializationFriedemann Kleint2019-07-1118-94/+54
| | | | | | | | | | | | | | | | | | | | | | | | Apply Fixits by Qt Creator with some amendments. Task-number: QTBUG-69413 Change-Id: Iba0834dc89cbfc215acc5873f31fa6eeed74177d Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* | | Fix testlib build without features.propertiesTasuku Suzuki2019-07-101-0/+2
| | | | | | | | | | | | | | | | | | Change-Id: I3ca7f8cdb59a9a1e61d2702e92cd5e2d1420ac84 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Jason McDonald <macadder1@gmail.com>
* | | QTestLib: Speed up QCOMPARE for float, double, int, unsignedFriedemann Kleint2019-07-094-22/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Factor out a helper template formatting the QCOMPARE failure message delaying the formatting of the parameters with toString() and use that for float, double, int and unsigned. This removes the need to always format and allocate strings for the operands even in the success case, speeding up the QColor test from 3.3s to 700ms (Windows/release). Task-number: QTBUG-38890 Change-Id: I999484765bdaed921d3fc35f35a9fbbcd82a9704 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | QTestlib: Check compared images for device pixel ratioFriedemann Kleint2019-07-091-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When accidentally running a test doing screen-grabbing with High DPI scaling active, sizes of the obtained pixmaps can differ due to the device pixel ratio. Add a check to make that clearer. [ChangeLog][QtTestLib] Comparison of QImage, QPixmap now checks for the device pixel ratio. Change-Id: Id8d5187e99c565c44a7bfb8b9cfb09737815fb15 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Fix build without features.itemmodelTasuku Suzuki2019-07-061-0/+4
| | | | | | | | | | | | | | | | | | Change-Id: I1235bed395a47438bc18571e2331a3432e274dec Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | | Fix qFindTestData() to work with relative resource pathsJan Arve Sæther2019-07-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the resource path 'base' was relative it would enter condition 3) in qFindTestData() and it would actually find the nonsensical "://data" as a viable candidate. We don't want to enter that case, but rather enter the subsequent ('Try resources') case Change-Id: I1928ba02c941e23fee4fec9052a1981e46fa59b7 Task-number: QTBUG-73512 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | | Testlib: Reset the global benchmark data only if it matchesUlf Hermann2019-07-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | You can create multiple instances of QBenchmarkGlobalData as the ctor is public. The qmltest plugin does create a static one, but only conditionally assigns it to the singleton pointer. On shutdown the plugin is removed and the QBenchmarkGlobalData::current should only be reset by the dtor if it's actually pointing to the same object. Change-Id: I616c1ccf6f7a00abf1de342094da88481510bc7b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | QTestLib: Replace typedef by 'using'Friedemann Kleint2019-06-294-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Apply Fixits by Qt Creator with some amendments. Task-number: QTBUG-69413 Change-Id: I366cca6e5755719e8241e76774af6be2b5312627 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-06-272-1/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/network/ssl/qsslsocket_openssl.cpp Done-With: Timur Pocheptsov <timur.pocheptsov@qt.io> Change-Id: Ibb57a0548b4977797b400637487a56245ac1c024
| * | Add keyword msvc-2019 to testlib blacklistingHeikki Halmet2019-06-251-1/+3
| | | | | | | | | | | | | | | | | | Change-Id: Ibb1d225909e6c0c8b35f3b41aeb619784012d43b Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>