summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Cleanup tests that add test data to resources explicitlyAlexey Edelev2022-02-1119-591/+24
| | | | | | | | | | | | Remove Integrity and Android specific code that explicitly adds test data to the resource files. qt_internal_add_test functions implicitly adds test data to resources for Android and Integrity platforms by default. Change-Id: Ia1d58755b47442e1953462e38606f70fec262368 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Add BUILTIN_TESTDATA option to qt_internal_add_testAlexey Edelev2022-02-1121-312/+176
| | | | | | | | | | | Multiple tests use qt_internal_add_resource that copies the functionality that is already implemented inside the qt_internal_add_test function. Simplify these test by replacing the qt_internal_add_resource call with the new BUILTIN_TESTDATA option. Change-Id: I18475b817d6f87264f0de53817d6c26c5ccab4e2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QMdiSubwindow: respect minimum size of subwidgets when shown maximizedChristian Ehrlicher2022-02-111-0/+32
| | | | | | | | | | Size a QMdiSubWindow is no real toplevel widget, QLayout::activate() did not properly set the minimum size based on it's children. Fix this by treating a QMdiSubWindow as a toplevel widget during the calculation. Fixes: QTBUG-100494 Change-Id: Ia2e6c519c7214c36383facd244711bd932231d40 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QPlainTextEdit: fix the visibility of placeholderTextQiang Li2022-02-111-0/+105
| | | | | | | | | | | If one calls setPlainText("") before setting a placeholder text, the placeholder visibility is not updated, and the placeholder is not visible. Fix it by updating placeholderVisible properly. Fixes: QTBUG-96212 Pick-to: 5.15 6.2 6.3 Change-Id: I1bd3f0cb4c59973a847bcf3787e35d7c17b6d673 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use function-style casts in preference to C-style onesEdward Welbourne2022-02-101-61/+60
| | | | | | | | | In one case, cast an int to qsizetype rather than the other way round, in order to compare them. Change-Id: Id8dffe61f9565040f1a5ee24867956397f814a55 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Convert some if/else-if/else chains into switch()esEdward Welbourne2022-02-101-99/+146
| | | | | | | | | | | | | | | | Some of the else if lines exceeded 100 characters, so should have been split; and some lines already were split. So each whole chain should have had braces on its bodies. Instead make it a switch, as this makes it more evident what's going on in any case. Furthermore, as each branch did the same thing with dbType-specific strings, change to just setting QLatin1String variables, so that the rest of the code needn't be duplicated in each branch; it can simply be done once after the switch, using the string's .arg() to embed fragments. In the process break up the SQL query strings more gracefully, purge spaces just inside C++ parentheses. Change-Id: Ie26166e098ad74720bb6d7c4d9fe47718c33a13c Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Convert some QVERIFY2() with useless messages to QVERIFY()Edward Welbourne2022-02-101-8/+5
| | | | | | | | | | | | | | | Telling us the condition tested should have been true is what QVERIFY() does anyway, so don't go to the whole trouble of saying the same thing - and wrapping it in in a QString() merely in order to then qPrintable() it back out again, pointlessly converting a C-string to unicode and back again. At the same time, skip one other qPrintable(QString("...")) without .arg() formatting; and change the check it's the message for to use QL1S::arg() instead of QString::arg(). Change-Id: Ie71a79da8017916d301a38b69fc422e55a5a3649 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Suppress, and thus verify we do get, two warnings in tst_QSqlQueryEdward Welbourne2022-02-101-0/+5
| | | | | | | | Expected warnings are clutter for anyone reding the output, so suppress them when they're correct behavior. Change-Id: Idf47ba4fab8069237067d9b20afef3041e0c2f8c Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Use qScopeGuard() to take care of post-test tidy-upEdward Welbourne2022-02-101-22/+27
| | | | | | | | | | | | | | Doing the tidy-up after the last check has the problem that it gets skipped if any check fails, as the premature return skips the tidy-up. In the process, added the missing tidy-up to prematureExec(). Repackage the code for one tidy-up as a named lambda so that the duplicate can share it with the scope guard. Made some existing scope guards const, while I was about it, so that the one that isn't - because it gets dismiss()ed - stand out. Change-Id: I96d6834d5d7675f15018169a7093b0211db6f8a9 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Activate tst_QTimeLine on AndroidAndreas Buhr2022-02-101-4/+1
| | | | | | | Fixes: QTBUG-88137 Change-Id: I2b66eefd7733198664eaeecf9507daabb3a04e81 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* tst_qrhi: use OpenGL instead of raster pipeline on webOSJanne Juntunen2022-02-101-0/+3
| | | | | | | | | | Raster pipeline is not supported on webOS OSE: trying to use it causes an exit(1). Fixes: QTBUG-100654 Pick-to: 6.3 Change-Id: I00325fc1330a2d0d4abfdee054343ecfac767309 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* qtextstream.h: streamline includesFabian Kosmale2022-02-101-0/+1
| | | | | | | | | | | [ChangeLog][Potentially Source-Incompatible Changes] The qtextstream header no longer includes <QString>, <QStringEncoder> and <QStringDecoder>. Code which relied on the implicit inclusion of those classes might now need to include the headers explicitly. Task-number: QTBUG-97601 Change-Id: Ifb8c8452026195a772c0588dbbbc53fb51cac548 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use 'copy' but not 'copy_if_different' on Windows platformsAlexey Edelev2022-02-102-0/+134
| | | | | | | | | | | | | | Use custom script to copy big Android artifacts on Windows platforms. The script uses 'copy' but not 'copy_if_different' when source file size is bigger than 2GB. 'cmake -E copy_if_different' only compares first 2GB of files because of cmake issue, so this step only workaround the problem. Pick-to: 6.2 6.3 Task-number: QTBUG-99491 Change-Id: Id076734700e334dfc3330da412462c2b53829b33 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QAbstractSocket: Don't pretend pause and resume is a stackMårten Nordheim2022-02-091-2/+0
| | | | | | | | | | | | | | | | It only stores one layer of state, and pausing twice in a row will just overwrite the previous state. This doesn't happen often but can happen, especially on Windows if a certificate needs to be looked up in the system certificate stores (socket gets paused) and then a recoverable error occurs in QNAM (socket gets paused again). Fixes: QTBUG-100362 Fixes: QTBUG-63196 Fixes: QTBUG-98476 Pick-to: 6.3 6.2 5.15 Change-Id: Ie524c48e11b6fa8010b78cc1bf3931efe2ce3351 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Get rid of empty optional methods in tst_QSqlQueryEdward Welbourne2022-02-091-10/+0
| | | | | | | | | | No need for a virtual do-nothing destructor in a class that isn't inherited from. Defining an empty init merely makes QTest go to the trouble of calling it, which it could just as well skip. Change-Id: Ifd44c473c05fdeaaa7923d2ccdd0a13c8921b6bd Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Fix an inaccurate comment and update a test caseEdward Welbourne2022-02-091-2/+2
| | | | | | | | | | | | | The offset fields for tst_QTimeZone::specificTransition() had a comment claiming they are in minutes; they are in fact in seconds, so fix that. At the same time, Moscow hasn't had a time-zone change since 2017, so the end-date for one of the test intervals can be nudged a little closer to the present without harm. Change-Id: I66822cb758f7e00d6added801466a6745be3e31a Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QProcess/Unix: ensure we don't accidentally execute something from CWDThiago Macieira2022-02-092-3/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unless "." (or the empty string) is in $PATH, we're not supposed to find executables in the current directory. This is how the Unix shells behave and we match their behavior. It's also the behavior Qt had prior to 5.9 (commit 28666d167aa8e602c0bea25ebc4d51b55005db13). On Windows, searching the current directory is the norm, so we keep that behavior. This commit does not add an explicit check for an empty return from QStandardPaths::findExecutable(). Instead, we allow that empty string to go all the way to execve(2), which will fail with ENOENT. We could catch it early, before fork(2), but why add code for the error case? See https://kde.org/info/security/advisory-20220131-1.txt [ChangeLog][Important Behavior Changes] When passed a simple program name with no slashes, QProcess on Unix systems will now only search the current directory if "." is one of the entries in the PATH environment variable. This bug fix restores the behavior QProcess had before Qt 5.9. If launching an executable in the directory set by setWorkingDirectory() or inherited from the parent is intended, pass a program name starting with "./". For more information and best practices about finding an executable, see QProcess' documentation. Pick-to: 5.15 6.2 6.3 Change-Id: I54f205f6b7314351b078fffd16cf7013c97ee9fb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix C++20 ambiguous relational operators between QJsonValue{,Ref}Marc Mutz2022-02-091-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In C++20, any given relational operator is also considered in its reversed form, so e.g. given op==(X, Y) and X x, Y y, then y == x will compile, by using the reversed op(X, Y) This, unfortunately, makes some existing asymmetric operator overload sets ambiguous, and instead of applying tie-breaker rules, at least Clang is warning about these. For us, this means we need to make our overload set non-ambiguous. The QJsonValue{,Ref} classes failed this, because they only provide the following member-operators: - QJsonValue::op==(const QJsonValue&) const - QJsonValueRef::op==(const QJsonValue &) const For member functions, there are no implicit conversions on the LHS. So in C++17, we have a nice dichotomous overload set: - LHS is QJsonValue -> use QJsonValue::op==(QJsonValue) - LHS is QJsonValueRef -> use QJsonValueRef::op==(QJsonValue) In both of these, it the RHS is a QJsonValueRef, it's implicitly converted to QJsonValue for the call. Enter C++20, and the reversed signatures are suddenly available, too, which is a problem for QJsonValueRef <> QJsonValueRef, which could be resolved, as in C++17, using lhs.QJVR::op==(QJV(rhs)) or it could now be rhs.QJVR::op==(QJV(lhs)); // reversed Says Clang 10: tst_qtjson.cpp:990:5: warning: ISO C++20 considers use of overloaded operator '==' (with operand types 'QJsonValueRef' and 'QJsonValueRef') to be ambiguous despite there being a unique best viable function [-Wambiguous-reversed-operator] CHECK(r0, a0, r1); ^ ~~ ~~ qjsonvalue.h:189:17: note: ambiguity is between a regular call to this operator and a call with the argument order reversed inline bool operator==(const QJsonValue &other) const { return toValue() == other; } ^ A similar argument makes op!= ambiguous. Says Clang 10: tst_qtjson.cpp:988:5: error: use of overloaded operator '!=' is ambiguous (with operand types 'QJsonValueRef' and 'QJsonValueRef') CHECK(r0, r0, r1); ^ ~~ ~~ qjsonvalue.h:190:17: note: candidate function inline bool operator!=(const QJsonValue &other) const { return toValue() != other; } ^ qjsonvalue.h:189:17: note: candidate function inline bool operator==(const QJsonValue &other) const { return toValue() == other; } ^ qjsonvalue.h:189:17: note: candidate function (with reversed parameter order) To fix, provide the missing operators as free inline functions (so Qt 6.2 and 5.15 don't get new symbols added) so there's always exactly one best match. This is a fix for 6.2 and 5.15. At the time of writing, 6.3 isn't released, yet, so there, we could QT_REMOVED_SINCE the pre-existing member operators in favor of hidden friends (as per QTBUG-87973). Use C++17'isms to prevent an automatic merge to 5.15, which requires contains(QT_CONFIG,c++2a):CONFIG += c++2a added to tst_qtjson.pro. [ChangeLog][QtCore][QJsonValue] Fixed relational operators to not cause warnings/ambiguities when compiling in C++20. Pick-to: 6.3 6.2 5.15 Change-Id: Ic70f3cad9987c87f7346d426c29cc2079d85ad13 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* macOS: Prevent recursion when modifying the edit menuVolker Hilsheimer2022-02-091-0/+29
| | | | | | | | | | | | | Amends d42cfeb84faf154b46f2811b2059946b396fcc12, which would result in infinite recursion when the Edit menu was populated and added to the menubar after the menubar has been shown. Add a macOS-only test case that reproduces the crash without the fix. Fixes: QTBUG-100441 Pick-to: 6.3 Change-Id: I018a7aa7f01558a3b9732b4d6d96a911dc7fbd19 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add lineedit and QAbstractItemView widgets in tst_baseline_widgetsAxel Spoerl2022-02-091-0/+350
| | | | | | | | | | Add baseline tests for QListView, QTableView, QTreeView Add const to reflect number of available standard icons Add baseline test for QLineEdit Task-number: QTBUG-99677 Change-Id: I1abaae7f90c9b05c3b3467dc85c5652bc9d0f53b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_QContainerApiSymmetry: fix incorrect P1115 detectionAllan Sandfeld Jensen2022-02-091-1/+1
| | | | | | | | | | | | | The value of __cplusplus has nothing to do with whether the library implements wg21.link/P1115 (libstdc++ even before C++20) or not (libc++, even in C++20). Use the idiomatic check (#if defined(foo) && foo >= x) instead, fixing the Android build. Pick-to: 6.3 6.2 Change-Id: I11bcefe455a1f13865c15d4beecbd3fe32115328 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Add missing implicit dependencies to the tool testsAlexey Edelev2022-02-094-11/+34
| | | | | | | | | | | | | moc, qmake, rcc, and uic tests execute corresponding tools inside the test executables. This adds dependencies explicitly, to execute tests using _check targets, without the need to manually build dependencies. Pick-to: 6.3 6.2 Fixes: QTBUG-98576 Change-Id: I8b989276e21199b867591f7b0f6af9204695ac13 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Exclude tst_qmake if the build of qmake tool is disabledAlexey Edelev2022-02-091-1/+3
| | | | | | Pick-to: 6.2 6.3 Change-Id: I5aadf5250c19d8a8b26c4a890350ff3bf79e31c7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QNetworkInformation: Rename parameter-less load() to loadDefaultBackendMårten Nordheim2022-02-092-2/+2
| | | | | | | | | | To clarify its purpose and separate it from the others Pick-to: 6.3 Change-Id: Id9efcf474ac0cd8777393380bb85c83780454005 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Handle situation when device running test does not have enough RAMPasi Petäjäjärvi2022-02-091-0/+8
| | | | | | | | | | CI tests for QNX are run in QEMU which does not have enough RAM to run this test successfully. Pick-to: 6.2 6.3 Change-Id: Idab3e8b6a1e0ae3eddf5aedb82e6784a74ae9a3a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QNX: Remove expected failPasi Petäjäjärvi2022-02-093-12/+0
| | | | | | | Pick-to: 6.2 6.3 Change-Id: I66b05685dd1c5c5e083db1ecd9265e1e3c859d45 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Rafael Roquetto <rafael.roquetto@qt.io>
* rhi: Add the long-pending probe() helper, with backing for MetalLaszlo Agocs2022-02-091-0/+2
| | | | | | | | | | | | | | | | | | | | | There is a TODO for this in Qt Quick from the 6.0 times. To decide upfront if Metal can be expected to function, or if a fallback to OpenGL needs to be triggered (especially important with macOS virtual machines, where, unlike any real macOS system, Metal may not be present at all), the scenegraph calls create() and then drops the result. The idea to make this less wasteful was back then to add a dedicated probing function which can, possibly, perform the checks in a more lightweight manner than full initialization. Implement this now, focusing on Metal. Brought to attention by QTBUG-100441: printing warnings about not having an MTLDevice is confusing in a Metal-less macOS VM, because it is not an actual error, only part of the probing at scenegraph initialization. We can now avoid printing confusing warnings there. Change-Id: Ie52c36af9224bedc3f5e4c23edb486d961c9f216 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Make time sensitive QScrollBar test fault tolerantVolker Hilsheimer2022-02-091-1/+8
| | | | | | | | | | | | | The auto-repeat timer of QScrollBar kicks in after 50ms, so if the test takes too long and the timer fires during the qWait call or during event delivery, then we might get multiple valueChanged emissions. Detect that scenario and allow the test to XFAIL if things take a significant time (more than 40ms vs the expected 1ms). Pick-to: 6.3 6.2 Change-Id: Ie90aadc62372397db695fd2b34fe1f5252ce8d37 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Update widgets inheriting QAbstractSpinbox in tst_baseline_widgetsAxel Spoerl2022-02-091-16/+122
| | | | | | | | | | | | Create QAbstractSpinBox test Update test for QSpinBox Add tests for QDoubleSpinBox, QDateEdit, QTimeEdit Add test for QDateTimeEdit incl. calendar popup Task-number: QTBUG-99677 Change-Id: Ia74686f47a1520ab4c7e878b19fc774e00db88dd Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Blacklist tst_qscreen::grabWindow on WindowsFabian Kosmale2022-02-051-0/+2
| | | | | | | Task-number: QTBUG-100412 Pick-to: 6.3 Change-Id: I8497cf31d690bc5fc22d808cba95254b7fedcc49 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Deprecate QContextMenuEvent and QMouseEvent ctors without globalPosShawn Rutledge2022-02-0517-83/+124
| | | | | | | | | | | | | As with QHoverEvent, it's better to require globalPos rather than "initialized to QCursor::pos(), which may not be appropriate" as the docs have pointed out for many years now. This removes the remaining calls to QCursor::pos() in event constructors. Task-number: QTBUG-52430 Task-number: QTBUG-69433 Task-number: QTBUG-100324 Change-Id: I076dae56f37abaad7085cc95dddee453a80a45f3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_qresourceengine: use QFINDTESTDATA() to find correct pathJanne Juntunen2022-02-041-1/+1
| | | | | | | | | | | | Use alternative method for finding searchPath since QT_TESTCASE_SOURCEDIR did not point to a correct location on webOS QEMU test environment. Fixes: QTBUG-99954 Pick-to: 6.3 Change-Id: I05f95b4aa02027976036d0842ca564a602e01d0e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QCborValue: fix incorrect to{Array,Map} when the value is emptyThiago Macieira2022-02-031-0/+87
| | | | | | | | | | When QCborValue referred to an empty array or map, toArray() and toMap() would respectively return the default value instead of the empty object, as expected. Pick-to: 6.2 6.3 Change-Id: I5e52dc5b093c43a3b678fffd16b60456d0037ad7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tst_qlogging: use correct qlogging_helper path on webOSJanne Juntunen2022-02-031-11/+17
| | | | | | | | | | | Switched to use runtime path instead of compile time path for the helper executable. Some tests cases were failing on webOS because of wrong path. Fixes: QTBUG-99846 Pick-to: 6.3 Change-Id: I566bc04bdb96ac6e7dd0a875eadb50685aef8282 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Move prematureExec() to the end of tst_qsqlquery's testingEdward Welbourne2022-02-031-2/+4
| | | | | | | | | | | | | It leaves the system in a state that breaks at least one later test, so put it last. (This was first seen when picking back to 6.2, but I am now able to reproduce it on dev.) Amends commit 78eac57f3dc788345f8f3e9b6dbd3dce70b8f511 Pick-to: 6.3 Change-Id: I918cf43cdfc27357329a175518d6f9755747bae5 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add a QHoverEvent ctor taking global mouse position; deprecate the otherShawn Rutledge2022-02-032-5/+5
| | | | | | | | | | | | | | | | | The QSinglePointEvent ctor assumes that the given globalPos is correct, so it was wrong that the QHoverEvent ctor passed along a local position as global. It's better to require globalPos as an argument; and in fact it seems that everywhere we construct a QHoverEvent, global position is available, or possible to get by transformation (which is better than resorting to QCursor::pos()). Also, don't convert to QPoint: pointer events have qreal resolution and there's no reason to truncate them. Fixes: QTBUG-100324 Change-Id: I919455da36265988d3d149eb97563c9ed0d2c660 Pick-to: 6.3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Always wait in the QScreen::grabWindow testVolker Hilsheimer2022-02-031-7/+8
| | | | | | | | | | | | | | | | | On X11 we already had to wait as window managers might scroll windows in. On macOS we also waited - albeit a bit shorter - also because screens scroll in slowly. We didn't wait on Windows, and on Windows the test is quite flaky. Attempting to make it run stably by waiting for long enough so that all paint events are flushed to the screen. As a drive-by, break some overly long lines. Task-number: QTBUG-100412 Pick-to: 6.3 Change-Id: I49b1e447aced2fe1af3c5d30b514f8df3cc1813c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QPluginLoader: report the right load hintsGiuseppe D'Angelo2022-02-031-1/+10
| | | | | | | | | | | | | | | A default-constructed QPluginLoader erroneously reports that the load hints are empty. However, setting a filename would then automatically set the PreventUnload hint, surprising the user. Return the correct flags instead. Amends 494376f980e96339b6f1eff7c41336ca4d853065 Change-Id: I7a95964cb680afd3adf2f71ed73d2f93023238f2 Fixes: QTBUG-100416 Pick-to: 5.15 6.2 6.3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Extend baseline test for QTabWidgetAxel Spoerl2022-02-031-0/+85
| | | | | | | | | tabsClosable and documentMode added, merge conflict fixed Task-number: QTBUG-99773 Pick-to: 6.3 Change-Id: I8eb51b9f434bc97e6e7e55377801c6ee8aec52b0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QPlainTestLogger: do not print "failure location" if there's no failureGiuseppe D'Angelo2022-02-021-0/+2
| | | | | | | | | | | | | | | When running a test under increased verbosity levels, QTestLib would print "failure location" for every QTest function (QVERIFY, QCOMPARE, ...), even if there's no failure at all. Keep the code centralized, but split the formatting of failures and non-failures (other messages). Task-number: QTBUG-96844 Change-Id: I3c508653176b68579dc0eb0cffcc153a52da2e2c Pick-to: 5.15 6.2 6.3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add some more QDate::{start,end}OfDay() testsEdward Welbourne2022-02-021-0/+12
| | | | | | | | | | | | | | | | | | | | | While investigating an assertion failure I noticed that the existing tests didn't even exercise these methods for local time or zone time. Of course, we can't robustly test these time-specs, due to vagueries of offset details and zone availability, but we can at least verify that they return date-times on the specified date. Add a test-case for the start of 1900, on which the assertions were first seen; it is the earliest moment representable with tm_year >= 0, after all. One of these tests fails on 6.2 but the fix for that (as opposed to the the assertion) requires 6.3's improvements to the handling of time_t's fuller range - too risky a change to pick back to 6.2. Pick-to: 6.3 Task-number: QTBUG-99747 Change-Id: I98f5d7850a701972b2d8ea2ce203a2b3e7071354 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add qt_internal_undefine_global_definition functionAlexey Edelev2022-02-025-10/+5
| | | | | | | | | | | | | | | | qt_internal_undefine_global_definition disables an internal global definition that is defined by the qt_internal_add_global_definition function for a specific target. Remove the ability to set the custom "undefine" flag for the definitions since it's hard to control it using the introduced function. Pick-to: 6.2 6.3 Task-number: QTBUG-100334 Change-Id: Ic1637d97aa51bbdd06c5b191c57a941aa208d4dc Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix clang-cl build of tst_qobjectAllan Sandfeld Jensen2022-02-021-1/+1
| | | | | | | | Not MSVC, but pretends to be. Pick-to: 6.3 6.2 Change-Id: I5c201dd917e79a22d6ef15715bf1d3a7010d123e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix flags in QFileSystemModelAndreas Buhr2022-02-021-0/+4
| | | | | | | | | | | | | | | | In 63eea5e5c69434871eaef9d9dc7184d7e54d7276, the Qt::ItemNeverHasChildren flag was introduced. QFileSystemModel was modified to use this flag for items which are not directories, but only if the QFileSystemModel is not read-only and the directory is writable. This patch modifies QFileSystemModel to use the ItemNeverHasChildren flags also if the model is read-only and if the item is read-only. Amends 63eea5e5c69434871eaef9d9dc7184d7e54d7276 Change-Id: Ie7f7d58ecf7baade93f9f03d120da84d3c005d42 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
* Stylesheet: Fix tab layout when tab has a font and iconsVolker Hilsheimer2022-02-021-14/+43
| | | | | | | | | | | | | | | | | | | | | | | Amends e3b2b12a912361af309302a4b1fc27c2206322af, which made the style sheet calculate the font-dependent text size, but didn't add the space needed for the close button or a tab icon. QTabBar's layout code already adds the space needed for icons and margins to the size; so instead of overwriting that size, subtract the size needed by the normal font, and then add the size needed for the font form the style rule, considering both vertical and horizontal tab bars. Fix the test case to style only one tab rather than the entire tab bar, otherwise the font is applied to the entire tab bar, and not just to a specific tab, which is the style sheet style code in question. Pick-to: 6.2 6.3 Task-number: QTBUG-6905 Change-Id: Ieed0ba146a32e81229419adecaf41f467cfd5959 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Blacklist putWithServerClosingConnectionImmediately on WindowsFabian Kosmale2022-02-021-0/+2
| | | | | | | Task-number: QTBUG-100362 Change-Id: Ib09aec5ea03867163d476a2c92562bc949fc1b1a Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Sequential erase/_if: don't apply predicate twice to elementMarc Mutz2022-02-021-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code was trying to avoid a detach in the case no element needed to be removed, by first running find_if() on const_iterators, and then, after converting its result to (mutable) iterators, start the remove_if() algorithm where find_if() left off. But this applies the predicate to the element found by find_if() (if any) _twice_: first just before we exit the first find_if() and then just as we enter remove_if(), which will start by running find_if() again, with the result of the initial find_if as 'first'. Apart from being needlessly inefficient, this violates the specification of Uniform Erasure, which defines sequential erase_if() as being equivalent to remove_if() + container erase(), with the former being specified to apply the predicate exactly once per element. Fix by writing the remove_if() part by hand. Instead of doing the dance with the loop invariant documentation twice, simply implement erase() via erase_if() (complicated a bit by the weird passing of predicates by lvalue reference instead of by value, as would be idiomatic). This exposes users to: [ChangeLog][QtCore][Potentially Source-Incompatible Changes] A fix in the implementation of the erase-like algorithms of sequential Qt container may re-enable signed/unsigned comparison warnings previously suppressed by having occurred in std library code. To fix, cast the value to look for such that it has the same signedness as the container's elements. ... but the issue would be the same had we inlined std::remove() instead of passing a lambda to sequential_erase_if(), so it's nothing we can, nor should, work around. [ChangeLog][QtCore][Containers] Fixed a bug in the implementation of most sequential Qt container's erase-like algorithms (member removeAll()/removeIf() and free erase()/erase_if()) where the equality operator or the predicate, respectively, was applied to the first matching element twice. Each element is now tested exactly once. Pick-to: 6.3 6.2 Change-Id: Ib6d24b01b40866c125406f1cd6042d4cd083ea0d Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QImageReader: Check for existing handler in initHandlerRobert Löhning2022-02-021-0/+26
| | | | | | | | | Some calling code did this beforehand, other didn't. Now, the function itself checks for an existing handler before doing anything else. Change-Id: I8fc43fb8788c9dfe825b15ffa2fa69ee43915cd6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Add tab close button in QTabBar baseline testAxel Spoerl2022-02-011-5/+29
| | | | | | | Fixes: QTBUG-99772 Pick-to: 6.3 Change-Id: I01e0fc78880baae12f46005e4a88db41bea89d65 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* rhi: Add the basic infrastructure for geometry shader supportBen Fletcher2022-01-3110-0/+208
| | | | | | | | | | | | | | | | | | | | | .. but this will only be supported on Vulkan, OpenGL 3.2+, and Open GL ES 3.2+ for the time being. The situation is: - Vulkan is working. qsb accepts .geom files already, and QShader has existing geometry shader support. - OpenGL 3.2 and OpenGL ES 3.2 are working. - D3D11 is not working. D3D11 supports geometry shaders, but SPIRV- Cross does not support translating geometry shaders to HLSL. - Metal is not working. Metal does not directly support geometry shaders. Change-Id: Ieb7c44c58b8be5f2e2197bf5133cf6847e6c132d Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>