summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcase.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QTestLib: allow for non-zero values in env variablesGiuseppe D'Angelo2020-12-041-2/+2
| | | | | | | | | | | The usual behavior for env variables is that any nonzero value means "enable", so do the same for a couple of QTestLib env vars. While at it: document them. Change-Id: I854285df5d7af5be771f9d6532ddec5d8a6f8987 Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 89def082c6db80e877e2a6a33db41b67f94cdf46) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QFileInfo: mark constructors as explicitGiuseppe D'Angelo2020-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | These look like leftovers (API flaws). Construction of QFileInfo from QString (or similar) should be not implicit, as QFileInfo construction is expensive (might hit the file system), and this may have users overlook APIs (for instance build a QFileInfo out of QDirIterator::next(), instead of using ::fileInfo(); using QDir::entryList instead of entryInfoList; etc.). Leave an opt-out mechanism to ease porting. Fix a handful of usages around qtbase, with at least a couple of them likely to be actual "sloppy" code. [ChangeLog][Potentially Source-Incompatible Changes][QFileInfo] Most QFileInfo constructors are now explicit. The QT_IMPLICIT_QFILEINFO_CONSTRUCTION macro is provided to keep old code working. Change-Id: Ic580e6316e67edbc840aa0c60d98c7aaabaf1af6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* testlib: Spit out crash backtraces to stderrTor Arne Vestbø2020-10-231-2/+2
| | | | | | | | Ensures that the backtrace is interleaved with the header and footer that we print ourselves. Change-Id: I728f4a05be31e345687cbb5fefe49f76dbe8ae36 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Rename QLibraryInfo::location() to path()Lars Knoll2020-09-121-1/+1
| | | | | | | | As per ### Qt6 comment. Also rename the LibraryLocation enum to LibraryPath. Change-Id: I556025a19c5bcdf2ff52598eaba32269522d4128 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Partially revert "Inline QTest::qSleep()"Lars Knoll2020-09-121-18/+0
| | | | | | | | | | | | | | | | | | This change partially reverts change a0e0b51001edfc1c7aea113c472ce995efa833fd. Replacing the QTest specific sleep function with QThread::msleep() was not a good idea. The reason is that QThread::msleep() will force the thread to sleep to x mseconds, even if a signal woke the thread in the meantime. This would cause qWaitFor() to not call processEvents(), in some cases, leading to flakyness and test failures in tests that rely on timing, such as the animation tests in Qt Qml. Change-Id: I0ad132cdf32be5813b2e73552d772251fe1d7f89 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Inline QTest::qSleep()Lars Knoll2020-09-061-6/+0
| | | | | | | Simply use QThread::msleep() to implement it. Change-Id: I37c255fc70951715edc489d9f67669b01af380b1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Deprecate the static int based API in QMetaTypeLars Knoll2020-08-241-2/+2
| | | | | | | | | | | | | And remove one of the type id to name mapping that still existed in QMetaType. QMetaTypeInterface can provide that, so there's no need to have a second copy of the data. qMetaTypeTypeInternal() can still map all the names of all builtin types to ids. That functionality is for now still required by moc and can't be removed yet. Change-Id: Ib4f8e9c71e1e7d99d52da9e44477c9a1f1805e57 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* testlib: Explicitly name watchdog timer threadTor Arne Vestbø2020-07-221-0/+1
| | | | | | | Simplifies debugging of issues where the watchdog thread is involved. Change-Id: I4862167bca4a942c7d4319a9374f1f83f292d831 Reviewed-by: Simon Hausmann <hausmann@gmail.com>
* testlib: Defer signal dumper start until tests are ready to runTor Arne Vestbø2020-07-221-3/+5
| | | | | | | | | | | | | | | We don't want the signal dumper to pick up signals that our own test machinery produces, such as the ones emitted from the watchdog thread startup and shutdown. This would otherwise produce: tst_Signaldumper::initTestCase() Signal: QThread(7fc969e0d870) started () At startup, and at shutdown even more confusingly: tst_Signaldumper::UnknownTestFunc() Signal: QThread(7fc969e0d870) finished () Change-Id: I9e81fa168eaa92551d38d5576973bbf95ac23364 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace use of deprecated Q_OS_MACX in favor of Q_OS_MACOSTor Arne Vestbø2020-07-081-1/+1
| | | | | Change-Id: I1059d56f67be28a4cc1a66b744e81df6d0b5d00d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use QList instead of QVector in qtbaseJarek Kobus2020-07-071-9/+9
| | | | | | | | Fixes all other QVector occurrences Task-number: QTBUG-84469 Change-Id: I5f9311298d341a9a3061a6a640539583d1618939 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Use QList instead of QVector in testlibJarek Kobus2020-06-251-4/+4
| | | | | | Task-number: QTBUG-84469 Change-Id: Icbc3c3130399296f6b5a7e9a313ad4737669de00 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Port testlib from QStringRef to QStringViewLars Knoll2020-06-111-1/+1
| | | | | | Task-number: QTBUG-84319 Change-Id: I780945c8923c0a03e9c0a32d039da0c793f650fd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove winrtOliver Wolff2020-06-061-11/+5
| | | | | | | | | Macros and the await helper function from qfunctions_winrt(_p).h are needed in other Qt modules which use UWP APIs on desktop windows. Task-number: QTBUG-84434 Change-Id: Ice09c11436ad151c17bdccd2c7defadd08c13925 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Never include windows.h directly in Qt codeLars Knoll2020-05-271-1/+1
| | | | | | | Please use qt_windows.h instead, so we avoid having min/max defined. Change-Id: Ic1b29666c427bf24556da5494af45ee5953ae827 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-05-041-6/+11
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/text/qlocale.cpp src/network/access/qnetworkaccessmanager.cpp Regenerated tests/auto/testlib/selftests/float/CMakeLists.txt Change-Id: I5a8ae42511380ca49a38b13c6fa8a3c5df8bed01
| * QCOMPARE: treat values as equal if qFuzzyIsNull(each)Edward Welbourne2020-04-301-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We hope this shall avoid some flaky failures noticed in quick tests, e.g. tst_QQuickMenu::Material::subMenuPosition(cascading,flip) was recently seen failing with 3.88e-11 != 0. This required some revision to test data in the testlib selftest for floats; the resulting expected output differs in details but not in which tests pass or fail. QEMU, naturally, made life difficult, requiring special-case code in the test-driver. [ChangeLog][QtTestLib][QCOMPARE] QCOMPARE() now treats its values as equal when qFuzzyIsNull() is true for both of them. Change-Id: Icc6ad5164b609937eddbe39cc69120f0abf0f3b4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-081-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/opengl/doc/src/cube.qdoc src/corelib/global/qlibraryinfo.cpp src/corelib/text/qbytearray_p.h src/corelib/text/qlocale_data_p.h src/corelib/time/qhijricalendar_data_p.h src/corelib/time/qjalalicalendar_data_p.h src/corelib/time/qromancalendar_data_p.h src/network/ssl/qsslcertificate.h src/widgets/doc/src/graphicsview.qdoc src/widgets/widgets/qcombobox.cpp src/widgets/widgets/qcombobox.h tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro tests/manual/diaglib/debugproxystyle.cpp tests/manual/diaglib/qwidgetdump.cpp tests/manual/diaglib/qwindowdump.cpp tests/manual/diaglib/textdump.cpp util/locale_database/cldr2qlocalexml.py util/locale_database/qlocalexml.py util/locale_database/qlocalexml2cpp.py Resolution of util/locale_database/ are based on: https://codereview.qt-project.org/c/qt/qtbase/+/294250 and src/corelib/{text,time}/*_data_p.h were then regenerated by running those scripts. Updated CMakeLists.txt in each of tests/auto/corelib/serialization/qcborstreamreader/ tests/auto/corelib/serialization/qcborvalue/ tests/auto/gui/kernel/ and generated new ones in each of tests/auto/gui/kernel/qaddpostroutine/ tests/auto/gui/kernel/qhighdpiscaling/ tests/libfuzzer/corelib/text/qregularexpression/optimize/ tests/libfuzzer/gui/painting/qcolorspace/fromiccprofile/ tests/libfuzzer/gui/text/qtextdocument/sethtml/ tests/libfuzzer/gui/text/qtextdocument/setmarkdown/ tests/libfuzzer/gui/text/qtextlayout/beginlayout/ by running util/cmake/pro2cmake.py on their changed .pro files. Changed target name in tests/auto/gui/kernel/qaction/qaction.pro tests/auto/gui/kernel/qaction/qactiongroup.pro tests/auto/gui/kernel/qshortcut/qshortcut.pro to ensure unique target names for CMake Changed tst_QComboBox::currentIndex to not test the currentIndexChanged(QString), as that one does not exist in Qt 6 anymore. Change-Id: I9a85705484855ae1dc874a81f49d27a50b0dcff7
| * macOS: Remove all use of deprecated Q_OS_OSX defineTor Arne Vestbø2020-04-031-1/+1
| | | | | | | | | | Change-Id: I49c285604694c93d37c9d1c7cd6d3b1509858319 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devLiang Qi2020-02-131-232/+209
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/widgets/graphicsview/boxes/scene.h src/corelib/Qt5CoreMacros.cmake src/corelib/Qt6CoreMacros.cmake src/network/ssl/qsslsocket.cpp src/network/ssl/qsslsocket.h src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp src/testlib/CMakeLists.txt src/testlib/.prev_CMakeLists.txt tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp Disabled building manual tests with CMake for now, because qmake doesn't do it, and it confuses people. Done-With: Alexandru Croitor <alexandru.croitor@qt.io> Done-With: Volker Hilsheimer <volker.hilsheimer@qt.io> Change-Id: I865ae347bd01f4e59f16d007b66d175a52f1f152
| * testlib: Be more selective in choosing to show stacktraces on macOSTor Arne Vestbø2020-02-061-14/+1
| | | | | | | | | | | | | | | | | | The built in crash reporter on macOS will by default not show the dialog if the application is not one that will run in the foreground. Change-Id: I0020520ae2f14a0e2f84fdca1d80ec6fe1247ffd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| * Maintain at least 500ms timestamp distance between each test functionJan Arve Sæther2020-02-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we had one test function that just did tst_Mouse::f1() { QTest::mouseMove(w, QPoint(0,0)); } and another test function that did tst_Mouse::f2() { QTest::mouseMove(w, QPoint(500,500)); } their corresponding event timestamps were only 1 apart from each other. This meant that any code that tried to estimate the velocity of a mouse cursor would get a really high velocity estimate inside f2(). This would come as a surprise to most people. So to avoid this, we add a 500 ms timestamp delay between each test function call. In theory this could also prevent generating a mouseDoubleClickEvent when a pair of test functions containing a press-release sequence was run, but there is a separate pre-existing mechanism to handle that case. Change-Id: Icd4fc35853c09f080466d22411208c7b5c4174b5 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| * Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-02-041-2/+2
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf examples/widgets/widgets/imageviewer/imageviewer.cpp src/corelib/text/qchar.cpp src/corelib/time/qdatetime.cpp Change-Id: I9762f5c4ff650799219729d6aee79ac07ce9024a
| | * Fix 'the the' typo in commentsLinus Jahn2020-02-021-2/+2
| | | | | | | | | | | | | | | Change-Id: I00fcb1c2374e7ca168b6240f9d41c0323fb0867c Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
| * | testlib: Clarify that our XUnit reporter is actually a JUnit reporterTor Arne Vestbø2020-02-031-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reporter was probably named 'xunit' based on the historical use of xUnit to refer to testing frameworks derived from Smalltalk's SUnit. These frameworks typically added their own prefix, e.g. JUnit for Java, RUnit for R, etc. The most popular of these was the JUnit framework, and the corresponding XML output produced by the Ant built tool became somewhat of a de facto standard, which is probably why we chose to model our reporter after it. Nowadays however, naming it 'xunit' is problematic as there is actually a testing famework named xUnit.net, typically shortened to, you guessed it: xunit. Test report consumers will typically have a junit mode, and an xunit mode, and the latter could easily be mistaken for what testlib outputs, unless we clarify this. The clarification also allows us to safely extend our support for the JUnit XML format to incorporate some elements that are nowadays common, but where we are lagging behind the standard. [ChangeLog][QTestLib] The formerly named 'xunitxml' test reporter has been renamed to what it actually is: a JUnit test reporter, and is now triggered by passing -o junitxml to the test binary. Change-Id: Ieb20d3d2b5905c74e55b98174948cc70870c0ef9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | testlib: Unite Windows and Unix signal handler codeTor Arne Vestbø2020-02-011-165/+165
| | | | | | | | | | | | | | | Change-Id: I7b9d480008167c071bf925d655eb97ef437bc206 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | testlib: Implement FatalSignalHandler inlineTor Arne Vestbø2020-02-011-87/+82
| | | | | | | | | | | | | | | Change-Id: Ie6f151cb099151616f83ea8d5e11e6625bedeb8c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | testlib: Properly cleanup after caught exceptionTor Arne Vestbø2020-02-011-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | We were only doing half of what qCleanup was doing in the exception case, and in an inconsistent order. There's no reason not to just call qCleanup to align the behavior. Change-Id: Ic4e63afb4733de5b01a79272cca8908fca3de762 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | testlib: Simplify macOS setup/teardown codeTor Arne Vestbø2020-02-011-21/+12
| | | | | | | | | | | | | | | Change-Id: If92845ccb044becee136c7791fdb3cfe3641b28d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | testlib: Fix indentationTor Arne Vestbø2020-02-011-14/+15
| | | | | | | | | | | | | | | Change-Id: I54bb2c3dda731e1fd6c7e909aa30a3cedb53612b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | testlib: Don't disable watchdog when the macOS crash reporter is enabledTor Arne Vestbø2020-02-011-8/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The debuggerPresent() function was used both to decide whether we should print our own stacktrace, and if we should start the watchdog timer, but checking for the macOS crash reporter only applies to the former usecase. The crash reporter check has now been split into a separate function, only used to decide whether we should print our own stacktrace or not. Change-Id: I282aa57a51c14b07d3cbd547b551b6bf81b61897 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Merge remote-tracking branch 'origin/dev' into wip/cmakeLeander Beernaert2019-11-191-2/+2
|\| | | | | | | | | | | Change-Id: Ifecc2d9db396d783124df8567553ba5f846f30bb
| * | 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/dev' into wip/cmakeAlexandru Croitor2019-10-141-29/+63
|\| | | | | | | | | | | Change-Id: I4a78428a8ea273b6960792e3b8043f816fa37fcf
| * | 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 branch 'wip/qt6' into wip/cmakeAlexandru Croitor2019-08-151-33/+105
|\| | | | | | | | | | | Change-Id: I50ac36b8803c296998149e98cc61e38687cdd14b
| * | QTestLib: Speed up QCOMPARE for QStringFriedemann Kleint2019-08-011-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-291-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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>
| * | QTestLib: Introduce nullptrFriedemann Kleint2019-07-111-22/+21
| | | | | | | | | | | | | | | | | | | | | | | | Apply Fixits by Qt Creator with some amendments. Task-number: QTBUG-69413 Change-Id: I620e40a277dc2b20b0ec26fc32577e66b0456bb3 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
| * | QTestLib: Speed up QCOMPARE for float, double, int, unsignedFriedemann Kleint2019-07-091-6/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Merge remote-tracking branch 'origin/wip/qt6' into wip/cmakeAlexandru Croitor2019-07-111-7/+7
|\| | | | | | | | | | | Change-Id: I715b1d743d5f11560e7b3fbeb8fd64a5e5ddb277
| * | 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>
| * | QTestLib: Replace typedef by 'using'Friedemann Kleint2019-06-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Apply Fixits by Qt Creator with some amendments. Task-number: QTBUG-69413 Change-Id: I366cca6e5755719e8241e76774af6be2b5312627 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * | Port from QAtomic::load() to loadRelaxed()Giuseppe D'Angelo2019-06-201-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Semi-automated, just needed ~20 manual fixes: $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)load\(\)/$1loadRelaxed\(\)/g' -i \{\} + $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)store\(/$1storeRelaxed\(/g' -i \{\} + It can be easily improved (e.g. for store check that there are no commas after the opening parens). The most common offender is QLibrary::load, and some code using std::atomic directly. Change-Id: I07c38a3c8ed32c924ef4999e85c7e45cf48f0f6c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | Fix qFindTestData with cmake and ninja generatorSimon Hausmann2019-06-041-3/+19
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order for test lib to locate the file requested via QFINDTESTDATA, it needs the build directory of the test (for example $builddir/tests/auto/foo/bar) and __FILE__ expanding to a path to the source relative to this build directory. With ninja, __FILE__ is a path that is always relative to the top-level build directory, not the per-test case one. Therefore the path resolution in testlib fails. To accommodate this, add_qt_test() now always sets QT_TESTCASE_BUILDDIR as well as the newly introduced QT_TESTCASE_SOURCEDIR, which, as an absolute path, removes the need to use __FILE__. Change-Id: I16c2b0001e38162e6da9fdb1a61f4f8ce634fe46 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>