summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Add support for naming JNI functions with the unstringify macroJuha Vuolle2022-07-052-0/+27
| | | | | | | | | | | | | | The manually defined native JNI function tables allow defining a name that may be different from the actual function name; this name is then used from the Java-side. This can be useful to provide also as an option with the new "unstringifying" macros which can help for example in porting code to these new macros. Pick-to: 6.4 Change-Id: Icfebfb351cb8dfb122795d20b37e2eac167a41bf Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Harden drag and drop handling in widget windowLaszlo Agocs2022-07-011-0/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | User code in an event handler can do arbitrary things, including operations that lead to destroying the QWidgetWindow. An example is what the autotest does: reparenting the top-level widget to under another top-level upon the drop. Internally this leads to destroying the drop target's QWidgetWindow as the widget is now a child, not a top-level. In fact some of the existing drag and drop handling code seems to be prepared to handle the case of having the drag target widget destroyed in the user's event handler during a drag-move. But none of it is prepared for having the QWidgetWindow destroyed upon returning from forwardEvent(). The associated bug report has the same root cause, it is just popping up now via the new 6.4 behavior: adding a QOpenGLWidget to a widget hierarchy upon a drop leads to getting a new QWidgetWindow (if the window only had regular raster widgets before). To solve this, avoid touching members on 'this' after the forwardEvent(). It looks like the handlers for mouse events follow this pattern already, no member data is touched after forwarding events (not sure if that is intentional or just incidental but it is the safe solution, even if this is not feasible everywhere, but ideally input events should take this into account). Fixes: QTBUG-104596 Pick-to: 6.4 6.3 6.2 Change-Id: I96c704cadcd799fc5619b776e939dfdf313a27dd Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QLayout: add className() to a warning messageAhmad Samir2022-07-012-2/+2
| | | | | | | | | | | | | | | | Since objectName() isn't always set, the className() makes it slightly easier to find and fix the issue. Also unify some wording "produce a warning", which is generic enough to fit: print warning in terminal print warning in logviewer (if you're unlucky and have to use Windows?) print warning in system journal (if you're unlucky have to use binary systemd journal logs) Pick-to: 6.4 Change-Id: I7522d65666cb5829c33c45039b8646dd535e21ea Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* IM: Don't let all widgets support IM by defaultRichard Moe Gustavsen2022-07-011-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A new property Qt::ImEnabled was added in Qt 5.3. Since the already existing widgets with IM support (3rd party included) didn't implement this property, QWidget got the fall back logic that if a widget was queried for Qt::ImEnabled, and the returned QVariant was invalid (the widget didn't implement it), we would, for backwards compatibility with Qt 4, return "true" (meaning that the widget supports IM). But a side effect from this fallback logic, is that now any widget that doesn't implement ImEnabled (or input methods at all) report that they support IM. This will confuse platforms like iOS, which uses ImEnabled to decide if the input panel should show, and if text selection tools should be enabled. The result is therefore that if you click on a QPushButton, the input panel will open. This patch will implement a more careful strategy to check if a widget implements IM, if ImEnabled is missing. Rather than saying that all widgets that don't implement ImEnabled supports IM, we now require that the widget also returns a valid QVariant for Qt::ImSurroundingText. We assume then, that a widget that doesn't do so will anyway not be in need of input method support from the platform. Fixes: QTBUG-104527 Pick-to: 6.4 6.3 6.2 Change-Id: Ib391fd1daae92c4325e9ccb59730fbdd7c9328fc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Create a promise wrapper for C++ and port existing usesMikolaj Boc2022-06-302-0/+646
| | | | | | | | | | | | | | | Currently, to use a promise from C++ we either have to use an ASM block (which does not work well with dynamic linking) or declare exports in the EMSCRIPTEN_BINDINGS block, which is cumbersome and cannot be chained. This solution makes it easy to use js promises by introducing the WebPromiseManager which dispatches callbacks to appropriate callers when available. This is a preliminary patch for FileSystem support, which will heavily use async APIs. Task-number: QTBUG-99611 Change-Id: I368a8f173027eaa883a9ca18d0ea6a3e99b86071 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* wasm: add qtwasmtestlibMorten Johan Sørvig2022-06-295-0/+416
| | | | | | | | | | | | | | | | | | | | | | | | qtwasmtestlib supports writing asynchronous tests for the web platform. Asynchronous test functions differ from normal test functions in that they allow returning from the test function before the test has completed: void TestObject::testTimer() { QTimer::singleShot(100, [](){ completeTestFunction(); // Test pass if we get here }); } Currently one logging backend is supported which writes the results to an html element. See the README file for further documentation. Change-Id: Ia633ad3f41a653e40d6bf35dd09d62a97c608f84 Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* qtestlib: exit with error if a test is invoked with unknown data tagDimitrios Apostolou2022-06-281-0/+52
| | | | | | | | | | | | | | Previously trying to execute a test function with an unknown data tag would print an error message but exit with 0. This patch stores a test failure, and continues trying to execute the rest of the command line arguments, if any. In the end the process exits with the usual exit code (number of failed tests) which is now !=0. Pick-to: 6.4 6.3 6.2 Fixes: QTBUG-24240 Change-Id: Id4d422035f173e01e77ca88028dfd94dc0f9085c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Avoid including qopenglfunctions header files if Qt is built with GLES2Alexey Edelev2022-06-281-1/+3
| | | | | Change-Id: I3a7a69f5eef604408713934811efb984e78d68dd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* rhi: metal: Switch back to presentDrawableLaszlo Agocs2022-06-281-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This convenience should be, according to the Apple docs, equivalent to calling present from a scheduled handler. (which on its own makes it unclear why we switched in the first place) In practice it seems the two approaches are not identical. It looks like that once a frame is submitted earlier than the next display link callback, the throttling behavior we implement in beginFrame() (waiting on the semaphore for the completion of the appropriate command list etc.) starts exhibiting unexpected behavior, not correctly throttling the thread to the refresh rate. Changing back to presentDrawable does not exhibit this at all. The suspicion is that presentDrawable is probably doing more than what the docs suggest, and so is not fully equivalent to calling present manually from a scheduled handler. Therefore, switch to presentDrawable now, which restores the expected cross-platform behavior, but make a note of the oddity, and also prepare the hellominimalcrossgfxtriangle manual test to provide an easy, self-contained application to allow experimenting in the future, if needed. This allows Qt Quick render thread animations to advance at the expected speed (because the render thread is correctly throttled to the refresh rate), even if the render thread decides to generate a new frame right away, without waiting for the next display link update. Without this patch, attempting to get updates not via requestUpdate(), but by other means (timer etc.) leads to incorrect throttling, and so the triangle in the test app is rotating faster than expected - but only with Metal. Running with OpenGL on macOS or with any API on any other platform the behavior will be correct. Even if scheduling updates without display link is not efficient, and should be discouraged, not doing so cannot break the core contract of vsync throttling, i.e. the thread cannot run faster just because it renders a frame not in response to an UpdateRequest. Amends 98b60450f7ce6b16464392747ab8721f30add15e (effectively reverts but keeps the code and the notes because we might want to clear this up some day) Pick-to: 6.4 6.3 6.2 Fixes: QTBUG-103415 Change-Id: Id3bd43e94785384142337564ce4b2644bf257100 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* FatalSignalHandler: print some more information from siginfo_tThiago Macieira2022-06-281-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The siginfo_t parameter allows us to show what process sent a signal or the crashing address. Additionally, it allows us to determine if the crashing signal was indeed sent due to a crash. The selftest tst_crashes produces now: $ QTEST_DISABLE_STACK_DUMP=1 ./crashes ********* Start testing of tst_Crashes ********* Config: Using QtTest library 6.4.0, Qt 6.4.0 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 11.2.1 20220420 [revision 691af15031e00227ba6d5935c1d737026cda4129]), opensuse-tumbleweed 20220428 PASS : tst_Crashes::initTestCase() Received signal 11 (SIGSEGV), code 1, for address 0x0000000000000004 Function time: 0ms, total time: 0ms [1] 201995 segmentation fault (core dumped) QTEST_DISABLE_STACK_DUMP=1 ./crashes The last line comes from the shell. The code isn't decoded, but on Linux it's a SEGV_MAPERR. macOS prints exactly the same thing. I've updated one of the expected_crashes_*.txt output that doesn't seem possible (the "Received a fatal error" message does not appear in Qt anywhere). Pick-to: 6.4 Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16ebc8391234f0e2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QKeySequenceEdit: add a maximumSquenceLength propertyLaszlo Papp2022-06-271-0/+37
| | | | | | | | | | | | | | | At the very least, it would be important to have a single combination key sequence. This is commonly seen in keyboard shortcut editors where QKeySequenceEdit is very much applicable. [ChangeLog][QtWidgets][QKeySequenceEdit] Added a maximumSquenceLength property. Done-with: Marc Mutz <marc.mutz@qt.io> Change-Id: Id7fa5a8593eb150fa67d7e89308492c0a200ac36 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix QDBusInterface crashing with empty path on constructionMårten Nordheim2022-06-271-0/+7
| | | | | | | | | | | | | On some machines having an empty path passed to QDBusInterface would cause a crash. This happened because the code created a QDBusMessage and manually marked it as validated when it was not. The validation would not pass for this object. Change-Id: I496dd922fa64353399655a1e84996b99990f5879 Pick-to: 6.4 6.3 6.2 5.15 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QHttpHeaderParser: Allow larger fields but restrict total sizeLars Schmertmann2022-06-274-16/+143
| | | | | | | | | | | | | | | | | | Our limit of 8k for a single header field was too small for certain services which returned Location values or WWW-Authenticate challenges longer than 8k. Instead, taking inspiration from Chromium, we have a limit of 250k for the full header itself. And increasing our field limit to 100k, which would occupy almost half of what the total header allows. Also took the opportunity to make it adjustable from the outside so we can set more strict limits in other components. Fixes: QTBUG-104132 Pick-to: 6.3 6.4 Change-Id: Ibbe139445e79baaef30829cfbc9a59f884e96293 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
* tst_moc: fix build with GCC 12Thiago Macieira2022-06-241-3/+3
| | | | | | | | | | | | | You can't mismatch the export macros. The QT_MOC_EXPORT_PLUGIN_V2 macro defines these functions as Q_DECL_EXPORT so they can be found by QPluginLoader. We must match the macro here, otherwise GCC 12 complains (tst_moc.cpp is compiled with -fvisibility=hidden): tst_moc.cpp.o: non-canonical reference to canonical protected function `qt_plugin_instance' in moc_plugin_metadata.cpp.o Pick-to: 6.4 Change-Id: Id0fb9ab0089845ee8843fffd16f99893d5730da5 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Emit autolinks in QTextMarkdownWriterShawn Rutledge2022-06-242-2/+4
| | | | | | | | | | | | | | | | | | | When a markdown document contains a "naked" URL, or an angle-bracketed <URL>, md4c recognizes it, and we set the AnchorHref charfmt property. There's no need to expand it into the [text](url) form if the text is the same as the url, there is no tooltip, and the url is valid. QTextMarkdownWriter now writes a CommonMark "autolink" in that case: https://spec.commonmark.org/0.30/#autolinks [ChangeLog][QtGui][Text] QTextMarkdownWriter now writes an autolink whenever a hyperlink has no custom text and no tooltip, including when the document was parsed from Markdown containing a naked URL. Pick-to: 6.4 Fixes: QTBUG-94713 Change-Id: I432db8499c62e1e0b1e913bfd8ef2147e3c2bb2a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Support markdown in QTextEditMimeData; fix pasting trailing newlinesShawn Rutledge2022-06-242-0/+105
| | | | | | | | | | | | | | | | | | | - Since 4edcea762d9ce334c4c1a78234c90c118b81da87 the dropsite example shows markdown if available; and now it shows that when we do DnD of a selection from the richtext example, text/markdown is available. - If we artificially make html unavailable, copying and pasting between widget-based rich text editors uses markdown. In case markdown writer output contains unnecessary backticks due to monospace fonts getting used, the workaround from 1ad456c908467212bc30223a69eb7524b64b86e1 is applied. Pick-to: 6.4 Task-number: QTBUG-76105 Task-number: QTBUG-103484 Change-Id: Ie6ca4dbb450dbc36b3d09fd0df1ae5909aaebca7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Blacklist qtcpsocket bind on arm macOSToni Saario2022-06-241-0/+2
| | | | | | | | This was unblacklisted in b885820c395a0bbfb0ff55ab0ee47a4703aa6b59 however it is still very flaky. Change-Id: If9796231c584c894387106dfeb262c9eb4ce73f5 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Network: Update expired certMårten Nordheim2022-06-242-30/+30
| | | | | | Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I233ffee5b720c0554071c1d49d4fb861736b2e2a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* unblacklist passing tests 2022Anna Wojciechowska2022-06-2310-55/+31
| | | | | Change-Id: Ifb09a997d39fc2c92503e77cf372d443c13c4c2b Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
* moc: fix use of escape sequence of more than one characterThiago Macieira2022-06-221-20/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We had the code to calculate the length, but were improperly using it only for the offset, not the length of the string or its containing array. That resulted in the generated moc output containing: QT_MOC_LITERAL(111, 5), // "\xffz" QT_MOC_LITERAL(114, 5), // "\0012" QT_MOC_LITERAL(117, 23), // "slotWithAReallyLongName" The two strings are described as occupying 5 bytes (length 4 + null terminator), which is incorrect. The offset was correct: 114 - 111 = 3 and 117 - 114 = 3. The new output is: QT_MOC_LITERAL(111, 2), // "\xffz" QT_MOC_LITERAL(114, 2), // "\0012" QT_MOC_LITERAL(117, 23), // "slotWithAReallyLongName" The effect of the array size calculation would only be felt if moc decided it needed a second string array (for strings over 65535 bytes), which would cause the offsets in the second array to be all wrong. There was no such test until now. Drive-by fixing of the newline, indentation, and the stale comment referring to QByteArrayData (Qt 5). Pick-to: 6.2 6.3 6.4 Change-Id: Id0fb9ab0089845ee8843fffd16f9cd01b3e0709a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add QDom internalSubset implementationYe ShanShan2022-06-231-0/+66
| | | | | | | | | | | | QDom's internalSubset() always returned empty because nothing actually set the internal data member it returns. When parsing the DECLTYPE, extract the internal subset and save it to the doctype()'s member when present. Pick-to: 5.15 6.2 6.3 6.4 Fixes: QTBUG-53661 Change-Id: I6e41ff8b914381168246073b3289d82205b1c255 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* moc: Allow reading property values through bindablesUlf Hermann2022-06-221-0/+39
| | | | | | | | | | | | | The behavior is similar to MEMBER: If the READ accessor is "default", synthesize it using the bindable. [ChangeLog][QtCore] You can now specify "READ default" in a Q_PROPERTY if you also specify a BINDABLE. moc will synthesize a READ accessor in that case. Task-number: QTBUG-97249 Change-Id: I4a275adabaed12df95dac505095f847c4be65dfe Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QJsonValue: fix incorrect to{Array,Object} when the value is emptyThiago Macieira2022-06-211-2/+16
| | | | | | | | | | | | This is a repeat of commit de6ced66920600e659dbaa2509526a3bcb0b3360 "QCborValue: fix incorrect to{Array,Map} when the value is empty" (6.4), which fixed the same thing for QCborValue. I've just copied the exact same implementation onto the QJsonValue functions. Pick-to: 6.2 6.3 6.4 5.15 Fixes: QTBUG-104085 Change-Id: I175efddd75f24ae59057fffd16f6b257bf7ed36d Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* tst_tostring: add benchmarks for QCOMPARE vs. QCOMPARE_EQMarc Mutz2022-06-221-0/+55
| | | | | | | | | | | | | | There's currently no statistically-significant difference between the two, due to a huge pessimistion in QTestLib where every QCOMPARE* and QVERIFY writes 1KiB of data onto the stack before doing anything else, so I'm not reporting numbers in this commit message. Pick-to: 6.4 Task-number: QTBUG-98873 Task-number: QTBUG-98874 Change-Id: I233878596f0a8fe6b96360adb839fecd72c398a2 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tst_bench_shared_ptr: fix build with BOOST_NO_EXCEPTIONSMarc Mutz2022-06-221-0/+13
| | | | | | | | | | | | | | | | | If, for whatever reason, BOOST_NO_EXCEPTIONS is defined, the user of the Boost libraries is supposed to provide a definition of boost::throw_exception, which we didn't. We used to run into this only on ubsan builds, but it seems we now have the problem on a regular Ubuntu 22.04 build, too (cf. bugreport). Fix by adding the necessary definitions. Fixes: QTBUG-104083 Pick-to: 6.4 6.3 Change-Id: I9b061a158a5b77e8d286bd7b40312e5bc63ee8de Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QPromise: run continuation(s) on destructionSona Kurazyan2022-06-221-0/+20
| | | | | | | | | | | | | | | | | | If the QFuture is canceled because the associated QPromise has been destroyed, we still need to run its continuations (i.e. onCanceled handler, if it's attached), so replaced the cleanContinuation() call inside ~QPromise() with runContinuation(), which will also take care of cleaning the continuation. [ChangeLog][QtCore][Important Behavior Changes] QFuture now runs its continuations when its associated QPromise has been destroyed. Previously, if a QFuture was canceled because the associated QPromise has been destroyed, its continuations were skipped. Fixes: QTBUG-103992 Pick-to: 6.4 6.3 6.2 Change-Id: Ie05bc760c96c349aade8adb8d2fe5263aff8efac Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Remove unused variable in tst_QTextEdit::setDocumentPreservesPalette()Shawn Rutledge2022-06-211-1/+0
| | | | | Change-Id: I96c0f39c2ee1bd03cf0d7939624652ee008c9726 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Add QStringDecoder::decoderForHtml()Lars Knoll2022-06-211-20/+64
| | | | | | | | | | | | | | Now that QStringConverter can handle non UTF encodings through ICU, add a way to get a decoder for arbitrary HTML code. Opposed to QStringConverter::encodingForHtml(), this method will try to create a valid string decoder also for non unicode codecs. Pick-to: 6.4 Change-Id: I343584da1b114396c744f482d9b433c9cedcc511 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDom: Stop treating non-BMP characters as invalidSona Kurazyan2022-06-201-0/+22
| | | | | | | | | | | | | According to https://www.w3.org/TR/REC-xml/#NT-Char unicode characters within the range of [#x10000-#x10FFFF] are considered to be valid, so fix the check for valid characters accordingly. This requires changing the loop over the input QString to iterate over code points (instead of code units). Fixes: QTBUG-104362 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I7dcf5cad05265a54882807a50522d28b647e06ee Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* function_ref test: Don't take reference of temporariesMårten Nordheim2022-06-201-5/+10
| | | | | | | | | | | | | When assigning the lambdas directly to a function_ref their lifetime is limited to that of the expression. Store them on the stack first to avoid the UB. Fixes: QTBUG-104419 Pick-to: 6.4 Change-Id: I3c85ac683b0bd7768b646dc9d0a1ed4dd173e6f3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QGraphicsScene: respect that items can override selection changesVolker Hilsheimer2022-06-201-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | QGraphicsItems may override itemChange to prevent certain attribute changes. Overriding ItemSelectedChange this way is explicitly documented to be allowed. However QGraphicsScene::clearSelection did not test whether items were in fact deselected after the call to setSelection, and always cleared the stored set of selected items. Fix this by checking the actual selected state of the item as we iterate over them, and store those items that are still selected in a set that becomes the new selectedItems set (which will be empty if no item overrides, which is the default). Add a test that also checks that clearing the selection emits the selectionChanged signal correctly (and does not if all selected items block being deselected). Fixes: QTBUG-85474 Pick-to: 6.4 6.3 6.2 Change-Id: I665afc132876e02e6e1061b7be37f4f6e4be418f Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* BLACKLIST tst_qfont for Ubuntu 22.04Heikki Halmet2022-06-201-0/+2
| | | | | | | Pick-to: 6.4 6.3 6.2 5.15 Task-number: QTBUG-84248 Change-Id: I2978cd2a6ed07bb6fc5769b174d0a897dfa3566d Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
* Avoid misleading bindingStatusAllan Sandfeld Jensen2022-06-201-1/+37
| | | | | | | | | | | Set it to nullptr on clear, and deal with possibly null bindingStatus. Task-number: QTBUG-101177 Task-number: QTBUG-102403 Pick-to: 6.4 Change-Id: I66cb4d505a4f7b377dc90b45ac13834fca19d399 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* BLACKLIST: tst_QGlyphRun::mixedScripts for Ubuntu 22.04Heikki Halmet2022-06-201-0/+1
| | | | | | | Pick-to: 6.4 6.3 6.2 5.15 Task-number: QTBUG-68860 Change-Id: I79c085c7321e0bee78e8cb31daa8c7992d3a3ec6 Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
* BLACKLIST tst_QApplication::sendEventsOnProcessEvents for Ubuntu 22.04Heikki Halmet2022-06-201-0/+1
| | | | | | | Pick-to: 6.4 6.3 6.2 5.15 Task-number: QTBUG-87137 Change-Id: Ib09382af7504f5ee078d23cc021c1b0faf051e23 Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
* BLACKLIST tst_QMenuBar::check_menuPosition for Ubuntu 22.04Heikki Halmet2022-06-201-0/+1
| | | | | | | Pick-to: 6.4 6.3 6.2 5.15 Task-number: QTBUG-68865 Change-Id: I1eda9789a30737104c6e97de583a9f3022ae0bf6 Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
* tst_qthread: Fix compilation under ubsanFabian Kosmale2022-06-201-4/+4
| | | | | | | | | We missed the terminating ";" in the QSKIP lines. Amends ea4d6b987ae10f1bb910081b523c3b22b11f7b64 Pick-to: 6.3 6.4 Change-Id: Ibda43b8a84230c243dbcc74e157f4c3f8ef3891d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Skip tests that terminate threads under ASANVolker Hilsheimer2022-06-191-0/+16
| | | | | | | | | | | | | | | Thread termination might prevent stack unwinding, which then generates ASAN errors such as ERROR: AddressSanitizer: stack-buffer-underflow on address 0x7f3c1d7858b0 at pc 0x7f3c243d8918 bp 0x7f3c1d7857f0 sp 0x7f3c1d7857e8 Skip such tests so that we can enable blocking CI runs under ASAN. Fixes: QTBUG-104421 Pick-to: 6.4 6.3 Change-Id: I169235a12190e3f72525cddfe1a44a4bee19eca1 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Long live the ICU-based QStringConverter interface!Fabian Kosmale2022-06-193-2/+280
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for additional codecs to QStringConverter when ICU is available. We store the converter in the state (d[0]), and its canonical name in d[1]. We need the name there, as in the clear function we close the UConverter, and set the pointer to null. Consequently, the actual conversion functions might need to re-open the converter again. The advantage of this approach is that clear is used in the destructor of State, and with this approach we properly clean up the state. There is however a disadvantage: The clear function was so far also used for resetting the state when QStringConverter::resetState . Discarding the whole Uconverter for that is however rather costly. For that reason we modify resetState to call a new function, State::reset. For existing converters, it behaves the same as clear; for the ICU based converter, we call the more efficient ucnv_reset. Code compiled against Qt 6.4 can benefit from this more efficient version; code compiled against older Qt versions will continue to work, as the conversion functions can just recretate the converter from the name. We can distinguish between ICU and non-ICU converters by checking if the UsesIcu flag is set. QStringConverter::name is changed to return the name stored in d[1]. The interface of the ICU converter has a dummy name, so code using the old name function from QT < 6.4 still returns something, namely a message asking the user to recompile. The function is moved out of line, as we need to check for the private ICU feature, and want to avoid having that check in the public header. As the QStringConverter ctor taking a name now can allocate memory, it can no longer be noexcept. Removing the noexceptness is safe, as it was only added after Qt 6.3. Note that we cannot extend the API consuming or returning Encoding, as we use Encoding values to index into an array of converter interfaces in inline API. Further API to support getting an ICU converter for HTML will be added in a future commit. Currently, the code depending on ICU is enabled at compile time if ICU is found. However, in the future it could be moved into a plugin to avoid a hard dependency on ICU in Core. [ChangeLog][Corelib][Text] QStringConverter and API using it now supports more text codecs if Qt is compiled with ICU support. Fixes: QTBUG-103375 Change-Id: I7afb92fc68ef994179ebc7a3aa73beebb1386204 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update window state in QWindowsWindow and QXcbWindow geometry settersAxel Spoerl2022-06-171-0/+97
| | | | | | | | | | | | | | | | | When QWidget::resize() is called on a maximized or minimized QWidget, the window state of the widget and the corresponding QWindow is not updated (i.e. remains maximized or minimized). This patch updates the window state to Qt:WindowNoState when setGeometry() is called in QWindowsWindow or QXcbWindow. A test is added in tst_QWidget. Fixes: QTBUG-104201 Pick-to: 6.4 Change-Id: I07491fb9293d13509573fc403750da0a50f6a785 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QMainWindow: fix restoreState() for toolbarsIvan Solovev2022-06-171-0/+5
| | | | | | | | | | | | | | | | | | Restoring the toolbar state of a QMainWindow could not update QWidgetPrivate::widgetItem for the QToolBar, because at that point it was still holding the pointer to the widgetItem of the previous state. Later on, when the new state was successfully applied, the previous state was deleted, and the corresponding widgetItem was reset to nullptr. This patch explicitly resets the QToolBar's widgetItem while updating the state, so that it is later correctly updated while creating a new QWidgetItemV2. Fixes: QTBUG-102395 Pick-to: 6.4 6.3 6.2 5.15 Change-Id: I17613d62423edcc0faf85ecb0a714865a50d87e8 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Teach qmake about digit-grouping apostrophes in numeric literalsEdward Welbourne2022-06-173-3/+16
| | | | | | | | | | | | | It was previously understanding them as character literal delimiters, with unfortunate consequences if a numeric literal contained an odd number of them. Recognize that an apostrophe with a digit on each side of it isn't the opening quote of a character literal (unless the digit before it is preceded by a u). Extend the findMocs test to trigger the bug, prior to the fix; verified it passes with the fix. Fixes: QTBUG-98845 Change-Id: I5db3ac59aaeade7c2d6c1fb680ba97261ec0e8a9 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QComboBox: emit currentIndexChanged() and currentTextChanged() when the ↵Ivan Solovev2022-06-161-0/+33
| | | | | | | | | | | | | | | | | | model is cleared QComboBox uses QPersistentModelIndex to store the current index of the underlying model. When the model is cleared, that index is automatically invalidated, so calling QComboBoxPrivate::setCurrentIndex(QModelIndex()) does not result in signals being emitted, because we do not detect the index change. This patch uses indexBeforeChange to detect such situation and emit all necessary signals. Fixes: QTBUG-103007 Pick-to: 6.4 6.3 6.2 Change-Id: I29326830a30a17900839e8d1737a08bd940081ea Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Work around lavapipe bug in tst_qvulkanLaszlo Agocs2022-06-161-7/+9
| | | | | | | | | | | Work around https://gitlab.freedesktop.org/mesa/mesa/-/issues/5875 by treating the driver as broken when both the driver and device UUIDs are all zeroes. Fixes: QTBUG-104231 Pick-to: 6.4 6.3 6.2 Change-Id: Ibf7973361d472ebb1cb433bc61b50b2828f75c6b Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Accessibility: don't emit focus change when reason is window activationVolker Hilsheimer2022-06-161-0/+10
| | | | | | | | | | | | | | | | | | | | If a window becomes active, then the accessibility system gets informed about that already. Qt puts focus on the focus child of the activated window afterwards, and if this emits another accessibility event, then accessibility clients like Windows Narrator will stop reading the activated window, and instead read about the focused widget. This makes dialogs like message boxes poorly accessible. Accessibility clients already know that a window became active, and can query Qt about the focused child within that window. Amend test case. Fixes: QTBUG-101585 Pick-to: 6.4 6.3 6.2 Change-Id: I2d6bff7c415a6f29c4a4f7f4e4be38079fb976ca Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Implement a dedicated QAccessibleInterface for QMessageBoxVolker Hilsheimer2022-06-161-0/+104
| | | | | | | | | | | | | | | QMessageBox has text values that an accessible client should be able to read directly without having to navigate through the text labels. Add test coverage. Windows Narrator is inconsistent in reading the contents of a message box. It might skip them completely, even though the text property is read through the interface. Task-number: QTBUG-101585 Change-Id: I639c2210a627733c093743790c6a6b83f4bb80d0 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Endian: Remove old special integer bitfieldsUlf Hermann2022-06-161-29/+0
| | | | | | | | | | | | | | The only way to use them was to put them in a union and then write all the members of the union to set the various bit ranges. As only one member of a union can be active at any time, the compiler is free to optimize those writes away, though. This has started happening in the wild now. As we have a replacement, we can remove the old and broken code now. Task-number: QTBUG-99545 Change-Id: I90718ec06662258d1c15220f54da9eed2186c5a5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QStringConverter: fix use-after-free in the stack in the testThiago Macieira2022-06-151-7/+11
| | | | | | | | | Detected by ASan. Introduced by aef27c5aa2f43e8e34970168dfc517062cc87db8 Pick-to: 6.3 6.4 Fixes: QTBUG-104261 Change-Id: Id0fb9ab0089845ee8843fffd16f88bdeb4f42c7c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Increase timeout of slow test for ASAN-enabled buildDimitrios Apostolou2022-06-151-0/+4
| | | | | Change-Id: I47b6e7e1462c1af7d41677bfe7bb0f78430f72d1 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Fix memory leaksDimitrios Apostolou2022-06-152-0/+5
| | | | | | | | | | This renders these simple tests ASAN and LSAN (Address Sanitizer and Leak Sanitizer) clean. Change-Id: Ibe5b7054a20c1575a1a7939b0bed4101afeeee56 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>