summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Do not use QExposedEvent::region() in internal codeIvan Solovev2022-07-132-27/+1
| | | | | | | Task-number: QTBUG-104857 Pick-to: 6.4 6.3 6.2 Change-Id: I5ee41802ecc4d6291aaaa1f0efddd20027c1c1e4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use debug stream in QTest::toString's default fallback if possibleVolker Hilsheimer2022-07-1316-65/+135
| | | | | | | | | | | | | | | | | | | | For built-in types, this is a compile-time assert - we should not have any types in Qt for which we have neither debug streaming nor a QTest::toString specialization implemented. A build of most of Qt submodules passes with this change, after minor modifications to some tests. We cannot declare QSizeHint::Policy as a metatype after the QMetaType has already been instantiated for it, and the QDebug stream operator for QElaspedTimer needs to be correctly declared within the namespace. Add a self-test function for a custom type, and update reference files of the self-test. Task-number: QTBUG-104867 Pick-to: 6.4 Change-Id: I2936db5933f4589fce45f47cf2f3224ed614d8c9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Skip test which depends on window activations on WaylandEskil Abrahamsen Blomfeldt2022-07-131-2/+4
| | | | | | | | | | | Wayland does not support window activation, so rather than skipping tests based on platform name, we can use the platform capability (which will also cover future platforms with the same issue) Pick-to: 6.4 Task-number: QTBUG-104241 Change-Id: Ibf5f8968f3979b789ef68f92768419bef4500fb3 Reviewed-by: Inho Lee <inho.lee@qt.io>
* Add QInputDevice::name() to output in device_information manual testShawn Rutledge2022-07-131-0/+1
| | | | | | | Pick-to: 6.4 6.3 6.2 Task-number: QTBUG-104878 Change-Id: I4299228c90777d71f01c3e2607f8ad4af6e081ed Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QThread: Initialize bindingStatus for adopted threadsFabian Kosmale2022-07-131-0/+17
| | | | | | | | | | | | | If we create a QThread from QThread::current(), we want it to have a correct value for its bindingStatus. Thus, initialize bindingStatus in the ctor of QAdoptedThread. Task-number: QTBUG-101177 Task-number: QTBUG-102403 Pick-to: 6.4 6.3 Change-Id: I3ef27ed62c5dc25eed05d551c72743a1b8528318 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* wasm: secondary thread blocking sockets exampleMorten Johan Sørvig2022-07-133-0/+105
| | | | | | | | Connects to echo_server via websockify, like the async version. Pick-to: 6.4 Change-Id: I9ed560cd388cfddbd0d284d8d40fb7ddf964ba96 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* qobjectrace test: Don't hardcode the number of threadsVolker Hilsheimer2022-07-121-11/+18
| | | | | | | | | | | | | | | | Use QThread::idealThreadCount instead. This requires that we use QVarLengthArray, as MSVC doesn't allow us to allocate arrays with a non-constexpr size on the stack. By using as many threads as the system has cores, we are more likely to detect race conditions reliably. On systems with fewer cores (in particular on qemu platforms like QNX, where this test has been failing a lot), we'll less likely end up with false negatives due to timeouts. Pick-to: 6.4 6.3 6.2 Change-Id: Ie8631aef544ca7b53c06a0729d05459016745486 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* rhi: Clean up some inconsistenciesLaszlo Agocs2022-07-123-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some of the offsets are already quint32 in the API (vertex input attributes, dynamic offsets, offsets in draw calls), matching the reality of the underlying 3D APIs, but many buffer-related functions use int as of now, simply because that used to be the default choice, and the same goes for sizes (such as buffer or range sizes). This is not quite consistent and should be cleaned up if for nothing else then just to make the classes consistent, but also because no 3D API use a signed type for offsets, sizes, and strides. (except OpenGL for some) When it comes to strides (for vertex inputs and raw image texture uploads), those are already all quint32s. This is straightforward because most of the 3D APIs use 32-bit uints for these regardless of the architecture. Sizes and offsets are often architecture-dependent (Vulkan, Metal), but there is at least one API where they are always 32-bit even on 64-bit Windows (UINT == unsigned int, D3D11). In addition, we do not really care about buffer or texture data larger than 4 GB, at least not without realistic use cases and real world testing, which are quite unlikely to materialize for now (esp. since we still have the width/height of 2D textures limited to 16 or 32K in many cases even on desktops, whereas 2GB+ buffers are not guaranteed in practice even when an API seemingly allows it). In any case, the important change here is the signed->unsigned switch. A number of casts can now be removed here and there in the backends, because the offsets and sizes are now unsigned as well, matching the underlying API reality. The size can be potentially increased later on with minimal effort, if that becomes necessary for some reason. Change-Id: I404dbc365ac397eaeeb3bd2da9ce7eb98916da5f Reviewed-by: Inho Lee <inho.lee@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* QJniObject: Add template overloads for get/setStaticFieldVolker Hilsheimer2022-07-121-0/+7
| | | | | | | | | | | | | | Allow specifying the Java class on which to set/get the field via its corresponding C++ type, removing the need to explicitly provide the Java type string. Those were missing from a085a14d76553ebd1fa4a4a11a27110ee544a531, which was noticed when porting QtConnectivity over to the new template APIs. Pick-to: 6.4 Change-Id: I8f324c9fcc486b4c6c2f2b9051f7eca0cbec0e91 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Disable unit testing setting up QTcpServer on special Apple interfacesØystein Heskestad2022-07-121-0/+6
| | | | | | | | | | | | The iBridge interface is used for the keyboard touch bar, and the Apple Wireless Direct Link interfaces are used by Apple for various purposes. Setting up a server on these interfaces does not work. Only the tst_QTcpServer::linkLocal unit test on macOS is affected by this change. Fixes: QTBUG-103892 Change-Id: I29701ce51d5e40dff6c59547a8639c1fba330d36 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Specialize MetaObjectForType for non-pointer QObject-derived typesMikolaj Boc2022-07-121-0/+1
| | | | | | | | | | | | | | | | | | QMetaTypeInterfaceWrapper tries to find the metaObjectFunction using the MetaObjectForType template. Using SFINAE, for a QObject, it should resolve to a suitable specialization. Such a specialization doesn't yet exist. It had to be created. The following path returns nullptr for registered meta types: auto metatype = QMetaType(typeId); requestedTestType.metaObject() -> returns nullptr since a bad template argument is fed to MetaObjectForType<T> in QMetaTypeInterfaceWrapper<IneritingFromQObject>::metaType's static initializer. Change-Id: I8b31c51e12cb19c333e00480b0177354b910ce1e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDomDocument: add a missing full-stop to a warning messageSona Kurazyan2022-07-121-1/+1
| | | | | | Change-Id: I3c44afa466cbcb12fc0b44ad8bd1b52ded5f4ddd Pick-to: 6.4 6.3 6.2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Port QXmlStremReader to QAnyStringViewSona Kurazyan2022-07-121-0/+22
| | | | | | | | | | | | | | | | Port the constructor and addData() method to QAnyStringView, but keep the overloads taking a QByteArray to avoid extra copies when actual QByteArray is passed. These overlaods need to be Q_WEAK_OVERLOADs, to avoid ambiguities (e.g. for const char * arguments). Additionally, add a test to make sure the patch doesn't break parsing from a QLatin1StringView input. [ChangeLog][QtCore][QXmlStremReader] Added constructor and addData() overloads taking QAnyStringView. Change-Id: I0efaab82a2123271c88407e380f3c67d1099a4a6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add wasm exception for tst_qcharDavid Skoland2022-07-111-0/+5
| | | | | | | | | Since wasm doesn't like filesystems that well, we omit this test in tst_qchar for wasm, this allows us to still run the test without the case where it needs to read the normalization file. Change-Id: I37e54d97e119f94e1a9ca53917d0b93183321899 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Fix directory listing in manual filetest; add recursive findShawn Rutledge2022-07-111-6/+10
| | | | | | | | | | | | | - QFileInfo::fileName() is not the name of a directory, so we need absoluteFilePath() to construct a QDir - QDir::entryList() returns only the name suffix, not the whole path - stop at any arbitrary depth, and add a find command which does full recursion Amends 04a5a74685ceae7bc288f5960b9b5cab5ed28d79 Change-Id: I9870db092125a797e8b654e98954ac611dde1ab2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QString: fix lifetime issues with QRegularExpression APIsGiuseppe D'Angelo2022-07-101-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QString has several functions taking a QRegularExpression: indexOf(), contains(), and so on. Some of those have an out-argument of type QRegularExpressionMatch, to report the details of the match (if any). For instance: QRegularExpression re(...); QRegularExpressionMatch match; if (string.contains(re, &match)) use(match); The code used to route the implementation of these functions through QStringView (which has the very same functions). This however opens up a lifetime problem with temporary strings: if (getString().contains(re, &match)) use(match); // match is dangling Here `match` is dangling because it is referencing data into the destroyed temporary -- nothing is keeping the string alive. This is against the rules we've decided for Qt, and it's also asymmetric with the corresponding code that uses QRegularExpression directly instead: match = re.match(getString()); if (match.hasMatch()) use(match); // not dangling ... although we've documented not to do this. (In light of the decision we've made w.r.t. temporaries, the documentation is wrong anyways.) Here QRE takes a copy of the string and stores it in the match object, thus keeping it alive. Hence, extend the implementation of the QString functions to keep a (shallow) copy of the string. To keep the code shared as much as possible with QStringView, in theory one could have a function taking a std::variant<QString, QStringView> and that uses the currently active member. However I've found that std::variant here creates some abysmal codegen, so instead I went for a simpler approach -- pass a QStringView and an optional pointer to a QString. Use the latter if it's loaded. QStringView has some inline code that calls into exported functions, so I can't change the signature of them without breaking BC; I'm instead adding new unexported functions and a Qt 7 note to unify them. Change-Id: I7c65885a84069d0fbb902dcc96ddff543ca84562 Fixes: QTBUG-103940 Pick-to: 6.2 6.3 6.4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* testlib: Don't print QCOMPARE values if they lack string representationVolker Hilsheimer2022-07-107-54/+101
| | | | | | | | | | | | | | | | | | | | | | | Before 0681a2dd5a8095baddb5905fb21a58ce19b958c5, QCOMPARE'ing types for which no QTest::toString specialization exists did not output Actual and Expected lines on failure, as that would only print <null> for both values (which then look like the same value, confusingly). Commit 0681a2dd5a8095baddb5905fb21a58ce19b958c5 changed that behavior, and started printing the confusing <null> values. Take care of the logic in the formatFailMessage function: if both values are nullptr, then print only the variable names, but not the confusing <null> text representation of the values. Remove dead and duplicated code related to the formatting logic, add a self-test function, and update the expected_cmptest files. Fixes: QTBUG-104867 Pick-to: 6.4 Change-Id: I4be98e79f91196b14690a2cc0a68ffd50b431a45 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QKeySequenceEdit: Add a finishing key combinations propertyLaszlo Papp2022-07-091-0/+40
| | | | | | | | | | | | | | | | | | | | | Different shortcut editors seem to have different preferences. By default, QWidget seems to utilise Tab, Backtab, Return and Enter for navigation purposes. However, some shortcut editors would like to be able to record these keys as part of combinations to use in the application. Therefore, leave it with the application developers to decide what key combinations they would like to use for finishing the key sequence edit. This should provide enough flexibility for application developers to customize their shortcut editor behavior. [ChangeLog][QtWidgets][QKeySequenceEdit] Added a property to allow defining the finishing key combinations. Fixes: QTBUG-103844 Fixes: QTBUG-103843 Change-Id: Id84644086ca7a4f11618d510e59698a43735b99b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Long live QDebug op<< QMetaType!Marc Mutz2022-07-091-0/+24
| | | | | | | | | | | It's needed in QtHttpServer. [ChangeLog][QtCore][QDebug] Can now stream QMetaType. [ChangeLog][QtCore][QMetaType] Can now be streamed through QDebug. Change-Id: I974d77d678137715472a3907ab1e50ba2dbaa087 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Always update QPalette resolve mask, regardless of QBrush changeJiDe Zhang2022-07-081-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 56bd1b76d2e81c58a80bf6b5d74219c6b1ab8499 changed the update resolve mask behavior in QPalette to avoid detaching brush data when modifying the resolve mask if the brush value is not changed. But this behavior broke compatibility, it introduced unknown risks, and we cannot ensure that other code in Qt does not depend on the old behavior. We both need to ensure that we don't detach when the value is not changed, and ensure that the resolveMask is always updated regardless of whether the value changes, so we need to split them up and independently share the brush data. QFont will update its corresponding resolveMask even if the value has not changed, so it is better to correct this behavior so that QPalette and QFont are consistent. [ChangeLog][QtGui][QPalette] Always update resolve mask in QPalette::setBrush, even if the value of brush has not changed. Fixes: QTBUG-98762 Pick-to: 6.4 6.3 6.2 Change-Id: Ib845361b30f21c3d78c16ced923c1678b12e05ac Reviewed-by: JiDe Zhang <zhangjide@uniontech.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QWidget: use WA_InputMethodEnabled when ImEnabled is not implementedRichard Moe Gustavsen2022-07-081-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt 6.3, a check for WA_InputMethodEnabled was removed in QWidget, to support IM queries also for read-only widgets (7c6e4af48). This caused a regression on iOS, which made the input panel open for widgets that didn't support IM at all. A patch was merged that solved the regression (3b12305575), but it didn't take the widget attribute into account. Since not doing so has the potential to cause regressions, this patch will modify the affected code once more, so that we instead fall back to test WA_InputMethodEnabled when ImEnabled is not implemented. This will match closely to the way ImEnabled was implemented in Qt 6.2. Since we, with this change, now require that either ImEnabled or WA_InputMethodEnabled is set, our own input widgets will fail to support IM text selection when they're read-only, since they actually don't implement ImEnabled. This patch will therefore also make sure that we do so. Task-number: QTBUG-104527 Pick-to: 6.4 6.3 Change-Id: I70ad910aec38d0a74f4dd7d3115d3c45c16d2b3b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* moc: Allow writing properties through bindablesUlf Hermann2022-07-081-21/+58
| | | | | | | | | | | | | BINDABLE should generally behave the same as MEMBER if "WRITE default", except where it cannot. In particular we cannot know if any NOTIFY signal should be sent from the synthetic WRITE accessor. [ChangeLog][QtCore] moc will now synthesize WRITE accessors for properties with BINDABLE if you specify "WRITE default". Task-number: QTBUG-97249 Change-Id: I883c40ba0dda7989c840971860addaeaa75a8c83 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* rcc: Suppress clang's -Wexit-time-destructorshjk2022-07-074-0/+36
| | | | | | | | | | | | | | It's an opt-in warning that some people like to use. It was introduced to clang 3.0.0 in 2011 by https://github.com/llvm/llvm-project/commit/98766db7858379f61d24d5d93b1b7be39fda0913 However, the feature is intentionally used here and the generated code is legit. Make both sides happy. Change-Id: I79335cd3a6a6cc128fa65f77d201a12f67424260 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* rhi: Fix a manual testLaszlo Agocs2022-07-071-1/+1
| | | | | | | | ...that uses the old name after a recent change in the name of a function. Change-Id: Ife36fbb0c5d28b350cb1cfc48625528a205af8f9 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Revert "Apply ScaleFactorRoundingPolicy to QT_SCREEN_SCALE_FACTORS"Morten Sørvig2022-07-071-14/+1
| | | | | | | | | | | | | Unblock the qtdeclarative dependency update. This behavior change is causing a regression for QQmlPreviewHandler's zoom feature. Back out of the change for now, until we can find a way to make both use cases work. This reverts commit 1c0a56a2f3300750978f2d6c703b2b917e03e718. Change-Id: I1b3d84504bbcb4f2b2250a20194fdaf4ab4fd97f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add support for scoped JNI callbacksJuha Vuolle2022-07-072-0/+89
| | | | | | | | | | | | | | This commit adds macros for declaring scoped native callbacks which are in namespace or for example defined as static class member variables. The existing macros don't allow this as they use QtJniMethods namespace and the introduced callbacks' namespaces are not enclosed in that namespace, yielding a compilation error. Pick-to: 6.4 Change-Id: I754560bea7e9a1b57c2661d1ee7236e78db39ba1 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* qdbusxml2cpp: allow choosing <> over ""Mate Barany2022-07-071-0/+49
| | | | | | | | | | | | | | | | | | | | qdbusxml2cpp's -i option uses "" for the includes. However, an option to include with <> would be also desirable, since some compilers may use a different search strategy for <> than for "". Add a new command line option -I/--global-include to include the given argument using <>. The new option will be used in qtconnectivity. [ChangeLog][qdbusxml2cpp] Added command line option -I/--global-include to include header files with <> in the generated files. Fixes: QTBUG-103362 Change-Id: If8e7f8b86440bdec53f2517db1ad460912664b20 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Make the promises js-less using a newly introduced thunk poolMikolaj Boc2022-07-071-110/+71
| | | | | | | | | | | | | | | | | Since we cannot rely on the clients specifying a suitable CSP that will not forbid execution of js injections, we have to refrain from using any explicit <script> elements. To keep the promise system working, a thunk pool was introduced which keeps track of a limited pool of promise callback exports. In case the resources are busy, pending calls are enqueued. This works since the JS Promise.then/catch/finally always fire, even on ready/failed promises. As the situation of full thunk pool allocation is unlikely to happen en masse IRL, the solution should not adversely affect the performance. Heavy unit tests were created to confirm the solution works as expected. Task-number: QTBUG-99611 Change-Id: I0e6982d4ee76a4263b59e72b004b3ff2f167e4df Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Revert "QFutureCallOutEvent: de-export again"Sona Kurazyan2022-07-061-7/+1
| | | | | | | | | | | | QFutureCallOutEvent is used externally, so it needs to be exported. This reverts commit 3141a13b2a5c3cf770e072e49d43c86f376688e5. Fixes: QTBUG-104732 Pick-to: 6.4 Change-Id: I82c9e7414192ee948f78259bd74a404691a7805a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Apply ScaleFactorRoundingPolicy to QT_SCREEN_SCALE_FACTORSMorten Sørvig2022-07-061-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | QT_SCREEN_SCALE_FACTORS in many cases set on behalf of the user, instead of by the user, so we should make it less sharp and more in line with standard high-dpi configuration. Specifically, make it subject to the rounding policy set by QGuiApplication::setHighDpiScaleFactorRoundingPolicy(). This means that applications which support integer scale factors only will see integers only, also when QT_SCREEN_SCALE_FACTORS specifies a fractional factor. Users who want to override can set QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough to restore the default Qt rounding behavior. [ChangeLog][QtGui] The high-DPI scale factor rounding policy (settable with QGuiApplication::setHighDpiScaleFactorRoundingPolicy() or QT_SCALE_FACTOR_ROUNDING_POLICY) now applies to scale factors set with QT_SCREEN_SCALE_FACTORS. Pick-to: 6.4 Fixes: QTBUG-95930 Fixes: QTBUG-99546 Change-Id: Ibb0aa5cb9d3a356d33429d0efe69d984b2530728 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* High-dpi: Add test for setting the scale factor rounding policyMorten Sørvig2022-07-061-0/+56
| | | | | | | Test setting both via QGuiApplication property and environment. Change-Id: Iaccc920adb6294d610b02d4c844aa5b15eb7eecd Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* wasm: begin work on accessibility backendMorten Sørvig2022-07-065-0/+78
| | | | | | | | | | | Implement a11y support by adding html elements of the appropriate type and/or with the appropriate ARIA attribute behind the canvas. Also add a simple manual-test. Change-Id: I2898fb038c1d326135a1341cdee323bc964420bb Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* Remove uses of Q_ATOMIC_INT{8,16,32}_IS_SUPPORTEDMarc Mutz2022-07-062-32/+14
| | | | | | | | | | | It's always true these days, assert so in qatomic.cpp and tst_QAtomicInteger. Update the docs. Pick-to: 6.4 Change-Id: I3684cff96c1d2e05677314e29514cc279bd6b1a1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QGraphicsScene: fix -Wsuggest-overrideMarc Mutz2022-07-061-1/+1
| | | | | | | | | | Add the override keyword. Amends 2e12479e06d6869f568f0a7ee939453cda9afdbf. Pick-to: 6.4 6.3 6.2 Change-Id: Ic62dd33b1ee52983481e39e862b9bd87695f5044 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Port promise tests to qtwasmtestlibMikolaj Boc2022-07-065-256/+171
| | | | | | | | | The promise tests have been ported to qtwasmtestlib so that they do not have to use asyncify anymore. Task-number: QTBUG-99611 Change-Id: Id1b5742c90e36a89540e7a2387cb4110c21ace9b Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Create the Qt File Filter => showOpen/SaveFilePicker options mapperMikolaj Boc2022-07-052-0/+235
| | | | | | | | | | | | | As a preparatory measure for using showXFilePicker, the Qt file filter has to be transformed to the format used by the showXFilePicker (sXFP) options. A class structure reflecting the options was created. Based on an input in the form of a qt file filter, it will parse the filter to the sXFP options format. Unit tests were added and the code is not yet used in non-test env, next change will use it. Task-number: QTBUG-99611 Change-Id: I277286467a7b5ce6f323c19bdd31740a41b6a6be Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Enhance the qtwasmtestlib with comparison functions and status reportingMikolaj Boc2022-07-054-83/+131
| | | | | | | | | | Added the functionality to report text statuses from tests, reporting file and line of assertion failures. Refactored the qtwasmtestlib.js for improved stability. Task-number: QTBUG-99611 Change-Id: I717e0cc38ac7f155fe870710f6b5e4bfb81b9317 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* tst_QSslKey: prepare for the migration to OpenSSL v3Timur Pocheptsov2022-07-051-12/+42
| | | | | | | | | | | | Many algorithms (ciphers etc.) had become 'legacy' in OpenSSL v3, meaning they are not available by default. Since we don't mess with loading providers and don't load the 'legacy' one, we have to skip tests involving such algorithms. Pick-to: 6.4 6.3 6.2 5.15 Fixes: QTBUG-104232 Change-Id: Ieceabeb080e531aeb24f733cb8c83ad08a25049c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QListview: PageDown/Up infinite loopTang Haixiang2022-07-051-0/+21
| | | | | | | | | | | When item.height > viewport.height, the next item is not found correctly, resulting in an infinite loop. In this case, move directly to the next item. Pick-to: 6.4 6.3 6.2 Change-Id: I67a40a079ca9dd9189bf84ae550758c685b83d75 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_qwindow: modify some abnormal touch testsTang Haixiang2022-07-051-39/+39
| | | | | | | | | | | | Under normal circumstances, when the second point is touched, the first point has not been released, and the message at this time should contain two touch points. We are simulating the case where the message is lost when the popup is closed by touch. Amends efc02f9cc301f98c77079adae026ffd07f50d5ab Pick-to: 6.4 6.3 6.2 Change-Id: Ic722e3dbd615c46076ede26611d0107501c5e274 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* rhi: Keep track of pipeline creation timesLaszlo Agocs2022-07-051-0/+34
| | | | | | | | | | | | | | | | | | | | | Make our QRhiMemAllocStats struct a bit more generic, drop the memory allocation part in the naming, and use the same getter and struct for reporting some important timings. (we are free to rename for now, there are no users in other modules yet) The time spent in graphics (or compute) pipeline creation has a special relevance in particular with the modern APIs (as it is the single biggest potentially time consuming blocking operation), but also highly interesting with others like D3D11 simply because that's where we do the expensive source-to-intermediate compilation is HLSL source is provided. In order to see the effects of the various caching mechanisms (of which there can be confusingly many, on multiple levels), the ability to see how much time we spent on pipeline creation e.g. until we render the first view of an application can be pretty essential. Task-number: QTBUG-103802 Change-Id: I85dd056a39db7e6b25fb1f9d02e4c94298d22b41 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Make it possible to query the backend name beforehandLaszlo Agocs2022-07-051-0/+1
| | | | | | | | | | | | | | | | The goal is to make it possible to implement QSGRhiSupport::backendName() in Qt Quick with just a single line: return QString::fromUtf8(QRhi::backendName(m_rhiBackend)); instead of duplicating the strings and the logic. Similarly, QBackingStoreRhiSupport can now drop its apiName() helper entirely. Change-Id: Ia8cbb1f1243539ed4d7a98e71dcc2ed56b017e40 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* 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>