summaryrefslogtreecommitdiffstats
path: root/tests/auto
Commit message (Collapse)AuthorAgeFilesLines
* Fix DeferredFlag implementation for QTestEventLoopEdward Welbourne2022-08-121-4/+12
| | | | | | | | | | | As discovered in the expanded testing of QTRY_COMPARE() using the same class, the timer needs a context object and a slot to call. This amends commit 35ad157d88c7bfcb9b90b01111b0f43dd2e012d9 Pick-to: 6.4 6.3 Task-number: QTBUG-104441 Change-Id: I41fc23de84ce8c7d6608db0005276a2071974494 Reviewed-by: Jason McDonald <macadder1@gmail.com>
* Test QTRY_COMPARE() and expand testing of QTRY_VERIFY*()Edward Welbourne2022-08-127-36/+180
| | | | | | | | | | | | | In the process, simplify the latter while adding some actual time-variation for the QTRY_* loop to navigate round - based on the extendedcompare test's ClassWithDeferredSetter. Testing remains primitive, but is at least a bit more thorough. Pick-to: 6.4 Change-Id: I40be8fb485f3f18f0a4f4bc62ad36cccac691979 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Jason McDonald <macadder1@gmail.com>
* Remove the stale expected_crashes_[345].txtEdward Welbourne2022-08-123-16/+0
| | | | | | | | | | | These contain output only ever sent to stderr, which tst_selftests no longer looks at; it merely verifies stderr is empty for all tests except those expected to produce stderr output, and ignores the stderr output for these last. Change-Id: I50fee445d84c2d125e6db5303fc389e87746455e Reviewed-by: Jason McDonald <macadder1@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QMetaType: don't use global relocations to the lambdas and structuresThiago Macieira2022-08-121-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | The way the Qt 6.0 QMetaTypeInterface was designed, using a static inline variable in a template, would normally require the linker and dynamic linker to merge all copies and choose a single copy as the official one. But because of hidden visibility and of Windows DLLs, QMetaType already copes with multiple copies NOT getting merged. So we may as well ask the linkers not to bother and use simpler, local relocations to find those symbols. They are all supposed to still be equivalent and it's an ODR violation if they're not. The Apple ld64 linker complains if you use this type of global relocation: ld: warning: direct access in function [...] to global weak symbol 'QtPrivate::QMetaTypeInterfaceWrapper<int>::metaType' Fixes: QTBUG-93471 Pick-to: 6.3 6.4 Change-Id: Id0fb9ab0089845ee8843fffd16f98a10aa719434 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QMetaType: add a test to confirm that types are equal across librariesThiago Macieira2022-08-127-5/+193
| | | | | | | | Because of the template shenanigans. This is just to make sure. Pick-to: 6.4 Change-Id: Id0fb9ab0089845ee8843fffd16f989e7d555894f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Wait for window focus instead of expose eventDimitrios Apostolou2022-08-112-3/+1
| | | | | | | | | | This fixes the flakiness seen in OpenSUSE KDE/X11 desktop. Fixes: QTBUG-70590 Task-number: QTBUG-105177 Change-Id: I7c2431e58b2a60ea04e26d4e70c0f2867d544ff2 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Try to stabilize window activation on macOSDimitrios Apostolou2022-08-101-14/+30
| | | | | | | | Use activateWindow() that is documented as the right way to raise a window. Task-number: COIN-892 Change-Id: Ic9aadee0d3a526fd8e46e5b1099b5b0861700207 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Test is stable on OpenSUSE, un-blacklist itDimitrios Apostolou2022-08-101-1/+0
| | | | | | Task-number: QTBUG-74760 Change-Id: I78ca3779407d1076a11d0a948b61f4438d1ab4cc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Test is no longer flaky, unblacklist itDimitrios Apostolou2022-08-101-2/+0
| | | | | | | | | | I can't reproduce the test failing after hundreds of iterations on OpenSUSE, and the test hasn't flaked at all in our CI in the last 6 months according to our dashboards. Fixes: QTBUG-70612 Change-Id: I2397f3db5caf97f674de7d75fd99bd14c14166a4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Test is not flaky any longerDimitrios Apostolou2022-08-101-4/+0
| | | | | | | | | | I can't reproduce the issue after hundreds of iterations on OpenSUSE, and the test hasn't flaked at all in the last 3 months according to our dashboards. Task-number: QTBUG-66371 Change-Id: I9c4daf851e09fbcb47a6ab39418e7b213ccd9dfe Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove assertion from ownMethodIndex that breaks testsSami Shalayel2022-08-101-0/+39
| | | | | | | | | | | | | | | | | | | | ownMethodIndex works for all kind of methods, also for constructors. Therefore, remove the assertion there (that checks for non constructors) and add a test in qtbase so it does not happen again. The test broken by the assertion is in qtdeclarative: tst_QJSEngine::newQMetaObject(). Also rename QMetaMethodPrivate::ownConstructorIndex() to ownConstructorMethodIndex() as the previous naming implied that ownMethodIndex() could not be used for constructors. amends b73ab954dffffc462b6f6efe5a2dd97efeab0038 Task-number: QTBUG-105360 Change-Id: I0244993ed79bee055645b5443f5d02e1c089a6c6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Tests: remove #define COMMAThiago Macieira2022-08-092-13/+12
| | | | | | | | | | Those were workarounds to passing a comma to a macro, but there are ways around it. The simplest is to just use variadic macros; another, which has been applied to Q_DECLARE_METATYPE for a long time, is to define an alias to the thing you're trying to use. Change-Id: Ie4bb662dcb274440ab8bfffd17097fbf0c53eabc Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* CMake: Support big resources in qt_add_resourcesJoerg Bornemann2022-08-0910-0/+137
| | | | | | | | | | [ChangeLog][CMake] The target-based variant of qt6_add_resource gained the option BIG_RESOURCES. This can be used instead of qt6_add_big_resources, which is not target-based. Fixes: QTBUG-100268 Change-Id: Ib3fa783cbfbfd10f59c2f952bc88508a91f25e26 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Wayland: Remove XFAIL after underlying bug was fixedEskil Abrahamsen Blomfeldt2022-08-091-2/+0
| | | | | | | | | | The intialSize bug has been fixed in Qt Wayland Client, and thus this test will now start XPASSing. Pick-to: 6.4 Task-number: QTBUG-66818 Change-Id: I4b9cb8bd9306a67f04295eb23f09574dad0e97f7 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Add some testing of QTestEventLoopEdward Welbourne2022-08-0810-2/+333
| | | | | | | | | | | | Fairly minimal for now, just enough to verify a bug and serve as the sign of success when it's fixed. Tests fail in ways they shouldn't, for now; see expected_eventloop.* for details, notably "Earlier test failed to clean up" messages. Pick-to: 6.4 6.3 Task-number: QTBUG-104441 Change-Id: I59be4aa5f21fed23b19a0593a8c2f6c9956507df Reviewed-by: Jason McDonald <macadder1@gmail.com>
* tst_qimage: skip exifReadComments when the feature is not activeJanne Juntunen2022-08-081-0/+3
| | | | | | | | | | We need to skip the exifReadComments test case if reading text from image has been configured off, like in webOS's Yocto recipe for QtBase. Fixes: QTBUG-105393 Pick-to: 6.4 Change-Id: If45872ca7ed26620fa38bc6b47132363d661acdc Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Don't skip QDoubleConverter's digit-count check for non-whole boundEdward Welbourne2022-08-081-0/+1
| | | | | | | | | | | | | | | | Using convertDoubleTo() to get a whole number, from which to determine the number of digits we're allowed before the fractional part, fails if the double isn't a whole number, which lead to the skip being checked. Use qFloor() of the double (as this should have as many digits as the double had before its decimal point, which is what we care about; qCeil() might round up to a power of ten). This amends commit ff6d2cb0d5779d81e89d94d65c8d164602fa2567 Fixes: QTBUG-105341 Pick-to: 6.4 6.3 6.2 Change-Id: I4e0105d4602682c59e9830ec9a37556c96db884e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove blacklist of tryAcquireWithTimeout on WindowsAllan Sandfeld Jensen2022-08-071-6/+0
| | | | | | | Hasn't failed on Windows in months Change-Id: Id14eaead667dfba93807592a7e0cb4da7f91f16f Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* qputenv: port to QByteArrayViewMarc Mutz2022-08-068-16/+16
| | | | | | | | | | | | | | | | | | | | The vast majority of in-tree users pass simple and short C string literals as the value. By porting to QByteArrayView, we document that we'll accept non-NUL-terminated data, and do the NUL-termination internally, using SSO'ed std::string, saving memory allocations in the common case of short strings. I didn't bother to check which direction std::string takes for nullptrs these days (there was a change accepted in that area for C++20 or 23), so play it safe and protect against them. Follow-up to Task-number: QTBUG-105302 Change-Id: I2369acc62f1d5cbc26135396cfe0602d8c75300c Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Declare logging category exported in tst_QDockWidgetAxel Spoerl2022-08-051-6/+0
| | | | | | | | | | | | The logging category lcQpaDockWidgets was explicitly declared in tst_QDockWidget. That failed to complile on static builds. This patch replaces the explicit declaration with Q_DECLARE_EXPORTED_LOGGING_CATEGORY(lcQpaDockWidgets, Q_WIDGETS_EXPORT) Pick-to: 6.4 6.3 6.2 Change-Id: I1cad0e672313be84297eeddf992f6cafe9a35977 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* qputenv: defend against non-NUL-terminated QByteArray valuesMarc Mutz2022-08-051-1/+5
| | | | | | | | | | | | | | | | | | | | | | | The old code assumed that a QByteArray's data() is always NUL-terminated. Due to the conflation of owners and non-owners in QByteArray (but also in case we ever get efficient substringing), this is not always the case, e.g. QByteArray::fromRawData() does not ensure NUL-termination. From QString::utf16(), we learn that the condition to check for is QArrayData::isMutable(). After working around the fact that QByteArray::data_ptr() doesn't exist for const QBAs and that empty QBAs always refer to QByteArray::empty_, which is !isMutable(), we can detect this situation and re-allocate without introducing new API. This is the fix for Qt ≤ 6.4. For Qt 6.5, we'll port the function to QByteArrayView. Pick-to: 6.4 6.3 6.2 5.15 Fixes: QTBUG-105302 Change-Id: I3416535ab09d601e0e87b2767f2c024ba1217e64 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* CMake: Fix mockplugins test not to fail in a non-prefix buildAlexandru Croitor2022-08-051-5/+10
| | | | | | | | | | Explicitly running the install step would fail in a non-prefix build. Do it conditionally on the no_prefix feature. Pick-to: 6.4 Change-Id: I78cd63f51c499a0df451b08290c6dfc84e52666c Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* tst_QFocusFrame: fix -WparanthesesMarc Mutz2022-08-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Says Clang 10: tst_qfocusframe.cpp:73:28: warning: using the result of an assignment as a condition without parentheses [-Wparentheses] QTRY_VERIFY(focusFrame = window.findChild<QFocusFrame *>()); ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [...] tst_qfocusframe.cpp:73:28: note: place parentheses around the assignment to silence this warning QTRY_VERIFY(focusFrame = window.findChild<QFocusFrame *>()); ^ ( tst_qfocusframe.cpp:73:28: note: use '==' to turn this assignment into an equality comparison QTRY_VERIFY(focusFrame = window.findChild<QFocusFrame *>()); ^ == Amends f1812aad895ed2b8337a6d98d05623714680aba9. Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I3920ab0da725b76fb6c19bbc7cde7920f351af4a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Add Latin 1 case-insensitive Boyer-Moore searcherØystein Heskestad2022-08-041-0/+104
| | | | | | | | | | The std::boyer_moore_searcher is buggy for older verions of Microsoft's STL, and missing in AppleClang's libc++ with an inefficient fall back. Fixes: QTBUG-100236 Change-Id: Ic3cc916946546d2ef78456cd15e1425d957b989d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QDomDocument: Add a way to enable spacing-only text nodesSona Kurazyan2022-08-041-0/+61
| | | | | | | | | | | | | | | | Added a parse option that can be passed to setContent(), to specify that spacing-only text nodes must be preserved. [ChangeLog][QtXml][QDomDocument] Spacing-only text nodes can now be preserved by passing the ParseOption::PreserveSpacingOnlyNodes option to setContent(). Fixes: QTBUG-104130 Fixes: QTBUG-89690 Task-number: QTBUG-90003 Change-Id: Id43730ce5b79a856c4b434d1f1d4dd7c49c25f31 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix initialization of QDateEdit and QTimeEditEdward Welbourne2022-08-041-2/+0
| | | | | | | | | | | | Since 6.3 these use Qt::UTC as time-spec but I neglected to take that into account in QDateTimeEditPrivate::init()'s construction of a QDateTime from the QDate or QTime. This amends commit c00ee2f31013e99c79b820a0db57003c110a5510. Fixes: QTBUG-105322 Pick-to: 6.3 6.4 Change-Id: I11dec9808a54cf7da401b1734a9a2812f5fd2e63 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix handling of invalid input to Q(Date|Time)Edit constructorsEdward Welbourne2022-08-041-2/+1
| | | | | | | | | | | Change to match how QDateTimeEdit()'s overloads taking a QDate or QTime work, substituting a default value in place of an invalid one. This fixes one surprising anomaly in a recently-extended test, so that it now only fails the way I expected. Task-number: QTBUG-105322 Change-Id: Ied4da6160b7efe70990f956798fb826b5b36d8bb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Expand QDateTime edit constructor tests to cover Q(Date|Time)EditEdward Welbourne2022-08-041-20/+51
| | | | | | | | | | | | | | The constructor_qdate() and constructor_qtime() tests only tested QDateTimeEdit with a QDate or QTime. Extend them to also test QDateEdit and QTimeEdit constructors, respectively. This revealed one surprise; the QDateEdit constructor doesn't replace an invalid QDate with the usual start-date, as the QDateTimeEdit does. It also serves to reproduce a bug reported in Qt 6.3, see Task-number. These are all marked XFail for now. Task-number: QTBUG-105322 Change-Id: Ifafb40a9b78d9314b74ca9a1710d362b9a3cb18d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Simplify the data tables for some QDateTimeEdit constructor testsEdward Welbourne2022-08-041-75/+30
| | | | | | | | | | | | | | | | | | It makes no sense to pass, as parameters, values that can't vary between test data rows, so eliminate m{in,ax}imum{Dat,Tim}e columns. There were no parameters used to control how those would be set, so they were always going to be the type's defaults. The displayDateTime was only needed for the invalid test, in which its value is known and fixed; for the normal test it was necessarily implied by the parameter used to initialize the QDateTimeEdit. While the QDate and QTime tests do have to supplement that construction information, the other part is again known and fixed. We can check the data-tag against "invalid" to determine which known and fixed data to use, saving the need for a data table column. Change-Id: I3754ba1a6a127a4a872a7f4a3e7edad9a5ff0ec0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* moc: handle attributes in class declarationsFabian Kosmale2022-08-031-1/+1
| | | | | | | | | | | | We already had code to handle attributes on funtcions, but we didn't handle them correctly for classes so far. Fix this by simply skipping over the attribute. Fixes: QTBUG-105310 Pick-to: 5.15 6.2 6.3 6.4 Change-Id: Ic4149f940e74820de4f2fa9540d9dc5b4e626a3a Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Improve QDomDocument::setContent() APISona Kurazyan2022-08-031-2/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added new setContent() overloads, that: - take parameter of new ParseOptions enum type for specifying the parse options that can be used for enabling namepsace processing and, in future, whitespace-only text nodes, etc. - use ParseResult for returning the information about error message, line and coulmn number, instead of three parameters for each. - use QAnyStringView for a QString input data. To avoid ambiguities when calling setContent() with one argument, removed the default argument for errorString from all the overloads. [ChangeLog][QtXml][QDomDocument] Added new setContent() overloads that allow specifying different parse options through ParseOptions flags. These overloads use a new ParseResult struct for returning the information about an error, and QAnyStringView for passing string input. [ChangeLog][QtXml][QDomDocument][Potentially Source-Incompatible Changes] setContent() overloads that take only one argument now return ParseResult instead of a bool. ParseResult explicitly converts to bool, so the expressions calling setContent() with one argument will continue compiling, if they are contextually convertible to bool. If an implicit convertion is required (e.g. bool b = doc.setConetnt(data)), the result needs to be explicitly converted to bool first (e.g. bool b = bool(doc.setConetnt(data)). Task-number: QTBUG-104507 Change-Id: If6a78f8c9b1458f0e3ae719bfd3703a0b965449c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Rearrange the skipping of a test to give a better messageEdward Welbourne2022-08-031-2/+4
| | | | | | | | | | When tst_QDateTime::fromStringStringFormat_localTimeZone_data() skips due to feature timezone being undefined, it should report that as the issue, rather than claiming the system doesn't support the particular zones used in the test. Change-Id: I9837ac95c6d92317fbec7fcca184f7b7e6f81441 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make 'zz' format an alias for 'z' in time format stringsEdward Welbourne2022-08-032-2/+3
| | | | | | | | | | | | | | Also document the (seldom helpful) handling of over-long repeats of a format. Add test to QDateTime and amend QLocale test. [ChangeLog][QtCore][QDateTime] Doubling the 'z' format in a date-time or time format string now produces the same output as a single 'z'. Previously, this would have produced two copies of the milliseconds field (eliding any trailing zeros in each). Contrast with 'zzz', which produces the full milliseconds field, including any trailing zeros. Change-Id: I4c60462b062fee4079370096d745c191c1939506 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtBase: Windows: Replace some deprecated API usagesYuhang Zhao2022-08-033-3/+3
| | | | | | | | | | | | Microsoft recommends to use CoInitializeEx() and SetWindowLongPtr()/GetWindowLongPtr() in new code. Use COINIT_DISABLE_OLE1DDE to avoid overhead of initializing and using obsolete technology. Pick-to: 6.4 Change-Id: I9d16943e864d4487dd4f46fd9325579c298c52b9 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-03847-0/+2551
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Build minimal subset of tests for Android multi-ABI Qt buildsAlexey Edelev2022-08-021-0/+8
| | | | | | | | | Add an option to limit the number of tests for building and testing Android multi-ABI configurations in CI. Currently only Core tests supposed to run. Change-Id: Ibb8a41d60d108259ef2675ec54bde2482f87c8b2 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QMetaObject: fix calling overloaded functions & constructorsThiago Macieira2022-08-011-2/+69
| | | | | | | | | | | The rewrites in a1c34d8bd09bfc6e80dcb06c7900d40c2d32518c, 0f76e55bc440a70f5d9530a192c9ce6334a8f069 and in commit b73ab954dffffc462b6f6efe5a2dd97efeab0038 didn't do this right, though no problem ended up happening. In particular, the constructor one failed to check if there were even more parameters. Change-Id: I6f936da6f6e84d649f70fffd1706f827ba635584 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QMetaType: fix void* parametersThiago Macieira2022-08-012-1/+77
| | | | | | | | | | | | | Commit 3695b35dfc427f274e55f8e2a6a9876deb52f1b4 accounted for pointer to other incomplete types, but pointer-to-void was missed. This caused an inconsistency in the stored metatype for void*, which is a built-in type (QMetaType::VoidStar) but no pointer was recorded. The test in tst_moc hadn't been enabled because the functions in questions weren't extracted by moc. That is fixed in this commit. Change-Id: I6f936da6f6e84d649f70fffd1706f613517a75fb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* rhi: gl: Avoid magic adjustments to the context/window formatLaszlo Agocs2022-08-011-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...by removing the entire adjustedFormat() helper. Qt Quick has never used this, which indicates it is not that useful. Same goes for Qt Multimedia or Qt 3D. Ensuring depth and stencil is requested is already solved by using QSurfaceFormat::setDefaultFormat() or by adjusting the formats everywhere as appropriate. The helper function's usages are in the manual tests that use it as a shortcut, and in the GL backend itself. Remove it and leave it up the client to set the depth or stencil buffer size, typically in the global default surface format. (which in fact many of the mentioned manual tests already did, so some of calls to window->setFormat(adjustedFormat()) were completely unnecessary) By not having the built-in magic that tries to always force depth and stencil, we avoid problems that arise then the helper cannot be easily invoked (thinking of widgets and backingstores), and so one ends up with unexpected stencil (or depth) in the context (where the GL backend auto-adjusts), but not in the window (which is not under QRhi's control). It was in practice possible to trigger EGL_BAD_MATCH failures with the new rhi-based widget composition on EGL-based systems. For example, if an application with a QOpenGLWidget did not set both depth and stencil (but only one, or none), it ended up failing due to the context - surface EGLConfig mismatches. On other platforms this matters less due to less strict config/pixelformat management. Pick-to: 6.4 Change-Id: I28ae2de163de63ee91bee3ceae08b58e106e1380 Fixes: QTBUG-104951 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QProperty: Notify observers even when dependency is goneFabian Kosmale2022-08-011-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem description: -------------------- Assume we have two properties, P1 and P2. Assume further that we assign a binding to P2, so that it depends on P1. Let the binding additionally capture some (non-QProperty) boolean, and only create the dependency to P1 if the boolean is true. The state afterwards is P1:[p1vaue|firstObserver] | | v ---[p2binding] / P2:[p2value|binding] If the boolean is set to false, and P1 changes its value, we still correctly re-evaluate the binding and update P2's value. However, during binding evaluation we will notice that there is no further dependency from P2 on P1, and remove its observer. The state afterwards is P1:[p1vaue|firstObserver=nullptr] ---[p2binding] / P2:[p2value|binding] Then, during the notify phase, we traverse the observer's again, starting from P1's firstObserver. Given that it is nullptr now, we never reach P2's binding, and thus won't send a notification from it. Fix: ---- We store a list of all visited binding-observers (in a QVarLengthArray, to avoid allocations as long as possible). After the binding evaluation phase, we then use that list to send notifications from every binding that we visited. As we already have a list of all bindings, we no longer need to recurse on binding-observes during the notification process; instead, we only need to deal with static callbacks and ChangeHandlers. The pre-existing notification logic is still kept for the grouped update case, where we already have a list of all delayed properties, and should therefore not encounter the same issue. Unifying its codepath with the existing logic is left as an exercise for a later patch. Fixes: QTBUG-105204 Task-number: QTBUG-104982 Pick-to: 6.4 6.3 6.2 Change-Id: I2951f7d9597f4da0b8560a64dfb834f7ad86e757 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* tst_QMetaType: fix warning that buffer may be unusedThiago Macieira2022-07-311-2/+2
| | | | | | | | | | | | | We pass a pointer to uninitialized memory to QMetaType::create(). There's no harm because we're using the invalid QMetaType, but GCC is actually right to complain for any other type. qtestcase.h:54:25: warning: ‘buf’ may be used uninitialized [-Wmaybe-uninitialized] qmetatype.h:454:11: note: by argument 2 of type ‘const void*’ to ‘void* QMetaType::create(const void*) const’ declared here Pick-to: 6.3 6.4 Change-Id: I3859764fed084846bcb0fffd1703eb7967acf0d7 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QRegularExpression: introduce (global)matchViewGiuseppe D'Angelo2022-07-291-16/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QRegularExpression::match (and globalMatch) is currently overloaded for QString and QStringView. This creates a subtle API asymmetry: QRegularExpression re; auto m1 = re.match(getQString()); // OK auto m2 = re.match(getStdU16String()); // Dangling This goes against our decision that every time that there's a possible lifetime issue at play, it should be "evident". Solving the lifetime issue here is possible, but tricky -- since QRegularExpression is out-of-line, one needs a type-erased container for the input string (basically, std::any) to keep it alive and so on. Instead I went for the simpler solution: deprecate match(QStringView) and introduce matchView(QStringView) (same for globalMatch). This makes it clear that the call is matching over a view and therefore users are supposed to keep the source object alive. Drive-by, remove the documentation that says that the QString overloads might not keep the string alive: they do and forever will. [ChangeLog][QtCore][QRegularExpression] Added the matchView() and globalMatchView() functions that operate on string views. The match(QStringView) and globalMatch(QStringView) overloads have been deprecated. Change-Id: I054b8605c2fdea59b556dcfea8920ef4eee78ee9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMetaObject: rewrite invokeMethod()Thiago Macieira2022-07-281-3/+13
| | | | | | | | | | | | Use the QMetaMethodPrivate::invokeImpl() function we added in the last commit, without recreating the method signature. Instead, only do a comparison on the method name and allow invokeImpl() to decide whether this method can be called with the given arguments. This will allow invokeImpl() to have more flexibility in deciding if the arguments match, using the stored metatype information. Change-Id: I36b24183fbd041179f2ffffd17021a86484bfab6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QMetaObject: rewrite QMetaMethod::invokeThiago Macieira2022-07-281-0/+4
| | | | | | | | | | | | | This adds an internal method to QMetaMethodPrivate to do the work of actually placing the call on a given meta method. This rewrite should make the code clearer, but make no otherwise perceptible difference in behavior. The next commit will rewrite QMetaObject::invokeMethod to use this new, internal function to avoid doing a lot of string allocations. Change-Id: I36b24183fbd041179f2ffffd170219c0deaaf7f5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Remove unnecessary INCLUDE_DIRECTORIES . in testsAlexandru Croitor2022-07-284-7/+0
| | | | | Change-Id: Iafc4f9fcc2a68d299d6d3f255bbcaf90acd0399b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* CMake: Don't use PUBLIC_LIBRARIES for tests and test helpersAlexandru Croitor2022-07-28534-608/+607
| | | | | Change-Id: I9b7404e1d3a78fe0726ec0f5ce1461f6c209e90d Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* tst_qsslsocket: remove schannel workarounds for old certificateMårten Nordheim2022-07-281-10/+0
| | | | | | | | The certificate was updated recently and doesn't have the same deprecated hash functions and small key size as the old one did. Change-Id: I301ad50a96a30483b92a6e30f61e78e8d6b955ca Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tst_QMetaObject: add a test for using Q_ARG with a non-const refThiago Macieira2022-07-271-0/+15
| | | | | | | | | | | | | | This is in use in tst_qdbusinterface.cpp, so let's have it here to make sure it works: QVERIFY(QMetaObject::invokeMethod(&iface, "ping", Q_RETURN_ARG(QDBusVariant, retArg), Q_ARG(QDBusVariant, arg), Q_ARG(QDBusVariant, arg2), Q_ARG(QDBusVariant&, retArg2))); Change-Id: I36b24183fbd041179f2ffffd170271424c048292 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tst_QMetaObject: make sure we don't mix references with non-refsThiago Macieira2022-07-271-0/+10
| | | | | | | | We should fail to even find the method. `QString' and `QString&` are not compatible. Change-Id: I36b24183fbd041179f2ffffd170259bcf07fd459 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tst_QMetaObject: add some tests for passing and receiving pointersThiago Macieira2022-07-273-1/+86
| | | | | Change-Id: I36b24183fbd041179f2ffffd170259a81d65a36e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>