summaryrefslogtreecommitdiffstats
path: root/tests/auto/other
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge Objective-C++ parts of tst_QAccessibilityMac into main source fileTor Arne Vestbø2022-11-044-257/+172
| | | | | | | | | | | | | There's no need to split it, we can use the -x compiler flag to build the .cpp file as Objective-C++, or, as done here, just rename the file. This allows us to use QVERIFY and friends, giving more precise failure reporting. Pick-to: 6.4 Change-Id: I6fb1c4454335082c8a39010c5b75c59e6ec6561b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Revert "Accessibility: don't emit focus change when reason is window activation"Volker Hilsheimer2022-11-031-10/+0
| | | | | | | | | | | | This reverts commit 79a11470f3c4c61951906223f97001a77ce36500, which resulted in QTBUG-105735. The new behavior is worse and affects multiple screen readers, while the old issue is isolated to Windows Narrator and could be considered a narrator bug. Task-number: QTBUG-105735 Pick-to: 6.2 6.4 Change-Id: Ic8be1dbd592a3fdf2c3219ec4c5524bc2c7f0f6a Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-032-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that the on() matcher has been replaced by one that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache, to avoid porting calls that explicitly test count(). Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Android: delete dead code for tst_android under tests/auto/other/androidAssam Boudjelthia2022-10-263-82/+0
| | | | | | | | | | This amends 23780891a50ba678714f7e0a4cf43a0f8164b440 which moved the.txt test to tets/auto/corelib/platform/android and kept the old location mistakenly. Pick-to: 6.4 6.2 Change-Id: If58422f9a94cfe4d6a941cc5453d8f0506057dcb Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* a11y: support GetAccessibleId for at-spiHarald Sitter2022-10-251-0/+11
| | | | | | | | | | | This introduces a new helper function accessibleIdForAccessible (inspired by Windows' automationIdForAccessible) to synthesize an id out of the objectNames of the accessible parent chain. The id is then exposed via the GetAccessibleId D-Bus function for consumption in a11y tools. Change-Id: If72b86c5864c43f4ca842aa11423dd8aea0dde4a Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
* Long live Q_UNREACHABLE_RETURN()!Marc Mutz2022-10-151-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a combination of Q_UNREACHABLE() with a return statement. ATM, the return statement is unconditionally included. If we notice that some compilers warn about return after __builtin_unreachable(), then we can map Q_UNREACHABLE_RETURN(...) to Q_UNREACHABLE() without having to touch all the code that uses explicit Q_UNREACHABLE() + return. The fact that Boost has BOOST_UNREACHABLE_RETURN() indicates that there are compilers that complain about a lack of return after Q_UNREACHABLE (we know that MSVC, ICC, and GHS are among them), as well as compilers that complained about a return being present (Coverity). Take this opportunity to properly adapt to Coverity, by leaving out the return statement on this compiler. Apply the macro around the code base, using a clang-tidy transformer rule: const std::string unr = "unr", val = "val", ret = "ret"; auto makeUnreachableReturn = cat("Q_UNREACHABLE_RETURN(", ifBound(val, cat(node(val)), cat("")), ")"); auto ignoringSwitchCases = [](auto stmt) { return anyOf(stmt, switchCase(subStmt(stmt))); }; makeRule( stmt(ignoringSwitchCases(stmt(isExpandedFromMacro("Q_UNREACHABLE")).bind(unr)), nextStmt(returnStmt(optionally(hasReturnValue(expr().bind(val)))).bind(ret))), {changeTo(node(unr), cat(makeUnreachableReturn, ";")), // TODO: why is the ; lost w/o this? changeTo(node(ret), cat(""))}, cat("use ", makeUnreachableReturn)) ); where nextStmt() is copied from some upstream clang-tidy check's private implementation and subStmt() is a private matcher that gives access to SwitchCase's SubStmt. A.k.a. qt-use-unreachable-return. There were some false positives, suppressed them with NOLINTNEXTLINE. They're not really false positiives, it's just that Clang sees the world in one way and if conditonal compilation (#if) differs for other compilers, Clang doesn't know better. This is an artifact of matching two consecutive statements. I haven't figured out how to remove the empty line left by the deletion of the return statement, if it, indeed, was on a separate line, so post-processed the patch to remove all the lines matching ^\+ *$ from the diff: git commit -am meep git reset --hard HEAD^ git diff HEAD..HEAD@{1} | sed '/^\+ *$/d' | recountdiff - | patch -p1 [ChangeLog][QtCore][QtAssert] Added Q_UNREACHABLE_RETURN() macro. Change-Id: I9782939f16091c964f25b7826e1c0dbd13a71305 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Port from container.count()/length() to size()Marc Mutz2022-10-045-40/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tests: improve tst_gestures on GNOMELiang Qi2022-09-192-46/+16
| | | | | | | | | | | | | | | | | | | | | | | There are some issues when testing QGraphicsView on GNOME(xorg) overlapping with the default top bar. This change only move the view a bit. Notes: * There is no CentOS in CI any more. * panelPropagation() and panelStacksBehindParent() failed in CI and local vm on Ubuntu 20.04, but only in CI on Ubuntu 22.04. For example, we can turn the top bar off: In Extension Manager, install Just Perfection, and disable Panel in Visibility in it, all tests will pass too. Task-number: QTBUG-84258 Task-number: QTBUG-103054 Pick-to: 6.4 6.2 Change-Id: I05c262540c85af00182cd142760c4a29554b04c9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Guard windows-specific includes with Q_OS_WINAlexey Edelev2022-09-071-0/+2
| | | | | Change-Id: I0a7c605c55c815c7220024f302f511e302005ab9 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* a11y: Don't reassign unique ID to other object right awayMichael Weghorn2022-08-301-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the case that a newly created and registered accessible interface gets removed again from the cache before another one gets registered, the next registered interface was previously assigned the same "unique ID" again, which e.g. breaks assistive technology when using caching with AT-SPI, since that relies on the assumption that the ID is actually unique for each object. (But here, the new object was using the same object path as the old one, so data from the old object would be used for the new one.) To prevent that from happening, increment the counter for the next ID to try at the end of QAccessibleCache::acquireId, so the next time the method gets called, it doesn't try again whether the same ID as used previously is available again. For consistency, also rename the variable used for the counter from lastUsedId to nextId. This also adds a corresponding test case. Fixes: QTBUG-105962 Pick-to: 6.4 Change-Id: Iddf4f3b35c57895bcfbb623a5377edf8344ab6c2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add QComHelper class for dealing with COM on WindowsTor Arne Vestbø2022-08-291-4/+4
| | | | | | | | | | | | | | | Unifies our approach to calling CoInitializeEx and CoUninitialize, removing a lot of boilerplate in the process, and also fixes a few bugs where we would incorrectly balance our calls to CoInitializeEx and CoUninitialize. The optimistic approach of qfilesystemengine_win.cpp of calling CoCreateInstance without initializing the COM library explicitly has been removed, as calling CoInitializeEx should be a noop in the situation where it's already been loaded. Change-Id: I9e2ec101678c2ebb9946504b5e8034e58f1bb56a Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Deprecate QApplication::setActiveWindow() and mark as internalTor Arne Vestbø2022-08-273-6/+10
| | | | | | | | | | | | | | The function is used the internal window activation machinery and should not be called by user code. Many tests still use this function, and should be ported over to QWidget::activateWindow(). For now they are using the private helper in QApplicationPrivate, so that we can progress with the public API deprecation. Change-Id: I29f1575acf9efdcbae4c005ee9b2eb1bb0c8e5b5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* a11y: Prevent one case of losing a11y interface when setting event childMichael Weghorn2022-08-271-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 9a369a25ddfac9352cabde65c8476c7433dc6c3a added a QAccessibleEvent ctor that takes a QAccessibleInterface* instead of a QObject*. Retrieving the QAccessibleInterface* later is done using the interface's unique ID stored in the m_uniqueId member. However, the fact that m_uniqueId is a member of the union alongside with m_child means that setting a child via QAccessibleEvent::setChild also overwrites the stored unique ID, which breaks retrieving the accessible interface later. Fix this for the case where the QAccessibleInterface has an associated QObject by assigning m_object in the ctor as well. This means that a QAccessibleEvent created using either of the two constructors (the one taking the QObject* and the one taking the QAccessibleInterface* associated with the object) now behaves the same. Fixing the case where there is no associated QObject would require further changes (e.g. adding a member for the QAccessibleInterface* or making the m_uniqueId member a separate member instead of having it in a union with m_child). However, I see no way to do so without breaking the ABI, so that is left unchanged. This also adds a corresponding test case. Fixes: QTBUG-105988 Pick-to: 6.4 Change-Id: I71a548af0277a5034e9e207f066fa3e25c5393f3 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QtBase tests: remove QT_DISABLE_DEPRECATED_UP_TO definesIvan Solovev2022-08-241-2/+0
| | | | | | | | | The value will be propagated from Qt build. Task-number: QTBUG-104858 Change-Id: Iae2c32c3037438f41b92f9ee28004f30eb4e3210 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-2322-22/+22
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Rename QT_DISABLE_DEPRECATED_BEFORE -> QT_DISABLE_DEPRECATED_UP_TOIvan Solovev2022-08-191-1/+1
| | | | | | | | | | | | | | The new name describes the behavior in a better way. [ChangeLog][Build System] The QT_DISABLE_DEPRECATED_BEFORE macro is renamed to QT_DISABLE_DEPRECATED_UP_TO. The old name is deprecated, but is still recognized if it is defined during configuration and the new name is not defined. Task-number: QTBUG-104944 Change-Id: Ifc34323e0bbd9e3dc2f86c3e80d4d0940ebccbb8 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* qputenv: port to QByteArrayViewMarc Mutz2022-08-061-1/+1
| | | | | | | | | | | | | | | | | | | | 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>
* QtBase: Windows: Replace some deprecated API usagesYuhang Zhao2022-08-031-1/+1
| | | | | | | | | | | | 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-0322-0/+66
| | | | | | | | | | | | 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>
* CMake: Don't use PUBLIC_LIBRARIES for tests and test helpersAlexandru Croitor2022-07-2818-22/+22
| | | | | Change-Id: I9b7404e1d3a78fe0726ec0f5ce1461f6c209e90d Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* Fix flakiness of test on OpenSUSE/KDEDimitrios Apostolou2022-07-262-5/+1
| | | | | | | | | | | The cause is that the first EXPOSE event comes with the window not having focus. See QTBUG-105177. Fixes: QTBUG-67254 Task-number: QTBUG-105177 Change-Id: I04789d0a173979d9a60893989f76566b617c6576 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* CMake: Rename test to tst_qobjectraceAlexandru Croitor2022-07-201-1/+1
| | | | | | | | Coin test collector expects tests to start with the tst_ prefix. Pick-to: 6.2 6.3 6.4 Change-Id: Idc991273bacc41b62dbbf70f2ae0f3e712d34ab6 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* 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>
* unblacklist passing tests 2022Anna Wojciechowska2022-06-232-11/+31
| | | | | Change-Id: Ifb09a997d39fc2c92503e77cf372d443c13c4c2b Reviewed-by: Daniel Smith <Daniel.Smith@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>
* Use SPDX license identifiersLucie Gérard2022-05-1637-1000/+75
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Remove remnants of the old Intel C++ compilerThiago Macieira2022-05-111-6/+0
| | | | | | | | | | | | | We don't support it any more. I don't think it has ever properly compiled Qt 6 (and it's no longer working for me against GCC 12's libstdc++ headers). If you report a bug against it, Intel support's first question is if you can try instead the new Clang/LLVM-based oneAPI C++ compiler. So we support only that one, which identifies itself as Q_CC_CLANG. Change-Id: I5ff8e16fcdcb4ffd9ab6fffd16eb57a092c8439e Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* tst_qobjectrace: fix potential UB (something with pointers and new)Marc Mutz2022-05-071-11/+7
| | | | | | | | | | | | | | | | | | | | The current [basic.life] wording seems to cover the existing code, but IIRC, older versions of [basic.life] were not so relaxed. In particular, while not completely pertinent, the second placement new is awfully similar to http://eel.is/c++draft/ptr.launder#example-1 Just make all of this SEP and use std::optional. That way, the code gets simpler, too, plus we get rid of the last use of C++23-deprecated std::aligned_storage. The reset() before the 2nd emplace() isn't necessary, but, in a test, it doesn't hurt, either, and keeps code readers from guessing whether the first-emplaced object's dtor is actually properly run (it is). Pick-to: 6.3 6.2 Fixes: QTBUG-99122 Change-Id: If31a46f8be3a74499f1176133029d097faf7dfe9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Windows QPA: Fix slowdown with large table/tree views with accessibilityAndré de la Rocha2022-03-311-0/+107
| | | | | | | | | | | | | | The accessibility code for notifying focus changes related to a table/tree view was iterating over all items to find the focused one, which for a very large number of items could cause a major slowdown and UI freeze. This patch avoids the issue by removing the loop and implementing the focusChild() method in the table/tree accessibility classes. Fixes: QTBUG-100997 Pick-to: 6.2 6.3 5.15 Change-Id: I04c847a5e65223b7a93ab82363feb32e1ebab9f3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Windows: Fix accessibility testsAndré de la Rocha2022-03-312-7/+6
| | | | | | | | | | | | Accessibility tests were not being built on Windows as they were depending on a WindowsUIAutomationSupport internal module that no longer exists, as the UI Automation support classes are now in QtGui. The patch also fixes a test that was calculating widget geometry incorrectly on high DPI screens. Pick-to: 6.2 6.3 Change-Id: Iefed0f6d147853484dfab4b16838b9088fd32dcf Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* CI: Add docker support for qnetworkaccessmanager_and_qprogressdialog testPasi Petäjäjärvi2022-03-302-2/+8
| | | | | | | | | | Currently test relies solely for external test server. This makes it not possible to run test successfully with environment where docker is used. Pick-to: 6.2 6.3 Change-Id: I51f4f48a80c1be8dd24359fe24d9cbfd471d2195 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Tests: Do not depend on transitive includesFabian Kosmale2022-03-171-0/+1
| | | | | Change-Id: Ibc6a948480a904913a5427e6408d4d296784fb4f Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Android: unblacklist tst_toolsupport::offsetsIvan Solovev2022-03-041-3/+0
| | | | | | | | | | | | The test is no longer failing on Android in dev and 6.3, but still failing in 6.2. I think it's fixed by 63a35898f4990963fe91acd565df49111a281fa4 which is integrated into dev and 6.3 Task-number: QTBUG-87396 Pick-to: 6.3 Change-Id: I82e0aac1547f8e43353f0948cd3f91b4b8f9720e Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Fix tst_qaccessibility on AndroidIvan Solovev2022-02-252-5/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On Android we had 10 failing unit-tests in tst_qaccessibility One of them was failing because on Android QMdiSubWindow is created maximized by default, so we need to explicitly call showNormal() on it before doing all the checks. Other 9 were failing because we didn't get A11Y events when expected. This is a bit more tricky. On Android a11y state is not explicitly set by calling QPlatformAccessibility::setActive(), there is another flag that is controller from the Java side. It is set to 'true' only when some of the a11y services are enabled on the device. The state of this flag is queried during event processing, so a11y state can be reset to false while we do QTest::qWait(). This logic is absolutely correct for real applications, but it is a problem for the test case, because we can't easily enable a11y services in the CI. To overcome the issue in unit-tests, re-enable a11y before each test. A more precise fix will require re-enabling it after every qWait() or processEvents() call, but the current tests pass with such condition. Fixes: QTBUG-87674 Pick-to: 6.3 6.2 Change-Id: I6f765bc6d3aaeaa19aba3a64473ea25e9cbdb0f8 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* A11Y tests: wrap memory allocations into smart pointersIvan Solovev2022-02-171-101/+87
| | | | | | | | | | | | | | | | | | | | | | | Some of the UI elements in the a11y tests are allocated dynamically, which means that if the test fails, the element is not destroyed properly. As a result, the "hanging" UI elements affect all the following tests, which leads to more test failures and even hangs. This patch wraps all such allocations into smart pointers, which guarantees correct destruction in case of test failure, so that other tests are not affected, and also prevents memleaks. As a drive-by: - use nullptr instead of 0 in constructors; - create some objects on stack instead of dynamically allocating memory for them; - remove some unneeded 'delete' calls for the objects that belong to QObject-hierarchy. Task-number: QTBUG-87674 Pick-to: 6.3 6.2 Change-Id: I0dcc26990955cd7b240a689a7438880b686985b7 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QIODevice: use QVLA to hold the ring buffers, not QListMarc Mutz2021-12-151-2/+2
| | | | | | | | | | | | | | | The only users of more than one read- or write channel are the SCTP code and QProcess. SCTP being pretty rare, optimize for the common case of at most two QRingBuffers for reading (QProcess) and one for writing. Even with more channels, QVLA shouldn't be slower than QList - on the contrary. Need to adjust tst_toolsupport and TypeInformationVersion, as QFilePrivate::fileName has changed. Pick-to: 6.3 Change-Id: I3baf982ba1f4dc51463be8730e414f6164072d8b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QPA: Set focus reason when window activation changes focusVolker Hilsheimer2021-12-031-0/+36
| | | | | | | | | | | | | | | QApplication hides the fact that the reason is never set by several QPA plugins, but Quick items don't receive the correct reason on Windows, Android, the offscreen plugin, and other platforms. Add relevant scenario to the QFocusEvent test case, and fix the plugins to always set the focus reason when handling window activation changes. Exclude the minimal plugin from the test, it seems largely unmaintained anyway. Task-number: QTBUG-75862 Change-Id: I5404a225b387fc9a3851b6968d0777c687127ed1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Stabilize tst_QAccessibilityMacVolker Hilsheimer2021-11-261-12/+9
| | | | | | | | | | Introduce a TRY_EXPECT macro that uses qWaitFor, and use it whenever EXPECT was used after a call to processEvents. Fixes: QTBUG-94036 Pick-to: 6.2 5.15 Change-Id: Ia935444d529c2798637bf9b4a56e47a8dc9d75d2 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Rename and restructure the baseline (lancelot) testing codeEirik Aavitsland2021-11-16112-12027/+0
| | | | | | | | | | | | | | | | | | | | In preparation for addition of new baseline tests, establish a new test category, "baseline". This is similar to the category "benchmarks" in that it contains tests that use the QTest framework, but conceptually are not unit tests, in contrast to those under auto/. Move the existing QPainter baseline test, tst_lancelot, into this new category, and rename it accordingly. Baseline tests use the QBaselineTest extension to QTest. Move that extension too into the tests/baseline directory, allowing the clean out of the baselineserver directory. Pick-to: 6.2 Change-Id: I1b527f5867c953b1d22be73798fcf7d1494712ea Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Update clipping area when antialiasing changesChen Bin2021-10-271-0/+76
| | | | | | | | | | | | | | | | | | | Antialiasing is disabled when the painter's antialiasing attribute is set behind the clipping function(example `setClipPath` or `setClipRegion`). The cause of this problem is that the antialiasing state of the clipping region is not updated after the antialiasing attribute is set. A variable is required to record the painter's transformation state set before the clipping function, because the transformation will be applied to the clipping region, resulting in the abnormal clipping region. The value of `s->matrix` is not accurate for the clipping fun- ction. Pick-to: 6.2 Fixes: QTBUG-97269 Change-Id: I409a9db32efc3b991ebb97ec9aed19bbddb273d8 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix autotest public API compilation for INTEGRITYTatiana Borisova2021-10-151-0/+4
| | | | | | | | | | - getgid/getpwuid are not supported - process should be used with config check Task-number: QTBUG-96176 Pick-to: 6.2 Change-Id: Ib6854772bcf52f3533cb722f963426717926258b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add lancelot test for smallcaps text pathAlbert Astals Cid2021-10-043-2/+26
| | | | | Change-Id: I62b824e852fe6c05afabbd7ab80efaad5a298f82 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add testing of QPdfWriter output to QPainter lancelot testEirik Aavitsland2021-09-282-1/+103
| | | | | | | | | | Utilizes the native pdf renderer of macOS, so the test is only enabled on that platform. As the PDF generation should be platform independent anyway, this should not matter. Pick-to: 6.2 5.15 Change-Id: I8b6b70562d1f24fdb77795aa7eb5843279aaae85 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Compile autotests for IntegrityTatiana Borisova2021-09-201-1/+1
| | | | | | | | | - process environment/DNS are OFF for INTEGRITY Task-number: QTBUG-96176 Pick-to: 6.2 Change-Id: I189a97f88c96a428586c31a66b8d250e04482900 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Remove conditioning on Android embeddedEdward Welbourne2021-09-171-1/+2
| | | | | | | | It is no longer handled separately from Android. This effectively reverts commit 6d50f746fe05a7008b63818e77784dd0c99270a1 Change-Id: Ic2d75b8c5a09895810913311ab2fe3355d4d2983 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Improve lancelot test of dashed line paintingEirik Aavitsland2021-08-203-4/+70
| | | | | | | | | | | Add painting of sets of lines, both connected and unconnected, that go outside the device area. This prepares for fixes & improvements in the painting code. Pick-to: 6.2 6.1 5.15 Change-Id: I9cffc760524e9ade42362c9a04949270ac24180f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* tests: Remove unused SRCDIR definesIevgenii Meshcheriakov2021-08-171-2/+0
| | | | | | | | | | | Remove SRCDIR defines from tests that don't use them. There is a standard define called QT_TESTCASE_SOURCEDIR that is available to all tests and serves the same purpose. Pick-to: 6.2 Change-Id: I2aa237739c011495e31641cca525dc0eeef3c870 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix some compiler warnings from deprecated QFont constructorVolker Hilsheimer2021-08-111-1/+1
| | | | | | | | QFont should be constructed with a list of font families. Pick-to: 6.2 Change-Id: I61141b25d3f6e25f4fea141acbfa8e164d7af58f Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* testlib: Deprecate QWARN() in favor of qWarning()Tor Arne Vestbø2021-08-042-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | The QtTest best practices documentations recommends using output mechanisms such as qDebug() and qWarning() for diagnostic messages, and this is also what most of our own tests do. The QWARN() macro and corresponding internal QTest::qWarn() function was added when QtTest was first implemented, but was likely meant as an internal implementation detail, like its cousin QTestLog::info(), which does not have any corresponding macro. This theory is backed by our own QtTest self-test (tst_silent) describing the output from QWARN() as "an internal testlib warning". The only difference between QWARN() and qWarning(), besides the much richer feature set of the latter, is that qWarning() will not pass on file and line number information in release mode, but QWARN() will. This is an acceptable loss of functionality, considering that the user can override this behavior by defining QT_MESSAGELOGCONTEXT. [ChangeLog][QtTest] QWARN() has been deprecated in favor of qWarning() Pick-to: 6.2 Change-Id: I5a2431ce48c47392244560dd520953b9fc735c85 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>