summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/kernel
Commit message (Collapse)AuthorAgeFilesLines
...
* Add a test case for an invalid min/max size pairInho Lee2023-06-271-0/+7
| | | | | | | Task-number: QTBUG-113233 Pick-to: 6.6 6.5 Change-Id: Iad3f2f5d98637dbbe2ad6b23027ffdd942fb05d3 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Fix sending deferred delete events when posted before outermost loopMikolaj Boc2023-06-091-1/+0
| | | | | | | | | | | | | | | | | | | | | QDeferredDeleteEvent has the loopLevel field, which is a sum of scope and loop levels found at posting. In sendPostedEvents however, it is impossible to only use this information to find delete events posted before the outermost loop (which should be handled by any loop) based solely on this information, as the scope level essentialy removes the information on loop level. Break the loopLevel in two, storing both loop and scope levels in QDeferredDeleteEvent, so that we can check whether an event was posted before the outermost event loop (for which we need to compare only the loop level). QDeferredDeleteEvent was also made private as it should - it is an implementation detail that wasn't hidden properly. Change-Id: I0a607a0bd3a2deb5024acad67f740dbf4338574c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
* tst_QTimer: ensure that timer activation respects start orderThiago Macieira2023-06-061-0/+13
| | | | | | | Task-number: QTBUG-114152 Change-Id: Iff484344171647888da4fffd17640daef56f2479 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* QGuiApplication: Remove .desktop suffix in setDesktopFileNameVlad Zahorodnii2023-05-301-2/+2
| | | | | | | | | | | | | | | The desktop file name should not contain ".desktop" suffix, but some applications still specify it anyway because of the ambiguity in the documentation that was fixed in 0c5135a9dfa6140d23d86b001c3054891c22dcb9. This change makes setDesktopFileName remove ".desktop" suffix so desktopFileName always returns a desktop file name with correct format and its users don't need to chop ".desktop". Pick-to: 6.5 Change-Id: If5abccaf3bf976449cada8891fff887870e45b5f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QWindow test: Blacklist enterLeaveOnWindowShowHideVolker Hilsheimer2023-05-251-0/+2
| | | | | | | | | | | | | This test fails too frequently on Android and RHEL to leave in as significant. The bug report is already closed after timeouts were extended, so perhaps we just have to accept the status quo. No point in keeping tickets open for tests that we can't get stable on some platforms. Pick-to: 6.5 Task-number: QTBUG-102239 Change-Id: I54b8ae821e93b3e1f24acd67a2e84ef405388667 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Shoehorn AccentColor into QPalette and keep existing 64bit resolve maskAxel Spoerl2023-05-211-2/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is necessary to add an AccentColor role to QPalette. QPalette currently has 21 color roles and 3 color groups, which require 63 bits to resolve. The resolve mask is implemented with a qint64, which doesn't provide spare bits for another color role. The color role NoRole is used as a default value, marking that a role has not (yet) been defined. The enum value does not represent a valid brush, even though it can theoretically be stored in QPalette's shared data. This patch adds the enum value AccentColor to QPalette::ColorRole, increasing the available color roles to 22. To keep the resolve mask at 63 bits, AccentColor is mapped to NoRole in static constexpr bitPosition. As the enum range would exceed 64 bits without this tweak, 3 additional bits are substracted in the respective static assertion. With NoRole having no bit in the resolve mask, the following adaptions have been implemented: - QPalette::resolve() is adapted to explicitly ignore NoRole. - QPalette::isBrushSet() always returns false for NoRole. - tst_QPalette::setAllPossibleBrushes() to verify the latter - operator== ignores NoRole (documentation updated) AccentColor is added in tst_QPalette::roleValues and enum documentation is adapted. In QPalette's default constructor, the AccentColor brush is defaulting to the Highlight brush, it this is available. Otherwise it is made 30% darker or lighter than the Base brush, depending on dark/light mode heuristics. QPalette's data stram functions have been extended from QDataStream Version Qt_6_6. If earlier versions are de-serialised, the AccentColor defaults to Highlight. An autotest function dataStream() has been added to tst_QPalette. The QDataStream Version Qt_6_6 has been bumped to 21. tst_QDataStream has been adapted to the new version and the new color Role. Change-Id: I98bbf9de95fb83bda921e9614a0db3a3c0ebdf75 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Test for QWindow getting enter/leave events when secondary window shows/hidesVolker Hilsheimer2023-04-142-0/+85
| | | | | | | | | | | | Equivalent to the test added to the QWidget test case, but since QtWidgets code contains logic to both synthesize and compress/filter enter/leave events, we can only verify that the QWindow does get the events. The test is very flaky on Windows, so blacklisting it right away. Change-Id: Ic1da9439f60f619a76a3653a23fef8e9ebc0e75d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Use LANGUAGE OBJCXX rather than COMPILE_FLAGS "-x objective-c++"Tor Arne Vestbø2023-04-131-1/+1
| | | | | | | | | | | | | We sometimes use Objective-C++ code in files with a .cpp extension, to avoid the churn of adding a foo_mac.mm file. Instead of manually telling the compiler to build these files in Objective-C++ mode, we use CMake's intended mechanism, which means genex constructs such as $<$<COMPILE_LANGUAGE:OBJCXX> will work for these files as well. Pick-to: 6.5 6.2 Change-Id: If295c3f34f6bee9f4d9f877f519c9c7770665fee Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Add DPI change testsMorten Sørvig2023-04-061-0/+40
| | | | | | | | | We can expand the testing a bit bit verifying that also created windows work as expected, and that QWindow DPR is updated when Screen DPI is changed. Change-Id: I082aac18b6b086c69c16681977b7eaa6c3e54ee0 Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
* Pick up initial state of foreign windows instead of reflecting QWindowTor Arne Vestbø2023-03-281-0/+57
| | | | | | | | | | | | | | A foreign window can be used both for embedding a Qt window into a native window hierarchy, or for embedding a native window into a Qt window hierarchy. In the former case, we should not modify the foreign window in any way. Since the platform does not know anything about the intended use case at the time of the foreign window creation, it should avoid modifying the foreign window in any way, and should instead pick up the foreign window state and reflect that through QWindow. Pick-to: 6.5 Change-Id: Id2e39d101277ecebd656d615cea3e7f734a4b0a6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Ensure QHighDpiScaling::set(Screen/Global)Factor() results in QScreen signalsTor Arne Vestbø2023-03-281-0/+32
| | | | | Change-Id: I328b288b3fd83df0cc81c62bce1d946f90f1cd0d Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Apply ScaleFactorRoundingPolicy to QT_SCREEN_SCALE_FACTORSMorten Sørvig2023-03-281-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | QT_SCREEN_SCALE_FACTORS is in many cases set on behalf of the user, instead of by the user, so we should apply the standard app scale factor policies to it, instead of interpreting it as a user override. 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. Fixes: QTBUG-95930 Fixes: QTBUG-99546 Change-Id: I936e96671fe2a0a43c3e8129f0768875cb011103 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Add basic test for QWindow foreign windowsTor Arne Vestbø2023-03-162-0/+137
| | | | | | | Only implemented on macOS and Windows for now. Change-Id: Ib6330bc7024453d23675c1770367e8da6c4c9a34 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Fix warnings from deprecating QFileOpenEvent::openFile, update snippetVolker Hilsheimer2023-03-092-9/+10
| | | | | | | | | | | | Amends 76c63936d3d3c937960108da88a56394a0ac70b5 by adjusting the test case. We still just test that we can open a file based on a filename that we came up with ourselves. Also, update usage documentation and make the snippet a bit more relevant. Change-Id: I5bf00210d74e2a73d5a71a09a5beb1b3f6f8e225 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* tests: skip tst_QScreen::grabWindow() on XWaylandLiang Qi2023-03-021-3/+2
| | | | | | | | Pick-to: 6.5 Task-number: QTBUG-104595 Change-Id: Icb56a587dfbad84533616160817a3d43411146f1 Reviewed-by: Kalle Viironen <kalle.viironen@qt.io> Reviewed-by: Simo Fält <simo.falt@qt.io>
* tests: Remove remains of qmake conversion from CMakeLists.txt filesFriedemann Kleint2023-02-1740-108/+4
| | | | | | | Pick-to: 6.5 Change-Id: I8d106554bb86ac1ec9bb7a4083de4c376bcbab1d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Detach event points when cloning pointer eventsVolker Hilsheimer2022-12-101-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Input events that originate from actual device interaction should reflect the device's state, and device and events need to be kept in sync so that event sequences (such as multi-touch events, where we have begin/update/end cycles spanning multiple events) are working correctly. For that reason, the event point data in pointer events is explicitly shared, and we only detach in exceptional situations. This saves us memory allocations, and makes sure that the event point data carried by events, and the event point data stored persistently in the device, are kept in sync. Cloned pointer events do not originate from device interactions, and should therefore not sync back to the device. E.g. accepting a clone should not modify the original event data stored in the device. There are exceptions here as well, e.g. when cloning an event in Qt in order to deliver a translated version of it to a different scene. Different points might even get delivered to different scenes or windows, or at least different items in the same scene. For that reason, we explicitly detach, and then explicitly write back the relevant states after the cloned event has been delivered. But in general, we should assume that cloned events do not write back to the device. Since QEventPoint is an explicitly shared data type that never detaches itself, we have to explicitly detach it when making copies that should not be shared. The ideal implementation of this would be to do the detach in the copy constructor of QPointerEvent, which is called when cloning. However, Qt itself makes copies of QPointerEvent without using clone, e.g. when assembling lists of touch events for the different subscenes or windows in QGuiApplicationPrivate::processTouchEvent, where event objects are added to a QVarLengthArray<QMutableTouchEvent>. This makes copies, and those copies must not detach. So we have to implement the special cloning behavior in each override of QPointerEvent::clone(). For this, introduce a dedicated macro for the common member functions. This macro must be used for QPointerEvent subclasses. Fixes: QTBUG-107560 Change-Id: I4b56f9e71c7d067ba9054a2a631e8ba5bc7b1ab9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QPalette: always increase serial number when modifyingVolker Hilsheimer2022-11-251-0/+8
| | | | | | | | | | | | | | | | | | | After 109e088c7c5d0c9325966e88d55fd9f7a58f67ea, cache keys were unique for palettes with different private or data instances, but the key did not change when a palette without any shared copies was modified, as that does not create new private data structures. To fix this, always increase the counter for the private data structure, also when not detaching from shared copies. Augment test case with scenario that broke. Pick-to: 6.4 Fixes: QTBUG-108709 Change-Id: I606abfb8b1a03e515e46b10dc840a631eb31d496 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: JiDe Zhang <zhangjide@uniontech.com> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* Reintroduce converter APIs for supporting native clipboard formatsVolker Hilsheimer2022-11-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt 5, QWin(dows)Mime and QMacMime lived in the respective Extras modules, which were removed and partially folded into the relevant modules in Qt. QWindowsMime and QMacMime continued to provide the abstraction for implementing built-in support for native clipboard formats and UTIs within Qt, but only as private APIs. After the recent clean up of those APIs and respective infrastructure, we can now bring them back as public converter interfaces. Application developers can subclass those and instantiate an instance of their implementation to add support for platform or application specific data formats. These interfaces are not in the QNativeInterface namespace, as applications don't call into Windows or macOS using those interfaces. I.e. there is no class on which an application would call auto *converter= nativeInterface<QWindowsMimeConverter>(); Also, since applications override those converter types, we do want to guarantee binary and source compatibility. [ChangeLog][QtGui][QWindowsMimeConverter] Reintroduced to allow applications to add support for conversion from and to Windows-native clipboard formats to MIME-encoded data. [ChangeLog][QtGui][QUtiMimeConverter] Reintroduced to allow applications to add support for conversion from and to clipboard data on macOS and iOS to MIME-encoded data. Fixes: QTBUG-93632 Change-Id: Iebd909c3970015d203f59d5ab15e306b3d312f6e Reviewed-by: Yuhang Zhao <2546789017@qq.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* emit QWindow::windowStateChanged only when state has changedAxel Spoerl2022-11-111-0/+98
| | | | | | | | | | | | | | | | | Upon programmatic window state changes, windowStateChange was fired once in QWindow::setWindowStates and once when the visual state had been changed by the window interface. This patch adds if guards to ensure that the singal is fired only once. It adds a corresponding autotest to tst_QWindow. tst_QWidget::resizePropagation() is adapted to no longer expect double signal emission. Fixes: QTBUG-102478 Pick-to: 6.4 6.2 Change-Id: If093c0a883d76d8a676e4fab90db6b0676452267 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix unused variable compiler warning in tst_qpaletteAxel Spoerl2022-11-101-0/+12
| | | | | | | | | | Debug serials and detatch numbers of deep and shallow detatch in test function cacheKey, if it fails. That implicitly removes a compiler warning about these variables being unused. Change-Id: I481f4b63e3ed0d50fb442dffc658b97d913059bc Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-036-123/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* tst_QKeySequence::parseString_data(): drop duplicated rowsEdward Welbourne2022-10-181-4/+0
| | | | | | | | The "a" and "A" rows appeared under Valid, then again under Only Keys. The two copies were identical, in each case, so drop the latter. Change-Id: Ib3d84710e772171bb4a5e0aefd20022810fb41cd Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* tests: skip tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() on ↵Liang Qi2022-10-141-0/+5
| | | | | | | | | | | Wayland QWindow::requestActivate() is not supported. Task-number: QTBUG-107158 Pick-to: 6.4 6.2 Change-Id: I047337d736ff10693d98075e2636028225162765 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Allow programmatic closing of windows that are modally blockedVolker Hilsheimer2022-10-121-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | In Qt 6, after changes such as 121fddcf5ae2ab238ef802e44b45ce62c56015f5, we go through the QPA layer to close widget windows properly. Closing and hiding of windows is now done in when we receive and handle the window system's CloseEvent. Such an event to a modally blocked window should be blocked, so that users can't close a modally blocked window. However, if the event is the result of a call to QWindow::close, then it should not be blocked. Luckily, we know that the event is the result of such a call, so let such events through. This restores compatibility with Qt 5, where it was possible to first open a new dialog, and then close the previous dialog. Add a test case. Fixes: QTBUG-107188 Pick-to: 6.4 6.2 Change-Id: Id812c1fc36aa0e1a10dfb8d3a16a11d387289b05 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-112-7/+7
| | | | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace, with manual unstaging of the actual definition and documentation in dist/, src/corelib/doc/ and src/corelib/global/. Task-number: QTBUG-99313 Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Revert "tests: XFAIL tst_QGuiApplication::genericPluginsAndWindowSystemEvents()"Liang Qi2022-10-071-2/+0
| | | | | | | | | | | This reverts commit ae1197fc5644c653fbc652b6008b83b5b11def85. This doesn't fail on Wayland, perhaps a false alarm. Fixes: QTBUG-100891 Pick-to: 6.4 6.2 Change-Id: I3e1d2488b090f186c64d63cb6c9f97dfaafc8fff Reviewed-by: Liang Qi <liang.qi@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-046-57/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Make sure that palette cache keys are uniqueVolker Hilsheimer2022-10-031-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After 1d961491d817490da156769ddce6fce48a0bce4a, palettes are different if they either have different brush data, or a different private. Two privates can share data, but still must generate different cache keys. The cacheKey has so far been composted of the serial number of the Data struct, and a detach number that is incremented when we detach the private. This failed for two reasons: - the implicit copy constructor of the Data class copied the serial number, when it should have incremented it. Fix that by member- initializing the serial number rather than doing it only in the default constructor. The member initialization is also executed for the copy constructor. - the detach_no logic as it was implemented does not guarantee that two copies of the same palette that share data, but have different resolve masks (and thus different privates) have different detach_no values. Use a static serial counter for that number as well. Amend the test case to verfiy that cache keys, and the elements of the cache keys, change when they are expected to. Fixes: QTBUG-106984 Pick-to: 6.2 6.4 Change-Id: I84d7055ce8bfe0d42f1f8e9766f3f1ad610f4ec8 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* tst_qtnoeventloop: add missing overrideJohannes Kauffmann2022-09-201-1/+2
| | | | | Change-Id: I24ad2f4d069ce1c7a894f8466927acb6dfd266d3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix tst_QWindow::requestUpdate on WaylandEskil Abrahamsen Blomfeldt2022-09-051-7/+9
| | | | | | | | | | | | | | | | | | | | On Wayland there is a special case when decorations are enabled, where we post an initial update request to ensure widgets are redrawn after the buffer is recreated (see af7b60ade5c4be81cbc58eb18307c017d5594071 in qtwayland). To make sure the test behaves the same on Wayland as on other platforms, we disable client-side decorations when running these tests. The flag is primarily required for the requestUpdate() test at the moment, but it is only queried once per application run, so it has to be set before any tests are run. Pick-to: 6.4 Fixes: QTBUG-100889 Change-Id: Ica6d744083ecae4a3722b6d04b956e7615f0dfe5 Reviewed-by: Inho Lee <inho.lee@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Use testlib for multiPointRawEventTranslationOnTouchScreen eventsShawn Rutledge2022-09-022-68/+64
| | | | | | | | | | | | | | | | | | | | | | | | It was an old test written in a very low-level way, which perhaps is ok to be independent of testlib in a few tests; OTOH, it was blacklisted on a couple of platforms. Perhaps doing touch events the standard way could be more stable. While we're at it: - verify that the touch events are accepted, and thus verify the new bool return value from commit() - implement paintEvent() to help understand the layout, and touchpoint locations - remove repeated QCOMPARE lines - skip the test if window positioning fails - try to un-blacklist it, on the assumption that window positioning failure was the reason Task-number: QTBUG-87025 Task-number: QTBUG-104656 Pick-to: 6.4 Change-Id: Ie22eb24abf95cd849990a56212be87d06ce8e574 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io>
* tst_qguiapplication: guard the usage of deprecated signalsIvan Solovev2022-08-302-3/+10
| | | | | | | | | | | | | | | | The paletteChanged() and fontChanged() signals were deprecated in Qt 6.0, but the test was still using them unconditionally. This patch guards the usage of the deprecated signals with the usual QT_DEPRECATED_SINCE(6, 0) check, so that the test can be built and run with QT_DISABLE_DEPRECATED_UP_TO >= 0x060000 This commit amends 68ea9c022701359b447be076888331a4f9d9085b Task-number: QTBUG-104858 Change-Id: Idb2da6d91afcdb664f325f23ec625947c9a7fac0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Rest of QtBase tests: port away from deprecated methodsIvan Solovev2022-08-302-4/+3
| | | | | | | | | | Small changes to fix builds with QT_DISABLE_DEPRECATED_UP_TO >= 0x060500 Task-number: QTBUG-104858 Change-Id: Ia531a3cee97f13827e36b3d63f28eed879fe9a40 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Wayland: Skip test that queries window positionEskil Abrahamsen Blomfeldt2022-08-251-2/+3
| | | | | | | | | | The client does not know its global window position on Wayland, so testing for this will not work. Pick-to: 6.4 Fixes: QTBUG-100888 Change-Id: Ibdfc84f1b33d25223dbd740603ce4783c21afc70 Reviewed-by: Inho Lee <inho.lee@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-2340-40/+40
| | | | | | | 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>
* Wayland: Remove XFAIL after underlying bug was fixedEskil Abrahamsen Blomfeldt2022-08-091-2/+0
| | | | | | | | | | The intialSize bug has been fixed in Qt Wayland Client, and thus this test will now start XPASSing. Pick-to: 6.4 Task-number: QTBUG-66818 Change-Id: I4b9cb8bd9306a67f04295eb23f09574dad0e97f7 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* 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>
* Add license headers to cmake filesLucie Gérard2022-08-0340-0/+120
| | | | | | | | | | | | 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-2836-40/+40
| | | | | Change-Id: I9b7404e1d3a78fe0726ec0f5ce1461f6c209e90d Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* QMetaType: don't record trivial construction function pointersThiago Macieira2022-07-271-6/+61
| | | | | | | | | | | | We can implement the trivial {default,copy,move} construction outselves inside qmetatype.cpp and qvariant.cpp, simplifying the QMetaType interface object, removing up to three relocations per QMTI. This adds the testing for QMetaType::isXxxConstructible and isDestructible that couldn't be added before. Change-Id: Ic44396b31ba04712aab3fffd16ff0a28f541d507 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tst_QMetaType: merge flags and flagsStaticlessThiago Macieira2022-07-261-1/+10
| | | | | | | | | And rewrite them with templates. QMetaType::typeFlags() simply calls flags() anyway. Pick-to: 6.3 6.4 Change-Id: I3859764fed084846bcb0fffd170323f9d8c80466 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix test being flaky on LinuxDimitrios Apostolou2022-07-262-7/+1
| | | | | | | | | | | | The cause is that the first EXPOSE event comes with the window not having focus yet. See QTBUG-105177. Also remove processEvents() as events are always processed when doing qWaitFor...(). Task-number: QTBUG-105177 Change-Id: I2260d1885388bbf7091c423bc9b4c16e2ed0090f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Test fails always on Android, so skip itDimitrios Apostolou2022-07-261-0/+3
| | | | | | | | | Previously the failure was been ignored because of the very generic "linux" entry in the BLACKLIST file Task-number: QTBUG-105201 Change-Id: I6914fe350f78266fc18541eb8fcd881f5a4ac511 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Test is no longer flakyDimitrios Apostolou2022-07-261-4/+0
| | | | | | | | | | + I could not reproduce the flakiness on OpenSUSE Tumbleweed. + No significant flakiness can be seen for this test in our testresults statistics. + Ubuntu-16.04 is no longer part of our CI Change-Id: I7a18fc3fe2e58af8533171ebae0457b08424e810 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Ensure list has elements before getting themDimitrios Apostolou2022-07-221-6/+9
| | | | | | | | | | | | | | | | | Before a recent fix it would happen occasionally that lastNormalizedPositions.at(0) would segfault because the list was empty. The cause of the flakiness was fixed, but make the test more resilient anyway by checking first the list is correctly populated. Furthermore on some platforms this check fails: qAbs(leftWidget.lastNormalizedPositions.at(1).x() - 0.8) < 0.05 So instead of QVERIFY use QCOMPARE_LT to print the values when it fails. Task-number: QTBUG-104268 Change-Id: Id5430eb53c133cf5d23647cfd9749f01f266efce Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Fix test flaky-crashing on OpenSUSE with KDE window managerDimitrios Apostolou2022-07-221-1/+1
| | | | | | | | | | | | | Sometimes XCB_EXPOSE event is being propagated twice, once before and once after qWaitForWindowExposed(). But the window has focus only after the second expose event. Changing it to qWaitForWindowActive() fixes the issue. Fixes: QTBUG-104268 Pick-to: 6.2 6.3 6.4 Change-Id: Ibc78dd4958ed1a4a8d0967b29d2a53457ab9ae8b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QGuiApplication: do not emit deprecated signalsIvan Solovev2022-07-211-0/+9
| | | | | | | | | | | | | | ... when QT_DISABLE_DEPRECATED_BEFORE is past the deprecation version. This commit actually stops using the deprecated signals when we build Qt with QT_DISABLE_DEPRECATED_BEFORE >= 0x060000. Otherwise we will get a compilation error because the signals will be removed. Task-number: QTBUG-104857 Pick-to: 6.4 6.3 6.2 Change-Id: Ie513ecc9451bf2d88f80857cf19f3d2b4958d022 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* CMake: Rename test to tst_gui_variant_no_applicationAlexandru 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: I5cd49bf75fddc121fdfbde80d8a24a6110098011 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>